morelists 0.1.2__tar.gz → 0.1.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: morelists
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: A small and easy list you can add together like a math equation and has a expiration date for items. Mostly useful for games with stats from multiple sources. More lists will come soon.
5
5
  Home-page: https://github.com/EmanuelNorsk/enlist
6
6
  Author: Emanuel Odén Hesselroth
@@ -39,6 +39,11 @@ class GameList():
39
39
 
40
40
 
41
41
  def safeSum(self):
42
+ """
43
+ Returns the sum in a safe matter.
44
+
45
+ Dont use this, please access the sum by using .sum
46
+ """
42
47
  try:
43
48
  return (self.addValue - self.subtractValue) * self.multiplyValue / self.divideValue
44
49
  except ZeroDivisionError:
@@ -151,6 +156,8 @@ class GameList():
151
156
 
152
157
  # update() ignore the reeze flag because it's assumed the user is calling it with the purpose of updating it manually
153
158
  try:
159
+ if len(self.expirationList.keys()) == 0:
160
+ return
154
161
  expiration = min(self.expirationList.keys())
155
162
  while expiration < time.time():
156
163
  if self.list[expiration]["type"] == "add":
@@ -387,10 +394,14 @@ class GameList():
387
394
  if name == "sum":
388
395
  if not object.__getattribute__(self, "freeze"):
389
396
  self.update()
390
- return (object.__getattribute__(self, "addValue") -
391
- object.__getattribute__(self, "subtractValue")) * \
392
- object.__getattribute__(self, "multiplyValue") / \
393
- object.__getattribute__(self, "divideValue")
397
+ try:
398
+ return (object.__getattribute__(self, "addValue") -
399
+ object.__getattribute__(self, "subtractValue")) * \
400
+ object.__getattribute__(self, "multiplyValue") / \
401
+ object.__getattribute__(self, "divideValue")
402
+ except ZeroDivisionError:
403
+ print("[WARNING]: While retrieving the sum, a ZeroDivisionError showed up. Defaulting to 0")
404
+ return 0
394
405
  elif name == "history":
395
406
  if not object.__getattribute__(self, "freeze"):
396
407
  self.update()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: morelists
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: A small and easy list you can add together like a math equation and has a expiration date for items. Mostly useful for games with stats from multiple sources. More lists will come soon.
5
5
  Home-page: https://github.com/EmanuelNorsk/enlist
6
6
  Author: Emanuel Odén Hesselroth
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "morelists"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  description = "A small and easy list you can add together like a math equation and has a expiration date for items. Mostly useful for games with stats from multiple sources. More lists will come soon."
9
9
  authors = [{name = "Emanuel Odén Hesselroth", email = "emanuelodenhesselroth@gmail.com"}]
10
10
  license = {text = "MIT"}
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="morelists",
5
- version="0.1.2",
5
+ version="0.1.4",
6
6
  packages=find_packages(),
7
7
  install_requires=[],
8
8
  description="A small and easy list you can add together like a math equation and has a expiration date for items. Mostly useful for games with stats from multiple sources. More lists will come soon.",
File without changes
File without changes
File without changes