Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-jdatetime for 
openSUSE:Factory checked in at 2023-12-08 22:32:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-jdatetime (Old)
 and      /work/SRC/openSUSE:Factory/.python-jdatetime.new.25432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-jdatetime"

Fri Dec  8 22:32:02 2023 rev:6 rq:1131725 version:4.1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-jdatetime/python-jdatetime.changes        
2022-06-24 08:45:10.499130066 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-jdatetime.new.25432/python-jdatetime.changes 
    2023-12-08 22:32:23.972763990 +0100
@@ -1,0 +2,8 @@
+Thu Dec  7 22:26:41 UTC 2023 - Dirk Müller <dmuel...@suse.com>
+
+- update to 4.1.1:
+  * Add `fromisoformat` method to `jdatetime.date`
+  * Add support for Python 3.11
+  * Fix two chars month handling in jdatetime.datetime.strptime
+
+-------------------------------------------------------------------

Old:
----
  v4.1.0.tar.gz

New:
----
  v4.1.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-jdatetime.spec ++++++
--- /var/tmp/diff_new_pack.opRemm/_old  2023-12-08 22:32:24.396779592 +0100
+++ /var/tmp/diff_new_pack.opRemm/_new  2023-12-08 22:32:24.396779592 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-jdatetime
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-jdatetime
-Version:        4.1.0
+Version:        4.1.1
 Release:        0
 Summary:        Jalali datetime binding for python
 License:        Python-2.0

++++++ v4.1.0.tar.gz -> v4.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-jalali-4.1.0/.github/workflows/publish-to-pypi.yml 
new/python-jalali-4.1.1/.github/workflows/publish-to-pypi.yml
--- old/python-jalali-4.1.0/.github/workflows/publish-to-pypi.yml       
2022-03-22 15:07:54.000000000 +0100
+++ new/python-jalali-4.1.1/.github/workflows/publish-to-pypi.yml       
2023-03-28 12:14:00.000000000 +0200
@@ -11,7 +11,7 @@
 jobs:
   build-n-publish:
     name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
-    runs-on: ubuntu-18.04
+    runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@master
     - name: Set up Python 3.9
@@ -31,12 +31,11 @@
         --sdist
         --wheel
         --outdir dist/
-#    to enable back on the next release
-#    - name: Publish distribution 📦 to Test PyPI
-#      uses: pypa/gh-action-pypi-publish@master
-#      with:
-#        password: ${{ secrets.TEST_PYPI_API_TOKEN }}
-#        repository_url: https://test.pypi.org/legacy/
+    - name: Publish distribution 📦 to Test PyPI
+      uses: pypa/gh-action-pypi-publish@master
+      with:
+        password: ${{ secrets.TEST_PYPI_API_TOKEN }}
+        repository_url: https://test.pypi.org/legacy/
     - name: Publish distribution 📦 to PyPI
       if: startsWith(github.ref, 'refs/tags')
       uses: pypa/gh-action-pypi-publish@master
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/.github/workflows/test.yml 
new/python-jalali-4.1.1/.github/workflows/test.yml
--- old/python-jalali-4.1.0/.github/workflows/test.yml  2022-03-22 
15:07:54.000000000 +0100
+++ new/python-jalali-4.1.1/.github/workflows/test.yml  2023-03-28 
12:14:00.000000000 +0200
@@ -12,7 +12,7 @@
     strategy:
       matrix:
         os: [ubuntu-latest]
-        python-version: ["3.7", "3.8", "3.9", "3.10"]
+        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
     name: OS ${{ matrix.os}} - Python ${{ matrix.python-version }}
     steps:
       - uses: actions/checkout@v2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/CHANGELOG.md 
new/python-jalali-4.1.1/CHANGELOG.md
--- old/python-jalali-4.1.0/CHANGELOG.md        2022-03-22 15:07:54.000000000 
+0100
+++ new/python-jalali-4.1.1/CHANGELOG.md        2023-03-28 12:14:00.000000000 
+0200
@@ -1,5 +1,14 @@
 # Changelog
 
+## [4.1.1] - 2023-03-28
+
+### Add
+* Add `fromisoformat` method to `jdatetime.date`
+* Add support for Python 3.11
+
+### Fixed
+* Fix two chars month handling in ``jdatetime.datetime.strptime``
+
 ## [4.1.0] - 2022-03-22
 ### Add
 * Add support for ``%z`` directive in ``jdatetime.datetime.strptime`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/appveyor.yml 
new/python-jalali-4.1.1/appveyor.yml
--- old/python-jalali-4.1.0/appveyor.yml        2022-03-22 15:07:54.000000000 
+0100
+++ new/python-jalali-4.1.1/appveyor.yml        2023-03-28 12:14:00.000000000 
+0200
@@ -8,6 +8,8 @@
       APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
     - PYTHON: "C:\\Python310"
       APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
+    - PYTHON: "C:\\Python311"
+      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
 
 init:
   - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/jdatetime/__init__.py 
new/python-jalali-4.1.1/jdatetime/__init__.py
--- old/python-jalali-4.1.0/jdatetime/__init__.py       2022-03-22 
15:07:54.000000000 +0100
+++ new/python-jalali-4.1.1/jdatetime/__init__.py       2023-03-28 
12:14:00.000000000 +0200
@@ -18,7 +18,7 @@
     GregorianToJalali, JalaliToGregorian, j_days_in_month,
 )
 
-__VERSION__ = "4.1.0"
+__VERSION__ = "4.1.1"
 MINYEAR = 1
 MAXYEAR = 9377
 
@@ -333,6 +333,21 @@
         (y, m, d) = GregorianToJalali(d.year, d.month, d.day).getJalaliList()
         return date(y, m, d)
 
+    @staticmethod
+    def fromisoformat(date_string: str):
+        """
+        Convert an ISO 8601 formatted string to a jdatetime.date
+        """
+        if not isinstance(date_string, str):
+            raise TypeError("fromisoformat: argument must be str")
+
+        iso_format_regex = r"(\d{4})-?(\d{2})-?(\d{2})"
+        matched_str = re.fullmatch(iso_format_regex, date_string)
+        if matched_str is not None:
+            return date(*map(int, matched_str.groups()))
+        else:
+            raise ValueError(f'Invalid isoformat string: {date_string!r}')
+
     def toordinal(self):
         """Return proleptic jalali ordinal. Farvardin 1 of year 1 which is 
equal to 622-3-21 of Gregorian."""
         d = self.togregorian()
@@ -648,17 +663,17 @@
 date.max = date(MAXYEAR, 12, 30)
 
 _DIRECTIVE_PATTERNS = {
-    '%Y': '(?P<Y>\d{4})',
-    '%y': '(?P<y>\d{2})',
-    '%m': '(?P<m>\d{1,2})',
-    '%d': '(?P<d>\d{1,2})',
-    '%H': '(?P<H>\d{1,2})',
-    '%M': '(?P<M>\d{1,2})',
-    '%S': '(?P<S>\d{1,2})',
-    '%f': '(?P<f>\d{1,6})',
-    '%B': '(?P<B>[a-zA-Z\u0600-\u06EF\uFB8A\u067E\u0686\u06AF]{3,12})',
-    '%b': '(?P<b>[a-zA-Z]{3})',
-    '%z': 
'(?P<z>[+-]\d\d:?[0-5\u06F0-\u06F5]\d(:?[0-5\u06F0-\u06F5]\d(\.\d{1,6})?)?)',
+    '%Y': r'(?P<Y>\d{4})',
+    '%y': r'(?P<y>\d{2})',
+    '%m': r'(?P<m>\d{1,2})',
+    '%d': r'(?P<d>\d{1,2})',
+    '%H': r'(?P<H>\d{1,2})',
+    '%M': r'(?P<M>\d{1,2})',
+    '%S': r'(?P<S>\d{1,2})',
+    '%f': r'(?P<f>\d{1,6})',
+    '%B': r'(?P<B>[a-zA-Z\u0600-\u06EF\uFB8A\u067E\u0686\u06AF]{2,12})',
+    '%b': r'(?P<b>[a-zA-Z]{3})',
+    '%z': 
r'(?P<z>[+-]\d\d:?[0-5\u06F0-\u06F5]\d(:?[0-5\u06F0-\u06F5]\d(\.\d{1,6})?)?)',
 }
 
 # Replace directives with patterns according to _DIRECTIVE_PATTERNS
@@ -797,6 +812,21 @@
             now_datetime.microsecond,
         )
 
+    @classmethod
+    def fromisoformat(cls, date_string: str):
+        """
+        Convert an ISO 8601 formatted string to a jdatetime.datetime
+        """
+        # Since we do not (yet?) support ISO week dates, the date and time
+        # separator is either at 8th or 10th position, see:
+        # 
https://github.com/python/cpython/blob/b2b85b5db9cfdb24f966b61757536a898abc3830/Lib/datetime.py#L271
+        separator_position = 10 if date_string[4] == '-' else 8
+        time_string = date_string[separator_position + 1:]
+        return cls.combine(
+            date.fromisoformat(date_string[:separator_position]),
+            time.fromisoformat(time_string) if time_string else time(),
+        )
+
     @staticmethod
     def fromtimestamp(timestamp, tz=None):
         """timestamp[, tz] -> tz's local time from POSIX timestamp."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/setup.py 
new/python-jalali-4.1.1/setup.py
--- old/python-jalali-4.1.0/setup.py    2022-03-22 15:07:54.000000000 +0100
+++ new/python-jalali-4.1.1/setup.py    2023-03-28 12:14:00.000000000 +0200
@@ -4,7 +4,7 @@
 
 setup(
     name='jdatetime',
-    version='4.1.0',
+    version='4.1.1',
     packages=['jdatetime', ],
     license='Python Software Foundation License',
     keywords='Jalali implementation of Python datetime',
@@ -24,6 +24,7 @@
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: 3.10",
+        "Programming Language :: Python :: 3.11",
         "Topic :: Software Development",
     ],
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/tests/test_jdate.py 
new/python-jalali-4.1.1/tests/test_jdate.py
--- old/python-jalali-4.1.0/tests/test_jdate.py 2022-03-22 15:07:54.000000000 
+0100
+++ new/python-jalali-4.1.1/tests/test_jdate.py 2023-03-28 12:14:00.000000000 
+0200
@@ -137,3 +137,20 @@
         with open('tests/pickled_objects/%s' % pickled_object_file, 'rb') as f:
             d = pickle.load(f)
         self.assertEqual(d, jdatetime.date(1400, 10, 11))
+
+    def test_fromisoformat(self):
+        self.assertEqual(
+            jdatetime.date.fromisoformat("1378-02-22"),
+            jdatetime.date(day=22, month=2, year=1378),
+        )
+
+        self.assertEqual(  # new Python 3.11 format
+            jdatetime.date.fromisoformat('14020231'),
+            jdatetime.date(1402, 2, 31),
+        )
+
+        with self.assertRaises(ValueError, msg="Invalid isoformat string: 
'some-invalid-format'"):
+            jdatetime.date.fromisoformat("some-invalid-format")
+
+        with self.assertRaises(TypeError, msg="fromisoformat: argument must be 
str"):
+            jdatetime.date.fromisoformat(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/tests/test_jdatetime.py 
new/python-jalali-4.1.1/tests/test_jdatetime.py
--- old/python-jalali-4.1.0/tests/test_jdatetime.py     2022-03-22 
15:07:54.000000000 +0100
+++ new/python-jalali-4.1.1/tests/test_jdatetime.py     2023-03-28 
12:14:00.000000000 +0200
@@ -11,6 +11,7 @@
 
 try:
     import greenlet
+
     greenlet_installed = True
 except ImportError:
     greenlet_installed = False
@@ -359,32 +360,34 @@
 
     def test_strptime_handle_b_B_directive(self):
         tests = [
-            ('14 Ordibehesht 1400', '%d %B %Y'),
-            ('14 ordibehesht 1400', '%d %B %Y'),
-            ('14 ordiBehesHt 1400', '%d %B %Y'),
-            ('Û±Û´ Ordibehesht Û±Û´Û°Û°', '%d %B %Y'),
-            ('Û±Û´ ordibehesht Û±Û´Û°Û°', '%d %B %Y'),
-            ('Û±Û´ orDibeHesht Û±Û´Û°Û°', '%d %B %Y'),
-            ('1Û´ Ordibehesht 14Û°Û°', '%d %B %Y'),
-            ('Û±4 ordibehesht 14Û°0', '%d %B %Y'),
-            ('Û±4 OrdiBeheshT 14Û°0', '%d %B %Y'),
-            ('۱۴ اردیبهشت ۱۴۰۰', '%d %B %Y'),
-            ('14 اردیبهشت 1400', '%d %B %Y'),
-            ('1۴ اردیبهشت ۱4۰0', '%d %B %Y'),
-            ('14 Ord 1400', '%d %b %Y'),
-            ('14 ord 1400', '%d %b %Y'),
-            ('14 oRD 1400', '%d %b %Y'),
-            ('Û±Û´ Ord Û±Û´Û°Û°', '%d %b %Y'),
-            ('Û±Û´ ord Û±Û´Û°Û°', '%d %b %Y'),
-            ('Û±Û´ OrD Û±Û´Û°Û°', '%d %b %Y'),
-            ('Û±4 Ord 14Û°0', '%d %b %Y'),
-            ('Û±4 ord 14Û°0', '%d %b %Y'),
-            ('Û±4 ORD 14Û°0', '%d %b %Y'),
+            ('14 Ordibehesht 1400', '%d %B %Y', (1400, 2, 14)),
+            ('14 ordibehesht 1400', '%d %B %Y', (1400, 2, 14)),
+            ('14 ordiBehesHt 1400', '%d %B %Y', (1400, 2, 14)),
+            ('Û±Û´ Ordibehesht Û±Û´Û°Û°', '%d %B %Y', (1400, 2, 14)),
+            ('Û±Û´ ordibehesht Û±Û´Û°Û°', '%d %B %Y', (1400, 2, 14)),
+            ('Û±Û´ orDibeHesht Û±Û´Û°Û°', '%d %B %Y', (1400, 2, 14)),
+            ('1Û´ Ordibehesht 14Û°Û°', '%d %B %Y', (1400, 2, 14)),
+            ('Û±4 ordibehesht 14Û°0', '%d %B %Y', (1400, 2, 14)),
+            ('Û±4 OrdiBeheshT 14Û°0', '%d %B %Y', (1400, 2, 14)),
+            ('۱۴ اردیبهشت ۱۴۰۰', '%d %B %Y', (1400, 2, 14)),
+            ('14 اردیبهشت 1400', '%d %B %Y', (1400, 2, 14)),
+            ('1۴ اردیبهشت ۱4۰0', '%d %B %Y', (1400, 2, 14)),
+            ('14 Ord 1400', '%d %b %Y', (1400, 2, 14)),
+            ('14 ord 1400', '%d %b %Y', (1400, 2, 14)),
+            ('14 oRD 1400', '%d %b %Y', (1400, 2, 14)),
+            ('Û±Û´ Ord Û±Û´Û°Û°', '%d %b %Y', (1400, 2, 14)),
+            ('Û±Û´ ord Û±Û´Û°Û°', '%d %b %Y', (1400, 2, 14)),
+            ('Û±Û´ OrD Û±Û´Û°Û°', '%d %b %Y', (1400, 2, 14)),
+            ('Û±4 Ord 14Û°0', '%d %b %Y', (1400, 2, 14)),
+            ('Û±4 ord 14Û°0', '%d %b %Y', (1400, 2, 14)),
+            ('Û±4 ORD 14Û°0', '%d %b %Y', (1400, 2, 14)),
+            ('۱۴ دی ۱۴۰۰', '%d %B %Y', (1400, 10, 14)),
+            ('Û±Û´ dey Û±Û´Û°Û°', '%d %b %Y', (1400, 10, 14)),
         ]
-        for date_string, date_format in tests:
+        for date_string, date_format, expected_date in tests:
             with self.subTest(date_string=date_string, 
date_format=date_format):
                 date = jdatetime.datetime.strptime(date_string, date_format)
-                self.assertEqual(jdatetime.datetime(1400, 2, 14), date)
+                self.assertEqual(jdatetime.datetime(*expected_date), date)
 
     def test_strptime_invalid_date_string_b_directive(self):
         with self.assertRaises(ValueError, msg="time data '14 DRO 1400' does 
not match format '%d %b %Y'"):
@@ -846,3 +849,46 @@
         fa_greenlet.switch(fa_record, jdatetime.FA_LOCALE)
 
         self.assertEqual(['یک‌شنبه', 'خرداد'], fa_record)
+
+    def test_fromisoformat(self):
+        UTC = datetime.timezone.utc
+
+        self.assertEqual(
+            jdatetime.datetime.fromisoformat('1402-01-03T15:35:59.898169'),
+            jdatetime.datetime(1402, 1, 3, 15, 35, 59, 898169),
+        )
+
+        self.assertEqual(
+            jdatetime.datetime.fromisoformat('1401-11-04 00:05:23.283'),
+            jdatetime.datetime(1401, 11, 4, 0, 5, 23, 283000),
+        )
+
+        self.assertEqual(
+            jdatetime.datetime.fromisoformat('1403-11-04 00:05:23.283+00:00'),
+            jdatetime.datetime(1403, 11, 4, 0, 5, 23, 283000, tzinfo=UTC),
+        )
+
+        self.assertEqual(
+            jdatetime.datetime.fromisoformat('1400-11-04T00:05:23+04:00'),
+            jdatetime.datetime(
+                1400, 11, 4, 0, 5, 23, 0,
+                tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)),
+            ),
+        )
+
+        self.assertEqual(
+            jdatetime.datetime.fromisoformat('14020101'),
+            jdatetime.datetime(1402, 1, 1),
+        )
+
+        if sys.version_info[:2] >= (3, 11):  # new Python 3.11 time formats
+
+            self.assertEqual(
+                jdatetime.datetime.fromisoformat('1402-02-31T00:05:23Z'),
+                jdatetime.datetime(1402, 2, 31, 0, 5, 23, 0, tzinfo=UTC),
+            )
+
+            self.assertEqual(
+                jdatetime.datetime.fromisoformat('14031230T010203'),
+                jdatetime.datetime(1403, 12, 30, 1, 2, 3),
+            )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jalali-4.1.0/tox.ini 
new/python-jalali-4.1.1/tox.ini
--- old/python-jalali-4.1.0/tox.ini     2022-03-22 15:07:54.000000000 +0100
+++ new/python-jalali-4.1.1/tox.ini     2023-03-28 12:14:00.000000000 +0200
@@ -1,6 +1,6 @@
 [tox]
 envlist =
-    py{37,38,39,310}
+    py{37,38,39,310,311}
     flake8
     isort
 
@@ -10,6 +10,7 @@
     3.8: py38
     3.9: py39
     3.10: py310
+    3.11: py311
 
 [testenv]
 deps =

Reply via email to