# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # python-doc bot, 2025 # Takanori Suzuki , 2026 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.15\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-09-25 18:08+0000\n" "PO-Revision-Date: 2025-09-16 00:01+0000\n" "Last-Translator: Takanori Suzuki , 2026\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ja\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/pathlib.rst:2 msgid ":mod:`!pathlib` --- Object-oriented filesystem paths" msgstr ":mod:`!pathlib` --- オブジェクト指向のファイルシステムパス" #: ../../library/pathlib.rst:9 msgid "**Source code:** :source:`Lib/pathlib/`" msgstr "**ソースコード:** :source:`Lib/pathlib/`" #: ../../library/pathlib.rst:15 msgid "" "This module offers classes representing filesystem paths with semantics " "appropriate for different operating systems. Path classes are divided " "between :ref:`pure paths `, which provide purely computational " "operations without I/O, and :ref:`concrete paths `, which " "inherit from pure paths but also provide I/O operations." msgstr "" "このモジュールはファイルシステムのパスを表すクラスを提供していて、様々なオペ" "レーティングシステムについての適切な意味論をそれらのクラスに持たせていま" "す。\n" "Path クラスは :ref:`純粋パス ` と :ref:`具象パス ` からなります。\n" "純粋パスは I/O を伴わない純粋な計算操作を提供します。\n" "具象パスは純粋パスを継承していますが、 I/O 操作も提供しています。" #: ../../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 " "instantiates a :ref:`concrete path ` for the platform the " "code is running on." msgstr "" "あなたが今までこのモジュールを使用したことがない場合や、タスクに適しているの" "がどのクラスかわからない場合は、 :class:`Path` はきっとあなたに必要なもので" "しょう。\n" ":class:`Path` はコードが実行されているプラットフォーム用の :ref:`具象パス " "` のインスタンスを作成します。" #: ../../library/pathlib.rst:35 msgid "Pure paths are useful in some special cases; for example:" msgstr "純粋パスは、以下のようないくつかの特殊なケースで有用です:" #: ../../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 "" "Unix マシン上で Windows のパスを扱いたいとき (またはその逆)。Unix 上で実行し" "ているときに :class:`WindowsPath` のインスタンスを作成することはできません" "が、:class:`PureWindowsPath` なら可能になります。" #: ../../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 "" "実際に OS にアクセスすることなしにパスを操作するだけのコードを確認したいと" "き。この場合、純粋クラスのインスタンスを一つ作成すれば、それが OS にアクセス" "することはないので便利です。" #: ../../library/pathlib.rst:45 msgid ":pep:`428`: The pathlib module -- object-oriented filesystem paths." msgstr "" ":pep:`428`: The pathlib module -- オブジェクト指向のファイルシステムパス。" #: ../../library/pathlib.rst:48 msgid "" "For low-level path manipulation on strings, you can also use the :mod:`os." "path` module." msgstr "文字列による低水準のパス操作の場合は :mod:`os.path` も使用できます。" #: ../../library/pathlib.rst:53 msgid "Basic use" msgstr "基本的な使い方" #: ../../library/pathlib.rst:55 msgid "Importing the main class::" msgstr "メインクラスをインポートします::" #: ../../library/pathlib.rst:57 msgid ">>> from pathlib import Path" msgstr ">>> from pathlib import Path" #: ../../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 "" ">>> 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')]" #: ../../library/pathlib.rst:66 msgid "Listing Python source files in this directory tree::" msgstr "このディレクトリツリー内の Python ソースファイルの一覧を取得します::" #: ../../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 "" ">>> 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')]" #: ../../library/pathlib.rst:73 msgid "Navigating inside a directory tree::" msgstr "ディレクトリツリー内を移動します::" #: ../../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 "" ">>> q.exists()\n" "True\n" ">>> q.is_dir()\n" "False" #: ../../library/pathlib.rst:89 msgid "Opening a file::" msgstr "ファイルを開きます::" #: ../../library/pathlib.rst:91 msgid "" ">>> with q.open() as f: f.readline()\n" "...\n" "'#!/bin/bash\\n'" msgstr "" ">>> with q.open() as f: f.readline()\n" "...\n" "'#!/bin/bash\\n'" #: ../../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 "" ":exc:`NotImplementedError` を継承した例外です。パスオブジェクトがサポートして" "いない操作を行おうとした時に送出されます。 " #: ../../library/pathlib.rst:110 msgid "Pure paths" msgstr "純粋パス" #: ../../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 "" "純粋パスオブジェクトは実際にファイルシステムにアクセスしないパス操作処理を提" "供します。これらのクラスにアクセスするには 3 つの方法があり、それらを *フレー" "バー* と呼んでいます:" #: ../../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 "" "システムのパスのフレーバーを表すジェネリッククラスです (インスタンスを作成す" "ることで :class:`PurePosixPath` または :class:`PureWindowsPath` のどちらかが" "作成されます)::" #: ../../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 " "the :meth:`~os.PathLike.__fspath__` method returns a string, such as another " "path object::" msgstr "" "*pathsegments* の各要素は、パスの構成要素を表す文字列か、パスオブジェクトなど" "の、 :class:`os.PathLike` インターフェースを実装するオブジェクトである必要が" "あります。\n" ":class:`os.PathLike` インターフェースでは、 :meth:`~os.PathLike.__fspath__` " "メソッドが文字列を返します::" #: ../../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 "" ">>> PurePath('foo', 'some/path', 'bar')\n" "PurePosixPath('foo/some/path/bar')\n" ">>> PurePath(Path('foo'), Path('bar'))\n" "PurePosixPath('foo/bar')" #: ../../library/pathlib.rst:134 msgid "" "When *pathsegments* is empty or consists only of empty strings, the current " "directory is assumed::" msgstr "" #: ../../library/pathlib.rst:137 msgid "" ">>> PurePath(), PurePath('')\n" "(PurePosixPath('.'), PurePosixPath('.'))" msgstr "" #: ../../library/pathlib.rst:140 msgid "" "If a segment is an absolute path, all previous segments are ignored (like :" "func:`os.path.join`)::" msgstr "" "あるパス構成要素が絶対パスである場合、それより前の要素はすべて無視されます (:" "func:`os.path.join` と同様)::" #: ../../library/pathlib.rst:143 msgid "" ">>> PurePath('/etc', '/usr', 'lib64')\n" "PurePosixPath('/usr/lib64')\n" ">>> PureWindowsPath('c:/Windows', 'd:bar')\n" "PureWindowsPath('d:bar')" msgstr "" ">>> PurePath('/etc', '/usr', 'lib64')\n" "PurePosixPath('/usr/lib64')\n" ">>> PureWindowsPath('c:/Windows', 'd:bar')\n" "PureWindowsPath('d:bar')" #: ../../library/pathlib.rst:148 msgid "" "On Windows, the drive is not reset when a rooted relative path segment (e." "g., ``r'\\foo'``) is encountered::" msgstr "" "Windowsの場合、ルート相対パス (例えば ``r'\\foo'``) があってもドライブ名はそ" "のまま変わりません::" #: ../../library/pathlib.rst:151 msgid "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" msgstr "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" #: ../../library/pathlib.rst:154 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 "" "単一スラッシュと等価な複数スラッシュやシングルドットは簡略化されますが、ダブ" "ルドット (``'..'``) や先頭に位置するダブルスラッシュ (``'//'``) は簡略化され" "ません。\n" "これは、様々な理由でパスの意味が簡略化した場合と異なってしまうからです (例: " "シンボリックリンク、UNCパス)::" #: ../../library/pathlib.rst:158 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 "" ">>> 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')" #: ../../library/pathlib.rst:167 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 "" "(通常 ``PurePosixPath('foo/../bar')`` は ``PurePosixPath('bar')`` と等価にな" "りますが、``foo`` が他のディレクトリへのシンボリックリンクの場合は等価になり" "ません)" #: ../../library/pathlib.rst:171 msgid "" "Pure path objects implement the :class:`os.PathLike` interface, allowing " "them to be used anywhere the interface is accepted." msgstr "" "純粋パスオブジェクトは :class:`os.PathLike` インターフェースを実装しており、" "そのインターフェースを受理する箇所ならどこでも使用することができます。" #: ../../library/pathlib.rst:174 msgid "Added support for the :class:`os.PathLike` interface." msgstr ":class:`os.PathLike` インターフェースがサポートされました。" #: ../../library/pathlib.rst:179 msgid "" "A subclass of :class:`PurePath`, this path flavour represents non-Windows " "filesystem paths::" msgstr "" ":class:`PurePath` のサブクラスです。このパスフレーバーは非 Windows パスを表し" "ます::" #: ../../library/pathlib.rst:182 msgid "" ">>> PurePosixPath('/etc/hosts')\n" "PurePosixPath('/etc/hosts')" msgstr "" ">>> PurePosixPath('/etc/hosts')\n" "PurePosixPath('/etc/hosts')" #: ../../library/pathlib.rst:185 ../../library/pathlib.rst:197 #: ../../library/pathlib.rst:770 ../../library/pathlib.rst:780 #: ../../library/pathlib.rst:795 msgid "*pathsegments* is specified similarly to :class:`PurePath`." msgstr "*pathsegments* の指定は :class:`PurePath` と同じです。" #: ../../library/pathlib.rst:189 msgid "" "A subclass of :class:`PurePath`, this path flavour represents Windows " "filesystem paths, including `UNC paths`_::" msgstr "" ":class:`PurePath` のサブクラスです。このパスフレーバー `UNC paths`_ を含む " "Windows ファイルシステムパスを表します::" #: ../../library/pathlib.rst:192 msgid "" ">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" "PureWindowsPath('c:/Users/Ximénez')\n" ">>> PureWindowsPath('//server/share/file')\n" "PureWindowsPath('//server/share/file')" msgstr "" ">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" "PureWindowsPath('c:/Users/Ximénez')\n" ">>> PureWindowsPath('//server/share/file')\n" "PureWindowsPath('//server/share/file')" #: ../../library/pathlib.rst:201 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:206 msgid "General properties" msgstr "全般的な性質" #: ../../library/pathlib.rst:208 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 "" "パスオブジェクトはイミュータブルで :term:`ハッシュ可能 ` です。同じ" "フレーバーのパスオブジェクトは比較ならびに順序付け可能です。これらのプロパ" "ティは、フレーバーのケースフォールディング (訳注: 比較のために正規化するこ" "と、例えば全て大文字にする) のセマンティクスに従います。" #: ../../library/pathlib.rst:212 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 "" ">>> 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" #: ../../library/pathlib.rst:221 msgid "Paths of a different flavour compare unequal and cannot be ordered::" msgstr "" "異なるフレーバーのパスオブジェクト同士の比較は等価になることはなく、順序付け" "もできません::" #: ../../library/pathlib.rst:223 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 "" ">>> 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'" #: ../../library/pathlib.rst:232 msgid "Operators" msgstr "演算子" #: ../../library/pathlib.rst:234 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, " "the drive is not reset when the argument is a rooted relative path (e.g., " "``r'\\foo'``)::" msgstr "" "スラッシュ演算子を使って、 :func:`os.path.join` のように子パスを作成すること" "ができます。\n" "スラッシュの右側が絶対パスである場合、左側のパスは無視されます。\n" "Windows環境で、右側のパスがルート相対パス (例: ``r'\\foo'``) である場合、ドラ" "イブ名はリセットされません::" #: ../../library/pathlib.rst:239 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 "" ">>> 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')" #: ../../library/pathlib.rst:252 msgid "" "A path object can be used anywhere an object implementing :class:`os." "PathLike` is accepted::" msgstr "" ":class:`os.PathLike` を実装したオブジェクトが受理できる箇所ならどこでも、パス" "オブジェクトが使用できます::" #: ../../library/pathlib.rst:255 msgid "" ">>> import os\n" ">>> p = PurePath('/etc')\n" ">>> os.fspath(p)\n" "'/etc'" msgstr "" ">>> import os\n" ">>> p = PurePath('/etc')\n" ">>> os.fspath(p)\n" "'/etc'" #: ../../library/pathlib.rst:260 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 "" "パスオブジェクトの文字列表現はそのシステム自身の Raw ファイルシステムパス (ネ" "イティブの形式、例えば Windows では区切り文字がバックスラッシュ) になり、文字" "列としてファイルパスを取るあらゆる関数に渡すことができます::" #: ../../library/pathlib.rst:264 msgid "" ">>> p = PurePath('/etc')\n" ">>> str(p)\n" "'/etc'\n" ">>> p = PureWindowsPath('c:/Program Files')\n" ">>> str(p)\n" "'c:\\\\Program Files'" msgstr "" ">>> p = PurePath('/etc')\n" ">>> str(p)\n" "'/etc'\n" ">>> p = PureWindowsPath('c:/Program Files')\n" ">>> str(p)\n" "'c:\\\\Program Files'" #: ../../library/pathlib.rst:271 msgid "" "Similarly, calling :class:`bytes` on a path gives the raw filesystem path as " "a bytes object, as encoded by :func:`os.fsencode`::" msgstr "" "同様に、パスオブジェクトを :class:`bytes` で呼び出すと、Raw ファイルシステム" "パスを :func:`os.fsencode` でエンコードされたバイト列オブジェクトで返します::" #: ../../library/pathlib.rst:274 msgid "" ">>> bytes(p)\n" "b'/etc'" msgstr "" ">>> bytes(p)\n" "b'/etc'" #: ../../library/pathlib.rst:278 msgid "" "Calling :class:`bytes` is only recommended under Unix. Under Windows, the " "unicode form is the canonical representation of filesystem paths." msgstr "" ":class:`bytes` での呼び出しは Unix 上での使用のみ推奨します。Windows では " "Unicode 形式が標準的なファイルシステムパス表現になります。" #: ../../library/pathlib.rst:283 msgid "Accessing individual parts" msgstr "個別の構成要素へのアクセス" #: ../../library/pathlib.rst:285 msgid "" "To access the individual \"parts\" (components) of a path, use the following " "property:" msgstr "" "パスの個別の \"構成要素\" へアクセスするには、以下のプロパティを使用します:" #: ../../library/pathlib.rst:290 msgid "A tuple giving access to the path's various components::" msgstr "パスのさまざまな構成要素へのアクセス手段を提供するタプルになります::" #: ../../library/pathlib.rst:292 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 "" ">>> 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')" #: ../../library/pathlib.rst:300 msgid "(note how the drive and local root are regrouped in a single part)" msgstr "(ドライブ名とローカルルートは単一要素にまとめられます)" #: ../../library/pathlib.rst:304 msgid "Methods and properties" msgstr "メソッドとプロパティ" #: ../../library/pathlib.rst:310 msgid "Pure paths provide the following methods and properties:" msgstr "純粋パスは以下のメソッドとプロパティを提供します:" #: ../../library/pathlib.rst:314 msgid "" "The implementation of the :mod:`os.path` module used for low-level path " "parsing and joining: either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" "低レベルのパスのパースと結合に使用される :mod:`os.path` モジュールの実装。:" "mod:`!posixpath` または :mod:`!ntpath`。" #: ../../library/pathlib.rst:321 msgid "A string representing the drive letter or name, if any::" msgstr "ドライブ文字または名前を表す文字列があればそれになります::" #: ../../library/pathlib.rst:323 msgid "" ">>> PureWindowsPath('c:/Program Files/').drive\n" "'c:'\n" ">>> PureWindowsPath('/Program Files/').drive\n" "''\n" ">>> PurePosixPath('/etc').drive\n" "''" msgstr "" #: ../../library/pathlib.rst:330 msgid "UNC shares are also considered drives::" msgstr "UNC 共有名もドライブとみなされます::" #: ../../library/pathlib.rst:332 msgid "" ">>> PureWindowsPath('//host/share/foo.txt').drive\n" "'\\\\\\\\host\\\\share'" msgstr "" #: ../../library/pathlib.rst:337 msgid "A string representing the (local or global) root, if any::" msgstr "ローカルまたはグローバルルートを表す文字列があればそれになります::" #: ../../library/pathlib.rst:339 msgid "" ">>> PureWindowsPath('c:/Program Files/').root\n" "'\\\\'\n" ">>> PureWindowsPath('c:Program Files/').root\n" "''\n" ">>> PurePosixPath('/etc').root\n" "'/'" msgstr "" #: ../../library/pathlib.rst:346 msgid "UNC shares always have a root::" msgstr "UNC 共有名は常にルートを持ちます::" #: ../../library/pathlib.rst:348 msgid "" ">>> PureWindowsPath('//host/share').root\n" "'\\\\'" msgstr "" #: ../../library/pathlib.rst:351 msgid "" "If the path starts with more than two successive slashes, :class:`~pathlib." "PurePosixPath` collapses them::" msgstr "" ":class:`~pathlib.PurePosixPath` でパスの先頭が3つ以上の連続したスラッシュで" "ある場合、 余分なスラッシュは除去されます::" #: ../../library/pathlib.rst:354 msgid "" ">>> PurePosixPath('//etc').root\n" "'//'\n" ">>> PurePosixPath('///etc').root\n" "'/'\n" ">>> PurePosixPath('////etc').root\n" "'/'" msgstr "" #: ../../library/pathlib.rst:363 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " "paragraph `4.11 Pathname Resolution `_:" msgstr "" "この挙動は、以下に示す、 *The Open Group Base Specifications Issue 6* の " "`4.11 Pathname Resolution `_ に沿ったものです:" #: ../../library/pathlib.rst:367 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:373 msgid "The concatenation of the drive and root::" msgstr "ドライブとルートを結合した文字列になります::" #: ../../library/pathlib.rst:375 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:387 msgid "" "An immutable sequence providing access to the logical ancestors of the path::" msgstr "" "パスの論理的な上位パスにアクセスできるイミュータブルなシーケンスになります::" #: ../../library/pathlib.rst:390 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:398 msgid "" "The parents sequence now supports :term:`slices ` and negative index " "values." msgstr "" "parents シーケンスが、:term:`スライス ` と負のインデックスをサポートす" "るようになりました。" #: ../../library/pathlib.rst:403 msgid "The logical parent of the path::" msgstr "パスの論理的な上位パスになります::" #: ../../library/pathlib.rst:405 msgid "" ">>> p = PurePosixPath('/a/b/c/d')\n" ">>> p.parent\n" "PurePosixPath('/a/b/c')" msgstr "" #: ../../library/pathlib.rst:409 msgid "You cannot go past an anchor, or empty path::" msgstr "アンカーの位置を超えることや空のパスになる位置には対応していません::" #: ../../library/pathlib.rst:411 msgid "" ">>> p = PurePosixPath('/')\n" ">>> p.parent\n" "PurePosixPath('/')\n" ">>> p = PurePosixPath('.')\n" ">>> p.parent\n" "PurePosixPath('.')" msgstr "" #: ../../library/pathlib.rst:419 msgid "This is a purely lexical operation, hence the following behaviour::" msgstr "これは純粋な字句操作であるため、以下のような挙動になります::" #: ../../library/pathlib.rst:421 msgid "" ">>> p = PurePosixPath('foo/..')\n" ">>> p.parent\n" "PurePosixPath('foo')" msgstr "" #: ../../library/pathlib.rst:425 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 "" "任意のファイルシステムパスを上位方向に移動したい場合、シンボリックリンクの解" "決や ``\"..\"`` 要素の除去のため、最初に :meth:`Path.resolve` を呼ぶことを推" "奨します。" #: ../../library/pathlib.rst:432 msgid "" "A string representing the final path component, excluding the drive and " "root, if any::" msgstr "" "パス要素の末尾を表す文字列があればそれになります。ドライブやルートは含まれま" "せん::" #: ../../library/pathlib.rst:435 msgid "" ">>> PurePosixPath('my/library/setup.py').name\n" "'setup.py'" msgstr "" #: ../../library/pathlib.rst:438 msgid "UNC drive names are not considered::" msgstr "UNC ドライブ名は考慮されません::" #: ../../library/pathlib.rst:440 msgid "" ">>> PureWindowsPath('//some/share/setup.py').name\n" "'setup.py'\n" ">>> PureWindowsPath('//some/share').name\n" "''" msgstr "" #: ../../library/pathlib.rst:448 msgid "The last dot-separated portion of the final component, if any::" msgstr "末尾の要素をドットで分割した最後の部分があれば、それになります::" #: ../../library/pathlib.rst:450 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:457 msgid "This is commonly called the file extension." msgstr "一般的にはファイル拡張子と呼ばれています。" #: ../../library/pathlib.rst:461 ../../library/pathlib.rst:476 #: ../../library/pathlib.rst:492 msgid "A single dot (\"``.``\") is considered a valid suffix." msgstr "" #: ../../library/pathlib.rst:465 msgid "A list of the path's suffixes, often called file extensions::" msgstr "パスのサフィックス(ファイル拡張子)のリストです::" #: ../../library/pathlib.rst:467 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:481 msgid "The final path component, without its suffix::" msgstr "パス要素の末尾から拡張子を除いたものになります::" #: ../../library/pathlib.rst:483 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:497 msgid "" "Return a string representation of the path with forward slashes (``/``)::" msgstr "フォワードスラッシュ (``/``) を使用したパスを表す文字列を返します::" #: ../../library/pathlib.rst:499 msgid "" ">>> p = PureWindowsPath('c:\\\\windows')\n" ">>> str(p)\n" "'c:\\\\windows'\n" ">>> p.as_posix()\n" "'c:/windows'" msgstr "" #: ../../library/pathlib.rst:508 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:511 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:528 msgid "Return whether or not this path is relative to the *other* path." msgstr "" "このパスが *other* パスに対して相対なのかそうでないのかの結果を返します。" #: ../../library/pathlib.rst:536 msgid "" "This method is string-based; it neither accesses the filesystem nor treats " "\"``..``\" segments specially. The following code is equivalent:" msgstr "" #: ../../library/pathlib.rst:547 msgid "" "Passing additional arguments is deprecated; if supplied, they are joined " "with *other*." msgstr "" "追加の引数指定は非推奨となりました。指定された場合は *other* と連結されます。" #: ../../library/pathlib.rst:552 msgid "" "Calling this method is equivalent to combining the path with each of the " "given *pathsegments* in turn::" msgstr "" "このメソッドの呼び出しは、与えられた *pathsegments* のパスを順番に結合するこ" "とと等価です。" #: ../../library/pathlib.rst:555 msgid "" ">>> 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:567 msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise. For example::" msgstr "" "現在のパスが glob 形式で与えられたパターンと一致したら ``True`` を、一致しな" "ければ ``False`` を返します。例::" #: ../../library/pathlib.rst:570 msgid "" ">>> 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:580 ../../library/pathlib.rst:1346 msgid ":ref:`pathlib-pattern-language` documentation." msgstr ":ref:`pathlib-pattern-language` ドキュメント。" #: ../../library/pathlib.rst:582 msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "" "他のメソッドと同様に、大文字小文字の区別はプラットフォームの設定に従います::" #: ../../library/pathlib.rst:584 msgid "" ">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" ">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" msgstr "" #: ../../library/pathlib.rst:589 msgid "" "Set *case_sensitive* to ``True`` or ``False`` to override this behaviour." msgstr "" " *case_sensitive* に ``True`` または ``False`` を設定することでデフォルトの動" "作を上書きできます。" #: ../../library/pathlib.rst:596 msgid "" "Match this path against the provided non-recursive glob-style pattern. " "Return ``True`` if matching is successful, ``False`` otherwise." msgstr "" "現在のパスが非再帰の glob 形式で与えられたパターンと一致したら ``True`` を、" "一致しなければ ``False`` を返します。" #: ../../library/pathlib.rst:599 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:604 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:611 ../../library/pathlib.rst:1370 #: ../../library/pathlib.rst:1404 msgid "The *pattern* parameter accepts a :term:`path-like object`." msgstr "" "*pattern* パラメタが :term:`path-like object` を受け付けるようになりました。" #: ../../library/pathlib.rst:614 ../../library/pathlib.rst:1364 #: ../../library/pathlib.rst:1398 msgid "The *case_sensitive* parameter was added." msgstr "*case_sensitive* 引数が追加されました。" #: ../../library/pathlib.rst:620 msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" msgstr "" "*other* で表されたパスから現在のパスへの相対パスを返します。それが不可能だっ" "た場合は :exc:`ValueError` が送出されます::" #: ../../library/pathlib.rst:623 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:635 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 " "path. In all other cases, such as the paths referencing different drives, :" "exc:`ValueError` is raised.::" msgstr "" "*walk_up* がFalseの場合(デフォルト)、パスは *other* から始まる必要がありま" "す。引数に True を指定すると ``..`` を追加して相対パスを作成する場合がありま" "す。異なるドライブを参照するなど、それ以外のケースでは :exc:`ValueError` が送" "出されます。::" #: ../../library/pathlib.rst:640 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:650 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 " "*walk_up* option as it assumes that no symlinks are present in the path; " "call :meth:`~Path.resolve` first if necessary to resolve symlinks." msgstr "" #: ../../library/pathlib.rst:656 msgid "" "The *walk_up* parameter was added (old behavior is the same as " "``walk_up=False``)." msgstr "" "*walk_up* 引数が追加されました(``walk_up=False`` を指定すると以前の動作と同" "じになります)。" #: ../../library/pathlib.rst:661 msgid "" "Passing additional positional arguments is deprecated; if supplied, they are " "joined with *other*." msgstr "" "追加の位置引数の指定は非推奨となりました。指定された場合は *other* と連結され" "ます。" #: ../../library/pathlib.rst:666 msgid "" "Return a new path with the :attr:`name` changed. If the original path " "doesn't have a name, ValueError is raised::" msgstr "" "現在のパスの :attr:`name` 部分を変更したパスを返します。オリジナルパスに :" "attr:`name` 部分がない場合は ValueError が送出されます::" #: ../../library/pathlib.rst:669 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:683 msgid "" "Return a new path with the :attr:`stem` changed. If the original path " "doesn't have a name, ValueError is raised::" msgstr "" "現在のパスの :attr:`stem` 部分を変更したパスを返します。オリジナルパスに :" "attr:`stem` 部分がない場合は ValueError が送出されます::" #: ../../library/pathlib.rst:686 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:707 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 "" ":attr:`suffix` を変更した新しいパスを返します。\n" "元のパスに suffix が無かった場合、代わりに新しい *suffix* が追加されます。\n" "*suffix* が空文字列だった場合、元の suffix は除去されます::" #: ../../library/pathlib.rst:711 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:723 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:729 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, " "such as from :attr:`parent` and :meth:`relative_to`. Subclasses may override " "this method to pass information to derivative paths, for example::" msgstr "" #: ../../library/pathlib.rst:734 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:755 msgid "Concrete paths" msgstr "具象パス" #: ../../library/pathlib.rst:757 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 "" "具象パスは純粋パスクラスのサブクラスです。純粋パスが提供する操作に加え、パス" "オブジェクト上でシステムコールを呼ぶメソッドも提供しています。具象パスのイン" "スタンスを作成するには 3 つの方法があります:" #: ../../library/pathlib.rst:763 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 "" ":class:`PurePath` のサブクラスであり、システムのパスフレーバーの具象パスを表" "します (このインスタンスの作成で :class:`PosixPath` か :class:`WindowsPath` " "のどちらかが作成されます)::" #: ../../library/pathlib.rst:767 msgid "" ">>> Path('setup.py')\n" "PosixPath('setup.py')" msgstr "" #: ../../library/pathlib.rst:774 msgid "" "A subclass of :class:`Path` and :class:`PurePosixPath`, this class " "represents concrete non-Windows filesystem paths::" msgstr "" ":class:`Path` および :class:`PurePosixPath` のサブクラスで、非 Windows ファイ" "ルシステムの具象パスを表します::" #: ../../library/pathlib.rst:777 msgid "" ">>> PosixPath('/etc/hosts')\n" "PosixPath('/etc/hosts')" msgstr "" #: ../../library/pathlib.rst:782 msgid "" "Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" "`NotImplementedError` was raised instead." msgstr "" "Windows では :exc:`UnsupportedOperation` を送出します。以前のバージョンでは代" "わりに :exc:`NotImplementedError` を送出していました。" #: ../../library/pathlib.rst:789 msgid "" "A subclass of :class:`Path` and :class:`PureWindowsPath`, this class " "represents concrete Windows filesystem paths::" msgstr "" ":class:`Path` および :class:`PureWindowsPath` のサブクラスで、Windows ファイ" "ルシステムの具象パスを表します::" #: ../../library/pathlib.rst:792 msgid "" ">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" "WindowsPath('c:/Users/Ximénez')" msgstr "" #: ../../library/pathlib.rst:797 msgid "" "Raises :exc:`UnsupportedOperation` on non-Windows platforms. In previous " "versions, :exc:`NotImplementedError` was raised instead." msgstr "" "Windows 以外のプラットフォームでは :exc:`UnsupportedOperation` を送出します。" "以前のバージョンでは代わりに :exc:`NotImplementedError` を送出していました。" #: ../../library/pathlib.rst:802 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:806 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:820 msgid "" "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:825 msgid "Parsing and generating URIs" msgstr "URIのパースと生成" #: ../../library/pathlib.rst:827 msgid "" "Concrete path objects can be created from, and represented as, 'file' URIs " "conforming to :rfc:`8089`." msgstr "" #: ../../library/pathlib.rst:832 msgid "" "File URIs are not portable across machines with different :ref:`filesystem " "encodings `." msgstr "" #: ../../library/pathlib.rst:837 msgid "Return a new path object from parsing a 'file' URI. For example::" msgstr "'file' URIをパースして新しいパスオブジェクトを返します。例::" #: ../../library/pathlib.rst:839 msgid "" ">>> p = Path.from_uri('file:///etc/hosts')\n" "PosixPath('/etc/hosts')" msgstr "" #: ../../library/pathlib.rst:842 msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" msgstr "" #: ../../library/pathlib.rst:844 msgid "" ">>> 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:849 msgid "Several variant forms are supported::" msgstr "" #: ../../library/pathlib.rst:851 msgid "" ">>> 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:860 msgid "" ":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " "parsed path isn't absolute." msgstr "" #: ../../library/pathlib.rst:865 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:`ValueError` is raised." msgstr "" #: ../../library/pathlib.rst:874 msgid "" "Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " "isn't absolute." msgstr "" " 'file' URI で表したパスを返します。絶対パスではない場合に :exc:`ValueError` " "を送出します。" #: ../../library/pathlib.rst:877 msgid "" ">>> 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:888 msgid "" "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:894 msgid "Expanding and resolving paths" msgstr "パスの展開と解決" #: ../../library/pathlib.rst:898 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." msgstr "" "ユーザーのホームディレクトリ (:func:`os.path.expanduser` での ``~`` の返り" "値) を表す新しいパスオブジェクトを返します。ホームディレクトリが解決できない" "場合は、 :exc:`RuntimeError` を送出します。" #: ../../library/pathlib.rst:904 msgid "" ">>> Path.home()\n" "PosixPath('/home/antoine')" msgstr "" #: ../../library/pathlib.rst:912 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." msgstr "" "パス要素 ``~`` および ``~user`` を :meth:`os.path.expanduser` が返すように展" "開した新しいパスオブジェクトを返します。ホームディレクトリが解決できない場合" "は、 :exc:`RuntimeError` を送出します。" #: ../../library/pathlib.rst:918 msgid "" ">>> p = PosixPath('~/films/Monty Python')\n" ">>> p.expanduser()\n" "PosixPath('/home/eric/films/Monty Python')" msgstr "" #: ../../library/pathlib.rst:927 msgid "" "Return a new path object representing the current directory (as returned by :" "func:`os.getcwd`)::" msgstr "" "(:func:`os.getcwd` が返す) 現在のディレクトリを表す新しいパスオブジェクトを返" "します::" #: ../../library/pathlib.rst:930 msgid "" ">>> Path.cwd()\n" "PosixPath('/home/antoine/pathlib')" msgstr "" #: ../../library/pathlib.rst:936 msgid "" "Make the path absolute, without normalization or resolving symlinks. Returns " "a new path object::" msgstr "" "正規化やシンボリックリンクの解決をせずに、パスを絶対パスにします。新しいパス" "オブジェクトを返します::" #: ../../library/pathlib.rst:939 msgid "" ">>> p = Path('tests')\n" ">>> p\n" "PosixPath('tests')\n" ">>> p.absolute()\n" "PosixPath('/home/antoine/pathlib/tests')" msgstr "" #: ../../library/pathlib.rst:948 msgid "" "Make the path absolute, resolving any symlinks. A new path object is " "returned::" msgstr "" "パスを絶対パスにし、あらゆるシンボリックリンクを解決します。新しいパスオブ" "ジェクトが返されます::" #: ../../library/pathlib.rst:951 msgid "" ">>> p = Path()\n" ">>> p\n" "PosixPath('.')\n" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib')" msgstr "" #: ../../library/pathlib.rst:957 msgid "" "\"``..``\" components are also eliminated (this is the only method to do " "so)::" msgstr "" "\"``..``\" 要素は除去されます (このような挙動を示すのはこのメソッドだけで" "す)::" #: ../../library/pathlib.rst:959 msgid "" ">>> p = Path('docs/../setup.py')\n" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib/setup.py')" msgstr "" #: ../../library/pathlib.rst:963 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:968 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." msgstr "*strict* 引数を追加しました(3.6以前の挙動は strict です)。" #: ../../library/pathlib.rst:971 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:979 msgid "" "Return the path to which the symbolic link points (as returned by :func:`os." "readlink`)::" msgstr "( :func:`os.readlink` が返す) シンボリックリンクが指すパスを返します::" #: ../../library/pathlib.rst:982 msgid "" ">>> p = Path('mylink')\n" ">>> p.symlink_to('setup.py')\n" ">>> p.readlink()\n" "PosixPath('setup.py')" msgstr "" #: ../../library/pathlib.rst:989 msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.readlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." msgstr "" ":func:`os.readlink` が利用できない場合 :exc:`UnsupportedOperation` を送出しま" "す。以前のバージョンでは :exc:`NotImplementedError` を送出していました。" #: ../../library/pathlib.rst:995 msgid "Querying file type and status" msgstr "ファイルの種類とステータスを問い合わせる" #: ../../library/pathlib.rst:999 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 "" ":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_socket` は、OSレベルで表現不能な" "文字を含むパスに対して、例外を送出する代わりに ``False`` を返すようになりまし" "た。 " #: ../../library/pathlib.rst:1008 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:1018 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 "" "(:func:`os.stat` と同様の) 現在のパスについて :class:`os.stat_result` オブ" "ジェクトが含む情報を返します。値はそれぞれのメソッドを呼び出した時点のものに" "なります。" #: ../../library/pathlib.rst:1021 msgid "" "This method normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :meth:`~Path.lstat`." msgstr "" "このメソッドは通常はシンボリックリンクをたどります。シンボリックリンクに対し" "て stat したい場合は ``follow_symlinks=False`` とするか、 :meth:`~Path." "lstat` を利用してください。" #: ../../library/pathlib.rst:1026 msgid "" ">>> p = Path('setup.py')\n" ">>> p.stat().st_size\n" "956\n" ">>> p.stat().st_mtime\n" "1327883547.852554" msgstr "" #: ../../library/pathlib.rst:1032 ../../library/pathlib.rst:1064 #: ../../library/pathlib.rst:1078 ../../library/pathlib.rst:1092 #: ../../library/pathlib.rst:1741 ../../library/pathlib.rst:1757 #: ../../library/pathlib.rst:1778 msgid "The *follow_symlinks* parameter was added." msgstr "*follow_symlinks* パラメータが追加されました。" #: ../../library/pathlib.rst:1038 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 "" ":meth:`Path.stat` のように振る舞いますが、パスがシンボリックリンクを指してい" "た場合、リンク先ではなくシンボリックリンク自身の情報を返します。" #: ../../library/pathlib.rst:1044 msgid "" "Return ``True`` if the path points to an existing file or directory and " "``False`` if the path is invalid, inaccessible or missing. Use :meth:`Path." "stat` to distinguish between these cases." msgstr "" #: ../../library/pathlib.rst:1048 msgid "" "This method normally follows symlinks; to check if a symlink exists, add the " "argument ``follow_symlinks=False``." msgstr "" "このメソッドは通常はシンボリックリンクをたどります。シンボリックリンクが存在" "するかを確認したい場合は ``follow_symlinks=False`` 引数を追加してください。" #: ../../library/pathlib.rst:1053 msgid "" ">>> Path('').exists() # The current directory.\n" "True\n" ">>> 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:1070 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:1075 msgid "" "This method normally follows symlinks; to exclude symlinks, add the argument " "``follow_symlinks=False``." msgstr "" "このメソッドは通常はシンボリックリンクをたどります。シンボリックリンクを除外" "するには ``follow_symlinks=False`` 引数を追加してください。" #: ../../library/pathlib.rst:1084 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:1089 msgid "" "This method normally follows symlinks; to exclude symlinks to directories, " "add the argument ``follow_symlinks=False``." msgstr "" "このメソッドは通常はシンボリックリンクをたどります。ディレクトリへのシンボ" "リックリンクを除外するには ``follow_symlinks=False`` 引数を追加してください。" #: ../../library/pathlib.rst:1098 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:1106 msgid "" "Return ``True`` if the path points to a junction, and ``False`` for any " "other type of file. Currently only Windows supports junctions." msgstr "" "パスがジャンクションを指している場合は ``True`` を返し、それ以外の場合は " "``False`` を返します。現在はWindowsのみジャンクションをサポートしています。" #: ../../library/pathlib.rst:1114 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 " "function checks whether *path*'s parent, :file:`path/..`, is on a 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. On Windows, a mount point is considered to be a drive " "letter root (e.g. ``c:\\``), a UNC share (e.g. ``\\\\server\\share``), or a " "mounted filesystem directory." msgstr "" "パスがマウントポイント :dfn:`mount point` (ファイルシステムの中で異なるファイ" "ルシステムがマウントされているところ) なら、 ``True`` を返します。POSIX で" "は、この関数は *path* の親ディレクトリである :file:`path/..` が *path* と異な" "るデバイス上にあるか、あるいは :file:`path/..` と *path* が同じデバイス上の同" "じ i-node を指しているかをチェックします --- これによって全ての Unix 系システ" "ムと POSIX 標準でマウントポイントが検出できます。Windowsでは、マウントポイン" "トはドライブレターを持つルート(e.g. ``c:\\``)、共有 UNC(e.g. ``\\" "\\server\\share``)またはマウントされたファイルシステムのディレクトリです。" #: ../../library/pathlib.rst:1125 msgid "Windows support was added." msgstr "Windows のサポートが追加されました。" #: ../../library/pathlib.rst:1130 msgid "" "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:1138 msgid "" "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:1146 msgid "" "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:1154 msgid "" "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:1162 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`." msgstr "" "このパスが参照するファイルが *other_path* (Path オブジェクトか文字列) と同じ" "であれば ``True`` を、異なるファイルであれば ``False`` を返します。意味的に" "は :func:`os.path.samefile` および :func:`os.path.samestat` と同じです。" #: ../../library/pathlib.rst:1166 msgid "" "An :exc:`OSError` can be raised if either file cannot be accessed for some " "reason." msgstr "" "なんらかの理由でどちらかのファイルにアクセスできない場合は :exc:`OSError` が" "送出されます。" #: ../../library/pathlib.rst:1171 msgid "" ">>> p = Path('spam')\n" ">>> q = Path('eggs')\n" ">>> p.samefile(q)\n" "False\n" ">>> p.samefile('spam')\n" "True" msgstr "" #: ../../library/pathlib.rst:1183 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:1188 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:1200 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:1205 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:1214 msgid "Reading and writing files" msgstr "ファイルを読み書きする" #: ../../library/pathlib.rst:1219 msgid "" "Open the file pointed to by the path, like the built-in :func:`open` " "function does::" msgstr "組み込み関数 :func:`open` のようにパスが指しているファイルを開きます::" #: ../../library/pathlib.rst:1222 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:1231 msgid "Return the decoded contents of the pointed-to file as a string::" msgstr "指定されたファイルの内容を文字列としてデコードして返します::" #: ../../library/pathlib.rst:1233 ../../library/pathlib.rst:1266 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:1239 msgid "" "The file is opened and then closed. The optional parameters have the same " "meaning as in :func:`open`." msgstr "" "ファイルを開いた後に閉じます。\n" "オプションのパラメーターの意味は :func:`open` と同じです。" #: ../../library/pathlib.rst:1244 ../../library/pathlib.rst:1277 msgid "The *newline* parameter was added." msgstr "*newline* パラメータが追加されました。" #: ../../library/pathlib.rst:1250 msgid "Return the binary contents of the pointed-to file as a bytes object::" msgstr "指定されたファイルの内容をバイナリオブジェクトで返します::" #: ../../library/pathlib.rst:1252 ../../library/pathlib.rst:1286 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:1263 msgid "" "Open the file pointed to in text mode, write *data* to it, and close the " "file::" msgstr "" "指定されたファイルをテキストモードで開き、*data* を書き込み、ファイルを閉じま" "す::" #: ../../library/pathlib.rst:1272 msgid "" "An existing file of the same name is overwritten. The optional parameters " "have the same meaning as in :func:`open`." msgstr "" "同じ名前のファイルが存在する場合は上書きされます。オプションのパラメーターの" "意味は :func:`open` と同じです。" #: ../../library/pathlib.rst:1283 msgid "" "Open the file pointed to in bytes mode, write *data* to it, and close the " "file::" msgstr "" "指定されたファイルをバイトモードで開き、*data* を書き込み、ファイルを閉じま" "す::" #: ../../library/pathlib.rst:1292 msgid "An existing file of the same name is overwritten." msgstr "同じ名前のファイルがすでにあれば上書きされます。" #: ../../library/pathlib.rst:1298 msgid "Reading directories" msgstr "ディレクトリを読む" #: ../../library/pathlib.rst:1302 msgid "" "When the path points to a directory, yield path objects of the directory " "contents::" msgstr "" "パスがディレクトリを指していた場合、ディレクトリの内容のパスオブジェクトを " "yield します::" #: ../../library/pathlib.rst:1305 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:1316 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, it is unspecified whether a path " "object for that file is included." msgstr "" "子の要素は任意の順番で yield されます。特殊なパスの ``'.'`` と ``'..'`` は含" "まれません。イテレーターを生成したあとにディレクトリにファイルを削除または追" "加した場合に、そのファイルのパスオブジェクトが含まれるかは定義されていませ" "ん。" #: ../../library/pathlib.rst:1321 msgid "" "If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " "raised." msgstr "" "パスがディレクトリでないかアクセスできない場合は :exc:`OSError` を送出しま" "す。" #: ../../library/pathlib.rst:1327 msgid "" "Glob the given relative *pattern* in the directory represented by this path, " "yielding all matching files (of any kind)::" msgstr "" "現在のパスが表すディレクトリ内で相対 *pattern* に一致する (あらゆる種類の) す" "べてのファイルを yield します::" #: ../../library/pathlib.rst:1330 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:1342 ../../library/pathlib.rst:1385 msgid "" "The paths are returned in no particular order. If you need a specific order, " "sort the results." msgstr "" #: ../../library/pathlib.rst:1348 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 "" "デフォルトまたは *case_sensitive* キーワード専用引数に ``None`` を指定した場" "合、このメソッドはパスの一致判定にプラットフォームに依存した大文字小文字の" "ルールを使用します。一般的にPOSIXは大文字と小文字を区別し、Windowsは区別しま" "せん。*case_sensitive* を ``True`` または ``False`` に設定するとこの動作を上" "書きします。" #: ../../library/pathlib.rst:1353 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 "" "デフォルトまたは *recurse_symlinks* キーワード専用引数が ``False`` に設定さ" "れた場合、このメソッドは \"``**``\" ワイルドカードの展開時にシンボリックリン" "クをたどりません。*recurse_symlinks* を ``True`` に設定すると、つねにシンボ" "リックリンクをたどります。" #: ../../library/pathlib.rst:1358 ../../library/pathlib.rst:1389 msgid "" "Any :exc:`OSError` exceptions raised from scanning the filesystem are " "suppressed. This includes :exc:`PermissionError` when accessing directories " "without read permission." msgstr "" #: ../../library/pathlib.rst:1362 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.glob`` with " "arguments ``self``, ``pattern``." msgstr "" "引数 ``self``, ``pattern`` を指定して :ref:`監査イベント ` " "``pathlib.Path.glob`` を送出します。 " #: ../../library/pathlib.rst:1367 ../../library/pathlib.rst:1401 msgid "The *recurse_symlinks* parameter was added." msgstr "*recurse_symlinks* パラメータが追加されました。" #: ../../library/pathlib.rst:1373 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:1381 msgid "" "Glob the given relative *pattern* recursively. This is like calling :func:" "`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "与えられた相対 *pattern* で再帰的に Glob します。:func:`Path.glob` で " "*pattern* の前に \"``**/``\" をつけ呼び出した場合と似ています。" #: ../../library/pathlib.rst:1394 msgid ":ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation." msgstr ":ref:`pathlib-pattern-language` と :meth:`Path.glob` のドキュメント。" #: ../../library/pathlib.rst:1396 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " "arguments ``self``, ``pattern``." msgstr "" "引数 ``self``, ``pattern`` を指定して :ref:`監査イベント ` " "``pathlib.Path.rglob`` を送出します。 " #: ../../library/pathlib.rst:1410 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up." msgstr "" #: ../../library/pathlib.rst:1413 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:1417 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* " "(excluding ``'.'`` and ``'..'``), and *filenames* is a list of strings for " "the names of the non-directory files in *dirpath*. To get a full path (which " "begins with *self*) to a file or directory in *dirpath*, do ``dirpath / " "name``. Whether or not the lists are sorted is file system-dependent." msgstr "" #: ../../library/pathlib.rst:1425 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 " "subdirectories (directories are walked top-down). If *top_down* is false, " "the triple for a directory is generated after the triples for all of its " "subdirectories (directories are walked bottom-up). No matter the value of " "*top_down*, the list of subdirectories is retrieved before the triples for " "the directory and its subdirectories are walked." msgstr "" #: ../../library/pathlib.rst:1433 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." "walk` will only recurse into the subdirectories whose names remain in " "*dirnames*. This can be used to prune the search, or to impose a specific " "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 " "generated by the time *dirnames* is yielded to the caller." msgstr "" #: ../../library/pathlib.rst:1443 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:1449 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:1456 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 "" "*follow_symlinks* に True を指定すると、シンボリックリンクが親ディレクトリを" "指していた場合に、無限ループになることに注意してください。 :meth:`Path.walk` " "はすでにたどったディレクトリを管理したりはしません。" #: ../../library/pathlib.rst:1461 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:1469 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." msgstr "" #: ../../library/pathlib.rst:1472 msgid "" "This example displays the number of bytes used by all files in each " "directory, while ignoring ``__pycache__`` directories::" msgstr "" #: ../../library/pathlib.rst:1475 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:1488 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:1492 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:1505 msgid "Creating files and directories" msgstr "ファイルとディレクトリの作成" #: ../../library/pathlib.rst:1509 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 "" "与えられたパスにファイルを作成します。*mode* が与えられた場合、プロセスの " "``umask`` 値と組み合わせてファイルのモードとアクセスフラグが決定されます。" "ファイルがすでに存在した場合、*exist_ok* が真ならばこの関数は正常に終了しま" "す (そしてファイルの更新日付が現在の日時に変更されます)。その他の場合は :exc:" "`FileExistsError` が送出されます。" #: ../../library/pathlib.rst:1516 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:1523 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 "" "与えられたパスに新しくディレクトリを作成します。*mode* が与えられていた場合、" "プロセスの ``umask`` 値と組み合わせてファイルのモードとアクセスフラグを決定し" "ます。パスがすでに存在していた場合 :exc:`FileExistsError` が送出されます。" #: ../../library/pathlib.rst:1528 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 "" "*parents* の値が真の場合、このパスの親ディレクトリを必要に応じて作成します; " "それらのアクセス制限はデフォルト値が取られ、*mode* は使用されません (POSIX " "の ``mkdir -p`` コマンドを真似ています)。" #: ../../library/pathlib.rst:1532 msgid "" "If *parent_mode* is not ``None``, it is used as the mode for any newly-" "created, intermediate-level directories when *parents* is true. Like *mode*, " "it is combined with the process's ``umask`` value. Otherwise, intermediate " "directories are created with the default permissions (also subject to the " "umask)." msgstr "" #: ../../library/pathlib.rst:1538 msgid "" "If *parents* is false (the default), a missing parent raises :exc:" "`FileNotFoundError`." msgstr "" "*parents* の値が偽の場合 (デフォルト)、親ディレクトリがないと :exc:" "`FileNotFoundError` を送出します。" #: ../../library/pathlib.rst:1541 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." msgstr "" "*exist_ok* の値が (デフォルトの) 偽の場合、対象のディレクトリがすでに存在する" "と :exc:`FileExistsError` を送出します。" #: ../../library/pathlib.rst:1544 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:1548 msgid "The *exist_ok* parameter was added." msgstr "*exist_ok* 引数が追加されました。" #: ../../library/pathlib.rst:1551 msgid "The *parent_mode* parameter." msgstr "" #: ../../library/pathlib.rst:1557 msgid "Make this path a symbolic link pointing to *target*." msgstr "" #: ../../library/pathlib.rst:1559 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 "" "Windows では、シンボリックリンクはファイルかディレクトリのどちらかを表します" "が、ターゲットに合わせて動的に変化することはありません。ターゲットが存在する" "場合、シンボリックリンクの種類は対象に合わせて作成されます。ターゲットが存在" "せず *target_is_directory* が真である場合、シンボリックリンクはディレクトリの" "リンクとして作成され、偽である場合 (デフォルト) はファイルのリンクになりま" "す。Windows 以外のプラットフォームでは *target_is_directory* は無視されます。" #: ../../library/pathlib.rst:1567 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:1577 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." msgstr "引数の並び (link, target) は :func:`os.symlink` とは逆です。" #: ../../library/pathlib.rst:1580 msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.symlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." msgstr "" ":func:`os.symlink` が利用できない場合 :exc:`UnsupportedOperation` を送出しま" "す。以前のバージョンでは :exc:`NotImplementedError` を送出していました。" #: ../../library/pathlib.rst:1587 msgid "Make this path a hard link to the same file as *target*." msgstr "このパスを *target* と同じファイルへのハードリンクにします。" #: ../../library/pathlib.rst:1590 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.link`'s." msgstr "引数の並び (link, target) は :func:`os.link` とは逆です。" #: ../../library/pathlib.rst:1595 msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.link` is not available. In " "previous versions, :exc:`NotImplementedError` was raised." msgstr "" ":func:`os.link` が利用できない場合 :exc:`UnsupportedOperation` を送出します。" "以前のバージョンでは :exc:`NotImplementedError` を送出していました。" #: ../../library/pathlib.rst:1601 msgid "Copying, moving and deleting" msgstr "" #: ../../library/pathlib.rst:1605 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:1608 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:1613 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:1621 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:1631 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:1641 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 "" "このファイルかディレクトリを与えられた *target* にリネームし、 *target* を指" "す新しい :class:`!Path` のインスタンスを返します。\n" "Unix では *target* が存在するファイルの場合、ユーザにパーミッションがあれば静" "かに置換されます。\n" "Windows では *target* が存在する場合、:exc:`FileExistsError` が送出されま" "す。\n" "*target* は文字列か別のパスオブジェクトです::" #: ../../library/pathlib.rst:1647 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:1656 ../../library/pathlib.rst:1672 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 "" "targetパスは絶対または相対で指定できます。相対パスは現在の作業ディレクトリか" "らの相対パスとして解釈し、:class:`!Path` オブジェクトのディレクトリ *ではあり" "ません*。" #: ../../library/pathlib.rst:1660 msgid "" "It is implemented in terms of :func:`os.rename` and gives the same " "guarantees." msgstr "" #: ../../library/pathlib.rst:1662 ../../library/pathlib.rst:1676 msgid "Added return value, return the new :class:`!Path` instance." msgstr "戻り値を追加し、新しい :class:`!Path` インスタンスを返します。" #: ../../library/pathlib.rst:1668 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 "" "現在のファイルまたはディレクトリの名前を *target* に変更し、 *target* を指す" "新しい :class:`!Path` のインスタンスを返します。*target* が既存のファイルか空" "のディレクトリを指していた場合、無条件に置き換えられます。" #: ../../library/pathlib.rst:1682 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:1685 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:1690 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:1699 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:1708 msgid "" "Remove this file or symbolic link. If the path points to a directory, use :" "func:`Path.rmdir` instead." msgstr "" "このファイルまたはシンボリックリンクを削除します。パスがディレクトリを指して" "いる場合は :func:`Path.rmdir` を使用してください。" #: ../../library/pathlib.rst:1711 msgid "" "If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " "if the path does not exist." msgstr "" "*missing_ok* の値が (デフォルトの) 偽の場合、対象のファイルが存在しないと :" "exc:`FileNotFoundError` を送出します。" #: ../../library/pathlib.rst:1714 msgid "" "If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " "(same behavior as the POSIX ``rm -f`` command)." msgstr "" "*missing_ok* の値が真の場合、 :exc:`FileExistsError` 例外を送出しません " "(POSIX の ``rm -f`` コマンドの挙動と同じ)。" #: ../../library/pathlib.rst:1717 msgid "The *missing_ok* parameter was added." msgstr "*missing_ok* 引数が追加されました。" #: ../../library/pathlib.rst:1723 msgid "Remove this directory. The directory must be empty." msgstr "現在のディレクトリを削除します。ディレクトリは空でなければなりません。" #: ../../library/pathlib.rst:1727 msgid "Permissions and ownership" msgstr "パーミッションと所有者" #: ../../library/pathlib.rst:1731 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 "" "ファイルの所有者のユーザー名を返します。ファイルのユーザーID(UID)がシステムの" "データベースに見つからない場合 :exc:`KeyError` が送出されます。" #: ../../library/pathlib.rst:1734 msgid "" "This method normally follows symlinks; to get the owner of the symlink, add " "the argument ``follow_symlinks=False``." msgstr "" "このメソッドは通常はシンボリックリンクをたどります。シンボリックリンクの所有" "者を取得するには ``follow_symlinks=False`` 引数を追加してください。" #: ../../library/pathlib.rst:1737 msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." msgstr "" ":mod:`pwd` モジュールが利用できない場合 :exc:`UnsupportedOperation` を送出し" "ます。以前のバージョンでは :exc:`NotImplementedError` を送出していました。" #: ../../library/pathlib.rst:1747 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 "" "ファイルの所有者のグループ名を返します。ファイルのグループID(GID)がシステムの" "データベースに見つからない場合 :exc:`KeyError` が送出されます。" #: ../../library/pathlib.rst:1750 msgid "" "This method normally follows symlinks; to get the group of the symlink, add " "the argument ``follow_symlinks=False``." msgstr "" "このメソッドは通常はシンボリックリンクをたどります。シンボリックリンクのグ" "ループを取得するには ``follow_symlinks=False`` 引数を追加してください。" #: ../../library/pathlib.rst:1753 msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." msgstr "" ":mod:`grp` モジュールが利用できない場合 :exc:`UnsupportedOperation` を送出し" "ます。以前のバージョンでは :exc:`NotImplementedError` を送出していました。" #: ../../library/pathlib.rst:1763 msgid "Change the file mode and permissions, like :func:`os.chmod`." msgstr ":func:`os.chmod` のようにファイルのモードとアクセス権限を変更します。" #: ../../library/pathlib.rst:1765 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 "" "このメソッドは通常シンボリックリンクをたどります。一部のUnixではシンボリック" "リンク自体のパーミッション変更をサポートしています。そのようなプラットフォー" "ムでは引数に``follow_symlinks=False`` を追加するか、:meth:`~Path.lchmod` を使" "用してください。" #: ../../library/pathlib.rst:1771 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:1784 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 "" ":meth:`Path.chmod` のように振る舞いますが、パスがシンボリックリンクを指してい" "た場合、リンク先ではなくシンボリックリンク自身のモードが変更されます。" #: ../../library/pathlib.rst:1791 msgid "Pattern language" msgstr "" #: ../../library/pathlib.rst:1793 msgid "" "The following wildcards are supported in patterns for :meth:`~PurePath." "full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" msgstr "" #: ../../library/pathlib.rst:1796 msgid "``**`` (entire segment)" msgstr "" #: ../../library/pathlib.rst:1797 msgid "Matches any number of file or directory segments, including zero." msgstr "" #: ../../library/pathlib.rst:1798 msgid "``*`` (entire segment)" msgstr "" #: ../../library/pathlib.rst:1799 msgid "Matches one file or directory segment." msgstr "" #: ../../library/pathlib.rst:1800 msgid "``*`` (part of a segment)" msgstr "" #: ../../library/pathlib.rst:1801 msgid "Matches any number of non-separator characters, including zero." msgstr "" #: ../../library/pathlib.rst:1802 msgid "``?``" msgstr "``?``" #: ../../library/pathlib.rst:1803 msgid "Matches one non-separator character." msgstr "" #: ../../library/pathlib.rst:1804 msgid "``[seq]``" msgstr "``[seq]``" #: ../../library/pathlib.rst:1805 msgid "" "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:1809 msgid "``[!seq]``" msgstr "``[!seq]``" #: ../../library/pathlib.rst:1810 msgid "" "Matches one character not in *seq*, where *seq* follows the same rules as " "above." msgstr "" #: ../../library/pathlib.rst:1812 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``\"[?]\"`` matches the character ``\"?\"``." msgstr "" "リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、" "``\"[?]\"`` は文字 ``\"?\"`` にマッチします。" #: ../../library/pathlib.rst:1815 msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" msgstr "" #: ../../library/pathlib.rst:1818 msgid "Pattern" msgstr "Pattern" #: ../../library/pathlib.rst:1818 msgid "Meaning" msgstr "意味" #: ../../library/pathlib.rst:1820 msgid "\"``**/*``\"" msgstr "\"``**/*``\"" #: ../../library/pathlib.rst:1820 msgid "Any path with at least one segment." msgstr "1つ以上の要素がある任意のパス。" #: ../../library/pathlib.rst:1821 msgid "\"``**/*.py``\"" msgstr "\"``**/*.py``\"" #: ../../library/pathlib.rst:1821 msgid "Any path with a final segment ending \"``.py``\"." msgstr "最後の要素が \"``.py``\" で終わる任意のパス。" #: ../../library/pathlib.rst:1822 msgid "\"``assets/**``\"" msgstr "\"``assets/**``\"" #: ../../library/pathlib.rst:1822 msgid "Any path starting with \"``assets/``\"." msgstr "\"``assets/``\" で始まる任意のパス。" #: ../../library/pathlib.rst:1823 msgid "\"``assets/**/*``\"" msgstr "\"``assets/**/*``\"" #: ../../library/pathlib.rst:1823 msgid "" "Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." msgstr "\"``assets/``\" で始まる任意のパス(\"``assets/``\" 自身を除く)。" #: ../../library/pathlib.rst:1827 msgid "" "Globbing with the \"``**``\" wildcard visits every directory in the tree. " "Large directory trees may take a long time to search." msgstr "" #: ../../library/pathlib.rst:1830 msgid "" "Globbing with a pattern that ends with \"``**``\" returns both files and " "directories. In previous versions, only directories were returned." msgstr "" #: ../../library/pathlib.rst:1834 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:1837 msgid "" "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:1843 msgid "Comparison to the :mod:`glob` module" msgstr ":mod:`glob` モジュールとの比較" #: ../../library/pathlib.rst:1845 msgid "" "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:1848 msgid "" "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:1850 msgid "" "\"``**``\" pattern components are always recursive in pathlib. This is like " "passing ``recursive=True`` to :func:`glob.glob`." msgstr "" #: ../../library/pathlib.rst:1852 msgid "" "\"``**``\" 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:1855 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:1858 msgid "" "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:1861 msgid "" "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:1868 msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" msgstr ":mod:`os` と :mod:`os.path` モジュールの比較" #: ../../library/pathlib.rst:1870 msgid "" "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:1876 msgid "" "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:1880 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:1884 msgid "" "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:1889 msgid "" "pathlib's path normalization may render it unsuitable for some applications:" msgstr "" #: ../../library/pathlib.rst:1891 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:1896 msgid "" "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:1902 msgid "" "As a consequence of these differences, pathlib is not a drop-in replacement " "for :mod:`os.path`." msgstr "" #: ../../library/pathlib.rst:1907 msgid "Corresponding tools" msgstr "対応するツール" #: ../../library/pathlib.rst:1909 msgid "" "Below is a table mapping various :mod:`os` functions to their corresponding :" "class:`PurePath`/:class:`Path` equivalent." msgstr "" "下にあるのは、様々な :mod:`os` 関数とそれに相当する :class:`PurePath` あるい" "は :class:`Path` の同等のものとの対応表です。" #: ../../library/pathlib.rst:1913 msgid ":mod:`os` and :mod:`os.path`" msgstr ":mod:`os` と :mod:`os.path`" #: ../../library/pathlib.rst:1913 msgid ":mod:`!pathlib`" msgstr "" #: ../../library/pathlib.rst:1915 msgid ":func:`os.path.dirname`" msgstr ":func:`os.path.dirname`" #: ../../library/pathlib.rst:1915 msgid ":attr:`PurePath.parent`" msgstr ":attr:`PurePath.parent`" #: ../../library/pathlib.rst:1916 msgid ":func:`os.path.basename`" msgstr ":func:`os.path.basename`" #: ../../library/pathlib.rst:1916 msgid ":attr:`PurePath.name`" msgstr ":attr:`PurePath.name`" #: ../../library/pathlib.rst:1917 msgid ":func:`os.path.splitext`" msgstr ":func:`os.path.splitext`" #: ../../library/pathlib.rst:1917 msgid ":attr:`PurePath.stem`, :attr:`PurePath.suffix`" msgstr ":attr:`PurePath.stem`, :attr:`PurePath.suffix`" #: ../../library/pathlib.rst:1918 msgid ":func:`os.path.join`" msgstr ":func:`os.path.join`" #: ../../library/pathlib.rst:1918 msgid ":meth:`PurePath.joinpath`" msgstr ":meth:`PurePath.joinpath`" #: ../../library/pathlib.rst:1919 msgid ":func:`os.path.isabs`" msgstr ":func:`os.path.isabs`" #: ../../library/pathlib.rst:1919 msgid ":meth:`PurePath.is_absolute`" msgstr ":meth:`PurePath.is_absolute`" #: ../../library/pathlib.rst:1920 msgid ":func:`os.path.relpath`" msgstr ":func:`os.path.relpath`" #: ../../library/pathlib.rst:1920 msgid ":meth:`PurePath.relative_to` [1]_" msgstr ":meth:`PurePath.relative_to` [1]_" #: ../../library/pathlib.rst:1921 msgid ":func:`os.path.expanduser`" msgstr ":func:`os.path.expanduser`" #: ../../library/pathlib.rst:1921 msgid ":meth:`Path.expanduser` [2]_" msgstr ":meth:`Path.expanduser` [2]_" #: ../../library/pathlib.rst:1922 msgid ":func:`os.path.realpath`" msgstr ":func:`os.path.realpath`" #: ../../library/pathlib.rst:1922 msgid ":meth:`Path.resolve`" msgstr ":meth:`Path.resolve`" #: ../../library/pathlib.rst:1923 msgid ":func:`os.path.abspath`" msgstr ":func:`os.path.abspath`" #: ../../library/pathlib.rst:1923 msgid ":meth:`Path.absolute` [3]_" msgstr ":meth:`Path.absolute` [3]_" #: ../../library/pathlib.rst:1924 msgid ":func:`os.path.exists`" msgstr ":func:`os.path.exists`" #: ../../library/pathlib.rst:1924 msgid ":meth:`Path.exists`" msgstr ":meth:`Path.exists`" #: ../../library/pathlib.rst:1925 msgid ":func:`os.path.isfile`" msgstr ":func:`os.path.isfile`" #: ../../library/pathlib.rst:1925 msgid ":meth:`Path.is_file`" msgstr ":meth:`Path.is_file`" #: ../../library/pathlib.rst:1926 msgid ":func:`os.path.isdir`" msgstr ":func:`os.path.isdir`" #: ../../library/pathlib.rst:1926 msgid ":meth:`Path.is_dir`" msgstr ":meth:`Path.is_dir`" #: ../../library/pathlib.rst:1927 msgid ":func:`os.path.islink`" msgstr ":func:`os.path.islink`" #: ../../library/pathlib.rst:1927 msgid ":meth:`Path.is_symlink`" msgstr ":meth:`Path.is_symlink`" #: ../../library/pathlib.rst:1928 msgid ":func:`os.path.isjunction`" msgstr ":func:`os.path.isjunction`" #: ../../library/pathlib.rst:1928 msgid ":meth:`Path.is_junction`" msgstr ":meth:`Path.is_junction`" #: ../../library/pathlib.rst:1929 msgid ":func:`os.path.ismount`" msgstr ":func:`os.path.ismount`" #: ../../library/pathlib.rst:1929 msgid ":meth:`Path.is_mount`" msgstr ":meth:`Path.is_mount`" #: ../../library/pathlib.rst:1930 msgid ":func:`os.path.samefile`" msgstr ":func:`os.path.samefile`" #: ../../library/pathlib.rst:1930 msgid ":meth:`Path.samefile`" msgstr ":meth:`Path.samefile`" #: ../../library/pathlib.rst:1931 msgid ":func:`os.getcwd`" msgstr ":func:`os.getcwd`" #: ../../library/pathlib.rst:1931 msgid ":meth:`Path.cwd`" msgstr ":meth:`Path.cwd`" #: ../../library/pathlib.rst:1932 msgid ":func:`os.stat`" msgstr ":func:`os.stat`" #: ../../library/pathlib.rst:1932 msgid ":meth:`Path.stat`" msgstr ":meth:`Path.stat`" #: ../../library/pathlib.rst:1933 msgid ":func:`os.lstat`" msgstr ":func:`os.lstat`" #: ../../library/pathlib.rst:1933 msgid ":meth:`Path.lstat`" msgstr ":meth:`Path.lstat`" #: ../../library/pathlib.rst:1934 msgid ":func:`os.listdir`" msgstr ":func:`os.listdir`" #: ../../library/pathlib.rst:1934 msgid ":meth:`Path.iterdir`" msgstr ":meth:`Path.iterdir`" #: ../../library/pathlib.rst:1935 msgid ":func:`os.walk`" msgstr ":func:`os.walk`" #: ../../library/pathlib.rst:1935 msgid ":meth:`Path.walk` [4]_" msgstr ":meth:`Path.walk` [4]_" #: ../../library/pathlib.rst:1936 msgid ":func:`os.mkdir`, :func:`os.makedirs`" msgstr ":func:`os.mkdir`, :func:`os.makedirs`" #: ../../library/pathlib.rst:1936 msgid ":meth:`Path.mkdir`" msgstr ":meth:`Path.mkdir`" #: ../../library/pathlib.rst:1937 msgid ":func:`os.link`" msgstr ":func:`os.link`" #: ../../library/pathlib.rst:1937 msgid ":meth:`Path.hardlink_to`" msgstr ":meth:`Path.hardlink_to`" #: ../../library/pathlib.rst:1938 msgid ":func:`os.symlink`" msgstr ":func:`os.symlink`" #: ../../library/pathlib.rst:1938 msgid ":meth:`Path.symlink_to`" msgstr ":meth:`Path.symlink_to`" #: ../../library/pathlib.rst:1939 msgid ":func:`os.readlink`" msgstr ":func:`os.readlink`" #: ../../library/pathlib.rst:1939 msgid ":meth:`Path.readlink`" msgstr ":meth:`Path.readlink`" #: ../../library/pathlib.rst:1940 msgid ":func:`os.rename`" msgstr ":func:`os.rename`" #: ../../library/pathlib.rst:1940 msgid ":meth:`Path.rename`" msgstr ":meth:`Path.rename`" #: ../../library/pathlib.rst:1941 msgid ":func:`os.replace`" msgstr ":func:`os.replace`" #: ../../library/pathlib.rst:1941 msgid ":meth:`Path.replace`" msgstr ":meth:`Path.replace`" #: ../../library/pathlib.rst:1942 msgid ":func:`os.remove`, :func:`os.unlink`" msgstr ":func:`os.remove`, :func:`os.unlink`" #: ../../library/pathlib.rst:1942 msgid ":meth:`Path.unlink`" msgstr ":meth:`Path.unlink`" #: ../../library/pathlib.rst:1943 msgid ":func:`os.rmdir`" msgstr ":func:`os.rmdir`" #: ../../library/pathlib.rst:1943 msgid ":meth:`Path.rmdir`" msgstr ":meth:`Path.rmdir`" #: ../../library/pathlib.rst:1944 msgid ":func:`os.chmod`" msgstr ":func:`os.chmod`" #: ../../library/pathlib.rst:1944 msgid ":meth:`Path.chmod`" msgstr ":meth:`Path.chmod`" #: ../../library/pathlib.rst:1945 msgid ":func:`os.lchmod`" msgstr ":func:`os.lchmod`" #: ../../library/pathlib.rst:1945 msgid ":meth:`Path.lchmod`" msgstr ":meth:`Path.lchmod`" #: ../../library/pathlib.rst:1949 msgid "Footnotes" msgstr "脚注" #: ../../library/pathlib.rst:1950 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:1954 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:1957 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:1960 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:1966 msgid "Protocols" msgstr "プロトコル" #: ../../library/pathlib.rst:1972 msgid "" "The :mod:`!pathlib.types` module provides types for static type checking." msgstr "" #: ../../library/pathlib.rst:1979 msgid "" "A :class:`typing.Protocol` describing the :attr:`Path.info ` attribute. Implementations may return cached results from their " "methods." msgstr "" #: ../../library/pathlib.rst:1985 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:1988 msgid "" "If *follow_symlinks* is ``False``, return ``True`` for symlinks without " "checking if their targets exist." msgstr "" #: ../../library/pathlib.rst:1993 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:1997 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:2003 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:2007 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:2013 msgid "" "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:11 msgid "path" msgstr "パス" #: ../../library/pathlib.rst:11 msgid "operations" msgstr "操作"