Various fixes

Trunk + mod

FIx
This commit is contained in:
2023-06-23 20:06:18 +02:00
committed by migatu
parent 0a39eba723
commit dc9946533e
6 changed files with 115 additions and 13 deletions
+39
View File
@@ -158,3 +158,42 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
package-lock.json
package.json
.vscode/settings.json
node_modules/.package-lock.json
node_modules/.bin/prettier
node_modules/prettier/bin-prettier.js
node_modules/prettier/cli.js
node_modules/prettier/doc.js
node_modules/prettier/index.js
node_modules/prettier/LICENSE
node_modules/prettier/package.json
node_modules/prettier/parser-angular.js
node_modules/prettier/parser-babel.js
node_modules/prettier/parser-espree.js
node_modules/prettier/parser-flow.js
node_modules/prettier/parser-glimmer.js
node_modules/prettier/parser-graphql.js
node_modules/prettier/parser-html.js
node_modules/prettier/parser-markdown.js
node_modules/prettier/parser-meriyah.js
node_modules/prettier/parser-postcss.js
node_modules/prettier/parser-typescript.js
node_modules/prettier/parser-yaml.js
node_modules/prettier/README.md
node_modules/prettier/standalone.js
node_modules/prettier/third-party.js
node_modules/prettier/esm/parser-angular.mjs
node_modules/prettier/esm/parser-babel.mjs
node_modules/prettier/esm/parser-espree.mjs
node_modules/prettier/esm/parser-flow.mjs
node_modules/prettier/esm/parser-glimmer.mjs
node_modules/prettier/esm/parser-graphql.mjs
node_modules/prettier/esm/parser-html.mjs
node_modules/prettier/esm/parser-markdown.mjs
node_modules/prettier/esm/parser-meriyah.mjs
node_modules/prettier/esm/parser-postcss.mjs
node_modules/prettier/esm/parser-typescript.mjs
node_modules/prettier/esm/parser-yaml.mjs
node_modules/prettier/esm/standalone.mjs
+8
View File
@@ -0,0 +1,8 @@
*out
*logs
*actions
*notifications
plugins
user_trunk.yaml
user.yaml
shims
+41
View File
@@ -0,0 +1,41 @@
version: 0.1
cli:
version: 1.11.1
plugins:
sources:
- id: trunk
ref: v0.0.20
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- pylint
- codespell
- cspell
- git-diff-check
- eslint
- prettier
- semgrep
- autopep8
- bandit
- black
- flake8
- isort
- mypy
- pylint
- ruff
- semgrep
- yapf
- gitleaks
runtimes:
enabled:
- go@1.19.5
- node@18.12.1
- python@3.10.6
actions:
disabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
enabled:
- trunk-upgrade-available
+6 -1
View File
@@ -1,4 +1,9 @@
{
"python.linting.enabled": true,
"python.linting.pylintEnabled": true
"python.linting.pylintEnabled": true,
"trunk.inlineDecorators": true,
"trunk.inlineDecoratorsForAllExtensions": true,
"trunk.showPreexistingIssues": true,
"trunk.autoInit": true,
"trunk.showBelowThresholdIssues": true
}
+14 -12
View File
@@ -24,7 +24,7 @@ from logging import handlers
from pathlib import Path, PurePath
from platform import uname
from sys import platform
from typing import List, TypedDict, Optional
from typing import List, Optional, TypedDict
# *==============Imported libraries
import discord
@@ -53,10 +53,12 @@ Music_Config = TypedDict(
)
# *=========================================== Predefines
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s")
MASTER_TIMEOUT = datetime.now()
INITIAL_TIME_WAIT = 5
MUZYKA: Music_Config = {"playing": False, "ctx": None, "queue": [], "requestor": []}
MUZYKA: Music_Config = {"playing": False,
"ctx": None, "queue": [], "requestor": []}
LOGFILE = ""
NETRC_FILE = ""
@@ -363,7 +365,6 @@ async def disconnect(ctx):
# trunk-ignore(pylint/R0915)
# trunk-ignore(pylint/R0914)
# trunk-ignore(pylint/R0912)
async def play(ctx, zamawial=None, arg=None):
"""
@@ -449,7 +450,6 @@ async def check():
"""Funkcja sprawdzająca czy grać następny kawałek."""
while True:
# TODO: Tu dołożyć skanowanie rozmiaru pliku logowania oraz plików pamięci i przenoszenie ich na większy dysk.
# TODO: Dodać typing i dać znać że wykonuje operacje porządkowania Baru (zamiata, układa szklanki itp.)
# trunk-ignore(codespell/misspelled)
# TODO: dlaczego sie tu wypierdala
if client.voice_clients:
@@ -631,7 +631,8 @@ async def get_file(ctx, source, link):
item_type, item_id = spotify.parse_spotify_url(link)
if item_id:
file_list = spotify.fetch_tracks(spotify_ctrl, item_type, link)
directory_name = spotify.get_item_name(spotify_ctrl, item_type, item_id)
directory_name = spotify.get_item_name(
spotify_ctrl, item_type, item_id)
url_data = {"urls": []}
url_dict = {}
url_dict["save_path"] = Path(
@@ -788,10 +789,8 @@ async def wyszukaj(ctx, how_many=0):
logger.info("Słowo kluczowe: %s", word)
itr = 0
for file in music_file_list:
if platform == "win32":
file = file.split("\\")
else:
file = file.split("/")
file = file.split(SEPARATOR_FILE_PATH)
char_remove = [
".",
"^",
@@ -804,6 +803,7 @@ async def wyszukaj(ctx, how_many=0):
"[",
"]",
"\\",
"/",
"|",
"(",
")",
@@ -832,13 +832,15 @@ async def wyszukaj(ctx, how_many=0):
if re.match(pattern, itm, re.IGNORECASE):
temp_weight = (
search_weight[itr][0]
+ (token_weight + (pingu**1.5) / pattern_len) / matched_times
+ (token_weight + (pingu**1.5) /
pattern_len) / matched_times
)
search_weight[itr] = temp_weight, music_file_list[itr]
matched_times += 1
itr += 1
logger.info("Stworzylem tablice wag zajęło mi to %s", datetime.now() - time_start)
logger.info("Stworzylem tablice wag zajęło mi to %s",
datetime.now() - time_start)
time_start = datetime.now()
item_to_search = await max_weight(search_weight)
itr = 0
+7
View File
@@ -358,6 +358,13 @@
false,
false
],
"same plusy[\\s\\.]*": [
"...Jak na cmentarzu",
15.0,
0,
false,
false
],
"(oj\\.*\\s*){3,}": [
"Widzę że szykuje się wpierdol. *Przeładowuje ręczną rewolwerową wyrzutnię granatów termojądrowych i szeroko się uśmiecha w kierunku Hammera i Wykidajłów*",
15.0,