[Git][debian-gis-team/cftime][master] 4 commits: New upstream version 1.0.0

Bas Couwenberg gitlab at salsa.debian.org
Thu May 17 06:17:02 BST 2018


Bas Couwenberg pushed to branch master at Debian GIS Project / cftime


Commits:
3560b673 by Bas Couwenberg at 2018-05-17T07:05:14+02:00
New upstream version 1.0.0
- - - - -
e3a5a8c8 by Bas Couwenberg at 2018-05-17T07:05:15+02:00
Merge tag 'upstream/1.0.0'

Upstream version 1.0.0

- - - - -
7a69f7cb by Bas Couwenberg at 2018-05-17T07:05:34+02:00
New upstream release.

- - - - -
64188364 by Bas Couwenberg at 2018-05-17T07:06:28+02:00
Set distribution to unstable.

- - - - -


7 changed files:

- .gitignore
- cftime/_cftime.pyx
- debian/changelog
- + docs/api.rst
- docs/index.rst
- + docs/installing.rst
- test/test_cftime.py


Changes:

=====================================
.gitignore
=====================================
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ build/
 *.egg-info
 _build/
 __pycache__
+.pytest_cache/


=====================================
cftime/_cftime.pyx
=====================================
--- a/cftime/_cftime.pyx
+++ b/cftime/_cftime.pyx
@@ -3,16 +3,15 @@ Performs conversions of netCDF time coordinate data to/from datetime objects.
 """
 
 from cpython.object cimport PyObject_RichCompare
-
+import cython
 import numpy as np
 import math
 import numpy
 import re
-
+import time
 from datetime import datetime as real_datetime
 from datetime import timedelta, MINYEAR
 import time                     # strftime
-
 try:
     from itertools import izip as zip
 except ImportError:  # python 3.x
@@ -28,7 +27,7 @@ _units = microsec_units+millisec_units+sec_units+min_units+hr_units+day_units
 _calendars = ['standard', 'gregorian', 'proleptic_gregorian',
               'noleap', 'julian', 'all_leap', '365_day', '366_day', '360_day']
 
-__version__ = '1.0.0b1'
+__version__ = '1.0.0'
 
 # Adapted from http://delete.me.uk/2005/03/iso8601.html
 # Note: This regex ensures that all ISO8601 timezone formats are accepted - but, due to legacy support for other timestrings, not all incorrect formats can be rejected.
@@ -1495,6 +1494,7 @@ _converters = {}
 for calendar in _calendars:
     _converters[calendar] = utime("seconds since 1-1-1", calendar)
 
+ at cython.embedsignature(True)
 cdef class datetime(object):
     """
 The base class implementing most methods of datetime classes that
@@ -1533,12 +1533,17 @@ Gregorial calendar.
         return '%Y-%m-%d %H:%M:%S'
 
     def strftime(self, format=None):
+        """
+        Return a string representing the date, controlled by an explicit format
+        string. For a complete list of formatting directives, see section
+        'strftime() and strptime() Behavior' in the base Python documentation.
+        """
         if format is None:
             format = self.format
         return _strftime(self, format)
 
     def replace(self, **kwargs):
-        "Return datetime with new specified fields."
+        """Return datetime with new specified fields."""
         args = {"year": self.year,
                 "month": self.month,
                 "day": self.day,
@@ -1555,8 +1560,15 @@ Gregorial calendar.
         return self.__class__(**args)
 
     def timetuple(self):
-        return (self.year, self.month, self.day, self.hour,
-                self.minute, self.second, self.dayofwk, self.dayofyr, -1)
+        """
+        Return a time.struct_time such as returned by time.localtime().
+        The DST flag is -1. d.timetuple() is equivalent to
+        time.struct_time((d.year, d.month, d.day, d.hour, d.minute,
+        d.second, d.weekday(), yday, dst)), where yday is the
+        day number within the current year starting with 1 for January 1st.
+        """
+        return time.struct_time((self.year, self.month, self.day, self.hour,
+                self.minute, self.second, self.dayofwk, self.dayofyr, -1))
 
     cpdef _to_real_datetime(self):
         return real_datetime(self.year, self.month, self.day,
@@ -1564,7 +1576,7 @@ Gregorial calendar.
                              self.microsecond)
 
     def __repr__(self):
-        return "{0}.{1}{2}".format(self.__class__.__module__,
+        return "{0}.{1}{2}".format('cftime',
                                    self.__class__.__name__,
                                    self._getstate())
 
@@ -1660,6 +1672,7 @@ Gregorial calendar.
             else:
                 return NotImplemented
 
+ at cython.embedsignature(True)
 cdef class DatetimeNoLeap(datetime):
     """
 Phony datetime object which mimics the python datetime object,
@@ -1674,6 +1687,7 @@ but uses the "noleap" ("365_day") calendar.
     cdef _add_timedelta(self, delta):
         return DatetimeNoLeap(*add_timedelta(self, delta, no_leap, False))
 
+ at cython.embedsignature(True)
 cdef class DatetimeAllLeap(datetime):
     """
 Phony datetime object which mimics the python datetime object,
@@ -1688,6 +1702,7 @@ but uses the "all_leap" ("366_day") calendar.
     cdef _add_timedelta(self, delta):
         return DatetimeAllLeap(*add_timedelta(self, delta, all_leap, False))
 
+ at cython.embedsignature(True)
 cdef class Datetime360Day(datetime):
     """
 Phony datetime object which mimics the python datetime object,
@@ -1702,6 +1717,7 @@ but uses the "360_day" calendar.
     cdef _add_timedelta(self, delta):
         return Datetime360Day(*add_timedelta_360_day(self, delta))
 
+ at cython.embedsignature(True)
 cdef class DatetimeJulian(datetime):
     """
 Phony datetime object which mimics the python datetime object,
@@ -1716,6 +1732,7 @@ but uses the "julian" calendar.
     cdef _add_timedelta(self, delta):
         return DatetimeJulian(*add_timedelta(self, delta, is_leap_julian, False))
 
+ at cython.embedsignature(True)
 cdef class DatetimeGregorian(datetime):
     """
 Phony datetime object which mimics the python datetime object,
@@ -1744,6 +1761,7 @@ a datetime.datetime instance or vice versa.
     cdef _add_timedelta(self, delta):
         return DatetimeGregorian(*add_timedelta(self, delta, is_leap_gregorian, True))
 
+ at cython.embedsignature(True)
 cdef class DatetimeProlepticGregorian(datetime):
     """
 Phony datetime object which mimics the python datetime object,


=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,10 @@
-cftime (1.0.0~b1-2) UNRELEASED; urgency=medium
+cftime (1.0.0-1) unstable; urgency=medium
 
+  * New upstream release.
   * Drop ancient X-Python-version field.
   * Strip trailing whitespace from control & rules.
 
- -- Bas Couwenberg <sebastic at debian.org>  Sun, 06 May 2018 08:56:48 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Thu, 17 May 2018 07:06:15 +0200
 
 cftime (1.0.0~b1-1) unstable; urgency=medium
 


=====================================
docs/api.rst
=====================================
--- /dev/null
+++ b/docs/api.rst
@@ -0,0 +1,7 @@
+API
+===
+
+.. automodule:: cftime
+   :members: datetime, date2num, date2index, num2date, JulianDayFromDate, DatetimeJulian, DatetimeProlepticGregorian, DatetimeNoLeap, DatetimeAllLeap, DatetimeGregorian
+   :show-inheritance:
+   :noindex:
\ No newline at end of file


=====================================
docs/index.rst
=====================================
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -4,16 +4,17 @@ cftime
 Python library for decoding time units and variable values in a netCDF file
 conforming to the Climate and Forecasting (CF) netCDF conventions.
 
+Contents
+--------
+
 .. toctree::
    :maxdepth: 2
-   :caption: Contents:
-
-.. automodule:: cftime
-   :members: datetime, date2num, date2index, num2date, JulianDayFromDate, DatetimeJulian, DatetimeProlepticGregorian, DatetimeNoLeap, DatetimeAllLeap, DatetimeGregorian
 
+   installing
+   api
 
 Indices and tables
-==================
+------------------
 
 * :ref:`genindex`
 * :ref:`modindex`


=====================================
docs/installing.rst
=====================================
--- /dev/null
+++ b/docs/installing.rst
@@ -0,0 +1,42 @@
+Installation
+============
+
+Required dependencies
+---------------------
+
+- Python 2.7, 3.4, 3.5, or 3.6
+- `numpy <http://www.numpy.org/>`__ (1.7 or later)
+
+
+Instructions
+------------
+
+The easiest way to get everything installed is to use conda_ command line tool::
+
+    $ conda install cftime
+
+.. _conda: http://conda.io/
+
+We recommend using the community maintained `conda-forge <https://conda-forge.github.io/>`__ channel if you need difficult\-to\-build dependencies such as cartopy or pynio::
+
+    $ conda install -c conda-forge cftime
+
+New releases may also appear in conda-forge before being updated in the default
+channel.
+
+If you don't use conda, be sure you have the required dependencies (numpy and
+cython) installed first. Then, install cftime with pip::
+
+    $ pip install cftime
+
+
+Developing
+----------
+
+
+When developing we recommend cloning the GitHub repository,
+building the extension in-place with `cython <http://cython.org/>`__ 0.19 or later
+``python setup.py build_ext --inplace``
+
+and running the test suite to check if the changes are passing the tests
+``pytest --pyargs test``


=====================================
test/test_cftime.py
=====================================
--- a/test/test_cftime.py
+++ b/test/test_cftime.py
@@ -1230,5 +1230,13 @@ def test_num2date_only_use_cftime_datetimes_post_gregorian(
     assert isinstance(result, expected_date_type)
 
 
+def test_repr():
+    expected = 'cftime.datetime(2000, 1, 1, 0, 0, 0, 0, -1, 1)'
+    assert repr(datetimex(2000, 1, 1)) == expected
+
+    expected = 'cftime.DatetimeGregorian(2000, 1, 1, 0, 0, 0, 0, -1, 1)'
+    assert repr(DatetimeGregorian(2000, 1, 1)) == expected
+
+
 if __name__ == '__main__':
     unittest.main()



View it on GitLab: https://salsa.debian.org/debian-gis-team/cftime/compare/6ad5722c2cfba74cd259257637a302621617a86a...64188364912ce0132c4b5cfe1ac2b31603b98482

---
View it on GitLab: https://salsa.debian.org/debian-gis-team/cftime/compare/6ad5722c2cfba74cd259257637a302621617a86a...64188364912ce0132c4b5cfe1ac2b31603b98482
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180517/73919bd0/attachment-0001.html>


More information about the Pkg-grass-devel mailing list