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
7dde792e
Kaydet (Commit)
7dde792e
authored
Eyl 03, 2010
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use a context manager for some file objects.
üst
24e561ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
32 deletions
+20
-32
keyword.py
Lib/keyword.py
+10
-12
pdb.py
Lib/pdb.py
+4
-10
platform.py
Lib/platform.py
+4
-7
turtle.py
Lib/turtle.py
+2
-3
No files found.
Lib/keyword.py
Dosyayı görüntüle @
7dde792e
...
...
@@ -61,21 +61,19 @@ def main():
else
:
optfile
=
"Lib/keyword.py"
# scan the source file for keywords
fp
=
open
(
iptfile
)
strprog
=
re
.
compile
(
'"([^"]+)"'
)
lines
=
[]
for
line
in
fp
:
if
'{1, "'
in
line
:
match
=
strprog
.
search
(
line
)
if
match
:
lines
.
append
(
" '"
+
match
.
group
(
1
)
+
"',
\n
"
)
fp
.
close
()
with
open
(
iptfile
)
as
fp
:
strprog
=
re
.
compile
(
'"([^"]+)"'
)
lines
=
[]
for
line
in
fp
:
if
'{1, "'
in
line
:
match
=
strprog
.
search
(
line
)
if
match
:
lines
.
append
(
" '"
+
match
.
group
(
1
)
+
"',
\n
"
)
lines
.
sort
()
# load the output skeleton from the target
fp
=
open
(
optfile
)
format
=
fp
.
readlines
()
fp
.
close
()
with
open
(
optfile
)
as
fp
:
format
=
fp
.
readlines
()
# insert the lines of keywords
try
:
...
...
Lib/pdb.py
Dosyayı görüntüle @
7dde792e
...
...
@@ -155,21 +155,15 @@ class Pdb(bdb.Bdb, cmd.Cmd):
if
'HOME'
in
os
.
environ
:
envHome
=
os
.
environ
[
'HOME'
]
try
:
rcFile
=
open
(
os
.
path
.
join
(
envHome
,
".pdbrc"
))
with
open
(
os
.
path
.
join
(
envHome
,
".pdbrc"
))
as
rcFile
:
self
.
rcLines
.
extend
(
rcFile
)
except
IOError
:
pass
else
:
for
line
in
rcFile
.
readlines
():
self
.
rcLines
.
append
(
line
)
rcFile
.
close
()
try
:
rcFile
=
open
(
".pdbrc"
)
with
open
(
".pdbrc"
)
as
rcFile
:
self
.
rcLines
.
extend
(
rcFile
)
except
IOError
:
pass
else
:
for
line
in
rcFile
.
readlines
():
self
.
rcLines
.
append
(
line
)
rcFile
.
close
()
self
.
commands
=
{}
# associates a command list to breakpoint numbers
self
.
commands_doprompt
=
{}
# for each bp num, tells if the prompt
...
...
Lib/platform.py
Dosyayı görüntüle @
7dde792e
...
...
@@ -200,9 +200,8 @@ def _dist_try_harder(distname,version,id):
"""
if
os
.
path
.
exists
(
'/var/adm/inst-log/info'
):
# SuSE Linux stores distribution information in that file
info
=
open
(
'/var/adm/inst-log/info'
)
.
readlines
()
distname
=
'SuSE'
for
line
in
info
:
for
line
in
open
(
'/var/adm/inst-log/info'
)
:
tv
=
line
.
split
()
if
len
(
tv
)
==
2
:
tag
,
value
=
tv
...
...
@@ -217,8 +216,7 @@ def _dist_try_harder(distname,version,id):
if
os
.
path
.
exists
(
'/etc/.installed'
):
# Caldera OpenLinux has some infos in that file (thanks to Colin Kong)
info
=
open
(
'/etc/.installed'
)
.
readlines
()
for
line
in
info
:
for
line
in
open
(
'/etc/.installed'
):
pkg
=
line
.
split
(
'-'
)
if
len
(
pkg
)
>=
2
and
pkg
[
0
]
==
'OpenLinux'
:
# XXX does Caldera support non Intel platforms ? If yes,
...
...
@@ -327,9 +325,8 @@ def linux_distribution(distname='', version='', id='',
return
_dist_try_harder
(
distname
,
version
,
id
)
# Read the first line
f
=
open
(
'/etc/'
+
file
,
'r'
)
firstline
=
f
.
readline
()
f
.
close
()
with
open
(
'/etc/'
+
file
,
'r'
)
as
f
:
firstline
=
f
.
readline
()
_distname
,
_version
,
_id
=
_parse_release_file
(
firstline
)
if
_distname
and
full_distribution_name
:
...
...
Lib/turtle.py
Dosyayı görüntüle @
7dde792e
...
...
@@ -169,9 +169,8 @@ _CFG = {"width" : 0.5, # Screen
def
config_dict
(
filename
):
"""Convert content of config-file into dictionary."""
f
=
open
(
filename
,
"r"
)
cfglines
=
f
.
readlines
()
f
.
close
()
with
open
(
filename
,
"r"
)
as
f
:
cfglines
=
f
.
readlines
()
cfgdict
=
{}
for
line
in
cfglines
:
line
=
line
.
strip
()
...
...
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