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
f878b812
Kaydet (Commit)
f878b812
authored
Nis 01, 2006
tarafından
Walter Dörwald
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make firstweekday a simple attribute instead
of hiding it behind a setter and a getter.
üst
cd10347b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
26 deletions
+12
-26
libcalendar.tex
Doc/lib/libcalendar.tex
+0
-9
calendar.py
Lib/calendar.py
+12
-17
No files found.
Doc/lib/libcalendar.tex
Dosyayı görüntüle @
f878b812
...
@@ -36,15 +36,6 @@ subclasses.
...
@@ -36,15 +36,6 @@ subclasses.
\class
{
Calendar
}
instances have the following methods:
\class
{
Calendar
}
instances have the following methods:
\begin{methoddesc}
{
firstweekday
}{}
Return the first day of the week (as specified in the constructor
or changed via
\method
{
setfirstweekday()
}
).
\end{methoddesc}
\begin{methoddesc}
{
setfirstweekday
}{
weekday
}
Set the first day of the week.
\end{methoddesc}
\begin{methoddesc}
{
iterweekdays
}{
weekday
}
\begin{methoddesc}
{
iterweekdays
}{
weekday
}
Return an iterator for the week day numbers that will be used
Return an iterator for the week day numbers that will be used
for one week. The first number from the iterator will be the
for one week. The first number from the iterator will be the
...
...
Lib/calendar.py
Dosyayı görüntüle @
f878b812
...
@@ -128,25 +128,14 @@ class Calendar(object):
...
@@ -128,25 +128,14 @@ class Calendar(object):
"""
"""
def
__init__
(
self
,
firstweekday
=
0
):
def
__init__
(
self
,
firstweekday
=
0
):
self
.
_firstweekday
=
firstweekday
# 0 = Monday, 6 = Sunday
self
.
firstweekday
=
firstweekday
# 0 = Monday, 6 = Sunday
def
firstweekday
(
self
):
return
self
.
_firstweekday
def
setfirstweekday
(
self
,
weekday
):
"""
Set weekday (Monday=0, Sunday=6) to start each week.
"""
if
not
MONDAY
<=
weekday
<=
SUNDAY
:
raise
IllegalWeekdayError
(
weekday
)
self
.
_firstweekday
=
weekday
def
iterweekdays
(
self
):
def
iterweekdays
(
self
):
"""
"""
Return a iterator for one week of weekday numbers starting with the
Return a iterator for one week of weekday numbers starting with the
configured first one.
configured first one.
"""
"""
for
i
in
xrange
(
self
.
_firstweekday
,
self
.
_
firstweekday
+
7
):
for
i
in
xrange
(
self
.
firstweekday
,
self
.
firstweekday
+
7
):
yield
i
%
7
yield
i
%
7
def
itermonthdates
(
self
,
year
,
month
):
def
itermonthdates
(
self
,
year
,
month
):
...
@@ -157,13 +146,13 @@ class Calendar(object):
...
@@ -157,13 +146,13 @@ class Calendar(object):
"""
"""
date
=
datetime
.
date
(
year
,
month
,
1
)
date
=
datetime
.
date
(
year
,
month
,
1
)
# Go back to the beginning of the week
# Go back to the beginning of the week
days
=
(
date
.
weekday
()
-
self
.
_
firstweekday
)
%
7
days
=
(
date
.
weekday
()
-
self
.
firstweekday
)
%
7
date
-=
datetime
.
timedelta
(
days
=
days
)
date
-=
datetime
.
timedelta
(
days
=
days
)
oneday
=
datetime
.
timedelta
(
days
=
1
)
oneday
=
datetime
.
timedelta
(
days
=
1
)
while
True
:
while
True
:
yield
date
yield
date
date
+=
oneday
date
+=
oneday
if
date
.
month
!=
month
and
date
.
weekday
()
==
self
.
_
firstweekday
:
if
date
.
month
!=
month
and
date
.
weekday
()
==
self
.
firstweekday
:
break
break
def
itermonthdays2
(
self
,
year
,
month
):
def
itermonthdays2
(
self
,
year
,
month
):
...
@@ -570,8 +559,14 @@ class LocaleHTMLCalendar(HTMLCalendar):
...
@@ -570,8 +559,14 @@ class LocaleHTMLCalendar(HTMLCalendar):
# Support for old module level interface
# Support for old module level interface
c
=
TextCalendar
()
c
=
TextCalendar
()
firstweekday
=
c
.
firstweekday
def
firstweekday
():
setfirstweekday
=
c
.
setfirstweekday
return
c
.
firstweekday
def
setfirstweekday
(
firstweekday
):
if
not
MONDAY
<=
firstweekday
<=
SUNDAY
:
raise
IllegalWeekdayError
(
firstweekday
)
c
.
firstweekday
=
firstweekday
monthcalendar
=
c
.
monthdayscalendar
monthcalendar
=
c
.
monthdayscalendar
prweek
=
c
.
prweek
prweek
=
c
.
prweek
week
=
c
.
formatweek
week
=
c
.
formatweek
...
...
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