nepali 1.0.1__py3-none-any.whl → 1.1.1__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.
Potentially problematic release.
This version of nepali might be problematic. Click here for more details.
- nepali/{datetime/constants.py → constants.py} +15 -2
- nepali/date_converter.py +4 -4
- nepali/datetime/__init__.py +1 -1
- nepali/datetime/_datetime.py +12 -13
- nepali/datetime/_formatter.py +3 -2
- nepali/datetime/_humanize.py +14 -29
- nepali/datetime/_nepalimonth.py +7 -6
- nepali/datetime/_nepaliweek.py +4 -3
- nepali/datetime/parser/__init__.py +1 -1
- nepali/datetime/parser/_parser.py +7 -9
- nepali/datetime/parser/validators.py +162 -78
- nepali/datetime/utils.py +1 -0
- nepali/locations/__init__.py +1 -1
- nepali/locations/_locations.py +1 -1
- nepali/locations/utils.py +1 -2
- nepali/number/__init__.py +1 -1
- nepali/number/_nepalinumber.py +26 -12
- nepali/number/_number.py +1 -6
- nepali/number/utils.py +1 -2
- nepali/phone_number.py +2 -3
- nepali/templatetags/nepalidatetime.py +37 -0
- nepali/templatetags/nepalinumber.py +26 -0
- nepali/tests/test_date_converter.py +17 -4
- nepali/tests/test_datetime.py +3 -5
- nepali/tests/test_humanize.py +1 -2
- nepali/tests/test_locations.py +3 -3
- nepali/tests/test_number.py +35 -33
- nepali/tests/test_phone_number.py +3 -3
- nepali/tests/test_timezone.py +6 -5
- nepali/timezone.py +5 -3
- nepali/utils.py +1 -1
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/METADATA +11 -85
- nepali-1.1.1.dist-info/RECORD +46 -0
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/WHEEL +1 -1
- nepali-1.0.1.dist-info/RECORD +0 -46
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/LICENSE +0 -0
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/top_level.txt +0 -0
nepali/tests/test_number.py
CHANGED
|
@@ -7,7 +7,7 @@ import sys
|
|
|
7
7
|
import unittest
|
|
8
8
|
|
|
9
9
|
from nepali import number
|
|
10
|
-
from nepali.number import
|
|
10
|
+
from nepali.number import NepaliNumber, nepalinumber
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class TestNumber(unittest.TestCase):
|
|
@@ -170,7 +170,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
170
170
|
self.nepalinumber_integer_10 + (-15.5), self.nepalinumber_negative_float_5_5
|
|
171
171
|
)
|
|
172
172
|
|
|
173
|
-
def
|
|
173
|
+
def test_nepalinumber_integer_is_addable_to_positive_nepali_number_integer(self):
|
|
174
174
|
self.assertEqual(
|
|
175
175
|
self.nepalinumber_integer_10 + self.nepalinumber_integer_10,
|
|
176
176
|
self.nepalinumber_integer_20,
|
|
@@ -280,7 +280,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
280
280
|
self.nepalinumber_negative_integer_10 + 15.5, self.nepalinumber_float_5_5
|
|
281
281
|
)
|
|
282
282
|
|
|
283
|
-
def
|
|
283
|
+
def test_negative_nepalinumber_integer_is_addable_to_positive_nepali_number_integer(
|
|
284
284
|
self,
|
|
285
285
|
):
|
|
286
286
|
self.assertEqual(
|
|
@@ -365,7 +365,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
365
365
|
self.nepalinumber_float_10_1 + (-15.6), self.nepalinumber_negative_float_5_5
|
|
366
366
|
)
|
|
367
367
|
|
|
368
|
-
def
|
|
368
|
+
def test_nepalinumber_float_is_addable_to_positive_nepali_number_integer(self):
|
|
369
369
|
self.assertEqual(
|
|
370
370
|
self.nepalinumber_float_10_1 + self.nepalinumber_integer_10,
|
|
371
371
|
self.nepalinumber_float_20_1,
|
|
@@ -443,7 +443,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
443
443
|
self.nepalinumber_negative_float_10_1 + 15.6, self.nepalinumber_float_5_5
|
|
444
444
|
)
|
|
445
445
|
|
|
446
|
-
def
|
|
446
|
+
def test_negative_nepalinumber_float_is_addable_to_positive_nepali_number_integer(
|
|
447
447
|
self,
|
|
448
448
|
):
|
|
449
449
|
self.assertEqual(
|
|
@@ -542,7 +542,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
542
542
|
self.nepalinumber_integer_10 - (-5.5), self.nepalinumber_float_15_5
|
|
543
543
|
)
|
|
544
544
|
|
|
545
|
-
def
|
|
545
|
+
def test_nepalinumber_integer_is_subtractable_by_positive_nepali_number_integer(
|
|
546
546
|
self,
|
|
547
547
|
):
|
|
548
548
|
self.assertEqual(
|
|
@@ -629,7 +629,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
629
629
|
self.nepalinumber_negative_integer_10 - (-15.5), self.nepalinumber_float_5_5
|
|
630
630
|
)
|
|
631
631
|
|
|
632
|
-
def
|
|
632
|
+
def test_negative_nepalinumber_integer_is_subtractable_by_positive_nepali_number_integer(
|
|
633
633
|
self,
|
|
634
634
|
):
|
|
635
635
|
self.assertEqual(
|
|
@@ -700,7 +700,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
700
700
|
self.nepalinumber_float_10_1 - (-5.4), self.nepalinumber_float_15_5
|
|
701
701
|
)
|
|
702
702
|
|
|
703
|
-
def
|
|
703
|
+
def test_nepalinumber_float_is_subtractable_by_positive_nepali_number_integer(self):
|
|
704
704
|
self.assertEqual(
|
|
705
705
|
self.nepalinumber_float_10_1 - self.nepalinumber_integer_10,
|
|
706
706
|
self.nepalinumber_float_0_0_9,
|
|
@@ -771,7 +771,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
771
771
|
self.nepalinumber_negative_float_10_1 - (-15.6), self.nepalinumber_float_5_5
|
|
772
772
|
)
|
|
773
773
|
|
|
774
|
-
def
|
|
774
|
+
def test_negative_nepalinumber_float_is_subtractable_by_positive_nepali_number_integer(
|
|
775
775
|
self,
|
|
776
776
|
):
|
|
777
777
|
self.assertEqual(
|
|
@@ -872,7 +872,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
872
872
|
self.nepalinumber_integer_10 * (-1.5), self.nepalinumber_negative_integer_15
|
|
873
873
|
)
|
|
874
874
|
|
|
875
|
-
def
|
|
875
|
+
def test_nepalinumber_integer_is_multiplicable_to_positive_nepali_number_integer(
|
|
876
876
|
self,
|
|
877
877
|
):
|
|
878
878
|
self.assertEqual(
|
|
@@ -955,7 +955,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
955
955
|
self.nepalinumber_integer_15,
|
|
956
956
|
)
|
|
957
957
|
|
|
958
|
-
def
|
|
958
|
+
def test_negative_nepalinumber_integer_is_multiplicable_to_positive_nepali_number_integer(
|
|
959
959
|
self,
|
|
960
960
|
):
|
|
961
961
|
self.assertEqual(
|
|
@@ -1008,7 +1008,9 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1008
1008
|
self.nepalinumber_float_4_5 * (-2.2), self.nepalinumber_negative_float_9_9
|
|
1009
1009
|
)
|
|
1010
1010
|
|
|
1011
|
-
def
|
|
1011
|
+
def test_nepalinumber_float_is_multiplicable_to_positive_nepali_number_integer(
|
|
1012
|
+
self,
|
|
1013
|
+
):
|
|
1012
1014
|
self.assertEqual(
|
|
1013
1015
|
self.nepalinumber_float_10_1 * self.nepalinumber_integer_2,
|
|
1014
1016
|
self.nepalinumber_float_20_2,
|
|
@@ -1059,7 +1061,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1059
1061
|
self.nepalinumber_float_5_25,
|
|
1060
1062
|
)
|
|
1061
1063
|
|
|
1062
|
-
def
|
|
1064
|
+
def test_negative_nepalinumber_float_is_multiplicable_to_positive_nepali_number_integer(
|
|
1063
1065
|
self,
|
|
1064
1066
|
):
|
|
1065
1067
|
self.assertEqual(
|
|
@@ -1075,7 +1077,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1075
1077
|
self.nepalinumber_negative_float_2_25,
|
|
1076
1078
|
)
|
|
1077
1079
|
|
|
1078
|
-
def
|
|
1080
|
+
def test_negative_nepalinumber_float_is_multiplicable_to_negative_nepali_number_integer(
|
|
1079
1081
|
self,
|
|
1080
1082
|
):
|
|
1081
1083
|
self.assertEqual(
|
|
@@ -1180,7 +1182,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1180
1182
|
self.nepalinumber_integer_10 / (-2.5), self.nepalinumber_negative_integer_4
|
|
1181
1183
|
)
|
|
1182
1184
|
|
|
1183
|
-
def
|
|
1185
|
+
def test_nepalinumber_integer_is_divisible_by_positive_nepali_number_integer(self):
|
|
1184
1186
|
self.assertEqual(
|
|
1185
1187
|
self.nepalinumber_integer_20 / self.nepalinumber_integer_10,
|
|
1186
1188
|
self.nepalinumber_integer_2,
|
|
@@ -1276,7 +1278,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1276
1278
|
self.nepalinumber_negative_integer_10 / -2.5, self.nepalinumber_integer_4
|
|
1277
1279
|
)
|
|
1278
1280
|
|
|
1279
|
-
def
|
|
1281
|
+
def test_negative_nepalinumber_integer_is_divisible_by_positive_nepali_number_integer(
|
|
1280
1282
|
self,
|
|
1281
1283
|
):
|
|
1282
1284
|
self.assertEqual(
|
|
@@ -1338,7 +1340,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1338
1340
|
self.nepalinumber_float_20_2 / (-10.1), self.nepalinumber_negative_integer_2
|
|
1339
1341
|
)
|
|
1340
1342
|
|
|
1341
|
-
def
|
|
1343
|
+
def test_nepalinumber_float_is_divisible_by_positive_nepali_number_integer(self):
|
|
1342
1344
|
self.assertEqual(
|
|
1343
1345
|
self.nepalinumber_float_20_2 / self.nepalinumber_integer_2,
|
|
1344
1346
|
self.nepalinumber_float_10_1,
|
|
@@ -1387,7 +1389,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1387
1389
|
self.nepalinumber_integer_2,
|
|
1388
1390
|
)
|
|
1389
1391
|
|
|
1390
|
-
def
|
|
1392
|
+
def test_negative_nepalinumber_float_is_divisible_by_positive_nepali_number_integer(
|
|
1391
1393
|
self,
|
|
1392
1394
|
):
|
|
1393
1395
|
self.assertEqual(
|
|
@@ -1470,7 +1472,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1470
1472
|
|
|
1471
1473
|
self.assertEqual(str(ze.exception), "division by zero")
|
|
1472
1474
|
|
|
1473
|
-
# floor
|
|
1475
|
+
# floor division
|
|
1474
1476
|
# nepalinumber positive integer division tests
|
|
1475
1477
|
def test_nepalinumber_integer_is_floor_divisible_by_positive_integer(self):
|
|
1476
1478
|
self.assertEqual(
|
|
@@ -1492,7 +1494,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1492
1494
|
self.nepalinumber_integer_10 // (-2.5), self.nepalinumber_negative_integer_4
|
|
1493
1495
|
)
|
|
1494
1496
|
|
|
1495
|
-
def
|
|
1497
|
+
def test_nepalinumber_integer_is_floor_divisible_by_positive_nepali_number_integer(
|
|
1496
1498
|
self,
|
|
1497
1499
|
):
|
|
1498
1500
|
self.assertEqual(
|
|
@@ -1600,7 +1602,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1600
1602
|
self.nepalinumber_negative_integer_10 // -2.5, self.nepalinumber_integer_4
|
|
1601
1603
|
)
|
|
1602
1604
|
|
|
1603
|
-
def
|
|
1605
|
+
def test_negative_nepalinumber_integer_is_floor_divisible_by_positive_nepali_number_integer(
|
|
1604
1606
|
self,
|
|
1605
1607
|
):
|
|
1606
1608
|
self.assertEqual(
|
|
@@ -1665,7 +1667,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1665
1667
|
self.nepalinumber_negative_integer_2,
|
|
1666
1668
|
)
|
|
1667
1669
|
|
|
1668
|
-
def
|
|
1670
|
+
def test_nepalinumber_float_is_floor_divisible_by_positive_nepali_number_integer(
|
|
1669
1671
|
self,
|
|
1670
1672
|
):
|
|
1671
1673
|
self.assertEqual(
|
|
@@ -1722,7 +1724,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1722
1724
|
self.nepalinumber_integer_2,
|
|
1723
1725
|
)
|
|
1724
1726
|
|
|
1725
|
-
def
|
|
1727
|
+
def test_negative_nepalinumber_float_is_floor_divisible_by_positive_nepali_number_integer(
|
|
1726
1728
|
self,
|
|
1727
1729
|
):
|
|
1728
1730
|
self.assertEqual(
|
|
@@ -1896,7 +1898,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1896
1898
|
self.nepalinumber_negative_integer_10,
|
|
1897
1899
|
)
|
|
1898
1900
|
|
|
1899
|
-
def
|
|
1901
|
+
def test_nepalinumber_integer_can_be_modulo_divided_by_negative_nepalinumber_float(
|
|
1900
1902
|
self,
|
|
1901
1903
|
):
|
|
1902
1904
|
self.assertEqual(
|
|
@@ -1945,7 +1947,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
1945
1947
|
self.nepalinumber_integer_10,
|
|
1946
1948
|
)
|
|
1947
1949
|
|
|
1948
|
-
def
|
|
1950
|
+
def test_negative_nepalinumber_float_can_be_modulo_divided_by_positive_nepalinumber_integer(
|
|
1949
1951
|
self,
|
|
1950
1952
|
):
|
|
1951
1953
|
self.assertEqual(
|
|
@@ -2000,7 +2002,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2000
2002
|
self.nepalinumber_negative_integer_10,
|
|
2001
2003
|
)
|
|
2002
2004
|
|
|
2003
|
-
def
|
|
2005
|
+
def test_negative_nepalinumber_integer_can_be_modulo_divided_by_negative_nepalinumber_float(
|
|
2004
2006
|
self,
|
|
2005
2007
|
):
|
|
2006
2008
|
self.assertEqual(
|
|
@@ -2048,7 +2050,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2048
2050
|
self.nepalinumber_negative_float_5_5,
|
|
2049
2051
|
)
|
|
2050
2052
|
|
|
2051
|
-
def
|
|
2053
|
+
def test_negative_nepalinumber_float_can_be_modulo_divided_by_negative_nepalinumber_integer(
|
|
2052
2054
|
self,
|
|
2053
2055
|
):
|
|
2054
2056
|
self.assertEqual(
|
|
@@ -2096,7 +2098,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2096
2098
|
self.nepalinumber_negative_float_15_5,
|
|
2097
2099
|
)
|
|
2098
2100
|
|
|
2099
|
-
def
|
|
2101
|
+
def test_nepalinumber_float_can_be_modulo_divided_by_negative_nepalinumber_float(
|
|
2100
2102
|
self,
|
|
2101
2103
|
):
|
|
2102
2104
|
self.assertEqual(
|
|
@@ -2148,7 +2150,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2148
2150
|
self.nepalinumber_integer_2,
|
|
2149
2151
|
)
|
|
2150
2152
|
|
|
2151
|
-
def
|
|
2153
|
+
def test_negative_nepalinumber_float_can_be_modulo_divided_by_negative_nepalinumber_integer_2(
|
|
2152
2154
|
self,
|
|
2153
2155
|
):
|
|
2154
2156
|
self.assertEqual(
|
|
@@ -2290,7 +2292,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2290
2292
|
),
|
|
2291
2293
|
)
|
|
2292
2294
|
|
|
2293
|
-
# divmod positive nepalinumber integer as
|
|
2295
|
+
# divmod positive nepalinumber integer as divisor tests
|
|
2294
2296
|
def test_positive_integer_can_be_divmod_with_positive_nepalinumber_integer(self):
|
|
2295
2297
|
self.assertEqual(
|
|
2296
2298
|
divmod(10, self.nepalinumber_integer_2),
|
|
@@ -2397,7 +2399,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2397
2399
|
),
|
|
2398
2400
|
)
|
|
2399
2401
|
|
|
2400
|
-
# divmod positive nepalinumber float as
|
|
2402
|
+
# divmod positive nepalinumber float as divisor tests
|
|
2401
2403
|
def test_positive_integer_can_be_divmod_with_positive_nepalinumber_float(self):
|
|
2402
2404
|
self.assertEqual(
|
|
2403
2405
|
divmod(10, self.nepalinumber_float_2_5),
|
|
@@ -2485,7 +2487,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2485
2487
|
(self.nepalinumber_integer_1, self.nepalinumber_negative_float_4_5),
|
|
2486
2488
|
)
|
|
2487
2489
|
|
|
2488
|
-
# divmod negative nepalinumber integer as
|
|
2490
|
+
# divmod negative nepalinumber integer as divisor tests
|
|
2489
2491
|
def test_positive_integer_can_be_divmod_with_negative_nepalinumber_integer(self):
|
|
2490
2492
|
self.assertEqual(
|
|
2491
2493
|
divmod(10, self.nepalinumber_negative_integer_2),
|
|
@@ -2557,7 +2559,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
|
|
|
2557
2559
|
(self.nepalinumber_integer_1, self.nepalinumber_negative_integer_2),
|
|
2558
2560
|
)
|
|
2559
2561
|
|
|
2560
|
-
# divmod negative nepalinumber float as
|
|
2562
|
+
# divmod negative nepalinumber float as divisor tests
|
|
2561
2563
|
def test_positive_integer_can_be_divmod_with_negative_nepalinumber_float(self):
|
|
2562
2564
|
self.assertEqual(
|
|
2563
2565
|
divmod(10, self.nepalinumber_negative_float_2_5),
|
|
@@ -2,16 +2,16 @@ import unittest
|
|
|
2
2
|
from unittest import mock
|
|
3
3
|
|
|
4
4
|
from nepali.phone_number import (
|
|
5
|
+
Operator,
|
|
5
6
|
_get_area_code,
|
|
6
7
|
_get_operator,
|
|
7
8
|
_parse_landline_number,
|
|
8
9
|
_parse_mobile_number,
|
|
9
|
-
|
|
10
|
+
get_exact_number,
|
|
10
11
|
is_landline_number,
|
|
12
|
+
is_mobile_number,
|
|
11
13
|
is_valid,
|
|
12
|
-
get_exact_number,
|
|
13
14
|
parse,
|
|
14
|
-
Operator,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
|
nepali/tests/test_timezone.py
CHANGED
|
@@ -7,13 +7,14 @@ import datetime
|
|
|
7
7
|
import unittest
|
|
8
8
|
from unittest.mock import patch
|
|
9
9
|
|
|
10
|
+
from nepali.constants import NEPAL_TIMEZONE
|
|
10
11
|
from nepali.timezone import (
|
|
11
12
|
NepaliTimeZone,
|
|
13
|
+
get_timezone,
|
|
14
|
+
now,
|
|
12
15
|
to_nepali_timezone,
|
|
13
16
|
to_utc_timezone,
|
|
14
17
|
utc_now,
|
|
15
|
-
now,
|
|
16
|
-
get_timezone,
|
|
17
18
|
)
|
|
18
19
|
|
|
19
20
|
|
|
@@ -32,13 +33,13 @@ class TestNepaliTimeZone(unittest.TestCase):
|
|
|
32
33
|
)
|
|
33
34
|
|
|
34
35
|
def test_nepali_timezone_tzname(self):
|
|
35
|
-
self.assertEqual(self.nepali_timezone.tzname(None),
|
|
36
|
+
self.assertEqual(self.nepali_timezone.tzname(None), NEPAL_TIMEZONE)
|
|
36
37
|
|
|
37
38
|
def test_nepali_timezone_str(self):
|
|
38
|
-
self.assertEqual(str(self.nepali_timezone),
|
|
39
|
+
self.assertEqual(str(self.nepali_timezone), NEPAL_TIMEZONE)
|
|
39
40
|
|
|
40
41
|
def test_nepali_timezone_repr(self):
|
|
41
|
-
self.assertEqual(repr(self.nepali_timezone),
|
|
42
|
+
self.assertEqual(repr(self.nepali_timezone), NEPAL_TIMEZONE)
|
|
42
43
|
|
|
43
44
|
def test_datetime_with_nepali_timezone(self):
|
|
44
45
|
dt = datetime.datetime(2015, 10, 14, tzinfo=self.nepali_timezone)
|
nepali/timezone.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
from typing import Union
|
|
3
3
|
|
|
4
|
+
from .constants import NEPAL_TIMEZONE
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
class NepaliTimeZone(datetime.tzinfo):
|
|
6
8
|
"""
|
|
@@ -14,13 +16,13 @@ class NepaliTimeZone(datetime.tzinfo):
|
|
|
14
16
|
return datetime.timedelta(0)
|
|
15
17
|
|
|
16
18
|
def tzname(self, dt):
|
|
17
|
-
return
|
|
19
|
+
return NEPAL_TIMEZONE
|
|
18
20
|
|
|
19
21
|
def __str__(self):
|
|
20
|
-
return
|
|
22
|
+
return NEPAL_TIMEZONE
|
|
21
23
|
|
|
22
24
|
def __repr__(self):
|
|
23
|
-
return
|
|
25
|
+
return NEPAL_TIMEZONE
|
|
24
26
|
|
|
25
27
|
def __eq__(self, o: object) -> bool:
|
|
26
28
|
return isinstance(o, self.__class__)
|
nepali/utils.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nepali
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: nepalidatetime compatible with python's datetime feature. Converting nepali date to english, parsing nepali datetime, nepali timezone, and timedelta support in nepali datetime
|
|
5
5
|
Home-page: https://github.com/opensource-nepal/py-nepali
|
|
6
6
|
Author: opensource-nepal
|
|
7
7
|
Author-email: aj3sshh@gmail.com, sugatbajracharya49@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Source, https://github.com/opensource-nepal/py-nepali
|
|
10
|
+
Project-URL: Changelog, https://github.com/opensource-nepal/py-nepali/blob/main/CHANGELOG.md
|
|
8
11
|
Keywords: nepali date conversion,convert date,nepali date time,python convert date,parse nepali date time
|
|
9
12
|
Classifier: Programming Language :: Python :: 3
|
|
10
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -15,9 +18,9 @@ License-File: LICENSE
|
|
|
15
18
|
# nepali
|
|
16
19
|
|
|
17
20
|
[](https://badge.fury.io/py/nepali)
|
|
18
|
-
[](https://github.com/opensource-nepal/py-nepali/actions)
|
|
19
22
|
[](https://pypi.org/project/nepali/)
|
|
20
|
-
[](https://codecov.io/gh/opensource-nepal/py-nepali)
|
|
21
24
|
|
|
22
25
|
`nepali` is a python package containing features that will be useful for Nepali projects.
|
|
23
26
|
|
|
@@ -307,11 +310,11 @@ np_datetime = parse("Jestha 15, 2079") # 2079-02-15 00:00:00
|
|
|
307
310
|
|
|
308
311
|
| Directive | Meaning | Example |
|
|
309
312
|
| --------- | --------------------------------------------------------- | ------------------------------ |
|
|
310
|
-
| `%
|
|
313
|
+
| `%a` | Weekday as locale’s abbreviated name. | Sun, Mon, …, Sat (आइत, सोम, …) |
|
|
311
314
|
| `%A` | Weekday as locale’s full name. | Sunday, Monday, …, Saturday |
|
|
312
315
|
| `%d` | Day of the month as a zero-padded decimal number. | 01, 02, …, 31 |
|
|
313
316
|
| `%-d` | Day of the month as a decimal number. | 1, 2, …, 31 |
|
|
314
|
-
| `%B` | Month as locale’s full name. |
|
|
317
|
+
| `%B` | Month as locale’s full name. | Baishakh, Jestha, …, Chaitra |
|
|
315
318
|
| `%m` | Month as a zero-padded decimal number. | 01, 02, …, 12 |
|
|
316
319
|
| `%-m` | Month as a decimal number. | 1, 2, …, 12 |
|
|
317
320
|
| `%y` | Year without century as a zero-padded decimal number. | 00, 01, …, 99 |
|
|
@@ -447,87 +450,10 @@ get_municipality(name_nepali="विराटनगर")
|
|
|
447
450
|
|
|
448
451
|
---
|
|
449
452
|
|
|
450
|
-
## For Django
|
|
451
|
-
|
|
452
|
-
Add `'nepali'` to your `INSTALLED_APPS` setting.
|
|
453
|
-
|
|
454
|
-
```python
|
|
455
|
-
INSTALLED_APPS = [
|
|
456
|
-
...
|
|
457
|
-
'nepali',
|
|
458
|
-
...
|
|
459
|
-
]
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
### nepalidatetime
|
|
463
|
-
|
|
464
|
-
In your Template
|
|
465
|
-
|
|
466
|
-
```python
|
|
467
|
-
{% load nepalidatetime %}
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
#### nepalinow
|
|
471
|
-
|
|
472
|
-
`nepalinow` renders the current Nepali date and time in 'en-US' locale (English).
|
|
473
|
-
|
|
474
|
-
```python
|
|
475
|
-
{% nepalinow %}
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
```python
|
|
479
|
-
{% nepalinow '%Y-%m-%d' %}
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
#### nepalinow_ne
|
|
483
|
-
|
|
484
|
-
`nepalinow_ne` renders the current Nepali date and time in 'ne' locale (Nepali).
|
|
485
|
-
|
|
486
|
-
```python
|
|
487
|
-
{% nepalinow_ne %}
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
#### nepalidate
|
|
491
|
-
|
|
492
|
-
`nepalidate` renders the datetime object into nepali datetime format in 'en-US' locale (English).
|
|
493
|
-
|
|
494
|
-
```python
|
|
495
|
-
{{ datetime_obj|nepalidate:"%Y-%m-%d" }}
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
#### nepalidate_ne
|
|
499
|
-
|
|
500
|
-
`nepalidate_ne` renders the datetime object into nepali datetime format in 'ne' locale (Nepali).
|
|
501
|
-
|
|
502
|
-
```python
|
|
503
|
-
{{ datetime_obj|nepalidate_ne:"%Y-%m-%d" }}
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
#### nepalihumanize
|
|
507
|
-
|
|
508
|
-
`nepalihumanize` renders the datetime object to a human readable form for 'ne' locale (Nepali)
|
|
509
|
-
|
|
510
|
-
```python
|
|
511
|
-
{{ datetime_obj|nepalihumanize }}
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
### nepalinumber
|
|
515
|
-
|
|
516
|
-
In your Template
|
|
517
|
-
|
|
518
|
-
```python
|
|
519
|
-
{% load nepalinumber %}
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
`nepalinumber` renders the english number into nepali format (devanagari)
|
|
523
|
-
|
|
524
|
-
```python
|
|
525
|
-
{{ forloop.counter|nepalinumber }}
|
|
526
|
-
|
|
527
|
-
{{ 150|nepalinumber }}
|
|
528
|
-
```
|
|
453
|
+
## For Django
|
|
529
454
|
|
|
455
|
+
We have created a new Django package called [django-nepali](https://github.com/opensource-nepal/django-nepali) to support `nepali` package. For more information, please visit [django-nepali](https://github.com/opensource-nepal/django-nepali).
|
|
530
456
|
|
|
531
457
|
## Contribution
|
|
532
458
|
|
|
533
|
-
We appreciate feedback and contribution to this package. To get started please see our [contribution guide](
|
|
459
|
+
We appreciate feedback and contribution to this package. To get started please see our [contribution guide](./CONTRIBUTING.md)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
nepali/__init__.py,sha256=8Vx8S0r8UT5PoFdlGHBp59j84si87m4mWgGipzwhVvs,16
|
|
2
|
+
nepali/char.py,sha256=WglBe0AefpsHwIXaPXr0FVjdI4qvmr06U8kSQLtvjdQ,3437
|
|
3
|
+
nepali/constants.py,sha256=FA5qvFaiNKyQ5APQytDovbr9tBPIITgLpPMrR0UlbsY,1309
|
|
4
|
+
nepali/date_converter.py,sha256=R2CvQN15mb7vcFB4eGpyPMYIcLPgYWw16BRyC8aIV3A,13575
|
|
5
|
+
nepali/exceptions.py,sha256=CKg1wEUuzcog7w8Q7pGBNthi9oTOeg_3Aapx1WaTveY,329
|
|
6
|
+
nepali/phone_number.py,sha256=QCAas5yyVVAXiS-CkO_-BGINmVTj96IwOyIn0-XVDZo,4172
|
|
7
|
+
nepali/timezone.py,sha256=qRO9ALaEDH4LkPPKGtUlHbDo6TysfQclgVmmQmFrkMU,1995
|
|
8
|
+
nepali/utils.py,sha256=rOHuHuUZzcTCQTfFXn3RneS9lx9RbtDTifnkO-buoDc,241
|
|
9
|
+
nepali/datetime/__init__.py,sha256=5tfqVCXri3zACb2twLI1QcYw9wp4-Omj6tJhSny-mxo,427
|
|
10
|
+
nepali/datetime/_datetime.py,sha256=jIeSotLQ_rLe5keRGZt31usDIt0RiXuM4SsPkbxmFsI,12049
|
|
11
|
+
nepali/datetime/_formatter.py,sha256=U0Fe-mPwM25VSru124SRG9Olv0FD1WwaFjR22G9TuOU,8744
|
|
12
|
+
nepali/datetime/_humanize.py,sha256=mfucIbpdZqq2-GjolfhLUP22dKkmy7484hE1FpzHvnM,3636
|
|
13
|
+
nepali/datetime/_nepalimonth.py,sha256=chyLZFh3vDt4StUia5GGxDNCTBLBjVatK4uYiumo5po,3224
|
|
14
|
+
nepali/datetime/_nepaliweek.py,sha256=kKuya3qo8lUokkuOGsgcsiHJx2Hf6Ith0nPZsaA1iQI,3400
|
|
15
|
+
nepali/datetime/utils.py,sha256=UpBhiwRrNg8bpTW018_gSzk3w8BMZiqVcK0C3x16JYU,1482
|
|
16
|
+
nepali/datetime/parser/__init__.py,sha256=IXGIIG8KO3VP4BPPQegoz2LRven1L9pLkM0mYbvHf7I,81
|
|
17
|
+
nepali/datetime/parser/_parser.py,sha256=U7W3wrY5hAPoB9XMD5KMT8OCEy6ZyIF48UHXnJRfny0,1930
|
|
18
|
+
nepali/datetime/parser/validators.py,sha256=Zd9KFEUVkWKY57_Oa1S7jOnPsnJjvEbNp38QwTglgeM,10597
|
|
19
|
+
nepali/locations/__init__.py,sha256=kaBcuMBHrf38Zj7BTXRIwP6rdXnzc_bpQMcig8BzDcQ,117
|
|
20
|
+
nepali/locations/_data.py,sha256=8qrkNLZAMgqTxopPaFOcO9HpwqapF7WfjPL20Qrcvyc,216494
|
|
21
|
+
nepali/locations/_locations.py,sha256=DpnE4lcTbxTDfKv5EsCupDqCi2K5-jSDICzF5DpKpss,1348
|
|
22
|
+
nepali/locations/models.py,sha256=OZ2C-ZK2Fz-eC8up-j0HLliFWOqMMyO_cvzTLkTIFs8,2870
|
|
23
|
+
nepali/locations/utils.py,sha256=dPV8tJDTajgfJaQ6qNMgnemMTlilYzza0m6DhrxkdOs,1546
|
|
24
|
+
nepali/number/__init__.py,sha256=r1qwwG-HQ_QtMt_qvfBZMmBKgWQArBERYRs4tJdFjKY,384
|
|
25
|
+
nepali/number/_nepalinumber.py,sha256=dwI-u7jXUi8SajjOT28yhDos1x4vykSSPvhVz4NRaTk,19561
|
|
26
|
+
nepali/number/_number.py,sha256=qPqXSeU7YxIR1IXxjgmfFeIlCWre8_6IHtPD_0ip20I,1892
|
|
27
|
+
nepali/number/utils.py,sha256=ieGpY0DK5_FZaTvSKp8q4hMepjWqyXtGtf7T7-0iVp4,1878
|
|
28
|
+
nepali/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
+
nepali/templatetags/nepalidatetime.py,sha256=g6UtfkToZtVDVe_Z9aGPwYPhNrPpZzvfi1bzFdTjSpg,5789
|
|
30
|
+
nepali/templatetags/nepalinumber.py,sha256=hjq0cxI1o_uny_8aH9skUhqzhWi4YvnvY3ivdt1ulGU,2452
|
|
31
|
+
nepali/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
+
nepali/tests/test_date_converter.py,sha256=9Ubr_SytLIIj-ptF7vhbQVjOEZQ2PVauXj6E4utYIHw,5830
|
|
33
|
+
nepali/tests/test_datetime.py,sha256=YjXGxnqeu4ytn5HpDU4CxwYTNmiB-KilJv10T2Wc5Eo,13581
|
|
34
|
+
nepali/tests/test_humanize.py,sha256=DX0-I1aXZkBNSPtXKbRrIPiBVxzVaFRItlDwx4lDzko,3845
|
|
35
|
+
nepali/tests/test_locations.py,sha256=DoiqiLh8FdvervTyqbbeG-f7QQDTOiQ4GJS68OheNPs,5968
|
|
36
|
+
nepali/tests/test_nepalimonth.py,sha256=1e-nFpCvk_JGUhRtjAL9_NDck2Ue828Gp3sN_uAWGxU,6575
|
|
37
|
+
nepali/tests/test_nepaliweek.py,sha256=ycGE3gY1d6JjF0VyAy5DbVGg3ayLcRTwAHruSqAWF_4,6468
|
|
38
|
+
nepali/tests/test_number.py,sha256=wDrAygSskvsLWGD3NqL8ButVdCwKbouzzmdL-ncqjpY,117664
|
|
39
|
+
nepali/tests/test_parser.py,sha256=_p6H09Ybw-sTRpNNgf7qMibEtnubI-HRECxrbLlgRnw,6712
|
|
40
|
+
nepali/tests/test_phone_number.py,sha256=fswHlwgaiS3outmHOevNj1IVh0ZOYyrvuFKYBYODGRE,11726
|
|
41
|
+
nepali/tests/test_timezone.py,sha256=-GBtiRU5msL9SjPeBBrZuXKMn89k_Q4mqhiT48W0BJE,6542
|
|
42
|
+
nepali-1.1.1.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
|
43
|
+
nepali-1.1.1.dist-info/METADATA,sha256=7HqpBeucbg71RscCsa7ntJjd0N58YcNzzmlhu1bgstc,14156
|
|
44
|
+
nepali-1.1.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
45
|
+
nepali-1.1.1.dist-info/top_level.txt,sha256=joX2GOfHg0KHYsDxi7eXDVTBQK0t6ZsvKz9uz7S6mFE,7
|
|
46
|
+
nepali-1.1.1.dist-info/RECORD,,
|
nepali-1.0.1.dist-info/RECORD
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
nepali/__init__.py,sha256=8Vx8S0r8UT5PoFdlGHBp59j84si87m4mWgGipzwhVvs,16
|
|
2
|
-
nepali/char.py,sha256=WglBe0AefpsHwIXaPXr0FVjdI4qvmr06U8kSQLtvjdQ,3437
|
|
3
|
-
nepali/date_converter.py,sha256=ZRmjTl7GjKW8Gvx2KKN3kyAd62lepHk8f6SJ8f0kLzQ,13551
|
|
4
|
-
nepali/exceptions.py,sha256=CKg1wEUuzcog7w8Q7pGBNthi9oTOeg_3Aapx1WaTveY,329
|
|
5
|
-
nepali/phone_number.py,sha256=x4lYjHjkXfQYMf8Lawl5v-eHwMLkmnbyu33eWUcZ8IM,4182
|
|
6
|
-
nepali/timezone.py,sha256=xDjw73xhhb6ub-M_NzZJBJ0yDobe6CAiCrHAFUUaP50,1962
|
|
7
|
-
nepali/utils.py,sha256=0dNNZwzYiK7XxSaUeH_NQcsplc-EQglwGA3eWOtBXAk,241
|
|
8
|
-
nepali/datetime/__init__.py,sha256=nyhLV-y803az7F28qKAwyQcwJYW46t-A8ZYntnZtz_Y,427
|
|
9
|
-
nepali/datetime/_datetime.py,sha256=yi2pkdVby_rCaiCTwgCMzHC8InK291GF3kdSfCglPB0,12071
|
|
10
|
-
nepali/datetime/_formatter.py,sha256=mFX6c0XCuuVfkN_-WANIhNS9J461wLKYG12CcRUJN-k,8750
|
|
11
|
-
nepali/datetime/_humanize.py,sha256=sPvyYqtdwsJtJlkLnCU4oZntDwYlo4P3VbE3c_2VUnQ,4420
|
|
12
|
-
nepali/datetime/_nepalimonth.py,sha256=l2jYL_GQvLjP01ulvOb2OU9cyPffXKeAyR4i6et_rmU,3162
|
|
13
|
-
nepali/datetime/_nepaliweek.py,sha256=OYQm_GAXwuwZ8-M_hMfDps9mngFXIHrxoCpoDBMkgY8,3383
|
|
14
|
-
nepali/datetime/constants.py,sha256=P0O0g2koC_KOd-AgCqHbQHIWMWWY1rezs38MRSa26eg,965
|
|
15
|
-
nepali/datetime/utils.py,sha256=h616TYFIy7cFbl0gFXgp1rQJ-D7NDJwAGW_yWTx1WyM,1481
|
|
16
|
-
nepali/datetime/parser/__init__.py,sha256=sngXPD5hrjkBOIMeS9TbjtA489yoBv0MIltbVr9qcJM,81
|
|
17
|
-
nepali/datetime/parser/_parser.py,sha256=fdrm6R4HnT9TJ22kihYli_THBeH6uOEkBtK49h3GRFo,2074
|
|
18
|
-
nepali/datetime/parser/validators.py,sha256=vxaKRdvgQtXHbsOnYgU2kjBSPAD4grTn-hefJKRAVeE,8546
|
|
19
|
-
nepali/locations/__init__.py,sha256=1ZPHODk6lP0w9k6rZsfumX8BCbhvqoqJGvHVFXEP3UY,117
|
|
20
|
-
nepali/locations/_data.py,sha256=8qrkNLZAMgqTxopPaFOcO9HpwqapF7WfjPL20Qrcvyc,216494
|
|
21
|
-
nepali/locations/_locations.py,sha256=C8NBtSbRsd049eGbIxtPd-vxp-9Vpv43DNRit_1Bc9o,1348
|
|
22
|
-
nepali/locations/models.py,sha256=OZ2C-ZK2Fz-eC8up-j0HLliFWOqMMyO_cvzTLkTIFs8,2870
|
|
23
|
-
nepali/locations/utils.py,sha256=b7q3UQeGMsautBSCPAdWFeGi8L8khh2xtIrM0H3sOn4,1547
|
|
24
|
-
nepali/number/__init__.py,sha256=blTGsavxmNmL_mZP9jpxOFk239kpKZv6lsMW4sJVnvk,384
|
|
25
|
-
nepali/number/_nepalinumber.py,sha256=TUcmRSRwbfE-gvMCMMba49j_E-iSHqqhvfwG4WqzEVM,19019
|
|
26
|
-
nepali/number/_number.py,sha256=dDfv4MLxK2iS3z-0ryTVTEbFIO4o4KwMP84J9R3W7z0,1913
|
|
27
|
-
nepali/number/utils.py,sha256=CABRrMndpmn3-PKTFgJi3RB0_dRdnmQrzwiU-VsvOUE,1887
|
|
28
|
-
nepali/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
-
nepali/templatetags/nepalidatetime.py,sha256=tcrSMs_pGJmAqJ8fQ5iwFT8pD1YqWu5HzDp0Q6BfuYU,4754
|
|
30
|
-
nepali/templatetags/nepalinumber.py,sha256=ENjB7FriZORrSvlHAFc5J0TV5q8-lyRQAxFBFZnlrU4,1749
|
|
31
|
-
nepali/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
nepali/tests/test_date_converter.py,sha256=rVUelyeuPziIN_1YewZqa0bgzCG-BzbjH_Dk7AKkJy4,5282
|
|
33
|
-
nepali/tests/test_datetime.py,sha256=j1XW1vSkc6Rq5GhwQVBuObdMR6ftgY7v_F_632Zpk2I,13621
|
|
34
|
-
nepali/tests/test_humanize.py,sha256=MxiRCCGtZtqcMKUQSh6ViKuEu9A1sSI3J2LdrWjJyZE,3846
|
|
35
|
-
nepali/tests/test_locations.py,sha256=DEszPh-F_d2XZi7TKcaHxKI8MR4pl5rg4xRtAGyd-_U,5968
|
|
36
|
-
nepali/tests/test_nepalimonth.py,sha256=1e-nFpCvk_JGUhRtjAL9_NDck2Ue828Gp3sN_uAWGxU,6575
|
|
37
|
-
nepali/tests/test_nepaliweek.py,sha256=ycGE3gY1d6JjF0VyAy5DbVGg3ayLcRTwAHruSqAWF_4,6468
|
|
38
|
-
nepali/tests/test_number.py,sha256=Q8DaQNeWEKH5WK4NN8f5FTU2m3HOyTn2OBdZITPgu1Y,117623
|
|
39
|
-
nepali/tests/test_parser.py,sha256=_p6H09Ybw-sTRpNNgf7qMibEtnubI-HRECxrbLlgRnw,6712
|
|
40
|
-
nepali/tests/test_phone_number.py,sha256=ND2yJj5pHkkICTdZzVPBxUW4vc0Wib8qMDzBJ03G87s,11726
|
|
41
|
-
nepali/tests/test_timezone.py,sha256=cYzTF4G0fKxwO8Verf6NH9K5reZMQmB1OpPk8aTSsME,6504
|
|
42
|
-
nepali-1.0.1.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
|
43
|
-
nepali-1.0.1.dist-info/METADATA,sha256=2g62AVob3esUz5pHQM-zt5DXtlU3_Ydfkk0tAdnnhWs,14992
|
|
44
|
-
nepali-1.0.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
45
|
-
nepali-1.0.1.dist-info/top_level.txt,sha256=joX2GOfHg0KHYsDxi7eXDVTBQK0t6ZsvKz9uz7S6mFE,7
|
|
46
|
-
nepali-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|