Skip to content

Commit dfad7cb

Browse files
authored
remove_object, TypeError, ValueError, Documentation (#163)
* Better exs (#154) * Timedelta on period parameters (#157) * Parameter updates - Timedelta on period parameters, - forced type annotations for some functions, classes * ``.update`` methods to support channel checking (#159) Updated ``.update`` methods to support new channel checking * requirement (#160) * Stronger Types (#162) * Remove Message refactor, TypeError, ValueError * Documentation * Documentation
1 parent 38c178e commit dfad7cb

File tree

16 files changed

+342
-304
lines changed

16 files changed

+342
-304
lines changed

docs/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ help:
1919

2020
html: Makefile
2121
$(SPHINXBUILD) -b $@ source/ build/html
22-
python3.8 scripts/add_tracking.py
2322

2423

2524
%: Makefile

docs/scripts/add_tracking.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/scripts/generate_autodoc.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
import sys
55

66
# Set current working directory to scripts folder
7-
for path, dirs, files in os.walk("./"):
8-
for dir in dirs:
9-
if dir == "scripts":
10-
os.chdir(os.path.join(path, dir))
11-
break
7+
os.chdir(os.path.dirname(__file__))
128

139

1410
sys.path.append(os.path.abspath("../../src"))
@@ -18,16 +14,18 @@
1814
"""
1915
{function_name}
2016
--------------------------
21-
.. autofunction:: framework.{function_name}
17+
.. autofunction:: {module}.{function_name}
2218
"""
2319

2420
CLASS_TEMPLATE =\
2521
"""
2622
2723
{class_name}
28-
~~~~~~~~~~~~~~~~~~~~~~~~~
29-
.. autoclass:: framework.{class_name}
24+
~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
.. autoclass:: {class_path}
3026
:members:
27+
28+
{properties}
3129
"""
3230

3331

@@ -37,9 +35,18 @@
3735
name, item = item
3836
if not name.startswith(("_", "Base")):
3937
if inspect.isfunction(item):
40-
export_f += FUNCTION_TEMPLATE.format(function_name=item.__name__) + "\n"
38+
export_f += FUNCTION_TEMPLATE.format(module= item.__module__, function_name=item.__name__) + "\n"
4139
elif inspect.isclass(item):
42-
export_c += CLASS_TEMPLATE.format(class_name=item.__name__) + "\n"
40+
# Fill properties
41+
properties = []
42+
cls_path = f"{item.__module__}.{item.__name__}"
43+
for name in dir(item):
44+
attr = getattr(item, name)
45+
if isinstance(attr, property):
46+
properties.append(f".. autoproperty:: {cls_path}.{name}")
47+
48+
export_c += CLASS_TEMPLATE.format(class_name=item.__name__, class_path=cls_path, properties="\n\n ".join(properties)) + "\n"
49+
4350

4451

4552
with open("__autodoc_export_funct.rst", "w") as f:

docs/scripts/generate_error_codes.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,22 @@
66

77

88
# Set current working directory to scripts folder
9-
for path, dirs, files in os.walk("./"):
10-
for dir in dirs:
11-
if dir == "scripts":
12-
os.chdir(os.path.join(path, dir))
13-
break
9+
os.chdir(os.path.dirname(__file__))
1410

1511

1612
EXCEPTION_TEMPLATE =\
1713
"""
18-
| {error_name}| {error_code}| {error_message}|
19-
+----------------------------------------+------+----------------------------------------------------------------------------------------------------------------------------+"""
14+
{error_name}:
15+
Value: {error_code}
16+
17+
Info: {error_message}
18+
"""
19+
# """
20+
# | {error_name}| {error_code}| {error_message}|
21+
# +----------------------------------------+------+----------------------------------------------------------------------------------------------------------------------------+"""
2022

2123

22-
export_e = """\
23-
+----------------------------------------+------+----------------------------------------------------------------------------------------------------------------------------+
24-
| Name | Num | Description |
25-
+========================================+======+============================================================================================================================+"""
24+
export_e = ".. glossary::\n"
2625
fdata = ""
2726
with open("../../src/framework/exceptions.py", "r") as f:
2827
fdata += f.read()
@@ -33,9 +32,7 @@
3332
name = re.search(r"[A-z]+", exc).group(0)
3433
value = re.search(r"[0-9]+", exc).group(0)
3534
description = re.search(r"(?<=#:).+", exc).group(0).strip()
36-
export_e += EXCEPTION_TEMPLATE.format(error_name=name + "".join(' ' for i in range(39-len(name))), error_code=value + "".join(' ' for i in range(5-len(value))), error_message=description + "".join(' ' for i in range(123-len(description))))
37-
38-
export_e += ""
35+
export_e += EXCEPTION_TEMPLATE.format(error_name=name, error_code=value, error_message=description)
3936

4037

4138
with open("__autodoc_export_exceptions.rst", "w") as f:

docs/source/changelog.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ v2.1
1212
- ``timedelta`` object on ``start_period/end_period`` parameters
1313
- Replaced ``start_now`` with ``start_in`` parameter, deprecated use of bool value
1414
- :class:`framework.TextMESSAGE` and :class:`framework.VoiceMESSAGE` now check if the given channels are actually inside the guild
15-
- Fixed message slippage in case of slow Discord API calls or rate limit
15+
- Time slippage correction:
1616

17-
.. figure:: images/changelog_2_1_slippage_fix.png
18-
19-
Fixed message slippage in case of slow Discord API calls or rate limit
17+
.. figure:: images/changelog_2_1_slippage_fix.png
18+
19+
Time slippage correction
2020

2121

2222
v2.0

0 commit comments

Comments
 (0)