eodash_catalog 0.0.7__py3-none-any.whl → 0.0.10__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 eodash_catalog might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Daniel Santillan <daniel.santillan@eox.at>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.0.7"
4
+ __version__ = "0.0.10"
@@ -4,8 +4,9 @@ This module defines a Duration class.
4
4
  The class Duration allows to define durations in years and months and can be
5
5
  used as limited replacement for timedelta objects.
6
6
  """
7
+
7
8
  from datetime import timedelta
8
- from decimal import Decimal, ROUND_FLOOR
9
+ from decimal import ROUND_FLOOR, Decimal
9
10
 
10
11
 
11
12
  def fquotmod(val, low, high):
@@ -82,9 +83,7 @@ class Duration:
82
83
  years = Decimal(str(years))
83
84
  self.months = months
84
85
  self.years = years
85
- self.tdelta = timedelta(
86
- days, seconds, microseconds, milliseconds, minutes, hours, weeks
87
- )
86
+ self.tdelta = timedelta(days, seconds, microseconds, milliseconds, minutes, hours, weeks)
88
87
 
89
88
  def __getstate__(self):
90
89
  return self.__dict__
@@ -167,13 +166,8 @@ class Duration:
167
166
  carry, newmonth = fquotmod(newmonth, 1, 13)
168
167
  newyear = other.year + self.years + carry
169
168
  maxdays = max_days_in_month(newyear, newmonth)
170
- if other.day > maxdays:
171
- newday = maxdays
172
- else:
173
- newday = other.day
174
- newdt = other.replace(
175
- year=int(newyear), month=int(newmonth), day=int(newday)
176
- )
169
+ newday = maxdays if other.day > maxdays else other.day
170
+ newdt = other.replace(year=int(newyear), month=int(newmonth), day=int(newday))
177
171
  # does a timedelta + date/datetime
178
172
  return self.tdelta + newdt
179
173
  except AttributeError:
@@ -252,13 +246,8 @@ class Duration:
252
246
  carry, newmonth = fquotmod(newmonth, 1, 13)
253
247
  newyear = other.year - self.years + carry
254
248
  maxdays = max_days_in_month(newyear, newmonth)
255
- if other.day > maxdays:
256
- newday = maxdays
257
- else:
258
- newday = other.day
259
- newdt = other.replace(
260
- year=int(newyear), month=int(newmonth), day=int(newday)
261
- )
249
+ newday = maxdays if other.day > maxdays else other.day
250
+ newdt = other.replace(year=int(newyear), month=int(newmonth), day=int(newday))
262
251
  return newdt - self.tdelta
263
252
  except AttributeError:
264
253
  # other probably was not compatible with data/datetime