Commit Graph

68 Commits

Author SHA1 Message Date
Brett Cannon 568be63248 Issue #27186: Add os.PathLike support to pathlib.
This adds support both to pathlib.PurePath's constructor as well as
implementing __fspath__(). This removes the provisional status for
pathlib.

Initial patch by Dusty Phillips.
2016-06-10 12:20:49 -07:00
Guido van Rossum 03e6061956 Back out pathlib.Path.path attr. (Merge 3.5->3.6) 2016-05-19 13:11:17 -07:00
Guido van Rossum 387e6e3817 Back out pathlib.Path.path attr. (Merge 3.4->3.5) 2016-05-19 13:10:20 -07:00
Guido van Rossum 3d4d01f614 Back out 7e9605697dfc, 2e3c31ab586a, 759b2cecc289.
These added a path attribute to pathlib.Path objects, and docs.
Instead, we're going to use PEP 519.

(Starting in the 3.4 branch and merging forward from there since that's what I did originally.)
2016-05-19 13:00:21 -07:00
Serhiy Storchaka 0e120525f0 Issue #24950: Fixed expanduser tests when the users home directory in pwd is "/".
Based on patch by SilentGhost.
2016-05-03 21:17:52 +03:00
Serhiy Storchaka a3fd0b26ba Issue #24950: Fixed expanduser tests when the users home directory in pwd is "/".
Based on patch by SilentGhost.
2016-05-03 21:17:03 +03:00
Serhiy Storchaka b6a9c9761c Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Victor Stinner 25caed546d Merge 3.5 2016-03-11 22:53:15 +01:00
Victor Stinner d7569637b5 Issue #20589: Fix test_pathlib 2016-03-11 22:53:00 +01:00
Berker Peksag d0e9b6919f Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
NotImplementedError instead of ImportError.
2016-03-11 23:08:11 +02:00
Berker Peksag 04d4229719 Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
NotImplementedError instead of ImportError.
2016-03-11 23:07:27 +02:00
Berker Peksag 396cbd6dfd Issue #23076: Path.glob() now raises a ValueError if it's called with an
invalid pattern.

Patch by Thomas Nyberg.
2016-01-30 17:51:35 +02:00
Berker Peksag 4a208e448e Issue #23076: Path.glob() now raises a ValueError if it's called with an
invalid pattern.

Patch by Thomas Nyberg.
2016-01-30 17:50:48 +02:00
Guido van Rossum 2900995edd Hopeful fix for test_rglob_common on Windows without symlinks. (Merge 3.5->3.6) 2016-01-07 13:13:31 -08:00
Guido van Rossum 03abf6dd98 Hopeful fix for test_rglob_common on Windows without symlinks. (Merge 3.4->3.5) 2016-01-07 13:13:04 -08:00
Guido van Rossum 9c39b67ca5 Hopeful fix for test_rglob_common on Windows without symlinks. 2016-01-07 13:12:34 -08:00
Guido van Rossum 8355bd7f66 Add another try/except PermissionError to avoid depending on listdir order. Fix issues #24120 and #26012. (Merge 3.5->3.6) 2016-01-07 10:58:20 -08:00
Guido van Rossum c3a8272705 Add another try/except PermissionError to avoid depending on listdir order. Fix issues #24120 and #26012. (Merge 3.4->3.5) 2016-01-07 10:57:37 -08:00
Guido van Rossum bc9fddaf50 Add another try/except PermissionError to avoid depending on listdir order. Fix issues #24120 and #26012. 2016-01-07 10:56:36 -08:00
Guido van Rossum 483397a235 Issue #22570: Add 'path' attribute to pathlib.Path objects. (Merge 3.5->3.6) 2016-01-06 11:03:47 -08:00
Guido van Rossum 1a4afec0d6 Issue #22570: Add 'path' attribute to pathlib.Path objects. (Merge 3.4->3.5) 2016-01-06 11:03:15 -08:00
Guido van Rossum e428231539 Issue #22570: Add 'path' attribute to pathlib.Path objects. 2016-01-06 11:01:42 -08:00
Guido van Rossum e630b6818f Issue #26012: Don't traverse into symlinks for ** pattern in pathlib.Path.[r]glob(). (Merge 3.5->3.6) 2016-01-06 10:36:19 -08:00
Guido van Rossum 520f297eb4 Issue #26012: Don't traverse into symlinks for ** pattern in pathlib.Path.[r]glob(). (Merge 3.4->3.5) 2016-01-06 10:35:30 -08:00
Guido van Rossum 69bfb15bd8 Issue #26012: Don't traverse into symlinks for ** pattern in pathlib.Path.[r]glob(). 2016-01-06 10:31:33 -08:00
Guido van Rossum 080169c494 Issue #24120: Ignore PermissionError in pathlib.Path.[r]glob(). Ulrich Petri. (Merge 3.5->3.6) 2016-01-06 09:53:51 -08:00
Guido van Rossum d54377d2ca Issue #24120: Ignore PermissionError in pathlib.Path.[r]glob(). Ulrich Petri. (Merge 3.4->3.5) 2016-01-06 09:51:42 -08:00
Guido van Rossum 6c2d33a258 Issue #24120: Ignore PermissionError in pathlib.Path.[r]glob(). Ulrich Petri. 2016-01-06 09:42:07 -08:00
Ezio Melotti ac1e7f6983 Remove duplicate method in test_pathlib. Initial patch by Navneet Suman. 2015-12-28 23:50:19 +02:00
Antoine Pitrou 2d07b85585 Issue #23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
Detected and fixed by Serhiy.
2015-02-15 18:06:54 +01:00
Antoine Pitrou 57fffd6f99 Issue #23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
Detected and fixed by Serhiy.
2015-02-15 18:03:59 +01:00
Antoine Pitrou 17cba7daf5 Issue #19777: Provide a home() classmethod on Path objects.
Contributed by Victor Salgado and Mayank Tripathi.
2015-01-12 21:03:41 +01:00
Victor Stinner e969439862 Issue #19776: Fix test_pathlib.test_expanduser()
Skip users with an empty home directory.
2015-01-10 09:00:20 +01:00
Antoine Pitrou 8477ed6048 Issue #19776: Add a expanduser() method on Path objects.
Patch by Serhiy.
2014-12-30 20:54:45 +01:00
Antoine Pitrou c689101a5e Issue #22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) now return False when the underlying stat call raises NotADirectoryError. 2014-10-30 23:15:25 +01:00
Antoine Pitrou 2b2852b1b4 Issue #22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) now return False when the underlying stat call raises NotADirectoryError. 2014-10-30 23:14:03 +01:00
Georg Brandl ea68398355 Closes #20218: Added convenience methods read_text/write_text and read_bytes/
write_bytes to pathlib.Path objects.

Thanks to Christopher Welborn and Ram Rachum for original patches.
2014-10-01 19:12:33 +02:00
Barry Warsaw 7c549c4e64 - Issue #21539: Add a *exists_ok* argument to `Pathlib.mkdir()` to mimic
`mkdir -p` and `os.makedirs()` functionality.  When true, ignore
  FileExistsErrors.  Patch by Berker Peksag.

(With minor cleanups, additional tests, doc tweaks, etc. by Barry)

Also:

* Remove some unused imports in test_pathlib.py reported by pyflakes.
2014-08-05 11:28:12 -04:00
Victor Stinner 963b4bab52 Merge Python 3.4
* Issue #19811, #22022: test_pathlib uses support.rmtree() instead of
  shutil.rmtree() to remove the temporary directory.

* Issue #19629: Fix support.rmtree(), use os.lstat() to check if the file is a
  directory, not os.path.isdir()
2014-07-21 19:20:06 +02:00
Victor Stinner ec86469ca3 Issue #19811, #22022: test_pathlib uses support.rmtree() instead of
shutil.rmtree() to remove the temporary directory.
2014-07-21 19:19:05 +02:00
Antoine Pitrou 006c725426 Merge pathlib fixes 2014-07-06 21:38:35 -04:00
Antoine Pitrou e50dafcd63 Issue #20639: calling Path.with_suffix('') allows removing the suffix again.
Patch by July Tikhonov.
2014-07-06 21:37:15 -04:00
Antoine Pitrou 7084e736db Issue #21714: Disallow the construction of invalid paths using Path.with_name(). Original patch by Antony Lee. 2014-07-06 21:31:12 -04:00
Antoine Pitrou 43e3d9409d Issue #19775: Add a samefile() method to pathlib Path objects.
Initial patch by Vajrasky Kok.
2014-05-13 10:50:15 +02:00
Antoine Pitrou cb5ec77d33 Issue #21127: Path objects can now be instantiated from str subclass instances (such as numpy.str_).
Thanks to Antony Lee for the report and preliminary patch.
2014-04-23 00:34:15 +02:00
Gregory P. Smith b599c61179 Fix the unittest to run properly when the working directory has
additional bits set (such as the setgid or sticky bits).
2014-01-20 01:10:33 -08:00
Serhiy Storchaka 8f8ec92de8 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang lines in the unittestgui and checkpip scripts.
2014-01-16 17:33:23 +02:00
Antoine Pitrou 1b02da95d2 Issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix. 2014-01-03 00:07:17 +01:00
Antoine Pitrou 156b3610b8 Issue #19918: Fix PurePath.relative_to() under Windows. 2013-12-28 19:49:04 +01:00