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
e07b8359
Kaydet (Commit)
e07b8359
authored
Haz 09, 2003
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Document context_diff() and unified_diff()
üst
4e3363e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
libdifflib.tex
Doc/lib/libdifflib.tex
+63
-0
No files found.
Doc/lib/libdifflib.tex
Dosyayı görüntüle @
e07b8359
...
...
@@ -52,6 +52,38 @@
characters.
\end{classdesc*}
\begin{funcdesc}
{
context
_
diff
}{
a, b
\optional
{
, fromfile
\optional
{
, tofile
\optional
{
, fromfiledate
\optional
{
, tofiledate
\optional
{
, n
\optional
{
, lineterm
}}}}}}}
Compare
\var
{
a
}
and
\var
{
b
}
(lists of strings); return a
delta (a generator generating the delta lines) in context diff
format.
Context diffs are a compact way of showing just the lines that have
changed plus a few lines of context. The changes are shown in a
before/after style. The number of context lines is set by
\var
{
n
}
which defaults to three.
By default, the diff control lines (those with
\code
{
***
}
or
\code
{
---
}
)
are created with a trailing newline. This is helpful so that inputs created
from
\function
{
file.readlines()
}
result in diffs that are suitable for use
with
\function
{
file.writelines()
}
since both the inputs and outputs have
trailing newlines.
For inputs that do not have trailing newlines, set the
\var
{
lineterm
}
argument to
\code
{
""
}
so that the output will be uniformly newline free.
The context diff format normally has a header for filenames and
modification times. Any or all of these may be specified using strings for
\var
{
fromfile
}
,
\var
{
tofile
}
,
\var
{
fromfiledate
}
, and
\var
{
tofiledate
}
.
The modification times are normally expressed in the format returned by
\function
{
time.ctime()
}
. If not specified, the strings default to blanks.
\file
{
Tools/scripts/diff.py
}
is a command-line front-end for this
function.
\end{funcdesc}
\begin{funcdesc}
{
get
_
close
_
matches
}{
word, possibilities
\optional
{
,
n
\optional
{
, cutoff
}}}
Return a list of the best ``good enough'' matches.
\var
{
word
}
is a
...
...
@@ -151,6 +183,37 @@ emu
\end{funcdesc}
\begin{funcdesc}
{
unified
_
diff
}{
a, b
\optional
{
, fromfile
\optional
{
, tofile
\optional
{
, fromfiledate
\optional
{
, tofiledate
\optional
{
, n
\optional
{
, lineterm
}}}}}}}
Compare
\var
{
a
}
and
\var
{
b
}
(lists of strings); return a
delta (a generator generating the delta lines) in unified diff
format.
Unified diffs are a compact way of showing just the lines that have
changed plus a few lines of context. The changes are shown in a
inline style (instead of separate before/after blocks). The number
of context lines is set by
\var
{
n
}
which defaults to three.
By default, the diff control lines (those with
\code
{
---
}
,
\code
{
+++
}
,
or
\code
{
@@
}
) are created with a trailing newline. This is helpful so
that inputs created from
\function
{
file.readlines()
}
result in diffs
that are suitable for use with
\function
{
file.writelines()
}
since both
the inputs and outputs have trailing newlines.
For inputs that do not have trailing newlines, set the
\var
{
lineterm
}
argument to
\code
{
""
}
so that the output will be uniformly newline free.
The context diff format normally has a header for filenames and
modification times. Any or all of these may be specified using strings for
\var
{
fromfile
}
,
\var
{
tofile
}
,
\var
{
fromfiledate
}
, and
\var
{
tofiledate
}
.
The modification times are normally expressed in the format returned by
\function
{
time.ctime()
}
. If not specified, the strings default to blanks.
\file
{
Tools/scripts/diff.py
}
is a command-line front-end for this
function.
\end{funcdesc}
\begin{funcdesc}
{
IS
_
LINE
_
JUNK
}{
line
}
Return true for ignorable lines. The line
\var
{
line
}
is ignorable
...
...
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