Compare commits

..

8 Commits
dev ... main

Author SHA1 Message Date
171e36a491 Merge pull request 'v3.2.3' (#118) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 1m2s
Tests / test (3.11) (push) Successful in 58s
Tests / test (3.8) (push) Successful in 1m4s
Tests / test (3.9) (push) Successful in 1m1s
Reviewed-on: #118
2024-07-10 00:07:54 +03:00
c419c684aa Merge pull request 'v3.2.2' (#107) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 1m10s
Tests / test (3.11) (push) Successful in 1m4s
Tests / test (3.8) (push) Successful in 1m6s
Tests / test (3.9) (push) Successful in 1m7s
Reviewed-on: #107
2024-05-26 22:44:18 +03:00
748b2b2abb Merge pull request 'v3.2.1' (#106) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 1m3s
Tests / test (3.11) (push) Successful in 1m23s
Tests / test (3.8) (push) Successful in 1m7s
Tests / test (3.9) (push) Successful in 1m7s
Reviewed-on: #106
2024-05-26 17:53:00 +03:00
52c2e5cc13 Merge pull request 'v3.2.0' (#105) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 1m4s
Tests / test (3.11) (push) Successful in 1m2s
Tests / test (3.8) (push) Successful in 1m29s
Tests / test (3.9) (push) Successful in 1m4s
Reviewed-on: #105
2024-05-26 17:29:44 +03:00
55c61e3fce Merge pull request 'v3.1.0' (#102) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 55s
Tests / test (3.11) (push) Successful in 55s
Tests / test (3.8) (push) Successful in 57s
Tests / test (3.9) (push) Successful in 1m27s
Reviewed-on: #102
2024-05-19 16:22:17 +03:00
b9550032ba Merge pull request 'Update to 3.0.1' (#98) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 57s
Tests / test (3.11) (push) Successful in 54s
Tests / test (3.8) (push) Successful in 1m8s
Tests / test (3.9) (push) Successful in 55s
Reviewed-on: #98
2024-05-15 00:19:03 +03:00
5ba763246b Merge pull request 'Update to 3.0.0' (#52) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 1m15s
Tests / test (3.11) (push) Successful in 1m14s
Tests / test (3.8) (push) Successful in 1m14s
Tests / test (3.9) (push) Successful in 1m22s
Reviewed-on: #52
2024-01-04 00:06:50 +02:00
f0ffdf096d Merge pull request 'Pycord support initial release' (#48) from dev into main
All checks were successful
Tests / test (3.10) (push) Successful in 1m8s
Tests / test (3.11) (push) Successful in 1m5s
Tests / test (3.8) (push) Successful in 1m43s
Tests / test (3.9) (push) Successful in 1m3s
Reviewed-on: #48
2023-12-27 15:00:41 +02:00
12 changed files with 28 additions and 60 deletions

View File

@ -1,24 +0,0 @@
name: Analysis
on:
push:
branches:
- main
- dev
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View File

@ -10,12 +10,11 @@ on:
jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
@ -36,4 +35,4 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: Artifacts
path: dist/*
path: dist/*

View File

@ -8,17 +8,17 @@ dynamic = ["version", "dependencies", "optional-dependencies"]
authors = [{ name = "Profitroll" }]
description = "Universal bot library with functions needed for basic Discord/Telegram bot development."
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.8"
license = { text = "GPLv3" }
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
]
@ -42,7 +42,7 @@ Tracker = "https://git.end-play.xyz/profitroll/LibBotUniversal/issues"
where = ["src"]
[tool.black]
target-version = ['py39', 'py310', 'py311' ,'py312']
target-version = ['py38', 'py39', 'py310', 'py311']
[tool.isort]
profile = "black"
@ -61,7 +61,7 @@ show_error_codes = true
[tool.pylint.main]
extension-pkg-whitelist = ["ujson"]
py-version = 3.9
py-version = 3.8
[tool.coverage.run]
source = ["libbot"]

View File

@ -1,11 +1,11 @@
black==24.10.0
build==1.2.2.post1
black==24.4.2
build==1.2.1
isort==5.13.2
mypy==1.13.0
pylint==3.3.1
pytest-asyncio==0.24.0
pytest-cov==6.0.0
pytest==8.3.3
tox==4.23.2
mypy==1.10.1
pylint==3.2.5
pytest-asyncio==0.23.7
pytest-cov==5.0.0
pytest==8.2.2
tox==4.16.0
types-aiofiles==24.1.0.20240626
types-ujson==5.10.0.20240515

View File

@ -1,2 +0,0 @@
sonar.projectKey=profitroll_libbot
sonar.organization=profitroll

View File

@ -1,4 +1,4 @@
__version__ = "3.3.0"
__version__ = "3.2.3"
__license__ = "GPL3"
__author__ = "Profitroll"

View File

@ -11,8 +11,6 @@ except ImportError:
from ._utils import supports_argument
from .sync._nested import nested_delete, nested_set
DEFAULT_CONFIG_LOCATION: str = "config.json"
async def json_read(path: Union[str, Path]) -> Any:
"""Read contents of a JSON file
@ -45,7 +43,7 @@ async def json_write(data: Any, path: Union[str, Path]) -> None:
async def config_get(
key: str, *path: str, config_file: Union[str, Path] = DEFAULT_CONFIG_LOCATION
key: str, *path: str, config_file: Union[str, Path] = "config.json"
) -> Any:
"""Get a value of the config key by its path provided
For example, `foo.bar.key` has a path of `"foo", "bar"` and the key `"key"`
@ -85,7 +83,7 @@ async def config_get(
async def config_set(
key: str, value: Any, *path: str, config_file: Union[str, Path] = DEFAULT_CONFIG_LOCATION
key: str, value: Any, *path: str, config_file: Union[str, Path] = "config.json"
) -> None:
"""Set config's key by its path to the value
@ -101,13 +99,14 @@ async def config_set(
await json_write(
nested_set(await json_read(config_file), value, *(*path, key)), config_file
)
return
async def config_delete(
key: str,
*path: str,
missing_ok: bool = False,
config_file: Union[str, Path] = DEFAULT_CONFIG_LOCATION,
config_file: Union[str, Path] = "config.json",
) -> None:
"""Set config's key by its path

View File

@ -358,8 +358,7 @@ class PyroClient(Client):
]
logger.info(
"Registering commands %s with a default scope 'BotCommandScopeDefault'",
commands
"Registering commands %s with a default scope 'BotCommandScopeDefault'"
)
await self.set_bot_commands(commands)

View File

@ -9,8 +9,6 @@ try:
except ImportError:
from json import dumps, loads
DEFAULT_CONFIG_LOCATION: str = "config.json"
def json_read(path: Union[str, Path]) -> Any:
"""Read contents of a JSON file
@ -43,7 +41,7 @@ def json_write(data: Any, path: Union[str, Path]) -> None:
def config_get(
key: str, *path: str, config_file: Union[str, Path] = DEFAULT_CONFIG_LOCATION
key: str, *path: str, config_file: Union[str, Path] = "config.json"
) -> Any:
"""Get a value of the config key by its path provided
For example, `foo.bar.key` has a path of `"foo", "bar"` and the key `"key"`
@ -83,7 +81,7 @@ def config_get(
def config_set(
key: str, value: Any, *path: str, config_file: Union[str, Path] = DEFAULT_CONFIG_LOCATION
key: str, value: Any, *path: str, config_file: Union[str, Path] = "config.json"
) -> None:
"""Set config's key by its path to the value
@ -97,13 +95,14 @@ def config_set(
* `KeyError`: Key is not found under path provided
"""
json_write(nested_set(json_read(config_file), value, *(*path, key)), config_file)
return
def config_delete(
key: str,
*path: str,
missing_ok: bool = False,
config_file: Union[str, Path] = DEFAULT_CONFIG_LOCATION,
config_file: Union[str, Path] = "config.json",
) -> None:
"""Set config's key by its path

View File

@ -59,7 +59,7 @@ def test_config_delete(key: str, path: List[str], location_config: Path):
("bot_lol", ["bot"]),
],
)
def test_config_delete_missing(key: str, path: List[str], location_config: Path):
async def test_config_delete_missing(key: str, path: List[str], location_config: Path):
assert (
sync.config_delete(key, *path, missing_ok=True, config_file=location_config)
is None

View File

@ -6,12 +6,10 @@ from libbot._utils import supports_argument
def func1(foo: str, bar: str):
"""Dummy function with specific arguments"""
pass
def func2(foo: str):
"""Dummy function with specific arguments"""
pass

View File

@ -1,14 +1,14 @@
[tox]
minversion = 3.9.0
envlist = py39, py310, py311, py312
minversion = 3.8.0
envlist = py38, py39, py310, py311
isolated_build = true
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
[testenv]
setenv =