Skip to content

Commit 65086cb

Browse files
authored
Merge pull request #644 from davidhozic/develop
Merge develop into master
2 parents 6e7823b + f2ffcd9 commit 65086cb

25 files changed

+242
-344
lines changed

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
python -m build
3131
3232
- name: Publish package
33-
uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241
33+
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70
3434
with:
3535
user: __token__
3636
password: ${{ secrets.PYPI_API_TOKEN }}

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build:
1212
apt_packages:
1313
- inkscape
1414
tools:
15-
python: "3.9"
15+
python: "3.12"
1616
jobs:
1717
pre_build:
1818
- pip install .[all] .[docs]

docs/source/changelog.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,27 @@ Glossary
3737
Releases
3838
---------------------
3939

40+
v4.2.0
41+
=====================
42+
- Deprecated parameters will now raise an exception:
43+
44+
- :class:`daf.guild.AutoGUILD` and :class:`daf.message.AutoCHANNEL`:
45+
46+
- ``include_pattern``: :class:`TypeError` when using :class:`str`. Logical operators are now required.
47+
- ``exclude_pattern``: :class:`NameError` when used.
48+
49+
- :class:`daf.message.TextMESSAGE`,
50+
:class:`daf.message.VoiceMESSAGE` and
51+
:class:`daf.message.DirectMESSAGE`:
52+
53+
- ``start_period``: :class:`NameError` when used.
54+
- ``end_period``: :class:`NameError` when used.
55+
- ``start_in``: :class:`NameError` when used.
56+
- ``data`` parameter now requires subclasses of ``BaseMessageData`` instead of plain types.
57+
Additionally, the ``data_function`` can no longer be used and has been removed completely.
58+
59+
60+
4061
v4.1.1
4162
=====================
4263
- Fixed segmentation-fault crash when using Python 3.12+.

requirements/docs.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
sphinx==7.3.7
2-
sphinx-autobuild==2024.9.3
1+
sphinx==8.2.3
2+
sphinx-autobuild==2024.9.19
33
sphinx-copybutton==0.5.2
44
furo==2024.8.6
55
enum-tools[sphinx]==0.12.0
66
sphinx-design[furo]==0.6.1
77
readthedocs-sphinx-search==0.3.2
8-
sphinxcontrib-svg2pdfconverter==1.2.2
8+
sphinxcontrib-svg2pdfconverter==1.3.0

requirements/mandatory.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
aiohttp>=3.9.0,<3.11.0
2-
aiohttp_socks>=0.8,<0.10
1+
aiohttp>=3.9.0,<3.12.0
2+
aiohttp_socks>=0.8,<0.11
33
typeguard>=2.13,<2.14
44
typing_extensions>=4,<5; python_version < "3.11"
5-
tkinter-async-execute>=1.2,<1.4
5+
tkinter-async-execute>=1.2,<1.5
66
asyncio-event-hub>=1.0,<1.2
77
tkclasswiz>=1.4,<1.5
88
ttkbootstrap==1.10.1
9-
pillow>=10.4.0,<10.5.0
10-
audioop-lts~=0.2.0; python_version>='3.13'
9+
audioop-lts~=0.2.1; python_version>='3.13'
10+
pillow>=10.4.0,<11.2.0

requirements/sql.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
sqlalchemy[asyncio]>=2.0,<3.0
2-
aiosqlite>=0.19,<0.21
2+
aiosqlite>=0.19,<0.22
33
pymssql>=2.2,<2.4
44
asyncpg>=0.29,<0.31
55
asyncmy>=0.2,<0.3

requirements/web.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
selenium>=4.16,<4.25
1+
selenium>=4.16,<4.30
22
undetected-chromedriver>=3.5,<3.6
33
webdriver-manager>=4.0,<4.1
4+
setuptools>=77.0,<77.1; python_version>='3.12'

src/daf/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@
1818
from .responder import *
1919
from .messagedata import *
2020

21-
22-
VERSION = "4.1.2"
21+
VERSION = "4.2.0"

src/daf/dtypes.py

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,16 @@
22
The module contains definitions regarding the data types
33
you can send using the xxxMESSAGE objects.
44
"""
5-
from typing import Any, Callable, Coroutine, Union, Optional
6-
from functools import wraps
5+
from typing import Callable
76

87
from .logging.tracing import *
9-
from .misc import doc
10-
11-
import importlib.util as iu
12-
import io
138

149

1510
__all__ = (
1611
"data_function",
17-
"_FunctionBaseCLASS",
1812
)
1913

2014

21-
class GLOBALS:
22-
"Storage class used for storing global variables"
23-
24-
25-
26-
#######################################################################
27-
# Decorators
28-
#######################################################################
29-
class _FunctionBaseCLASS:
30-
"""
31-
Used as a base class to FunctionCLASS which gets created in :ref:`data_function` decorator.
32-
Because the FunctionCLASS is inaccessible outside the :ref:`data_function` decorator,
33-
this class is used to detect if the MESSAGE.data parameter is of function type,
34-
because the function isinstance also returns True when comparing
35-
the object to it's class or to the base class from which the object class is inherited from.
36-
"""
37-
38-
3915
def data_function(fnc: Callable):
4016
"""
4117
Decorator used for wrapping a function that will return data to send when the message is ready.
@@ -73,50 +49,7 @@ def get_data():
7349
a ``data`` parameter to the :ref:`Messages` objects.
7450
"""
7551
trace(
76-
"Using @data_function is deprecated. Use DynamicMessageData / DynamicMessageData instead.",
77-
TraceLEVELS.DEPRECATED
52+
"Using @data_function is deprecated and its usage is no longer allowed. Use DynamicMessageData / DynamicMessageData instead.",
53+
TraceLEVELS.ERROR,
54+
exception_cls=NameError
7855
)
79-
80-
@wraps(fnc, updated=[])
81-
class FunctionCLASS(_FunctionBaseCLASS):
82-
"""
83-
Used for creating special classes that are then used to create objects in the daf.MESSAGE
84-
data parameter, allows for sending dynamic content received thru an user defined function.
85-
86-
Parameters
87-
-----------
88-
- Custom number of positional and keyword arguments.
89-
90-
.. literalinclude:: ../../Examples/Message Types/TextMESSAGE/main_data_function.py
91-
:language: python
92-
"""
93-
__slots__ = (
94-
"args",
95-
"kwargs",
96-
"func_name",
97-
)
98-
99-
def __init__(self, *args: Any, **kwargs: Any):
100-
self.fnc = fnc
101-
self.args = args
102-
self.kwargs = kwargs
103-
self.func_name = fnc.__name__
104-
105-
async def retrieve(self):
106-
"""
107-
Retrieves the data from the user function.
108-
"""
109-
_ = fnc(*self.args, **self.kwargs)
110-
if isinstance(_, Coroutine):
111-
return await _
112-
return _
113-
114-
def __str__(self) -> str:
115-
return self.func_name
116-
117-
return FunctionCLASS
118-
119-
120-
#######################################################################
121-
# Other
122-
#######################################################################

src/daf/guild/autoguild.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,24 @@ def __init__(
140140
invite_track = []
141141

142142
if isinstance(include_pattern, str):
143+
include_pattern = regex(re.sub(r"\s*\|\s*", '', include_pattern))
143144
trace(
144-
"Using text (str) on 'include_pattern' parameter of AutoGUILD is deprecated (planned for removal in 4.2.0)!\n"
145-
"Use logical operators instead (daf.logic). E. g., regex, contains, or_, ...\n",
146-
TraceLEVELS.DEPRECATED
145+
"Using text (str) on 'include_pattern' parameter of AutoGUILD is deprecated and has been removed!\n"
146+
"Use logical operators instead (daf.logic). E. g., regex, contains, or_, ...\n"
147+
f"E. g., use {include_pattern.__class__} as the include_pattern parameter.",
148+
TraceLEVELS.ERROR,
149+
exception_cls=TypeError
147150
)
148-
include_pattern = regex(re.sub(r"\s*\|\s*", '', include_pattern))
149151

150152
if exclude_pattern is not None:
151-
trace(
152-
"'exclude_pattern' parameter is deprecated (planned for removal in 4.2.0)!\n",
153-
TraceLEVELS.DEPRECATED
154-
)
155153
exclude_pattern = regex(re.sub(r"\s*\|\s*", '', exclude_pattern))
156154
include_pattern = and_(include_pattern, not_(exclude_pattern))
155+
trace(
156+
"'exclude_pattern' parameter is deprecated and has been removed!\n"
157+
f"Use {include_pattern.__class__} instead at the include_pattern parameter.",
158+
TraceLEVELS.ERROR,
159+
exception_cls=NameError
160+
)
157161

158162
self.include_pattern = include_pattern
159163
self._remove_after = remove_after
@@ -163,7 +167,8 @@ def __init__(
163167
if auto_join is not None: # TODO: remove in future after feature is reenabled.
164168
auto_join = None
165169
trace(
166-
"Automatic join feature is currently disabled and will not work. It will be reenabled in a future version.",
170+
"Automatic join feature is currently disabled and will not work. It will be reenabled in a future version\n"
171+
"when a suitable new server provider is found",
167172
TraceLEVELS.WARNING
168173
)
169174

@@ -443,9 +448,7 @@ async def _on_update(self, _, init_options, **kwargs):
443448
if "invite_track" not in kwargs:
444449
kwargs["invite_track"] = list(self._invite_join_count.keys())
445450

446-
if "exclude_pattern" not in kwargs: # DEPRECATED; TODO: remove in 4.2.0
447-
kwargs["exclude_pattern"] = None
448-
451+
kwargs["exclude_pattern"] = None
449452
kwargs["messages"] = kwargs.pop("messages", self._messages)
450453
if init_options is None:
451454
init_options = {"parent": self.parent, "event_ctrl": self._event_ctrl}

0 commit comments

Comments
 (0)