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
2411292b
Unverified
Kaydet (Commit)
2411292b
authored
Şub 09, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Şub 09, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601)
Co-authored-by:
Jake Davis
<
jcdavis@awedge.net
>
üst
bfe4fd5f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
1 deletion
+14
-1
csv.py
Lib/csv.py
+1
-1
test_csv.py
Lib/test/test_csv.py
+10
-0
ACKS
Misc/ACKS
+1
-0
2018-02-09-14-44-43.bpo-30157.lEiiAK.rst
...S.d/next/Library/2018-02-09-14-44-43.bpo-30157.lEiiAK.rst
+2
-0
No files found.
Lib/csv.py
Dosyayı görüntüle @
2411292b
...
...
@@ -217,7 +217,7 @@ class Sniffer:
matches
=
[]
for
restr
in
(
r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)'
,
# ,".*?",
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)'
,
# ".*?",
r'(?P<delim>
>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'
,
# ,".*?"
r'(?P<delim>
[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'
,
# ,".*?"
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'
):
# ".*?" (no delim, no space)
regexp
=
re
.
compile
(
restr
,
re
.
DOTALL
|
re
.
MULTILINE
)
matches
=
regexp
.
findall
(
data
)
...
...
Lib/test/test_csv.py
Dosyayı görüntüle @
2411292b
...
...
@@ -986,6 +986,16 @@ Stonecutters Seafood and Chop House+ Lemont+ IL+ 12/19/02+ Week Back
self
.
assertEqual
(
sniffer
.
has_header
(
self
.
header2
+
self
.
sample8
),
True
)
def
test_guess_quote_and_delimiter
(
self
):
sniffer
=
csv
.
Sniffer
()
for
header
in
(
";'123;4';"
,
"'123;4';"
,
";'123;4'"
,
"'123;4'"
):
with
self
.
subTest
(
header
):
dialect
=
sniffer
.
sniff
(
header
,
",;"
)
self
.
assertEqual
(
dialect
.
delimiter
,
';'
)
self
.
assertEqual
(
dialect
.
quotechar
,
"'"
)
self
.
assertIs
(
dialect
.
doublequote
,
False
)
self
.
assertIs
(
dialect
.
skipinitialspace
,
False
)
def
test_sniff
(
self
):
sniffer
=
csv
.
Sniffer
()
dialect
=
sniffer
.
sniff
(
self
.
sample1
)
...
...
Misc/ACKS
Dosyayı görüntüle @
2411292b
...
...
@@ -355,6 +355,7 @@ Kushal Das
Jonathan Dasteel
Pierre-Yves David
A. Jesse Jiryu Davis
Jake Davis
Ratnadeep Debnath
Merlijn van Deen
John DeGood
...
...
Misc/NEWS.d/next/Library/2018-02-09-14-44-43.bpo-30157.lEiiAK.rst
0 → 100644
Dosyayı görüntüle @
2411292b
Fixed guessing quote and delimiter in csv.Sniffer.sniff() when only the last
field is quoted. Patch by Jake Davis.
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