crxsnake 1.3.1__tar.gz → 1.3.2__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.
- {crxsnake-1.3.1 → crxsnake-1.3.2}/PKG-INFO +4 -1
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/__init__.py +7 -7
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/cogs.py +4 -3
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/files.py +7 -7
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/issues/crx.py +3 -2
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/issues/hotline.py +8 -6
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/tortoise.py +3 -8
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake.egg-info/PKG-INFO +4 -1
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake.egg-info/requires.txt +1 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/setup.py +7 -2
- {crxsnake-1.3.1 → crxsnake-1.3.2}/LICENSE +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/README.md +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/issues/__init__.py +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/logger.py +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake/misc.py +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake.egg-info/SOURCES.txt +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake.egg-info/dependency_links.txt +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/crxsnake.egg-info/top_level.txt +0 -0
- {crxsnake-1.3.1 → crxsnake-1.3.2}/setup.cfg +0 -0
@@ -1,12 +1,15 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crxsnake
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.2
|
4
4
|
Home-page: https://discord.gg/EEp67FWQDP
|
5
5
|
Author: CRX-DEV
|
6
6
|
Author-email: cherniq66@gmail.com
|
7
7
|
License: MIT License
|
8
|
+
Project-URL: Repository, https://github.com/CRX-DEV/crxsnake
|
9
|
+
Project-URL: Discord, https://discord.gg/EEp67FWQDP
|
8
10
|
Description-Content-Type: text/markdown
|
9
11
|
License-File: LICENSE
|
12
|
+
Requires-Dist: setuptools==72.2.0
|
10
13
|
Requires-Dist: tortoise-orm==0.21.0
|
11
14
|
Requires-Dist: disnake==2.9.2
|
12
15
|
Requires-Dist: aiofiles==23.2.1
|
@@ -9,11 +9,11 @@ from .issues.crx import IssueCRX
|
|
9
9
|
|
10
10
|
|
11
11
|
__all__ = [
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
"logger",
|
13
|
+
"load_cogs",
|
14
|
+
"read_json",
|
15
|
+
"write_json",
|
16
|
+
"Database",
|
17
|
+
"IssueHotline",
|
18
|
+
"IssueCRX",
|
19
19
|
]
|
@@ -1,9 +1,10 @@
|
|
1
|
+
from loguru import logger
|
2
|
+
|
1
3
|
from sys import path
|
2
4
|
from pathlib import Path
|
3
|
-
from rich.console import Console
|
4
5
|
|
5
6
|
|
6
|
-
async def load_cogs(bot, directory="src"):
|
7
|
+
async def load_cogs(bot, directory="src") -> None:
|
7
8
|
directory_path = Path(directory)
|
8
9
|
path.append(str(directory_path))
|
9
10
|
|
@@ -13,4 +14,4 @@ async def load_cogs(bot, directory="src"):
|
|
13
14
|
try:
|
14
15
|
bot.load_extension(f"{entry.name}.{filename.stem}")
|
15
16
|
except Exception:
|
16
|
-
|
17
|
+
logger.exception(f"An error occurred while loading cog {entry.name}.{filename.stem}")
|
@@ -1,9 +1,9 @@
|
|
1
|
+
from loguru import logger
|
2
|
+
from aiofiles import open
|
3
|
+
|
1
4
|
from typing import Optional, Any
|
2
5
|
from json import loads, dumps
|
3
6
|
|
4
|
-
from aiofiles import open
|
5
|
-
from rich.console import Console
|
6
|
-
|
7
7
|
|
8
8
|
async def read_json(path: str, *keys: str) -> Optional[Any]:
|
9
9
|
"""
|
@@ -22,16 +22,16 @@ async def read_json(path: str, *keys: str) -> Optional[Any]:
|
|
22
22
|
return file_data
|
23
23
|
|
24
24
|
except Exception:
|
25
|
-
|
25
|
+
logger.exception("An error occurred while reading json file")
|
26
26
|
|
27
27
|
|
28
|
-
async def write_json(path: str, data: Any) ->
|
28
|
+
async def write_json(path: str, data: Any) -> bool:
|
29
29
|
"""
|
30
30
|
Write data to json file.
|
31
31
|
"""
|
32
32
|
try:
|
33
33
|
async with open(path, "w", encoding="utf-8") as file:
|
34
34
|
await file.write(dumps(data, ensure_ascii=False, indent=2))
|
35
|
-
|
35
|
+
return True
|
36
36
|
except Exception:
|
37
|
-
|
37
|
+
logger.exception("An error occurred while writing json file")
|
@@ -3,12 +3,13 @@ from typing import List, Dict, Any
|
|
3
3
|
|
4
4
|
class IssueCRX:
|
5
5
|
async def create_items(
|
6
|
-
self,
|
6
|
+
self,
|
7
|
+
issue_type: str,
|
8
|
+
items_list: List[Dict[str, Any]]
|
7
9
|
) -> Dict[str, List[Dict[str, Any]]]:
|
8
10
|
"""
|
9
11
|
Create a dictionary with generated codes and processed items.
|
10
12
|
"""
|
11
|
-
|
12
13
|
issue_dict = {"items": [], "cars": [], "sets": []}
|
13
14
|
issue_dict[issue_type].extend(items_list)
|
14
15
|
return issue_dict
|
@@ -13,13 +13,13 @@ class IssueHotline:
|
|
13
13
|
return f"{part1}-{part2}-{part3}"
|
14
14
|
|
15
15
|
async def __generate_count(
|
16
|
-
self,
|
16
|
+
self,
|
17
|
+
items_list: List[Dict[str, Any]]
|
17
18
|
) -> AsyncGenerator[Dict[str, Any], None]:
|
18
19
|
"""
|
19
20
|
Generate item counts based on the MAX_STACK value.
|
20
21
|
Splits items into full stacks and the remainder.
|
21
22
|
"""
|
22
|
-
|
23
23
|
for item in items_list:
|
24
24
|
item_count = item.get("m_count", 0)
|
25
25
|
item_name = item.get("m_item", "")
|
@@ -32,12 +32,13 @@ class IssueHotline:
|
|
32
32
|
yield {"m_item": item_name, "m_count": remainder}
|
33
33
|
|
34
34
|
async def create_items(
|
35
|
-
self,
|
35
|
+
self,
|
36
|
+
issue_name: str,
|
37
|
+
items_list: List[Dict[str, Any]]
|
36
38
|
) -> Dict[str, Any]:
|
37
39
|
"""
|
38
40
|
Create a dictionary with generated codes and processed items.
|
39
41
|
"""
|
40
|
-
|
41
42
|
processed_items = [item async for item in self.__generate_count(items_list)]
|
42
43
|
return {
|
43
44
|
"m_CodeArray": [
|
@@ -55,12 +56,13 @@ class IssueHotline:
|
|
55
56
|
}
|
56
57
|
|
57
58
|
async def create_vehicle(
|
58
|
-
self,
|
59
|
+
self,
|
60
|
+
issue_name: str,
|
61
|
+
items_dict: Dict[str, Any]
|
59
62
|
) -> Dict[str, Any]:
|
60
63
|
"""
|
61
64
|
Create a dictionary with generated code and vehicle data.
|
62
65
|
"""
|
63
|
-
|
64
66
|
return {
|
65
67
|
"m_CodeArray": [
|
66
68
|
{
|
@@ -1,5 +1,5 @@
|
|
1
|
+
from loguru import logger
|
1
2
|
from tortoise import Tortoise
|
2
|
-
from rich.console import Console
|
3
3
|
|
4
4
|
|
5
5
|
class Database:
|
@@ -13,16 +13,11 @@ class Database:
|
|
13
13
|
try:
|
14
14
|
await Tortoise.init(db_url=self.DB_URL, modules=self.DB_MODEL)
|
15
15
|
await Tortoise.generate_schemas()
|
16
|
-
|
17
16
|
except Exception:
|
18
|
-
|
17
|
+
logger.exception("An error occurred while connecting to the database")
|
19
18
|
|
20
19
|
async def db_disconnect(self) -> None:
|
21
20
|
"""
|
22
21
|
Disconnect from the database.
|
23
22
|
"""
|
24
|
-
|
25
|
-
await Tortoise.close_connections()
|
26
|
-
|
27
|
-
except Exception:
|
28
|
-
Console().print_exception(show_locals=True)
|
23
|
+
await Tortoise.close_connections()
|
@@ -1,12 +1,15 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crxsnake
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.2
|
4
4
|
Home-page: https://discord.gg/EEp67FWQDP
|
5
5
|
Author: CRX-DEV
|
6
6
|
Author-email: cherniq66@gmail.com
|
7
7
|
License: MIT License
|
8
|
+
Project-URL: Repository, https://github.com/CRX-DEV/crxsnake
|
9
|
+
Project-URL: Discord, https://discord.gg/EEp67FWQDP
|
8
10
|
Description-Content-Type: text/markdown
|
9
11
|
License-File: LICENSE
|
12
|
+
Requires-Dist: setuptools==72.2.0
|
10
13
|
Requires-Dist: tortoise-orm==0.21.0
|
11
14
|
Requires-Dist: disnake==2.9.2
|
12
15
|
Requires-Dist: aiofiles==23.2.1
|
@@ -4,16 +4,20 @@ from pathlib import Path
|
|
4
4
|
this_directory = Path(__file__).parent
|
5
5
|
long_description = (this_directory / "README.md").read_text()
|
6
6
|
requires = [
|
7
|
+
"setuptools==72.2.0",
|
7
8
|
"tortoise-orm==0.21.0",
|
8
9
|
"disnake==2.9.2",
|
9
10
|
"aiofiles==23.2.1",
|
10
11
|
"loguru==0.7.2",
|
11
12
|
]
|
12
|
-
|
13
|
+
urls = {
|
14
|
+
"Repository": "https://github.com/CRX-DEV/crxsnake",
|
15
|
+
"Discord": "https://discord.gg/EEp67FWQDP",
|
16
|
+
}
|
13
17
|
|
14
18
|
setup(
|
15
19
|
name="crxsnake",
|
16
|
-
version="1.3.
|
20
|
+
version="1.3.2",
|
17
21
|
long_description=long_description,
|
18
22
|
long_description_content_type="text/markdown",
|
19
23
|
author="CRX-DEV",
|
@@ -22,4 +26,5 @@ setup(
|
|
22
26
|
license="MIT License",
|
23
27
|
packages=find_packages(),
|
24
28
|
install_requires=requires,
|
29
|
+
project_urls=urls
|
25
30
|
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|