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
a351f89a
Kaydet (Commit)
a351f89a
authored
Nis 04, 1998
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Relocating file to Lib/lib-old.
üst
f7d590c9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
140 deletions
+0
-140
Para.py
Lib/Para.py
+0
-0
addpack.py
Lib/addpack.py
+0
-67
fmt.py
Lib/fmt.py
+0
-0
newdir.py
Lib/newdir.py
+0
-73
No files found.
Lib/Para.py
deleted
100644 → 0
Dosyayı görüntüle @
f7d590c9
This diff is collapsed.
Click to expand it.
Lib/addpack.py
deleted
100644 → 0
Dosyayı görüntüle @
f7d590c9
# This module provides standard support for "packages".
#
# The idea is that large groups of related modules can be placed in
# their own subdirectory, which can be added to the Python search path
# in a relatively easy way.
#
# The current version takes a package name and searches the Python
# search path for a directory by that name, and if found adds it to
# the module search path (sys.path). It maintains a list of packages
# that have already been added so adding the same package many times
# is OK.
#
# It is intended to be used in a fairly stylized manner: each module
# that wants to use a particular package, say 'Foo', is supposed to
# contain the following code:
#
# from addpack import addpack
# addpack('Foo')
# <import modules from package Foo>
#
# Additional arguments, when present, provide additional places where
# to look for the package before trying sys.path (these may be either
# strings or lists/tuples of strings). Also, if the package name is a
# full pathname, first the last component is tried in the usual way,
# then the full pathname is tried last. If the package name is a
# *relative* pathname (UNIX: contains a slash but doesn't start with
# one), then nothing special is done. The packages "/foo/bar/bletch"
# and "bletch" are considered the same, but unrelated to "bar/bletch".
#
# If the algorithm finds more than one suitable subdirectory, all are
# added to the search path -- this makes it possible to override part
# of a package. The same path will not be added more than once.
#
# If no directory is found, ImportError is raised.
_packs
=
{}
# {pack: [pathname, ...], ...}
def
addpack
(
pack
,
*
locations
):
import
os
if
os
.
path
.
isabs
(
pack
):
base
=
os
.
path
.
basename
(
pack
)
else
:
base
=
pack
if
_packs
.
has_key
(
base
):
return
import
sys
path
=
[]
for
loc
in
_flatten
(
locations
)
+
sys
.
path
:
fn
=
os
.
path
.
join
(
loc
,
base
)
if
fn
not
in
path
and
os
.
path
.
isdir
(
fn
):
path
.
append
(
fn
)
if
pack
!=
base
and
pack
not
in
path
and
os
.
path
.
isdir
(
pack
):
path
.
append
(
pack
)
if
not
path
:
raise
ImportError
,
'package '
+
pack
+
' not found'
_packs
[
base
]
=
path
for
fn
in
path
:
if
fn
not
in
sys
.
path
:
sys
.
path
.
append
(
fn
)
def
_flatten
(
locations
):
locs
=
[]
for
loc
in
locations
:
if
type
(
loc
)
==
type
(
''
):
locs
.
append
(
loc
)
else
:
locs
=
locs
+
_flatten
(
loc
)
return
locs
Lib/fmt.py
deleted
100644 → 0
Dosyayı görüntüle @
f7d590c9
This diff is collapsed.
Click to expand it.
Lib/newdir.py
deleted
100644 → 0
Dosyayı görüntüle @
f7d590c9
# New dir() function
# This should be the new dir(), except that it should still list
# the current local name space by default
def
listattrs
(
x
):
try
:
dictkeys
=
x
.
__dict__
.
keys
()
except
(
AttributeError
,
TypeError
):
dictkeys
=
[]
#
try
:
methods
=
x
.
__methods__
except
(
AttributeError
,
TypeError
):
methods
=
[]
#
try
:
members
=
x
.
__members__
except
(
AttributeError
,
TypeError
):
members
=
[]
#
try
:
the_class
=
x
.
__class__
except
(
AttributeError
,
TypeError
):
the_class
=
None
#
try
:
bases
=
x
.
__bases__
except
(
AttributeError
,
TypeError
):
bases
=
()
#
total
=
dictkeys
+
methods
+
members
if
the_class
:
# It's a class instace; add the class's attributes
# that are functions (methods)...
class_attrs
=
listattrs
(
the_class
)
class_methods
=
[]
for
name
in
class_attrs
:
if
is_function
(
getattr
(
the_class
,
name
)):
class_methods
.
append
(
name
)
total
=
total
+
class_methods
elif
bases
:
# It's a derived class; add the base class attributes
for
base
in
bases
:
base_attrs
=
listattrs
(
base
)
total
=
total
+
base_attrs
total
.
sort
()
return
total
i
=
0
while
i
+
1
<
len
(
total
):
if
total
[
i
]
==
total
[
i
+
1
]:
del
total
[
i
+
1
]
else
:
i
=
i
+
1
return
total
# Helper to recognize functions
def
is_function
(
x
):
return
type
(
x
)
==
type
(
is_function
)
# Approximation of builtin dir(); but note that this lists the user's
# variables by default, not the current local name space.
def
dir
(
x
=
None
):
if
x
is
not
None
:
return
listattrs
(
x
)
else
:
import
__main__
return
listattrs
(
__main__
)
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