hijri-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cli.py +91 -0
- hijra.py +343 -0
- hijra_uq.py +175 -0
- hijri_cli-0.1.0.dist-info/METADATA +84 -0
- hijri_cli-0.1.0.dist-info/RECORD +11 -0
- hijri_cli-0.1.0.dist-info/WHEEL +5 -0
- hijri_cli-0.1.0.dist-info/entry_points.txt +2 -0
- hijri_cli-0.1.0.dist-info/licenses/LICENSE-ar.txt +138 -0
- hijri_cli-0.1.0.dist-info/licenses/LICENSE.txt +222 -0
- hijri_cli-0.1.0.dist-info/licenses/hijridate-LICENSE.txt +21 -0
- hijri_cli-0.1.0.dist-info/top_level.txt +3 -0
cli.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""
|
|
2
|
+
hijri - print and convert dates in the Umm al-Qura Hijri calendar
|
|
3
|
+
from the command line.
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2026 Muhammad Bakhit <muhammadbakhit@outlook.com>
|
|
6
|
+
|
|
7
|
+
This tool is inspired by, and built on, the "hijra" project by Ojuba Linux
|
|
8
|
+
(https://github.com/ojuba-org/hijra), written by Muayyad Saleh Alsadi.
|
|
9
|
+
Sadly, that project is no longer being developed. This tool is my attempt
|
|
10
|
+
to keep its work useful: it reuses its conversion engine (hijra.py), adds
|
|
11
|
+
official Umm al-Qura calendar support, and offers it as a simple command
|
|
12
|
+
that works like the "date" command.
|
|
13
|
+
|
|
14
|
+
Released under the terms of the Waqf Public License.
|
|
15
|
+
This program is free software; you can redistribute it and/or modify
|
|
16
|
+
it under the terms of the latest version of the Waqf Public License
|
|
17
|
+
as published by Ojuba.org.
|
|
18
|
+
|
|
19
|
+
This program is distributed in the hope that it will be useful,
|
|
20
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
22
|
+
|
|
23
|
+
A copy of the license is included in this repository (LICENSE.txt).
|
|
24
|
+
|
|
25
|
+
Umm al-Qura table data (hijra_uq.py) is taken from the "hijridate" project
|
|
26
|
+
by Mohammed Alshehri, under the MIT License (see hijridate-LICENSE.txt).
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
import datetime
|
|
30
|
+
import hijra
|
|
31
|
+
import argparse
|
|
32
|
+
|
|
33
|
+
HIJRI_MONTHS = ["Muharram", "Safar", "Rabi' I", "Rabi' II", "Jumada I", "Jumada II", "Rajab", "Sha'ban", "Ramadan", "Shawwal", "Dhul Qadah", "Dhul Hijjah"]
|
|
34
|
+
|
|
35
|
+
def format_hijri (year,month,day,weekday):
|
|
36
|
+
"""This function formats the Hijri date into a string representation, including the weekday, day, month name, and year."""
|
|
37
|
+
hijri_month = HIJRI_MONTHS[month - 1]
|
|
38
|
+
return f"{weekday} {day} {hijri_month} {year}"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def parse_hijri (parts):
|
|
42
|
+
parts = [int(num) for num in parts.split("-")]
|
|
43
|
+
h_year, h_month, h_day = parts
|
|
44
|
+
if not (1 <= h_month <= 12 and 1 <= h_day <= 30):
|
|
45
|
+
raise ValueError("month or day out of range")
|
|
46
|
+
if h_year < 1343 or h_year > 1500:
|
|
47
|
+
print("Warning: The date is less than 1343 or greater than 1500, which is outside the range of the Umm al-Qura calendar. This date may not be accurate!.")
|
|
48
|
+
return h_year, h_month, h_day
|
|
49
|
+
|
|
50
|
+
def main():
|
|
51
|
+
parser = argparse.ArgumentParser(prog="hijri",description="Print or convert dates in the Umm al-Qura Hijri calendar.")
|
|
52
|
+
parser.add_argument("-d", "--date", help="Gregorian date to convert to Hijri, as YYYY-MM-DD")
|
|
53
|
+
parser.add_argument("-g", "--to-gregorian", help="Hijri date to convert to gregorian, as YYYY-MM-DD")
|
|
54
|
+
args = parser.parse_args()
|
|
55
|
+
|
|
56
|
+
"""From Hijri to Gregorian, and Exit"""
|
|
57
|
+
if args.to_gregorian != None:
|
|
58
|
+
try:
|
|
59
|
+
h_year,h_month,h_day = parse_hijri(args.to_gregorian)
|
|
60
|
+
g_year,g_month,g_day = hijra.hijri_to_gregorian(h_year,h_month,h_day)
|
|
61
|
+
g_date = datetime.date(g_year,g_month,g_day)
|
|
62
|
+
except ValueError:
|
|
63
|
+
parser.error("Invalid Hijri date. Use YYYY-MM-DD.")
|
|
64
|
+
print(g_date.strftime("%A %d %B %Y")) # Example: Monday 05 August 2024
|
|
65
|
+
return
|
|
66
|
+
|
|
67
|
+
"""From Gregorian to Hijri"""
|
|
68
|
+
if args.date == None:
|
|
69
|
+
target = datetime.datetime.now() # Example: 2026-11-13 01:49:45
|
|
70
|
+
time_text = target.strftime("%X") # Time Now in HH:mm:ss
|
|
71
|
+
else:
|
|
72
|
+
try:
|
|
73
|
+
target = datetime.date.fromisoformat(args.date)
|
|
74
|
+
time_text = ""
|
|
75
|
+
except ValueError:
|
|
76
|
+
parser.error("Invalid date format. Please use YYYY-MM-DD.")
|
|
77
|
+
|
|
78
|
+
weekday = target.strftime("%A") # Example Friday
|
|
79
|
+
h_year,h_month,h_day = hijra.gregorian_to_hijri(target.year,target.month,target.day)
|
|
80
|
+
text = format_hijri(h_year,h_month,h_day,weekday)
|
|
81
|
+
|
|
82
|
+
if time_text:
|
|
83
|
+
print(text, time_text)
|
|
84
|
+
else:
|
|
85
|
+
print(text)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if __name__ == "__main__":
|
|
89
|
+
main()
|
|
90
|
+
|
|
91
|
+
|
hijra.py
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Copyright (c) 2006-2008 Muayyad Saleh Alsadi<alsadi@gmail.com>
|
|
5
|
+
Copyright (c) 2026 Muhammad Bakhit https://github.com/mubakhit
|
|
6
|
+
Umm al-Qura table support, Python 3 integer-division fixes, date validation
|
|
7
|
+
|
|
8
|
+
Hijri Islamic Calendar converting functions,
|
|
9
|
+
Copyright (c) 2006-2008 Muayyad Saleh Alsadi<alsadi@gmail.com>
|
|
10
|
+
Based on an enhanced algorithm designed by me
|
|
11
|
+
the algorithm is discussed in a book titled "حتى لا ندخل جحور الضباب"
|
|
12
|
+
(not yet published)
|
|
13
|
+
|
|
14
|
+
This file can be used to implement apps, gdesklets or karamba ..etc
|
|
15
|
+
|
|
16
|
+
This algorithm is based on integer operations
|
|
17
|
+
which that there is no round errors (given accurate coefficients)
|
|
18
|
+
the accuracy of this algorithm is based on 3 constants (p,q and a)
|
|
19
|
+
where p/q is the full months percentage [ gcd(p,q) must be 1 ]
|
|
20
|
+
currently it's set to 191/360 which mean that there is 191 months
|
|
21
|
+
having 30 days in a span of 360 years, other months are 29 days.
|
|
22
|
+
and a is just a shift.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Released under terms on Waqf Public License.
|
|
26
|
+
This program is free software; you can redistribute it and/or modify
|
|
27
|
+
it under the terms of the latest version Waqf Public License as
|
|
28
|
+
published by Ojuba.org.
|
|
29
|
+
|
|
30
|
+
This program is distributed in the hope that it will be useful,
|
|
31
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
32
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
33
|
+
|
|
34
|
+
The Latest version of the license can be found on
|
|
35
|
+
"http://www.ojuba.org/wiki/doku.php/waqf/license"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
Portions of this algorithm is based on that found on GNU EMACS
|
|
39
|
+
the difference is that this algorithm does not set
|
|
40
|
+
all months to a fixed number of days (in the original algorithm
|
|
41
|
+
first month always have 30 days)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
The original GNU Emacs LISP algorithm
|
|
45
|
+
Copyright (C) 1995, 1997, 2001 Free Software Foundation, Inc.
|
|
46
|
+
Edward M. Reingold <reingold@cs.uiuc.edu>
|
|
47
|
+
Technical details of all the calendrical calculations can be found in
|
|
48
|
+
``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
|
|
49
|
+
Cambridge University Press (1997).
|
|
50
|
+
Comments, corrections, and improvements should be sent to
|
|
51
|
+
Edward M. Reingold Department of Computer Science
|
|
52
|
+
(217) 333-6733 University of Illinois at Urbana-Champaign
|
|
53
|
+
reingold@cs.uiuc.edu 1304 West Springfield Avenue
|
|
54
|
+
"""
|
|
55
|
+
__p_const=191
|
|
56
|
+
__q_const=360
|
|
57
|
+
__a_const=48
|
|
58
|
+
__hijri_epoch=227015; # = Julian 0622-7-16 = gregorian 0759-6-11 (I think it should be 622, 7, 19)
|
|
59
|
+
# TODO: Why does the the hijri_epoch 227015 does not give the expected value when converted to gregorian
|
|
60
|
+
|
|
61
|
+
# Umm al-Qura table support: inside the table range (1343-1500 AH) dates
|
|
62
|
+
# follow the official Umm al-Qura calendar, outside it the arithmetic
|
|
63
|
+
# algorithm below is used. Call set_method("arithmetic") to disable the table.
|
|
64
|
+
from bisect import bisect_right
|
|
65
|
+
try: from hijra_uq import UQ_FIRST_YEAR, UQ_MONTH_STARTS
|
|
66
|
+
except ImportError: UQ_FIRST_YEAR=0; UQ_MONTH_STARTS=()
|
|
67
|
+
__use_uq=len(UQ_MONTH_STARTS)>1
|
|
68
|
+
|
|
69
|
+
def set_method(method):
|
|
70
|
+
"""Choose the calendar method: "ummalqura" (default, when table exists) or "arithmetic" """
|
|
71
|
+
global __use_uq
|
|
72
|
+
if method not in ("ummalqura", "arithmetic"): raise ValueError("unknown method %r" % (method,))
|
|
73
|
+
__use_uq=(method=="ummalqura" and len(UQ_MONTH_STARTS)>1)
|
|
74
|
+
def get_method():
|
|
75
|
+
"""Return the calendar method currently in use"""
|
|
76
|
+
if __use_uq: return "ummalqura"
|
|
77
|
+
return "arithmetic"
|
|
78
|
+
def __uq_index(Y,M):
|
|
79
|
+
"""Return index of month (Y,M) in Umm al-Qura table, or -1 if not covered"""
|
|
80
|
+
if not __use_uq: return -1
|
|
81
|
+
i=(Y-UQ_FIRST_YEAR)*12+M-1
|
|
82
|
+
if 0 <= i < len(UQ_MONTH_STARTS)-1 and 1 <= M <= 12: return i
|
|
83
|
+
return -1
|
|
84
|
+
|
|
85
|
+
def get_consts():
|
|
86
|
+
"""Return a tuple of the 3 constants (p,q,a) used by this algothim, for debuging"""
|
|
87
|
+
return (__p_const, __q_const, __a_const)
|
|
88
|
+
def get_epoch():
|
|
89
|
+
"""Return Hijri epoch, number of days since gregorian epoch, (should be Julian 0622-7-16 (ie. 227015 days)"""
|
|
90
|
+
return __hijri_epoch
|
|
91
|
+
|
|
92
|
+
def hijri_month_days(Y,M):
|
|
93
|
+
"""Return the number of days in a given hijri month M in a given Y"""
|
|
94
|
+
i=__uq_index(Y,M)
|
|
95
|
+
if i>=0: return UQ_MONTH_STARTS[i+1]-UQ_MONTH_STARTS[i]
|
|
96
|
+
Mc = ( Y -1) *12 + M
|
|
97
|
+
if (((Mc+ __a_const) * __p_const) % __q_const) < __p_const : return 30
|
|
98
|
+
else: return 29
|
|
99
|
+
|
|
100
|
+
# NOTE: trivial implementation
|
|
101
|
+
#def hijri_days_before_month_(Y,M): # simple mothod, optimization is possible by reusing Mc ..etc.
|
|
102
|
+
# """Return the number of days before a given moth M in a given year Y"""
|
|
103
|
+
# sum=0
|
|
104
|
+
# for i in xrange(1,M): sum+=hijri_month_days(Y,i);
|
|
105
|
+
# return sum
|
|
106
|
+
|
|
107
|
+
def hijri_days_before_month(Y,M):
|
|
108
|
+
"""Return the number of days before a given moth M in a given year Y (0 for M=1)"""
|
|
109
|
+
i=__uq_index(Y,1)
|
|
110
|
+
if i>=0 and 1 <= M <= 13: return UQ_MONTH_STARTS[i+M-1]-UQ_MONTH_STARTS[i]
|
|
111
|
+
Mc = ( Y -1) *12 + 1 + __a_const
|
|
112
|
+
McM=Mc * __p_const
|
|
113
|
+
sum=0
|
|
114
|
+
for i in range(1,M):
|
|
115
|
+
if (McM % __q_const) < __p_const : sum+=30
|
|
116
|
+
else: sum+=29
|
|
117
|
+
McM+=__p_const
|
|
118
|
+
return sum
|
|
119
|
+
|
|
120
|
+
def hijri_year_days(Y):
|
|
121
|
+
"""Return the number of days in a given year Y"""
|
|
122
|
+
return hijri_days_before_month(Y,13)
|
|
123
|
+
|
|
124
|
+
def hijri_day_number (Y, M, D):
|
|
125
|
+
"""Return the day number within the year of the Islamic date (Y, M, D), 1 for 1/1 in any year"""
|
|
126
|
+
return hijri_days_before_month(Y,M)+D
|
|
127
|
+
|
|
128
|
+
# correct implementation # TODO: optimize it more and test that after optimization
|
|
129
|
+
def hijri_to_absolute (Y, M, D):
|
|
130
|
+
"""Return absolute date of Hijri (Y,M,D), eg. ramadan (9),1,1427 -> 732578 """
|
|
131
|
+
i=__uq_index(Y,M)
|
|
132
|
+
if i>=0: return UQ_MONTH_STARTS[i]+D-1
|
|
133
|
+
Mc=(Y-1)*12
|
|
134
|
+
# day count=days before Hijra plus (...)
|
|
135
|
+
dc=__hijri_epoch
|
|
136
|
+
# plus days in the years before till first multiples of q plus (...)
|
|
137
|
+
Mc-=Mc % __q_const
|
|
138
|
+
y=Y-Mc//12
|
|
139
|
+
dc+=Mc*29 + Mc*__p_const//__q_const
|
|
140
|
+
# plus those after the multiples plus (...)
|
|
141
|
+
for i in range(1,y): dc+=hijri_year_days(i)
|
|
142
|
+
# plus days from the begining of that year
|
|
143
|
+
dc+=hijri_day_number (Y, M, D) - 1
|
|
144
|
+
return dc
|
|
145
|
+
|
|
146
|
+
def hijri_month_days_(y,m):
|
|
147
|
+
"""Return the number of days in a given hijri month M in a given Y"""
|
|
148
|
+
return hijri_to_absolute(y+m//12,m%12+1,1)-hijri_to_absolute(y,m,1)
|
|
149
|
+
|
|
150
|
+
# TEST: PASSED
|
|
151
|
+
#def test_hijri_to_absolute_v_month_days():
|
|
152
|
+
# #l=[(y,m) for y in xrange(1,31) for m in xrange(1,13)]
|
|
153
|
+
# l=[(y,m) for y in xrange(1400,1499) for m in xrange(1,13)]
|
|
154
|
+
# for y,m in l:
|
|
155
|
+
# d1=hijri_month_days(y,m)
|
|
156
|
+
# d2=hijri_to_absolute(y+m/12,m%12+1,1)-hijri_to_absolute(y,m,1)
|
|
157
|
+
# if d1!=d2: print y,m,y+m/12,m%12+1,'d1=',d1,", d2=",d2
|
|
158
|
+
|
|
159
|
+
# round then move to exact, very slow perfect implementation
|
|
160
|
+
#def absolute_to_hijri_ (date): # TODO: check if it's always compatible with absolute_from_hijri
|
|
161
|
+
# """Return Hijri date (Y,M,D) corresponding to the given absolute number of days."""
|
|
162
|
+
# if date < __hijri_epoch: return None; # pre-Islamic date
|
|
163
|
+
# dd=date-__hijri_epoch
|
|
164
|
+
# Mc=dd/(29*(__q_const-__p_const)+ 30*__p_const)*__q_const # mounth count till multibles of q
|
|
165
|
+
# Y=y=Mc/12+1; M=m=(Mc%12)+1
|
|
166
|
+
# while(date > hijri_to_absolute(Y,M,1)):
|
|
167
|
+
# y,m=Y,M
|
|
168
|
+
# M+=1
|
|
169
|
+
# if M>12: M=1; Y+=1
|
|
170
|
+
# Y=y; M=m
|
|
171
|
+
# D=1 + date - hijri_to_absolute(Y,M,1)
|
|
172
|
+
# if D>hijri_month_days(Y,M):
|
|
173
|
+
# M+=1
|
|
174
|
+
# if M>12: M=1; Y+=1
|
|
175
|
+
# D=1 + date - hijri_to_absolute(Y,M,1)
|
|
176
|
+
# return (Y,M,D)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# direct way, test PASSED
|
|
180
|
+
def absolute_to_hijri (date):
|
|
181
|
+
"""Return Hijri date (Y,M,D) corresponding to the given absolute number of days."""
|
|
182
|
+
if date < __hijri_epoch: return None; # pre-Islamic date
|
|
183
|
+
if __use_uq and UQ_MONTH_STARTS[0] <= date < UQ_MONTH_STARTS[-1]:
|
|
184
|
+
i=bisect_right(UQ_MONTH_STARTS, date)-1
|
|
185
|
+
return (UQ_FIRST_YEAR+i//12, i%12+1, date-UQ_MONTH_STARTS[i]+1)
|
|
186
|
+
Mc=(date-__hijri_epoch+1)*__q_const//(29*__q_const+__p_const)
|
|
187
|
+
Y=Mc//12+1; M=(Mc%12)+1
|
|
188
|
+
# consistency check
|
|
189
|
+
d=hijri_to_absolute(Y,M,1) # TODO: this is an expensive call
|
|
190
|
+
if (date < d): # go one month back if needed
|
|
191
|
+
M-=1
|
|
192
|
+
if M==0: Y-=1; M=12
|
|
193
|
+
d-=hijri_month_days(Y,M) # this call is fast
|
|
194
|
+
#
|
|
195
|
+
D=1 + date - d
|
|
196
|
+
return (Y,M,D)
|
|
197
|
+
|
|
198
|
+
# TEST: PASSED
|
|
199
|
+
#def test_c():
|
|
200
|
+
# l=[(y,m) for y in xrange(1400,1499) for m in xrange(1,13)]
|
|
201
|
+
# for y,m in l:
|
|
202
|
+
# d=hijri_month_days(y,m)
|
|
203
|
+
# if absolute_to_hijri(hijri_to_absolute(y,m,1))!=(y,m,1): print y,m,1, absolute_to_hijri(hijri_to_absolute(y,m,1))
|
|
204
|
+
# if absolute_to_hijri(hijri_to_absolute(y,m,d))!=(y,m,d): print y,m,d, absolute_to_hijri(hijri_to_absolute(y,m,d))
|
|
205
|
+
|
|
206
|
+
def hijri_day_of_week (Y, M, D):
|
|
207
|
+
"""Return the day-of-the-week index of hijri (Y,M,D) Date, 0 for Sunday, 1 for Monday, etc."""
|
|
208
|
+
return hijri_to_absolute (Y,M, D) % 7;
|
|
209
|
+
# ///////////////////////////////
|
|
210
|
+
# high level converting functions
|
|
211
|
+
|
|
212
|
+
def hijri_to_gregorian (year, month, day):
|
|
213
|
+
"""Return gregorian (year, month, day) converted from Islamic Hijri calender"""
|
|
214
|
+
if not (1 <= month <= 12 and 1 <= day <= hijri_month_days(year, month)):
|
|
215
|
+
raise ValueError("invalid hijri date: %d-%d-%d" % (year, month, day))
|
|
216
|
+
return absolute_to_gregorian( hijri_to_absolute (year, month, day));
|
|
217
|
+
|
|
218
|
+
def gregorian_to_hijri (year, month, day):
|
|
219
|
+
"""Return Hijri (year, month, day) converted from gregorian calender"""
|
|
220
|
+
if not (1 <= month <= 12 and 1 <= day <= gregorian_month_days(year, month)):
|
|
221
|
+
raise ValueError("invalid gregorian date: %d-%d-%d" % (year, month, day))
|
|
222
|
+
return absolute_to_hijri( gregorian_to_absolute (year, month, day));
|
|
223
|
+
|
|
224
|
+
#///////////////////////////////////
|
|
225
|
+
# Gregorian functions
|
|
226
|
+
#///////////////////////////////////
|
|
227
|
+
# This Portions of is based on that found on GNU EMACS
|
|
228
|
+
|
|
229
|
+
#The original GNU Emacs LISP algorithm
|
|
230
|
+
#Copyright (C) 1995, 1997, 2001 Free Software Foundation, Inc.
|
|
231
|
+
# Edward M. Reingold <reingold@cs.uiuc.edu>
|
|
232
|
+
# Technical details of all the calendrical calculations can be found in
|
|
233
|
+
# ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
|
|
234
|
+
# Cambridge University Press (1997).
|
|
235
|
+
# Comments, corrections, and improvements should be sent to
|
|
236
|
+
# Edward M. Reingold Department of Computer Science
|
|
237
|
+
# (217) 333-6733 University of Illinois at Urbana-Champaign
|
|
238
|
+
# reingold@cs.uiuc.edu 1304 West Springfield Avenue
|
|
239
|
+
|
|
240
|
+
days_in_month=( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
|
241
|
+
def gregorian_leap_year_p (year):
|
|
242
|
+
"""Return 1 (True) if YEAR is a Gregorian leap year."""
|
|
243
|
+
if ((year % 4) == 0 and ((year % 100) or (year % 400) == 0)): return 1;
|
|
244
|
+
return 0;
|
|
245
|
+
|
|
246
|
+
def gregorian_month_days (year, month):
|
|
247
|
+
"""The last day in MONTH during YEAR."""
|
|
248
|
+
if (month == 2 and gregorian_leap_year_p (year)): return 29;
|
|
249
|
+
return days_in_month[month-1];
|
|
250
|
+
|
|
251
|
+
def gregorian_day_number (year, month, day):
|
|
252
|
+
"""Return the day number within the year of the date (year,month, day)"""
|
|
253
|
+
if month<3: return day + (31 * (month - 1));
|
|
254
|
+
return day + (31 * (month - 1)) - \
|
|
255
|
+
((month << 2) + 23) // 10 + (gregorian_leap_year_p (year) & 1);
|
|
256
|
+
|
|
257
|
+
def gregorian_to_absolute (year, month, day):
|
|
258
|
+
prior_years = year - 1;
|
|
259
|
+
return gregorian_day_number (year, month, day) + \
|
|
260
|
+
365 * prior_years + (prior_years >> 2) - \
|
|
261
|
+
(prior_years // 100) + (prior_years // 400);
|
|
262
|
+
|
|
263
|
+
def absolute_to_gregorian(date):
|
|
264
|
+
"""return (year month day) corresponding to the absolute DATE.
|
|
265
|
+
The absolute date is the number of days elapsed since the (imaginary)
|
|
266
|
+
Gregorian date Sunday, December 31, 1 BC."""
|
|
267
|
+
|
|
268
|
+
# See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
269
|
+
# Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
270
|
+
# Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
271
|
+
# (April, 1993), pages 383-404 for an explanation.
|
|
272
|
+
d0 = date - 1;
|
|
273
|
+
n400 = d0 // 146097;
|
|
274
|
+
d1 = d0 % 146097;
|
|
275
|
+
n100 = d1 // 36524;
|
|
276
|
+
d2 = d1 % 36524;
|
|
277
|
+
n4 = d2 // 1461;
|
|
278
|
+
d3 = d2 % 1461;
|
|
279
|
+
n1 = d3 // 365;
|
|
280
|
+
dd = (d3 % 365) + 1;
|
|
281
|
+
yy = ((400 * n400) + (100 * n100) + (n4 * 4) + n1);
|
|
282
|
+
if (n100 == 4) or (n1 == 4): return (yy, 12, 31);
|
|
283
|
+
yy=yy+1;
|
|
284
|
+
mm = 1;
|
|
285
|
+
while(date >= gregorian_to_absolute (yy,mm, 1)): mm+=1;
|
|
286
|
+
d=gregorian_to_absolute (yy, mm-1, 1);
|
|
287
|
+
return (yy, mm-1,date-d+1);
|
|
288
|
+
# d = calendar_absolute_from_gregorian (1, 1, yy);
|
|
289
|
+
# mm=1;
|
|
290
|
+
# while(mm <= 12):
|
|
291
|
+
# dd = date - d + 1;
|
|
292
|
+
# dm = calendar_last_day_of_month (mm, yy);
|
|
293
|
+
# if dd <= dm: return (mm,dd+1,yy);
|
|
294
|
+
# d += dm;
|
|
295
|
+
# mm=mm+1;
|
|
296
|
+
# return 0; # should not happened
|
|
297
|
+
def gregorian_day_of_week (yy, mm, dd):
|
|
298
|
+
"""Return the day-of-the-week index of gregorian (yy, mm, dd) DATE, 0 for Sunday, 1 for Monday, etc."""
|
|
299
|
+
return gregorian_to_absolute (yy,mm, dd) % 7;
|
|
300
|
+
|
|
301
|
+
if __name__ == "__main__":
|
|
302
|
+
# conclusion
|
|
303
|
+
# 0% for a=16 48 65
|
|
304
|
+
# 7% for a=1 31 33 50 80 82 97 99
|
|
305
|
+
# 13% for a=14 18 46 63 67 95
|
|
306
|
+
# 20% for a=12 29 3 35 52 78 84
|
|
307
|
+
# ...
|
|
308
|
+
# 73% for a=45 47 49 ..etc.
|
|
309
|
+
##########################
|
|
310
|
+
__a_const=16
|
|
311
|
+
print("for a=%d" % __a_const)
|
|
312
|
+
sum=0.0
|
|
313
|
+
for y in range(1,4001): sum+= float(hijri_month_days(y,12)==30)
|
|
314
|
+
print("perfect thu-hijja months is %f %% " % float(float(sum)/4000.0*100.0))
|
|
315
|
+
sum=0.0
|
|
316
|
+
for y in range(1,4001): sum+= float(hijri_month_days(y,9)==30)
|
|
317
|
+
print("perfect Ramadan months is %f %% " % float(float(sum)/4000.0*100.0))
|
|
318
|
+
|
|
319
|
+
__a_const=48
|
|
320
|
+
print("for a=%d" % __a_const)
|
|
321
|
+
sum=0.0
|
|
322
|
+
for y in range(1,4001): sum+= float(hijri_month_days(y,12)==30)
|
|
323
|
+
print("perfect thu-hijja months is %f %% " % float(float(sum)/4000.0*100.0))
|
|
324
|
+
sum=0.0
|
|
325
|
+
for y in range(1,4001): sum+= float(hijri_month_days(y,9)==30)
|
|
326
|
+
print("perfect Ramadan months is %f %% " % float(float(sum)/4000.0*100.0))
|
|
327
|
+
|
|
328
|
+
__a_const=65
|
|
329
|
+
print("for a=%d" % __a_const)
|
|
330
|
+
sum=0.0
|
|
331
|
+
for y in range(1,4001): sum+= float(hijri_month_days(y,12)==30)
|
|
332
|
+
print("perfect thu-hijja months is %f %% " % float(float(sum)/4000.0*100.0))
|
|
333
|
+
sum=0.0
|
|
334
|
+
for y in range(1,4001): sum+= float(hijri_month_days(y,9)==30)
|
|
335
|
+
print("perfect Ramadan months is %f %% " % float(float(sum)/4000.0*100.0))
|
|
336
|
+
|
|
337
|
+
__a_const=48
|
|
338
|
+
print("for a=%d" % __a_const)
|
|
339
|
+
for m in range(1,13):
|
|
340
|
+
sum=0.0
|
|
341
|
+
for y in range(1,4001): sum+= float(hijri_month_days(y,m)==30)
|
|
342
|
+
print("perfect %d months is %f %% " % (m,float(float(sum)/4000.0*100.0)))
|
|
343
|
+
|
hijra_uq.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Umm al-Qura calendar table (1343 AH - 1500 AH).
|
|
4
|
+
|
|
5
|
+
UQ_MONTH_STARTS[i] is the absolute day number (same scale used in hijra.py,
|
|
6
|
+
1 = Gregorian 0001-01-01) of the first day of Hijri month number i,
|
|
7
|
+
counted from Muharram of UQ_FIRST_YEAR. The last entry is 1 Muharram 1501,
|
|
8
|
+
kept only to know the length of the last month.
|
|
9
|
+
|
|
10
|
+
Table data taken from the "hijridate" project (MIT License),
|
|
11
|
+
Copyright (c) Mohammed Alshehri, https://github.com/dralshehri/hijridate
|
|
12
|
+
which is based on the official Umm al-Qura calendar of Saudi Arabia.
|
|
13
|
+
"""
|
|
14
|
+
UQ_FIRST_YEAR = 1343
|
|
15
|
+
UQ_MONTH_STARTS = (
|
|
16
|
+
702574, 702604, 702633, 702663, 702693, 702722, 702752, 702782, 702812, 702840, 702870, 702900,
|
|
17
|
+
702930, 702959, 702988, 703018, 703047, 703077, 703106, 703136, 703165, 703195, 703224, 703254,
|
|
18
|
+
703283, 703313, 703342, 703372, 703401, 703432, 703461, 703491, 703519, 703549, 703579, 703608,
|
|
19
|
+
703638, 703667, 703696, 703726, 703756, 703785, 703815, 703845, 703874, 703903, 703933, 703963,
|
|
20
|
+
703992, 704021, 704050, 704080, 704110, 704139, 704169, 704199, 704228, 704258, 704288, 704317,
|
|
21
|
+
704346, 704376, 704405, 704435, 704464, 704494, 704523, 704553, 704583, 704612, 704641, 704672,
|
|
22
|
+
704700, 704730, 704759, 704789, 704818, 704848, 704877, 704907, 704937, 704967, 704995, 705026,
|
|
23
|
+
705056, 705085, 705115, 705144, 705174, 705203, 705232, 705262, 705291, 705321, 705351, 705380,
|
|
24
|
+
705410, 705440, 705469, 705499, 705528, 705558, 705587, 705616, 705645, 705675, 705705, 705734,
|
|
25
|
+
705764, 705794, 705823, 705853, 705882, 705912, 705941, 705971, 706000, 706030, 706059, 706089,
|
|
26
|
+
706118, 706148, 706177, 706207, 706237, 706266, 706296, 706325, 706355, 706385, 706414, 706443,
|
|
27
|
+
706473, 706502, 706532, 706561, 706591, 706620, 706650, 706680, 706709, 706739, 706768, 706798,
|
|
28
|
+
706827, 706857, 706886, 706916, 706945, 706975, 707004, 707034, 707063, 707093, 707123, 707152,
|
|
29
|
+
707182, 707211, 707240, 707270, 707299, 707329, 707358, 707388, 707418, 707447, 707476, 707506,
|
|
30
|
+
707535, 707565, 707594, 707624, 707653, 707683, 707712, 707742, 707771, 707801, 707830, 707860,
|
|
31
|
+
707890, 707920, 707950, 707979, 708009, 708038, 708067, 708097, 708126, 708155, 708185, 708215,
|
|
32
|
+
708244, 708274, 708304, 708334, 708363, 708393, 708422, 708451, 708481, 708510, 708539, 708569,
|
|
33
|
+
708598, 708628, 708657, 708687, 708716, 708746, 708775, 708805, 708834, 708864, 708893, 708923,
|
|
34
|
+
708953, 708983, 709012, 709042, 709071, 709101, 709130, 709160, 709189, 709219, 709248, 709278,
|
|
35
|
+
709307, 709337, 709366, 709396, 709425, 709455, 709484, 709514, 709543, 709573, 709602, 709632,
|
|
36
|
+
709661, 709691, 709720, 709750, 709779, 709809, 709838, 709868, 709897, 709927, 709956, 709986,
|
|
37
|
+
710016, 710046, 710075, 710105, 710134, 710164, 710193, 710223, 710251, 710281, 710311, 710341,
|
|
38
|
+
710370, 710400, 710429, 710459, 710488, 710518, 710547, 710577, 710606, 710636, 710665, 710695,
|
|
39
|
+
710725, 710755, 710784, 710814, 710843, 710873, 710902, 710932, 710961, 710991, 711020, 711050,
|
|
40
|
+
711079, 711109, 711138, 711168, 711197, 711227, 711256, 711286, 711315, 711345, 711374, 711404,
|
|
41
|
+
711433, 711463, 711492, 711522, 711551, 711581, 711610, 711640, 711669, 711699, 711728, 711758,
|
|
42
|
+
711788, 711818, 711847, 711877, 711906, 711936, 711965, 711995, 712025, 712054, 712084, 712114,
|
|
43
|
+
712143, 712173, 712202, 712232, 712261, 712291, 712320, 712350, 712379, 712409, 712438, 712468,
|
|
44
|
+
712497, 712527, 712556, 712586, 712615, 712644, 712674, 712703, 712733, 712762, 712792, 712822,
|
|
45
|
+
712852, 712881, 712911, 712940, 712970, 712999, 713029, 713058, 713087, 713117, 713146, 713176,
|
|
46
|
+
713206, 713235, 713265, 713294, 713324, 713353, 713383, 713412, 713442, 713471, 713501, 713530,
|
|
47
|
+
713560, 713590, 713619, 713649, 713678, 713708, 713737, 713767, 713797, 713826, 713855, 713885,
|
|
48
|
+
713915, 713945, 713974, 714004, 714033, 714063, 714092, 714122, 714151, 714180, 714210, 714240,
|
|
49
|
+
714269, 714298, 714328, 714357, 714386, 714416, 714446, 714476, 714505, 714535, 714564, 714594,
|
|
50
|
+
714623, 714653, 714682, 714711, 714741, 714770, 714800, 714829, 714859, 714889, 714918, 714948,
|
|
51
|
+
714978, 715008, 715037, 715067, 715096, 715126, 715155, 715185, 715214, 715244, 715273, 715303,
|
|
52
|
+
715332, 715361, 715391, 715420, 715450, 715479, 715509, 715538, 715568, 715597, 715627, 715656,
|
|
53
|
+
715686, 715716, 715745, 715775, 715804, 715834, 715863, 715893, 715922, 715952, 715981, 716011,
|
|
54
|
+
716040, 716070, 716099, 716129, 716159, 716188, 716218, 716247, 716276, 716306, 716335, 716365,
|
|
55
|
+
716394, 716424, 716453, 716483, 716513, 716542, 716572, 716602, 716631, 716660, 716690, 716719,
|
|
56
|
+
716749, 716778, 716808, 716837, 716867, 716897, 716926, 716956, 716985, 717015, 717044, 717074,
|
|
57
|
+
717103, 717133, 717162, 717192, 717221, 717251, 717280, 717310, 717339, 717369, 717398, 717428,
|
|
58
|
+
717457, 717487, 717516, 717546, 717576, 717605, 717634, 717664, 717693, 717723, 717753, 717783,
|
|
59
|
+
717812, 717842, 717872, 717901, 717930, 717960, 717989, 718019, 718048, 718078, 718107, 718137,
|
|
60
|
+
718167, 718196, 718225, 718255, 718284, 718314, 718343, 718373, 718402, 718432, 718461, 718491,
|
|
61
|
+
718521, 718550, 718580, 718610, 718639, 718669, 718698, 718728, 718757, 718787, 718816, 718846,
|
|
62
|
+
718875, 718905, 718934, 718964, 718993, 719023, 719052, 719082, 719111, 719141, 719170, 719200,
|
|
63
|
+
719230, 719260, 719289, 719319, 719348, 719378, 719407, 719437, 719467, 719496, 719526, 719555,
|
|
64
|
+
719584, 719614, 719643, 719673, 719702, 719732, 719761, 719791, 719820, 719850, 719879, 719909,
|
|
65
|
+
719939, 719968, 719997, 720027, 720056, 720086, 720115, 720145, 720174, 720204, 720233, 720263,
|
|
66
|
+
720293, 720323, 720352, 720382, 720411, 720440, 720469, 720499, 720528, 720558, 720587, 720617,
|
|
67
|
+
720647, 720677, 720706, 720736, 720765, 720795, 720824, 720854, 720883, 720912, 720942, 720972,
|
|
68
|
+
721001, 721031, 721060, 721090, 721120, 721149, 721179, 721208, 721237, 721267, 721296, 721326,
|
|
69
|
+
721355, 721385, 721414, 721444, 721474, 721504, 721533, 721563, 721592, 721621, 721651, 721680,
|
|
70
|
+
721710, 721739, 721769, 721798, 721828, 721858, 721887, 721917, 721946, 721976, 722005, 722035,
|
|
71
|
+
722064, 722094, 722123, 722153, 722182, 722212, 722241, 722271, 722301, 722330, 722360, 722389,
|
|
72
|
+
722419, 722448, 722478, 722507, 722537, 722566, 722596, 722625, 722655, 722684, 722714, 722744,
|
|
73
|
+
722773, 722803, 722833, 722862, 722892, 722921, 722950, 722980, 723009, 723039, 723068, 723098,
|
|
74
|
+
723128, 723157, 723187, 723216, 723246, 723275, 723305, 723334, 723363, 723393, 723422, 723452,
|
|
75
|
+
723481, 723511, 723541, 723571, 723600, 723630, 723659, 723689, 723718, 723747, 723777, 723806,
|
|
76
|
+
723836, 723865, 723895, 723925, 723955, 723984, 724014, 724043, 724073, 724102, 724131, 724161,
|
|
77
|
+
724190, 724219, 724249, 724279, 724308, 724338, 724368, 724398, 724427, 724457, 724486, 724515,
|
|
78
|
+
724545, 724574, 724603, 724633, 724663, 724692, 724722, 724752, 724781, 724811, 724840, 724870,
|
|
79
|
+
724899, 724929, 724958, 724988, 725017, 725047, 725076, 725106, 725135, 725165, 725195, 725224,
|
|
80
|
+
725254, 725283, 725313, 725342, 725372, 725401, 725431, 725460, 725490, 725519, 725549, 725578,
|
|
81
|
+
725608, 725638, 725667, 725697, 725726, 725756, 725785, 725815, 725844, 725873, 725903, 725932,
|
|
82
|
+
725962, 725992, 726021, 726051, 726081, 726110, 726140, 726169, 726199, 726228, 726257, 726287,
|
|
83
|
+
726316, 726346, 726375, 726405, 726435, 726465, 726494, 726524, 726553, 726583, 726612, 726641,
|
|
84
|
+
726671, 726700, 726730, 726759, 726789, 726819, 726848, 726878, 726908, 726937, 726967, 726996,
|
|
85
|
+
727025, 727055, 727084, 727113, 727143, 727173, 727202, 727232, 727262, 727292, 727321, 727351,
|
|
86
|
+
727380, 727409, 727439, 727468, 727497, 727527, 727557, 727586, 727616, 727646, 727675, 727705,
|
|
87
|
+
727735, 727764, 727793, 727823, 727852, 727881, 727911, 727940, 727970, 728000, 728030, 728059,
|
|
88
|
+
728089, 728118, 728148, 728177, 728207, 728236, 728265, 728295, 728324, 728354, 728384, 728413,
|
|
89
|
+
728443, 728473, 728502, 728532, 728561, 728591, 728620, 728650, 728679, 728708, 728738, 728767,
|
|
90
|
+
728797, 728827, 728856, 728886, 728915, 728945, 728975, 729004, 729034, 729063, 729093, 729122,
|
|
91
|
+
729151, 729181, 729210, 729240, 729269, 729299, 729329, 729359, 729388, 729418, 729447, 729477,
|
|
92
|
+
729506, 729535, 729565, 729594, 729624, 729653, 729683, 729713, 729742, 729772, 729802, 729831,
|
|
93
|
+
729861, 729890, 729920, 729949, 729978, 730008, 730037, 730067, 730097, 730127, 730157, 730186,
|
|
94
|
+
730216, 730245, 730274, 730304, 730333, 730362, 730391, 730421, 730451, 730481, 730511, 730540,
|
|
95
|
+
730570, 730600, 730629, 730658, 730688, 730717, 730746, 730775, 730805, 730835, 730865, 730894,
|
|
96
|
+
730924, 730954, 730983, 731013, 731042, 731072, 731101, 731130, 731160, 731189, 731219, 731248,
|
|
97
|
+
731278, 731308, 731337, 731367, 731397, 731426, 731456, 731485, 731514, 731544, 731573, 731603,
|
|
98
|
+
731632, 731662, 731691, 731721, 731751, 731780, 731810, 731839, 731869, 731899, 731928, 731958,
|
|
99
|
+
731987, 732016, 732046, 732075, 732105, 732134, 732164, 732194, 732223, 732253, 732283, 732312,
|
|
100
|
+
732342, 732371, 732400, 732430, 732459, 732489, 732518, 732548, 732578, 732607, 732637, 732667,
|
|
101
|
+
732696, 732726, 732755, 732784, 732814, 732843, 732872, 732902, 732932, 732962, 732991, 733021,
|
|
102
|
+
733051, 733080, 733110, 733139, 733168, 733198, 733227, 733256, 733286, 733316, 733345, 733375,
|
|
103
|
+
733405, 733434, 733464, 733494, 733523, 733552, 733582, 733611, 733641, 733670, 733700, 733729,
|
|
104
|
+
733759, 733788, 733818, 733848, 733877, 733907, 733936, 733966, 733995, 734025, 734054, 734083,
|
|
105
|
+
734113, 734142, 734172, 734202, 734232, 734261, 734291, 734320, 734350, 734379, 734409, 734438,
|
|
106
|
+
734467, 734497, 734526, 734556, 734586, 734615, 734645, 734675, 734704, 734734, 734763, 734793,
|
|
107
|
+
734822, 734851, 734881, 734910, 734940, 734969, 734999, 735029, 735058, 735088, 735118, 735147,
|
|
108
|
+
735176, 735206, 735235, 735265, 735294, 735324, 735353, 735383, 735412, 735442, 735472, 735501,
|
|
109
|
+
735531, 735560, 735590, 735619, 735649, 735678, 735708, 735737, 735767, 735796, 735826, 735855,
|
|
110
|
+
735885, 735915, 735944, 735974, 736004, 736033, 736062, 736092, 736121, 736151, 736180, 736209,
|
|
111
|
+
736239, 736269, 736298, 736328, 736358, 736388, 736417, 736446, 736476, 736505, 736534, 736564,
|
|
112
|
+
736593, 736623, 736652, 736682, 736712, 736742, 736771, 736801, 736830, 736860, 736889, 736918,
|
|
113
|
+
736948, 736977, 737007, 737036, 737066, 737096, 737126, 737155, 737185, 737214, 737244, 737273,
|
|
114
|
+
737302, 737332, 737361, 737391, 737420, 737450, 737480, 737509, 737539, 737569, 737598, 737628,
|
|
115
|
+
737657, 737686, 737716, 737745, 737775, 737804, 737834, 737863, 737893, 737923, 737952, 737982,
|
|
116
|
+
738011, 738041, 738070, 738100, 738129, 738159, 738188, 738218, 738247, 738277, 738306, 738336,
|
|
117
|
+
738366, 738395, 738425, 738454, 738484, 738514, 738543, 738572, 738602, 738631, 738661, 738690,
|
|
118
|
+
738720, 738749, 738779, 738809, 738839, 738868, 738898, 738927, 738956, 738986, 739015, 739044,
|
|
119
|
+
739074, 739103, 739133, 739163, 739193, 739222, 739252, 739282, 739311, 739340, 739370, 739399,
|
|
120
|
+
739428, 739458, 739487, 739517, 739547, 739577, 739606, 739636, 739665, 739695, 739724, 739754,
|
|
121
|
+
739783, 739812, 739842, 739871, 739901, 739931, 739960, 739990, 740020, 740049, 740079, 740108,
|
|
122
|
+
740138, 740167, 740196, 740226, 740255, 740285, 740314, 740344, 740374, 740403, 740433, 740463,
|
|
123
|
+
740492, 740522, 740551, 740581, 740610, 740639, 740669, 740698, 740728, 740757, 740787, 740817,
|
|
124
|
+
740846, 740876, 740906, 740935, 740965, 740994, 741023, 741053, 741082, 741112, 741141, 741171,
|
|
125
|
+
741200, 741230, 741260, 741290, 741319, 741349, 741378, 741407, 741437, 741466, 741496, 741525,
|
|
126
|
+
741555, 741584, 741614, 741644, 741674, 741703, 741732, 741762, 741791, 741821, 741850, 741880,
|
|
127
|
+
741909, 741938, 741968, 741998, 742028, 742057, 742087, 742116, 742146, 742175, 742205, 742234,
|
|
128
|
+
742264, 742293, 742322, 742352, 742382, 742411, 742441, 742470, 742500, 742530, 742559, 742589,
|
|
129
|
+
742618, 742648, 742677, 742706, 742736, 742765, 742795, 742824, 742854, 742884, 742914, 742943,
|
|
130
|
+
742973, 743002, 743032, 743061, 743090, 743120, 743149, 743178, 743208, 743238, 743267, 743297,
|
|
131
|
+
743327, 743357, 743386, 743416, 743445, 743474, 743504, 743533, 743562, 743592, 743622, 743651,
|
|
132
|
+
743681, 743711, 743741, 743770, 743800, 743829, 743858, 743888, 743917, 743946, 743976, 744006,
|
|
133
|
+
744035, 744065, 744095, 744124, 744154, 744183, 744213, 744242, 744272, 744301, 744330, 744360,
|
|
134
|
+
744390, 744419, 744449, 744478, 744508, 744538, 744567, 744597, 744626, 744656, 744685, 744715,
|
|
135
|
+
744744, 744774, 744803, 744833, 744862, 744892, 744921, 744951, 744980, 745010, 745040, 745069,
|
|
136
|
+
745099, 745128, 745158, 745187, 745216, 745246, 745275, 745305, 745335, 745364, 745394, 745424,
|
|
137
|
+
745453, 745483, 745512, 745542, 745571, 745600, 745630, 745659, 745689, 745718, 745748, 745778,
|
|
138
|
+
745808, 745837, 745867, 745896, 745926, 745955, 745984, 746014, 746043, 746072, 746102, 746132,
|
|
139
|
+
746162, 746192, 746221, 746251, 746280, 746310, 746339, 746368, 746398, 746427, 746457, 746486,
|
|
140
|
+
746516, 746546, 746575, 746605, 746635, 746664, 746694, 746723, 746752, 746782, 746811, 746841,
|
|
141
|
+
746870, 746900, 746929, 746959, 746989, 747018, 747048, 747077, 747107, 747136, 747166, 747195,
|
|
142
|
+
747225, 747254, 747283, 747313, 747343, 747372, 747402, 747432, 747461, 747491, 747521, 747550,
|
|
143
|
+
747579, 747609, 747638, 747667, 747697, 747727, 747756, 747786, 747815, 747845, 747875, 747905,
|
|
144
|
+
747934, 747963, 747993, 748022, 748051, 748081, 748110, 748140, 748170, 748199, 748229, 748259,
|
|
145
|
+
748288, 748318, 748347, 748377, 748406, 748436, 748465, 748494, 748524, 748553, 748583, 748613,
|
|
146
|
+
748642, 748672, 748701, 748731, 748761, 748790, 748820, 748849, 748878, 748908, 748937, 748967,
|
|
147
|
+
748996, 749026, 749056, 749085, 749115, 749145, 749174, 749204, 749233, 749262, 749292, 749321,
|
|
148
|
+
749351, 749380, 749410, 749439, 749469, 749499, 749529, 749558, 749588, 749617, 749646, 749676,
|
|
149
|
+
749705, 749734, 749764, 749793, 749823, 749853, 749883, 749912, 749942, 749972, 750001, 750030,
|
|
150
|
+
750060, 750089, 750118, 750148, 750177, 750207, 750237, 750266, 750296, 750326, 750356, 750385,
|
|
151
|
+
750414, 750444, 750473, 750502, 750532, 750561, 750591, 750621, 750650, 750680, 750710, 750739,
|
|
152
|
+
750769, 750798, 750828, 750857, 750886, 750916, 750945, 750975, 751004, 751034, 751064, 751093,
|
|
153
|
+
751123, 751152, 751182, 751212, 751241, 751270, 751300, 751329, 751359, 751388, 751418, 751447,
|
|
154
|
+
751477, 751506, 751536, 751566, 751595, 751625, 751655, 751684, 751714, 751743, 751772, 751802,
|
|
155
|
+
751831, 751861, 751890, 751920, 751950, 751979, 752009, 752039, 752068, 752098, 752127, 752156,
|
|
156
|
+
752186, 752215, 752244, 752274, 752304, 752333, 752363, 752393, 752423, 752452, 752482, 752511,
|
|
157
|
+
752540, 752570, 752599, 752628, 752658, 752688, 752717, 752747, 752777, 752806, 752836, 752866,
|
|
158
|
+
752895, 752924, 752954, 752983, 753012, 753042, 753072, 753101, 753131, 753160, 753190, 753220,
|
|
159
|
+
753250, 753279, 753308, 753338, 753367, 753397, 753426, 753456, 753485, 753515, 753544, 753574,
|
|
160
|
+
753604, 753633, 753663, 753692, 753722, 753751, 753781, 753810, 753839, 753869, 753898, 753928,
|
|
161
|
+
753958, 753987, 754017, 754047, 754076, 754106, 754135, 754165, 754194, 754223, 754253, 754282,
|
|
162
|
+
754312, 754341, 754371, 754401, 754431, 754460, 754490, 754519, 754549, 754578, 754607, 754637,
|
|
163
|
+
754666, 754696, 754725, 754755, 754785, 754814, 754844, 754874, 754903, 754933, 754962, 754991,
|
|
164
|
+
755021, 755050, 755080, 755109, 755139, 755168, 755198, 755228, 755257, 755287, 755316, 755346,
|
|
165
|
+
755376, 755405, 755434, 755464, 755493, 755523, 755552, 755582, 755611, 755641, 755671, 755700,
|
|
166
|
+
755730, 755760, 755789, 755818, 755848, 755877, 755907, 755936, 755965, 755995, 756025, 756054,
|
|
167
|
+
756084, 756114, 756144, 756173, 756202, 756232, 756261, 756290, 756320, 756349, 756379, 756408,
|
|
168
|
+
756438, 756468, 756498, 756527, 756557, 756586, 756616, 756645, 756674, 756704, 756733, 756763,
|
|
169
|
+
756792, 756822, 756852, 756882, 756911, 756941, 756970, 757000, 757029, 757058, 757088, 757117,
|
|
170
|
+
757147, 757176, 757206, 757236, 757265, 757295, 757325, 757354, 757383, 757413, 757442, 757472,
|
|
171
|
+
757501, 757531, 757560, 757590, 757619, 757649, 757679, 757708, 757738, 757767, 757797, 757826,
|
|
172
|
+
757856, 757885, 757915, 757944, 757974, 758003, 758033, 758062, 758092, 758121, 758151, 758181,
|
|
173
|
+
758210, 758240, 758270, 758299, 758328, 758358, 758387, 758416, 758446, 758475, 758505, 758535,
|
|
174
|
+
758565,
|
|
175
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hijri-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Hijri (Umm al-Qura) date command for the terminal: print today's Hijri date or convert between Hijri and Gregorian.
|
|
5
|
+
Author: Muhammad Bakhit
|
|
6
|
+
Project-URL: Homepage, https://github.com/mubakhit/hijri-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/mubakhit/hijri-cli/issues
|
|
8
|
+
Keywords: hijri,umm al-qura,islamic calendar,date,cli
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Utilities
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE.txt
|
|
16
|
+
License-File: LICENSE-ar.txt
|
|
17
|
+
License-File: hijridate-LICENSE.txt
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# hijri-cli
|
|
21
|
+
|
|
22
|
+
A simple command that prints and converts dates in the Umm al-Qura Hijri
|
|
23
|
+
calendar, the official calendar of Saudi Arabia. It works like the `date`
|
|
24
|
+
command, with no locale setup needed.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
pip install hijri-cli
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
Print today's Hijri date:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
$ hijri
|
|
38
|
+
Friday 3 Jumada II 1448 14:34:5
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Convert a Gregorian date to Hijri:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
$ hijri -d 2024-08-05
|
|
45
|
+
Monday 1 Safar 1446
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Convert a Hijri date to Gregorian:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
$ hijri -g 1446-02-01
|
|
52
|
+
Monday 05 August 2024
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Show help:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
$ hijri --help
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Accuracy
|
|
62
|
+
|
|
63
|
+
Dates from 1343 AH to 1500 AH (1924 to 2077 CE) follow the official
|
|
64
|
+
Umm al-Qura table. Dates outside this range are calculated arithmetically
|
|
65
|
+
and may differ from the official calendar by a day.
|
|
66
|
+
|
|
67
|
+
## Credits
|
|
68
|
+
|
|
69
|
+
This tool is inspired by, and built on, the
|
|
70
|
+
[hijra](https://github.com/ojuba-org/hijra) project by Ojuba Linux, written
|
|
71
|
+
by Muayyad Saleh Alsadi. Sadly, that project is no longer being developed.
|
|
72
|
+
This tool reuses its conversion engine (`hijra.py`) and adds Umm al-Qura
|
|
73
|
+
support.
|
|
74
|
+
|
|
75
|
+
The Umm al-Qura table data comes from the
|
|
76
|
+
[hijridate](https://github.com/dralshehri/hijridate) project by
|
|
77
|
+
Mohammed Alshehri.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
Released under the Waqf Public License. See `LICENSE.txt`.
|
|
82
|
+
|
|
83
|
+
The Umm al-Qura table data is under the MIT License.
|
|
84
|
+
See `hijridate-LICENSE.txt`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
cli.py,sha256=FqGS5kd6vnN5F9-j5di1zKeDxWuLOI3A34Ob27CDQrA,3817
|
|
2
|
+
hijra.py,sha256=0ngk7OKB7v0tFnnjJO0H7P4NHyfbBsfRoo4p8L4UFrw,14230
|
|
3
|
+
hijra_uq.py,sha256=c9XLz-ccWv5z0oCcYVtFyNNMDnGbtNuBZHv9rMYstbY,16423
|
|
4
|
+
hijri_cli-0.1.0.dist-info/licenses/LICENSE-ar.txt,sha256=j5N7v5-c5J55df1sKPgMbdCCTS83nc8gMyn6NtjDWrY,13779
|
|
5
|
+
hijri_cli-0.1.0.dist-info/licenses/LICENSE.txt,sha256=3K38Ingmk0T5wpUM3-K40CxVtVCm-McCEIVpH8wSuV0,12221
|
|
6
|
+
hijri_cli-0.1.0.dist-info/licenses/hijridate-LICENSE.txt,sha256=a9HR0X3rN3B5CchU5peHCnSJcYq_on4DzRSgTZMpaTQ,1069
|
|
7
|
+
hijri_cli-0.1.0.dist-info/METADATA,sha256=4Uh48vpfG9iY0JWf3aQHhpz0zq18lJwCNU-XkRiNFQ8,2123
|
|
8
|
+
hijri_cli-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
9
|
+
hijri_cli-0.1.0.dist-info/entry_points.txt,sha256=_YUlhEwrUym0DBhZ24hH_Y94N8UjDIdo7rZHVPBmM0I,35
|
|
10
|
+
hijri_cli-0.1.0.dist-info/top_level.txt,sha256=JZOO_j5jVkcSb3S6o1aGNeyueRix59HFiFZJzqUPxaQ,19
|
|
11
|
+
hijri_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
بسم الله الرحمن الرحيم
|
|
2
|
+
|
|
3
|
+
رخصة "وقف" العامة
|
|
4
|
+
|
|
5
|
+
مقدمة
|
|
6
|
+
|
|
7
|
+
إن نشر أي عمل فكري (برنامج حاسوبي أو كتاب على سبيل المثال لا الحصر) لا يكون بالبيع وإن بدا
|
|
8
|
+
كذلك بل يكون باتفاقية ضمنية لا قيمة لها لولا مفهوم الملكية الفكرية الذي رسخته القوانين الوضعة
|
|
9
|
+
التي يفترض أنها وضعت لحفز نشر الأعمال الفكرية النافعة. ترتكز الملكية الفكرية على أن أول مودع
|
|
10
|
+
العمل (يسمى المالك Owner أو copyright holder وسنشير له في هذه الوثيقة باسم صاحب العمل) يملك
|
|
11
|
+
الحق في العمل بصورته المعنوية على أي وسيط مادي كان وله حق التصرف في ملكه المزعوم. إن أي
|
|
12
|
+
استعمال للعمل الفكري دون الإذن المسبق الصريح من مالك العمل يعد مكافئا أخلاقيا لسرقة السفن أو
|
|
13
|
+
“قرصنة” بنظرهم. هذا الإذن يسمى “رخصة License” وتهدف تلك الرخص غالبا لإعطاء المالك (غالبا
|
|
14
|
+
الناشر) أفضلية في السوق أمام الناشرين الآخرين من خلال احتكار العمل وذلك بفرض قيود على
|
|
15
|
+
المستخدمين لا الناشرين. تسمى مثل تلك الأعمال بالأعمال “المملوكة Proprietary”.
|
|
16
|
+
|
|
17
|
+
إننا نرى أن هذه الاتفاقيات (الرخص المملوكة) مجحفة جدا لكننا ندرك إن قبول اتفاقية معينة (مثل
|
|
18
|
+
رخص البرامج المملوكة) وأنت تضمر مسبقا خرقها أمر غير أخلاقي ^1). لهذا فنحن لا نحل المشكلة
|
|
19
|
+
بمشكلة أخرى بل إننا نقدم البديل.
|
|
20
|
+
|
|
21
|
+
نحن لدينا رؤية مختلفة فنحن نقدم أعمالنا الفكرية من برامج حاسوبية وغيرها ابتغاء وجه الله، والتي
|
|
22
|
+
هي الركيزة الأساسية لهذه الرخصة التي تميزها عن الرخص المملوكة وعلى أي غاية آخرى (مثل نشر العلم
|
|
23
|
+
النافع أو جني الأرباح) أن تتحقق بوسيلة لا تخالف هذا الهدف الأسمى.
|
|
24
|
+
|
|
25
|
+
في قناعتنا - التي لا نلزم أحدا بها والتي لا يضيرك أن لا تشترك معنا فيها - أن الاسلام يحرم
|
|
26
|
+
وبشكل قطعي حكر العلم والمعرفة والانتاج الفكري على وجه العموم، وهذا التحريم يأتي من عدة أوجه :
|
|
27
|
+
|
|
28
|
+
* الحديث النبوي الشريف : “من كتم علما ألجمه الله يوم القيامة بلجام من نار” ^2) وقد جاءت
|
|
29
|
+
كلمة العلم نكرة عامة فهي تنطبق على كل علم ينتفع الناس به سواء علم ديني أو دنيوي.
|
|
30
|
+
* أن الإسلام حدد ما يصح أن يكون مملوكا وذلك لا ينطبق على العمل الفكري لأنه ليس عينا محصورا
|
|
31
|
+
وأغلب شروط البرمجيات المملوكة تقع في بيع الغرر (ذاك أن ما لا يجوز بيعه لا يجوز تملكه) دل
|
|
32
|
+
عليه ما ورد من النهي عن بيع الغرر في صحيح مسلم (ويدخل فيه مسائل كثيرة غير منحصرة كبيع
|
|
33
|
+
المعدوم والمجهول وما لا يقدر على تسليمه وما لم يتم ملك البائع عليه) وما ورد عن الأئمة
|
|
34
|
+
الأربعة من فهمهم لهذا.
|
|
35
|
+
* لسنا بحاجة لابتداع شيء لنشر العلم لأن الأعمال الفكرية ليست محدثة وأن قرون الخير الأولى
|
|
36
|
+
نشرت العلم دون تملكها.
|
|
37
|
+
* حبس المعرفة والعلم عمن يحتاجه هو إضرار بالناس لصالح قلة منهم، وهذا مما نهى عنه الشارع ولا
|
|
38
|
+
يبرر هكذا فعل إلا من يؤمن بالرأسمالية الذاتية التي تطرفت في تعظيم مصلحة الفرد.
|
|
39
|
+
* انتفاء مبرر المصلحة إذا وجدت طرق لنشر الأعمال الفكرية والتربح منها دون كتمها.
|
|
40
|
+
* إن المتمعن في قوانين الملكية الفكرية المختلفة يجد في أنها تتلخص بإعطاء “المالك” المزعوم
|
|
41
|
+
الحق في تحريم ما أحله الله ليكون ذلك مدخلا له في كسب مادي ولا علاقة لها بتقديم خدمة أو
|
|
42
|
+
منتج معين.
|
|
43
|
+
* الغموض الذي يحيط بماهية الشيء المزعوم ملكه تفتح الباب أمام جبات “الأتاوات” حيث تتكسب بعض
|
|
44
|
+
الشركات من التهديد بخطر المقاضاة حتى على أشياء لا تملكها والقضاء الأمريكي يغص بمثل هذه
|
|
45
|
+
القضايا.
|
|
46
|
+
|
|
47
|
+
فإن كانت الغاية قد بررت الوسيلة لواضعي الدستور الأمريكي حين أقروا مفهوم ”الملكية الفكرية”
|
|
48
|
+
كحق مكتسب (غير فطري باعترافهم) يخدم ما تؤمن به ثقافتهم من تعظيم المصلحة الذاتية وتقديمها على
|
|
49
|
+
كل شيء؛ ذاك لا يعنينا في شيء ونحن نؤمن بعدم صلاحية ذلك لعموم البشر، لهذا جاءت رخصة “وقف”
|
|
50
|
+
العامة (كما غيرها الكثير من رخص التوزيع المضادة لحكر التوزيع)، فهي وضعت لكي تؤكد لمستهلك العمل
|
|
51
|
+
الفكري أن لا قيد يفرضه صاحب العمل على استخدم منتجه والإفادة منه أو إعادة انتاجه وتوزيعه. أي أن
|
|
52
|
+
تجعل حقوق الطبع والتوزيع “ممنوحة” أو مرفوعة وليس “محفوظة” (وبالإنجليزية يشار لها باسم copyleft
|
|
53
|
+
او copy-wrong تهكما على copyright)
|
|
54
|
+
|
|
55
|
+
فمعادلة وتفاصيل تركيب الدواء هي عمل فكري، وبرمجية الحاسوب هي عمل فكري وقصيدة الشعر هي عمل
|
|
56
|
+
فكري. وهي بشكل عام كل فكرة تنفع الناس تصلهم على شكل منتج. وعندما نتكلم عن العمل الفكري فإننا
|
|
57
|
+
نحدد التعريف بالفكر الذي ينفع الناس نشره ولا نقصد به عموم الفكر فلكل منا خصوصيته وأسراره التي
|
|
58
|
+
لايشارك بها الاخرين. فأسماء الزبائن وأرقام المناقصات وسياسة الدولة العسكرية أو السياسية ليست
|
|
59
|
+
أعمالا فكرية.
|
|
60
|
+
|
|
61
|
+
وهنا يجدر الوقوف عند مسألتين :
|
|
62
|
+
|
|
63
|
+
* الأولى، أن الحق الأدبي للصاحب العمل يبقى للمبتكر الأصلي على كل الأحوال. فلا يجوز لأحد أن
|
|
64
|
+
يأخذ هذا العمل وينتحله ويدعيه لنفسه.
|
|
65
|
+
* والثانية، أن لصحاب العمل ولغيره (ممن عندهم الكفاية) الإفادة المادية من العمل كأن يطلب
|
|
66
|
+
أتعابا أو يتقاضى أجرا عن تحسينه أوتطويره أو أجرا عن تدريسه وهكذا. ولكن ما وراء ذلك فلا يحق
|
|
67
|
+
له إدعاء ملكيته للفكرة أو العمل في صورته المعنوية ولا يحق له منع الآخرين من اعادة نشرها
|
|
68
|
+
والاستفادة منها. وهذا لا تناقض مع كون العمل موقوفا لأن الموقوف هو أصل العمل الفكري بصورته
|
|
69
|
+
المعنوية وليس الوسيط أو الخدمة ^3)
|
|
70
|
+
|
|
71
|
+
تعريفات
|
|
72
|
+
|
|
73
|
+
تكون التعريفات هنا هي المقصودة عند استخدامها في الرخصة :
|
|
74
|
+
|
|
75
|
+
* العمل الفكري (أو اختصارا العمل): هو أي عمل فكري نافع غير مادي ولا ملموس ويمكن لمن يتلقاه
|
|
76
|
+
عمل نسخ منه ونقله إلى آخرين دون أي عبء على من قام بإيصال النسخة اليه.
|
|
77
|
+
* صاحب العمل : هو الشخص المُبتكِر أو الجهة التي قامت بتطوير وتوفير العمل الفكري (والتي تملك
|
|
78
|
+
حقوق النسخ عند الجهات الرسمية إن لزم الأمر).
|
|
79
|
+
* المُنتًفع (المستخدِم): هو الشخص أو الجهة التي ترغب بالانتفاع من العمل الفكري.
|
|
80
|
+
* رخصة الاستخدام (أو اختصارا الرخصة): هي هذا العقد الذي بين يديك وهو عقد بين صاحب العمل
|
|
81
|
+
والمنتفع يحق للمنتفع بموجبه وضمن شروطه الاستفادة والانتفاع من العمل. ونظرا لتوفر العمل
|
|
82
|
+
بشكل مفتوح للجميع فإن قيام المنتفع بالاستفادة من العمل الفكري يعني بالضرورة إقراره
|
|
83
|
+
وموافقته على كافة شروط الرخصة. فإذا لم يكن المنتفع موافقا على الرخصة تنتفي عنه حقوق الحقوق
|
|
84
|
+
الممنوحة بموجبها ويصبح أي انتفاع بالعمل غير مشروع ويعرض نفسه للمقاضاة.
|
|
85
|
+
|
|
86
|
+
بنود الرخصة
|
|
87
|
+
|
|
88
|
+
رخصة وقف العامة، يرمز لها اختصارا بـ “وقف”، هي رخصة لتوزيع العمل الفكري (من برمجيات أو مؤلفات
|
|
89
|
+
مكتوبة أو إنتاج فني على سبيل المثال لا الحصر). تتشابه هذه الرخصه في اهدافها مع رخص البرمجيات
|
|
90
|
+
الحرة والتوثيق الحر و رخصة الانتاج المشترك. ولكنها تزيد عليها ببعض الجوانب المتعلقة بالهدف من
|
|
91
|
+
وراء الانتاج و حدود الاستخدام.
|
|
92
|
+
|
|
93
|
+
رخصة وقف وكما يقترح الاسم هي إقرار من صاحب العمل بأن هذا العمل هو وقف لله تعالى ويتقصد به نوال
|
|
94
|
+
رضاه من خلال انتفاع الناس به، أي أن هذا العمل هو صدقة جارية لوجه الله تعالى. وبذلك فإن رخصة
|
|
95
|
+
وقف تقر بأن للمنتفع -أيا كان جنسه أو لونه أو عقيدته- الحق في الإفادة من العمل وإعادة توزيعه
|
|
96
|
+
وحتى تطويره ضمن الشروط التالية:
|
|
97
|
+
|
|
98
|
+
* أولا - أوجه الاستخدام :
|
|
99
|
+
|
|
100
|
+
يحق للمنتفع استخدام العمل ضمن أي غرض فيه منفعة ولايجوز استخدامه فيما يسئ للأخرين أو يخالف
|
|
101
|
+
مبادئ الإسلام السمحة. مع ملاحظة أن الأعمال التي يغلب الظن أنها الضارة لا يجوز أن توضع تحت هذه
|
|
102
|
+
الرخصة أصلا.
|
|
103
|
+
|
|
104
|
+
* ثانيا - حق التوزيع :
|
|
105
|
+
|
|
106
|
+
يحق للمنتفع إعادة توزيع العمل بصورته الأصلية ودون تعديل وتحت شروط رخصة وقف، بالكم الذي يريد مع
|
|
107
|
+
صون ذكر الحق الأدبي لصاحب العمل.
|
|
108
|
+
|
|
109
|
+
* ثالثا - حق التعديل :
|
|
110
|
+
|
|
111
|
+
يحق للمنتفع الحصول على النسخة المصدرية للعمل كما ويحق له التعديل عليها بما يناسب احتياجاته
|
|
112
|
+
وضمن الحدود الموضحة في بند أولا.
|
|
113
|
+
|
|
114
|
+
* رابعا - حق توزيع النسخة المُعدّلة :
|
|
115
|
+
|
|
116
|
+
يحق للمنتفع إعادة توزيع العمل المعدّل فقط تحت رخصة وقف العامة وعلى أن يذكر أصل العمل المعدل
|
|
117
|
+
وطبيعة التعديل وأن يكون واضحا بما لايدع مجالا للبس أن هذه النسخة معدلة وليست هي النسخة الأصلية
|
|
118
|
+
التي انتجها صاحب العمل الأول.
|
|
119
|
+
|
|
120
|
+
* خامسا - عدم المسؤلية :
|
|
121
|
+
|
|
122
|
+
لا يتحمل صاحب العمل أية مسؤوليه لا قانونية ولا أخلاقية عن حسن أو إساءة استخدام العمل أو
|
|
123
|
+
الأضرار المباشرة أو غير المباشرة الناتجة عنه إلى أقصى حد يسمح به القانون. وصاحب العمل بهذا لا
|
|
124
|
+
يقدم أية ضمانة لا ضمنا ولا تصريحا بقدرة المنتج على تحقيق أي غرض.
|
|
125
|
+
|
|
126
|
+
المسؤولية الكاملة تقع على عاتق المنتفع والضمانة الوحيدة المقدمة له هي مصدر العمل.
|
|
127
|
+
|
|
128
|
+
الخلاصة
|
|
129
|
+
|
|
130
|
+
استخدام رخصة وقف العامة يساعد في نشر الوعي على خطر مفاهيم الملكية الفكرية. كما ويقدم البديل
|
|
131
|
+
القانوني وإن كنّا لانؤمن بقانونية تلك الملكيات.
|
|
132
|
+
|
|
133
|
+
^1) انظر http://www.islam-qa.com/ar/ref/454
|
|
134
|
+
^2) الحديث صحيح رواه أحمد وأبو داود والترمذي وابن ماجه انظر “رفع المنار بطرق حديث من
|
|
135
|
+
كتم علماً ألجمه الله بلجام من نار”
|
|
136
|
+
^3) مثلا يجوز أخذ أجل على نقل ثمار أرض موقوفة أو عصرها
|
|
137
|
+
|
|
138
|
+
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
بسم الله الرحمن الرحيم
|
|
2
|
+
|
|
3
|
+
In the name of Allah, Most Gracious, Most Merciful
|
|
4
|
+
|
|
5
|
+
"Waqf" General Public License
|
|
6
|
+
|
|
7
|
+
This is the informal English translation of Waqf General Public License.
|
|
8
|
+
Anything but the Arabic version of the license has no value except for
|
|
9
|
+
convenience of our English speaking users. When we talk about the License
|
|
10
|
+
we refer to the Arabic version, which is the only one we officially
|
|
11
|
+
offer, we will try our best to make other translation as accurate as
|
|
12
|
+
possible but because of the nature of human languages we use one single
|
|
13
|
+
reference language.
|
|
14
|
+
|
|
15
|
+
Preamble
|
|
16
|
+
|
|
17
|
+
Publishing any intellectual work (including but not limited to books and
|
|
18
|
+
Computer Software) is not done by selling even if it appeared to be so,
|
|
19
|
+
but it's about getting an implied license that has no enforcement without
|
|
20
|
+
the concept of intellectual property granted by man-made laws which was
|
|
21
|
+
acquired as they claim to promote the publication of science and the
|
|
22
|
+
useful arts. The concept of the so called “intellectual property” is
|
|
23
|
+
centered around giving ownership to the first one who register the work
|
|
24
|
+
(called owner or copyright holder and we will refer to him/her/it as
|
|
25
|
+
holder) then the holder practice his rights on the work in it's intangible
|
|
26
|
+
form on any media it's carried, and thus using the intellectual work
|
|
27
|
+
without explicit prior permission is according to them ethically
|
|
28
|
+
equivalent to hijacking ships or “piracy” as they call it. This permission
|
|
29
|
+
is called License and it's aimed to give the holder (usually the
|
|
30
|
+
publisher) an advantage in the market against other publishers through
|
|
31
|
+
monopoly on providing that work by imposing restrictions on the users not
|
|
32
|
+
the publishers. Such works are called “Proprietary”.
|
|
33
|
+
|
|
34
|
+
We see that such agreements (proprietary licenses) are evil, but we also
|
|
35
|
+
acknowledge that making an agreement with a prior intention to violate it
|
|
36
|
+
is another immoral evil ^1). We don't solve problems with problems, we
|
|
37
|
+
offer an alternative.
|
|
38
|
+
|
|
39
|
+
We have a different vision, we offer our work (like computer software) to
|
|
40
|
+
please Allah, and this is the pillar of this license which distinguish it
|
|
41
|
+
from proprietary licenses. Any other intention (like spreading knowledge
|
|
42
|
+
or getting profits) should be accomplished in ways that does not go
|
|
43
|
+
against our primary moral aim.
|
|
44
|
+
|
|
45
|
+
According to our believes (which we don't enforce on any one, and you may
|
|
46
|
+
or may not share it with us) that Islam certainly forbids monopoly and
|
|
47
|
+
concealing knowledge in general, and this comes from:
|
|
48
|
+
|
|
49
|
+
* The sound Hadith (saying of prophet Muhammad PBUH): “Who conceal any
|
|
50
|
+
type of knowledge will be bridle with a bridle of fire on the Day of
|
|
51
|
+
Resurrection.” ^2)
|
|
52
|
+
* Islamic Jurisprudence has specified what can be owned, and the rules
|
|
53
|
+
does not apply to ideas as it's not a bounded tangible object and
|
|
54
|
+
almost all the terms of proprietary agreements fall in ruling of
|
|
55
|
+
forbidden Gharar^3) (a kind of fraud that use uncertainty to
|
|
56
|
+
fool the customers) as we see in Imam Muslim Sahih description of that
|
|
57
|
+
term {and below that term we classify so many actions like selling
|
|
58
|
+
negligible objects or unknowns or what can't be delivered or things
|
|
59
|
+
that are not full owned by the seller} and such view is also shared by
|
|
60
|
+
the four major scholars.
|
|
61
|
+
* The laws of Fiqh (Islamic Jurisprudence) have been perfected in the
|
|
62
|
+
good centuries and no new rulings are allowed to be brought except for
|
|
63
|
+
newly discovered things and this does not apply ideas as they did
|
|
64
|
+
exist in the past centuries and Muslims massively spread them without
|
|
65
|
+
owning them. FYI: Almost all the Islamic literature is freely
|
|
66
|
+
available on the internet.
|
|
67
|
+
* Concealing useful knowledge from those who need it impose damage to
|
|
68
|
+
people for temporal gains to few individuals. This can not be
|
|
69
|
+
justified by Shari'a (Islamic Law), it's only justified by
|
|
70
|
+
individualist capitalism ^4)
|
|
71
|
+
* Even bringing interests to software publishers is not a valid excuse
|
|
72
|
+
because there are some companies produce and publish software without
|
|
73
|
+
owning them (proprietary software) and yet they gain profits.
|
|
74
|
+
* the so call “Intellectual Proprietary” is all about giving owners the
|
|
75
|
+
right to forbid what Allah had made lawful to gain money, not by
|
|
76
|
+
providing service nor goods.
|
|
77
|
+
* The uncertainty and untangable nature of the claimed owned product is
|
|
78
|
+
the source of “protection money collecting” where some company
|
|
79
|
+
threaten some smaller company by copyright infringement lawsuit on
|
|
80
|
+
some purposely ambiguous product which the later can't afford so they
|
|
81
|
+
go safe and pay.
|
|
82
|
+
|
|
83
|
+
If the good intentions made excuses to introduce “intellectual
|
|
84
|
+
proprietary” by the Machiavellists who wrote the American constitution
|
|
85
|
+
as an acquired right (at least they admit it's not a natural right), they
|
|
86
|
+
serve their own way of life which is not international. We don't take
|
|
87
|
+
that. We have our own high moral standards. We introduce Waqf General
|
|
88
|
+
Public License to place it among the anti-copyright licenses. This license
|
|
89
|
+
is designed to grant rights to users not to restrict them, it's uses the
|
|
90
|
+
concept of copyleft/copy-wrong as opposed to the concept of copyright.
|
|
91
|
+
|
|
92
|
+
Computer software, Medicine formula or even poems are considered to be
|
|
93
|
+
intellectual works and thus can be covered by “Waqf”. An intellectual work
|
|
94
|
+
is any useful idea that can be delivered or utilized by people. “Waqf” is
|
|
95
|
+
not meant for ideas in general, but for intellectual work which is
|
|
96
|
+
beneficial to people if published. As we support protecting privacy for
|
|
97
|
+
example one shouldn't publish names of his customers, bid prices,
|
|
98
|
+
government military or political secrets because those are not
|
|
99
|
+
intellectual works.
|
|
100
|
+
|
|
101
|
+
We should clarify two things:
|
|
102
|
+
|
|
103
|
+
* First: The favor and ethical rights of the holder are preserved and
|
|
104
|
+
acknowledged
|
|
105
|
+
* Second: original author and any other party (if they have the
|
|
106
|
+
intention and the ability) have the right to get fees on enhancing the
|
|
107
|
+
work or developing it or to provide paid services or paid courses
|
|
108
|
+
…etc. but not the work in its intangible form. There is not
|
|
109
|
+
contradiction between getting fees on services because what is covered
|
|
110
|
+
by “Waqf” is the source form of the work not the media nor the service
|
|
111
|
+
(the same way one can take fees on shipping fruits for a charitable
|
|
112
|
+
Waqf fruit field or make juice)
|
|
113
|
+
|
|
114
|
+
Definitions
|
|
115
|
+
|
|
116
|
+
The following terms would have the corresponding meanings in this license
|
|
117
|
+
|
|
118
|
+
* The intellectual work (or The work for short): is any useful
|
|
119
|
+
intangible intellectual product that can be passed on to others or
|
|
120
|
+
replicated withno cost imposed on the original author or the one who
|
|
121
|
+
pass it on before.
|
|
122
|
+
* The holder: is the creative author or the party which carried the
|
|
123
|
+
process of developing the work and make it available (and the one who
|
|
124
|
+
holds the copyrights on the product before the governmental offices).
|
|
125
|
+
* the licensee or the user: any one or party who uses the work (runs,
|
|
126
|
+
copies, modifies or otherwise takes benefits provided by the work).
|
|
127
|
+
* The license: this agreement (the Arabic version of “Waqf”) between the
|
|
128
|
+
two parties (the holder and the user) covering the usage of the second
|
|
129
|
+
party on the work provided by the first party. The usage of the
|
|
130
|
+
product is with accordance to the terms of this license. And because
|
|
131
|
+
of the intangible nature of the work, this agreement applies by using
|
|
132
|
+
the product (in any way) without signing the agreement. One do not
|
|
133
|
+
accept the terms looses the rights given by this license and his/her
|
|
134
|
+
usage of the work is considered illegal and will be sued.
|
|
135
|
+
|
|
136
|
+
The Terms
|
|
137
|
+
|
|
138
|
+
Waqf General Public license (or “Waqf” for short) covers intellectual
|
|
139
|
+
works (including but not limited to Software and paper publications,
|
|
140
|
+
scientific theses, art works) and have many common features with FLOSS
|
|
141
|
+
licenses. Waf is distinguished with its moral intentions behind the work
|
|
142
|
+
and usage limits.
|
|
143
|
+
|
|
144
|
+
As the name suggests, with “Waqf” ^5) the holder announce his/her work
|
|
145
|
+
was produced and made available to the public for the sake of Allah aimed
|
|
146
|
+
to please Allah by providing people with useful works. It's a form of
|
|
147
|
+
“Sadaqa Jariah” ^6).
|
|
148
|
+
|
|
149
|
+
“Waqf” gives users (regardless of their nationality, color, race,
|
|
150
|
+
religion) the right to benefit from the work with running, copying,
|
|
151
|
+
redistribution, or even develop and only with according to the following
|
|
152
|
+
|
|
153
|
+
* First - Usage :
|
|
154
|
+
|
|
155
|
+
The user may use the work for any good purpose and he may not use it to
|
|
156
|
+
harm others or violate the permissive principles of Islam ^7). Notice
|
|
157
|
+
that any work that is most likely harmful can't be put under Waqf in the
|
|
158
|
+
first place.
|
|
159
|
+
|
|
160
|
+
* Second - Redistribution :
|
|
161
|
+
|
|
162
|
+
The user have the right to redistribute the unmodified work in any
|
|
163
|
+
quantity to any third party under the terms of this license, acknowledging
|
|
164
|
+
the favor and ethical rights of the holder to the third party.
|
|
165
|
+
|
|
166
|
+
* Third - Modifications :
|
|
167
|
+
|
|
168
|
+
The user has the right to get the source form of the work and make
|
|
169
|
+
modifications enhancing or adopting to the user's needs to the limits
|
|
170
|
+
given by this license.
|
|
171
|
+
|
|
172
|
+
* Fourth - Redistribute modifications:
|
|
173
|
+
|
|
174
|
+
The user can redistribute modifications only under this license provided
|
|
175
|
+
that he points to previous original work (the unmodified work) and its
|
|
176
|
+
author and the nature of modification clearly to the third party to whom
|
|
177
|
+
the modified work is presented in a way that no one may reasonably get
|
|
178
|
+
confused between it and the original unmodified work of the previous
|
|
179
|
+
author.
|
|
180
|
+
|
|
181
|
+
* Fourth - Disclaimer of responsibility :
|
|
182
|
+
|
|
183
|
+
The holder does not take any legal nor moral direct or indirect
|
|
184
|
+
responsibility nor liability on the good or bad usage or damages caused by
|
|
185
|
+
the work to the farthest level allowed by the law. THIS SOFTWARE IS
|
|
186
|
+
PROVIDED AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
187
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
188
|
+
PARTICULAR PURPOSE ARE DISCLAIMED BY THE HOLDER.
|
|
189
|
+
|
|
190
|
+
The entire responsibility is on the user and the only warranty given to
|
|
191
|
+
him is the source of the work.
|
|
192
|
+
|
|
193
|
+
Conclusion
|
|
194
|
+
|
|
195
|
+
Applying Waqf public license help to spread the awareness of dangers
|
|
196
|
+
caused by intellectual property. And provide people with a legal
|
|
197
|
+
alternative even though we don't believe on the validity of such man made
|
|
198
|
+
laws.
|
|
199
|
+
|
|
200
|
+
^1) http://www.islam-qa.com/ar/ref/454
|
|
201
|
+
^2) This is an authentic sound/Sahih as it's narrated by Imam
|
|
202
|
+
Ahmad, Abu Dawood, AlTirmithi and Ibn Majah. Refer to “Hoisting the
|
|
203
|
+
Lighthouse : A synopsis of the Various narrations of the Hadith: Whoever
|
|
204
|
+
conceals knowledge, Allah will bridle him with a bridle of fire” or in
|
|
205
|
+
Arabic “رفع المنار بطرق حديث من كتم علماً ألجمه الله بلجام من نار”.
|
|
206
|
+
^3) Some information about Ghrar is available at
|
|
207
|
+
http://www.investopedia.com/terms/g/gharar.asp
|
|
208
|
+
^4) Although Islamic economy is a kind of liberal capitalism economy
|
|
209
|
+
but it's regulated with so many moral rulings that guarantee social
|
|
210
|
+
justice
|
|
211
|
+
^5) The name Waqf means to prevent the source or assets from being
|
|
212
|
+
consumed while giving away for charity the proceeds.
|
|
213
|
+
^6) Sadaqa Jariah means sustainable charity which is a kind of charity
|
|
214
|
+
that continue to be beneficial to people even after the death of the one
|
|
215
|
+
who give it like giving the fruits of a field but not the field, more over
|
|
216
|
+
prophet Muhammad PBUH specifically named useful knowledge as a form of
|
|
217
|
+
that kind of charity.
|
|
218
|
+
^7) Some scholars use the term Maqasid Alsharia and summarize them by
|
|
219
|
+
saying that it aims to protect people rights in religion, lives, sanity,
|
|
220
|
+
breed, and properties.
|
|
221
|
+
|
|
222
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Mohammed Alshehri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|