morelists 0.1.0__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.
- morelists-0.1.0/LICENSE +1 -0
- morelists-0.1.0/PKG-INFO +15 -0
- morelists-0.1.0/README.md +1 -0
- morelists-0.1.0/morelists/__init__.py +127 -0
- morelists-0.1.0/morelists.egg-info/PKG-INFO +15 -0
- morelists-0.1.0/morelists.egg-info/SOURCES.txt +9 -0
- morelists-0.1.0/morelists.egg-info/dependency_links.txt +1 -0
- morelists-0.1.0/morelists.egg-info/top_level.txt +1 -0
- morelists-0.1.0/pyproject.toml +17 -0
- morelists-0.1.0/setup.cfg +4 -0
- morelists-0.1.0/setup.py +12 -0
morelists-0.1.0/LICENSE
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Made 3/22/2025. Pls don't judge.
|
morelists-0.1.0/PKG-INFO
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: morelists
|
3
|
+
Version: 0.1.0
|
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
|
+
Home-page: https://github.com/EmanuelNorsk/enlist
|
6
|
+
Author: Emanuel Odén Hesselroth
|
7
|
+
Author-email: Emanuel Odén Hesselroth <emanuelodenhesselroth@gmail.com>
|
8
|
+
License: MIT
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
11
|
+
Classifier: Operating System :: OS Independent
|
12
|
+
Requires-Python: >=3.6
|
13
|
+
License-File: LICENSE
|
14
|
+
Dynamic: author
|
15
|
+
Dynamic: home-page
|
@@ -0,0 +1 @@
|
|
1
|
+
Just chill, don't judge my project
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import time
|
2
|
+
|
3
|
+
class GameList():
|
4
|
+
def __init__(self):
|
5
|
+
self.list = {}
|
6
|
+
self.flippedList = {}
|
7
|
+
|
8
|
+
self.addValue = 0
|
9
|
+
self.subtractValue = 0
|
10
|
+
self.multiplyValue = 1
|
11
|
+
self.divideValue = 1
|
12
|
+
self.sum = 0
|
13
|
+
|
14
|
+
def add(self, item, expires = -1):
|
15
|
+
expires += time.time()
|
16
|
+
self.list[expires] = {"name":item.get("name", ""), "type":item.get("type", "add"), "value":item.get("value", 0)}
|
17
|
+
if self.list[expires]["type"] not in ["add", "subtract", "multiply", "divide"]:
|
18
|
+
self.list[expires]["type"] = "add"
|
19
|
+
self.flippedList[str(self.list[expires])] = expires
|
20
|
+
|
21
|
+
if item["type"] == "add":
|
22
|
+
self.addValue += item["value"]
|
23
|
+
elif item["type"] == "subtract":
|
24
|
+
self.subtractValue += item["value"]
|
25
|
+
elif item["type"] == "multiply":
|
26
|
+
self.multiplyValue += (item["value"] - 1)
|
27
|
+
elif item["type"] == "divide":
|
28
|
+
self.divideValue += (item["value"] - 1)
|
29
|
+
|
30
|
+
def unsafeAdd(self, item, expires = -1):
|
31
|
+
expiration = expires + time.time()
|
32
|
+
self.list[expiration] = item
|
33
|
+
self.flippedList[str(item)] = expiration
|
34
|
+
|
35
|
+
if item["type"] == "add":
|
36
|
+
self.addValue += item["value"]
|
37
|
+
elif item["type"] == "subtract":
|
38
|
+
self.subtractValue += item["value"]
|
39
|
+
elif item["type"] == "multiply":
|
40
|
+
self.multiplyValue += (item["value"] - 1)
|
41
|
+
elif item["type"] == "divide":
|
42
|
+
self.divideValue += (item["value"] - 1)
|
43
|
+
|
44
|
+
|
45
|
+
def update(self):
|
46
|
+
try:
|
47
|
+
expiration = min(self.list.keys())
|
48
|
+
while expiration < time.time():
|
49
|
+
if self.list[expiration]["type"] == "add":
|
50
|
+
self.addValue -= self.list[expiration]["value"]
|
51
|
+
elif self.list[expiration]["type"] == "subtract":
|
52
|
+
self.subtractValue -= self.list[expiration]["value"]
|
53
|
+
elif self.list[expiration]["type"] == "multiply":
|
54
|
+
self.multiplyValue -= (self.list[expiration]["value"] - 1)
|
55
|
+
else:
|
56
|
+
self.divideValue -= (self.list[expiration]["value"] - 1)
|
57
|
+
del self.list[expiration]
|
58
|
+
|
59
|
+
expiration = min(self.list.keys())
|
60
|
+
except ValueError:
|
61
|
+
pass
|
62
|
+
|
63
|
+
def pop(self, name):
|
64
|
+
pops = [value for value in self.list.values() if value["name"] == name]
|
65
|
+
pops.sort(key=lambda a: a["expires"])
|
66
|
+
if pops:
|
67
|
+
del self.list[self.flippedList[str(pops[0])]]
|
68
|
+
del self.flippedList[str(pops[0])]
|
69
|
+
|
70
|
+
def popAny(self, name):
|
71
|
+
pops = [value for value in self.list.values() if value["name"] == name]
|
72
|
+
if pops:
|
73
|
+
del self.list[self.flippedList[str(pops[0])]]
|
74
|
+
del self.flippedList[str(pops[0])]
|
75
|
+
|
76
|
+
def popAll(self, name):
|
77
|
+
pops = [value for value in self.list.values() if value["name"] == name]
|
78
|
+
if pops:
|
79
|
+
for x in range(len(pops)):
|
80
|
+
del self.list[self.flippedList[str(pops[x])]]
|
81
|
+
del self.flippedList[str(pops[x])]
|
82
|
+
|
83
|
+
def remove(self, item):
|
84
|
+
if self.flippedList.get(str(item), None):
|
85
|
+
del self.list[self.flippedList[str(item)]]
|
86
|
+
del self.flippedList[str(item)]
|
87
|
+
|
88
|
+
if item["type"] == "add":
|
89
|
+
self.addValue -= item["value"]
|
90
|
+
elif item["type"] == "subtract":
|
91
|
+
self.subtractValue -= item["value"]
|
92
|
+
elif item["type"] == "multiply":
|
93
|
+
self.multiplyValue -= (item["value"] - 1)
|
94
|
+
else:
|
95
|
+
self.divideValue -= (item["value"] - 1)
|
96
|
+
|
97
|
+
def unsafeRemove(self, item):
|
98
|
+
if item in self.list.values():
|
99
|
+
del self.list[dict(self.flippedList[str(item)])]
|
100
|
+
del self.flippedList[str(item)]
|
101
|
+
|
102
|
+
if item["type"] == "add":
|
103
|
+
self.addValue -= item["value"]
|
104
|
+
elif item["type"] == "subtract":
|
105
|
+
self.subtractValue -= item["value"]
|
106
|
+
elif item["type"] == "multiply":
|
107
|
+
self.multiplyValue -= (item["value"] - 1)
|
108
|
+
else:
|
109
|
+
self.divideValue -= (item["value"] - 1)
|
110
|
+
|
111
|
+
def __getattribute__(self, name):
|
112
|
+
if name == "sum":
|
113
|
+
self.update()
|
114
|
+
return (object.__getattribute__(self, "addValue") -
|
115
|
+
object.__getattribute__(self, "subtractValue")) * \
|
116
|
+
object.__getattribute__(self, "multiplyValue") / \
|
117
|
+
object.__getattribute__(self, "divideValue")
|
118
|
+
return object.__getattribute__(self, name)
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: morelists
|
3
|
+
Version: 0.1.0
|
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
|
+
Home-page: https://github.com/EmanuelNorsk/enlist
|
6
|
+
Author: Emanuel Odén Hesselroth
|
7
|
+
Author-email: Emanuel Odén Hesselroth <emanuelodenhesselroth@gmail.com>
|
8
|
+
License: MIT
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
11
|
+
Classifier: Operating System :: OS Independent
|
12
|
+
Requires-Python: >=3.6
|
13
|
+
License-File: LICENSE
|
14
|
+
Dynamic: author
|
15
|
+
Dynamic: home-page
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
morelists
|
@@ -0,0 +1,17 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["setuptools", "wheel"]
|
3
|
+
build-backend = "setuptools.build_meta"
|
4
|
+
|
5
|
+
[project]
|
6
|
+
name = "morelists"
|
7
|
+
version = "0.1.0"
|
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
|
+
authors = [{name = "Emanuel Odén Hesselroth", email = "emanuelodenhesselroth@gmail.com"}]
|
10
|
+
license = {text = "MIT"}
|
11
|
+
dependencies = []
|
12
|
+
requires-python = ">=3.6" # This must be correctly set
|
13
|
+
classifiers = [
|
14
|
+
"Programming Language :: Python :: 3",
|
15
|
+
"License :: OSI Approved :: MIT License",
|
16
|
+
"Operating System :: OS Independent"
|
17
|
+
]
|
morelists-0.1.0/setup.py
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
from setuptools import setup, find_packages
|
2
|
+
|
3
|
+
setup(
|
4
|
+
name="morelists",
|
5
|
+
version="0.1.0",
|
6
|
+
packages=find_packages(),
|
7
|
+
install_requires=[],
|
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
|
+
author="Emanuel Odén Hesselroth",
|
10
|
+
author_email="emanuelodenhesselroth@gmail.com",
|
11
|
+
url="https://github.com/EmanuelNorsk/enlist",
|
12
|
+
)
|