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
c0320fc1
Kaydet (Commit)
c0320fc1
authored
May 29, 2002
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Backport change to 1.18 adding docstrings
üst
9fa1efec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
dumbdbm.py
Lib/dumbdbm.py
+13
-1
formatter.py
Lib/formatter.py
+36
-1
No files found.
Lib/dumbdbm.py
Dosyayı görüntüle @
c0320fc1
...
...
@@ -150,9 +150,21 @@ class _Database:
def
__del__
(
self
):
if
self
.
_index
is
not
None
:
self
.
_commit
()
def
open
(
file
,
flag
=
None
,
mode
=
0666
):
"""Open the database file, filename, and return corresponding object.
The flag argument, used to control how the database is opened in the
other DBM implementations, is ignored in the dumbdbm module; the
database is always opened for update, and will be created if it does
not exist.
The optional mode argument is the UNIX mode of the file, used only when
the database has to be created. It defaults to octal code 0666 (and
will be modified by the prevailing umask).
"""
# flag, mode arguments are currently ignored
return
_Database
(
file
,
mode
)
Lib/formatter.py
Dosyayı görüntüle @
c0320fc1
...
...
@@ -27,6 +27,15 @@ AS_IS = None
class
NullFormatter
:
"""A formatter which does nothing.
If the writer parameter is omitted, a NullWriter instance is created.
No methods of the writer are called by NullFormatter instances.
Implementations should inherit from this class if implementing a writer
interface but don't need to inherit any implementation.
"""
def
__init__
(
self
,
writer
=
None
):
if
not
writer
:
...
...
@@ -52,6 +61,13 @@ class NullFormatter:
class
AbstractFormatter
:
"""The standard formatter.
This implementation has demonstrated wide applicability to many writers,
and may be used directly in most circumstances. It has been used to
implement a full-featured World Wide Web browser.
"""
# Space handling policy: blank spaces at the boundary between elements
# are handled by the outermost context. "Literal" data is not checked
...
...
@@ -283,7 +299,13 @@ class AbstractFormatter:
class
NullWriter
:
"""Minimal writer interface to use in testing & inheritance."""
"""Minimal writer interface to use in testing & inheritance.
A writer which only provides the interface definition; no actions are
taken on any methods. This should be the base class for all writers
which do not need to inherit any implementation methods.
"""
def
__init__
(
self
):
pass
def
flush
(
self
):
pass
def
new_alignment
(
self
,
align
):
pass
...
...
@@ -300,6 +322,12 @@ class NullWriter:
class
AbstractWriter
(
NullWriter
):
"""A writer which can be used in debugging formatters, but not much else.
Each method simply announces itself by printing its name and
arguments on standard output.
"""
def
new_alignment
(
self
,
align
):
print
"new_alignment(
%
s)"
%
`align`
...
...
@@ -336,6 +364,13 @@ class AbstractWriter(NullWriter):
class
DumbWriter
(
NullWriter
):
"""Simple writer class which writes output on the file object passed in
as the file parameter or, if file is omitted, on standard output. The
output is simply word-wrapped to the number of columns specified by
the maxcol parameter. This class is suitable for reflowing a sequence
of paragraphs.
"""
def
__init__
(
self
,
file
=
None
,
maxcol
=
72
):
self
.
file
=
file
or
sys
.
stdout
...
...
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