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
e2c11473
Kaydet (Commit)
e2c11473
authored
Şub 23, 2013
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #16695: Document how glob handles filenames starting with a dot
üst
3c75a48c
ee4a20ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
glob.rst
Doc/library/glob.rst
+13
-2
glob.py
Lib/glob.py
+8
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/glob.rst
Dosyayı görüntüle @
e2c11473
...
@@ -16,8 +16,10 @@ according to the rules used by the Unix shell. No tilde expansion is done, but
...
@@ -16,8 +16,10 @@ according to the rules used by the Unix shell. No tilde expansion is done, but
``*``, ``?``, and character ranges expressed with ``[]`` will be correctly
``*``, ``?``, and character ranges expressed with ``[]`` will be correctly
matched. This is done by using the :func:`os.listdir` and
matched. This is done by using the :func:`os.listdir` and
:func:`fnmatch.fnmatch` functions in concert, and not by actually invoking a
:func:`fnmatch.fnmatch` functions in concert, and not by actually invoking a
subshell. (For tilde and shell variable expansion, use
subshell. Note that unlike :func:`fnmatch.fnmatch`, :mod:`glob` treats
:func:`os.path.expanduser` and :func:`os.path.expandvars`.)
filenames beginning with a dot (``.``) as special cases. (For tilde and shell
variable expansion, use :func:`os.path.expanduser` and
:func:`os.path.expandvars`.)
For a literal match, wrap the meta-characters in brackets.
For a literal match, wrap the meta-characters in brackets.
For example, ``'[?]'`` matches the character ``'?'``.
For example, ``'[?]'`` matches the character ``'?'``.
...
@@ -51,6 +53,15 @@ preserved. ::
...
@@ -51,6 +53,15 @@ preserved. ::
>>> glob.glob('?.gif')
>>> glob.glob('?.gif')
['1.gif']
['1.gif']
If the directory contains files starting with ``.`` they won't be matched by
default. For example, consider a directory containing :file:`card.gif` and
:file:`.card.gif`::
>>> import glob
>>> glob.glob('*.gif')
['card.gif']
>>> glob.glob('.c*')
['.card.gif']
.. seealso::
.. seealso::
...
...
Lib/glob.py
Dosyayı görüntüle @
e2c11473
...
@@ -9,7 +9,10 @@ __all__ = ["glob", "iglob"]
...
@@ -9,7 +9,10 @@ __all__ = ["glob", "iglob"]
def
glob
(
pathname
):
def
glob
(
pathname
):
"""Return a list of paths matching a pathname pattern.
"""Return a list of paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
"""
"""
return
list
(
iglob
(
pathname
))
return
list
(
iglob
(
pathname
))
...
@@ -17,7 +20,10 @@ def glob(pathname):
...
@@ -17,7 +20,10 @@ def glob(pathname):
def
iglob
(
pathname
):
def
iglob
(
pathname
):
"""Return an iterator which yields the paths matching a pathname pattern.
"""Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
"""
"""
if
not
has_magic
(
pathname
):
if
not
has_magic
(
pathname
):
...
...
Misc/NEWS
Dosyayı görüntüle @
e2c11473
...
@@ -756,6 +756,9 @@ Tools/Demos
...
@@ -756,6 +756,9 @@ Tools/Demos
Documentation
Documentation
-------------
-------------
-
Issue
#
16695
:
Document
how
glob
handles
filenames
starting
with
a
dot
.
Initial
patch
by
Jyrki
Pulliainen
.
-
Issue
#
8890
:
Stop
advertising
an
insecure
practice
by
replacing
uses
-
Issue
#
8890
:
Stop
advertising
an
insecure
practice
by
replacing
uses
of
the
/
tmp
directory
with
better
alternatives
in
the
documentation
.
of
the
/
tmp
directory
with
better
alternatives
in
the
documentation
.
Patch
by
Geoff
Wilson
.
Patch
by
Geoff
Wilson
.
...
...
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