Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
17cba7da
Kaydet (Commit)
17cba7da
authored
Ock 12, 2015
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19777: Provide a home() classmethod on Path objects.
Contributed by Victor Salgado and Mayank Tripathi.
üst
2b4ec1ce
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
0 deletions
+34
-0
pathlib.rst
Doc/library/pathlib.rst
+11
-0
pathlib.py
Lib/pathlib.py
+7
-0
test_pathlib.py
Lib/test/test_pathlib.py
+11
-0
ACKS
Misc/ACKS
+2
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/pathlib.rst
Dosyayı görüntüle @
17cba7da
...
...
@@ -628,6 +628,17 @@ call fails (for example because the path doesn't exist):
PosixPath('/home/antoine/pathlib')
.. classmethod:: Path.home()
Return a new path object representing the user's home directory (as
returned by :func:`os.path.expanduser` with ``~`` construct)::
>>> Path.home()
PosixPath('/home/antoine')
.. versionadded:: 3.5
.. method:: Path.stat()
Return information about this path (similarly to :func:`os.stat`).
...
...
Lib/pathlib.py
Dosyayı görüntüle @
17cba7da
...
...
@@ -1008,6 +1008,13 @@ class Path(PurePath):
"""
return
cls
(
os
.
getcwd
())
@classmethod
def
home
(
cls
):
"""Return a new path pointing to the user's home directory (as
returned by os.path.expanduser('~')).
"""
return
cls
(
cls
()
.
_flavour
.
gethomedir
(
None
))
def
samefile
(
self
,
other_path
):
"""Return whether `other_file` is the same or not as this file.
(as returned by os.path.samefile(file, other_file)).
...
...
Lib/test/test_pathlib.py
Dosyayı görüntüle @
17cba7da
...
...
@@ -1261,6 +1261,17 @@ class _BasePathTest(object):
p
=
self
.
cls
.
cwd
()
self
.
_test_cwd
(
p
)
def
_test_home
(
self
,
p
):
q
=
self
.
cls
(
os
.
path
.
expanduser
(
'~'
))
self
.
assertEqual
(
p
,
q
)
self
.
assertEqual
(
str
(
p
),
str
(
q
))
self
.
assertIs
(
type
(
p
),
type
(
q
))
self
.
assertTrue
(
p
.
is_absolute
())
def
test_home
(
self
):
p
=
self
.
cls
.
home
()
self
.
_test_home
(
p
)
def
test_samefile
(
self
):
fileA_path
=
os
.
path
.
join
(
BASE
,
'fileA'
)
fileB_path
=
os
.
path
.
join
(
BASE
,
'dirB'
,
'fileB'
)
...
...
Misc/ACKS
Dosyayı görüntüle @
17cba7da
...
...
@@ -1201,6 +1201,7 @@ Sébastien Sablé
Suman Saha
Hajime Saitou
George Sakkis
Victor Salgado
Rich Salz
Kevin Samborn
Adrian Sampson
...
...
@@ -1390,6 +1391,7 @@ David Townshend
Nathan Trapuzzano
Laurence Tratt
Alberto Trevino
Mayank Tripathi
Matthias Troffaes
Tom Tromey
John Tromp
...
...
Misc/NEWS
Dosyayı görüntüle @
17cba7da
...
...
@@ -203,6 +203,9 @@ Core and Builtins
Library
-------
-
Issue
#
19777
:
Provide
a
home
()
classmethod
on
Path
objects
.
Contributed
by
Victor
Salgado
and
Mayank
Tripathi
.
-
Issue
#
23206
:
Make
``
json
.
dumps
(...,
ensure_ascii
=
False
)``
as
fast
as
the
default
case
of
``
ensure_ascii
=
True
``.
Patch
by
Naoki
Inada
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment