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
fd580cbd
Kaydet (Commit)
fd580cbd
authored
Tem 20, 2015
tarafından
Terry Jan Reedy
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge with 3.4
üst
d92d4efe
19c1a872
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
PathBrowser.py
Lib/idlelib/PathBrowser.py
+6
-4
test_pathbrowser.py
Lib/idlelib/idle_test/test_pathbrowser.py
+16
-1
No files found.
Lib/idlelib/PathBrowser.py
Dosyayı görüntüle @
fd580cbd
...
...
@@ -17,6 +17,7 @@ class PathBrowser(ClassBrowser):
self
.
init
(
flist
)
def
settitle
(
self
):
"Set window titles."
self
.
top
.
wm_title
(
"Path Browser"
)
self
.
top
.
wm_iconname
(
"Path Browser"
)
...
...
@@ -69,16 +70,17 @@ class DirBrowserTreeItem(TreeItem):
return
sublist
def
ispackagedir
(
self
,
file
):
" Return true for directories that are packages."
if
not
os
.
path
.
isdir
(
file
):
return
0
return
False
init
=
os
.
path
.
join
(
file
,
"__init__.py"
)
return
os
.
path
.
exists
(
init
)
def
listmodules
(
self
,
allnames
):
modules
=
{}
suffixes
=
importlib
.
machinery
.
EXTENSION_SUFFIXES
[:]
suffixes
+=
importlib
.
machinery
.
SOURCE_SUFFIXES
[:]
suffixes
+=
importlib
.
machinery
.
BYTECODE_SUFFIXES
[:]
suffixes
+=
importlib
.
machinery
.
SOURCE_SUFFIXES
suffixes
+=
importlib
.
machinery
.
BYTECODE_SUFFIXES
sorted
=
[]
for
suff
in
suffixes
:
i
=
-
len
(
suff
)
...
...
@@ -93,7 +95,7 @@ class DirBrowserTreeItem(TreeItem):
sorted
.
sort
()
return
sorted
def
_path_browser
(
parent
):
def
_path_browser
(
parent
):
# htest #
flist
=
PyShellFileList
(
parent
)
PathBrowser
(
flist
,
_htest
=
True
)
parent
.
mainloop
()
...
...
Lib/idlelib/idle_test/test_pathbrowser.py
Dosyayı görüntüle @
fd580cbd
import
unittest
import
idlelib.PathBrowser
as
PathBrowser
import
os
import
sys
import
idlelib
from
idlelib
import
PathBrowser
class
PathBrowserTest
(
unittest
.
TestCase
):
...
...
@@ -7,6 +10,18 @@ class PathBrowserTest(unittest.TestCase):
# Issue16226 - make sure that getting a sublist works
d
=
PathBrowser
.
DirBrowserTreeItem
(
''
)
d
.
GetSubList
()
self
.
assertEqual
(
''
,
d
.
GetText
())
dir
=
os
.
path
.
split
(
os
.
path
.
abspath
(
idlelib
.
__file__
))[
0
]
self
.
assertEqual
(
d
.
ispackagedir
(
dir
),
True
)
self
.
assertEqual
(
d
.
ispackagedir
(
dir
+
'/Icons'
),
False
)
def
test_PathBrowserTreeItem
(
self
):
p
=
PathBrowser
.
PathBrowserTreeItem
()
self
.
assertEqual
(
p
.
GetText
(),
'sys.path'
)
sub
=
p
.
GetSubList
()
self
.
assertEqual
(
len
(
sub
),
len
(
sys
.
path
))
self
.
assertEqual
(
type
(
sub
[
0
]),
PathBrowser
.
DirBrowserTreeItem
)
if
__name__
==
'__main__'
:
unittest
.
main
(
verbosity
=
2
,
exit
=
False
)
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