monkeyplug-enhanced 2.2.0__py3-none-any.whl

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.
monkeyplug/__init__.py ADDED
@@ -0,0 +1,21 @@
1
+ """monkeyplug - a little script to censor profanity in audio files"""
2
+
3
+ from importlib.metadata import version, PackageNotFoundError
4
+
5
+ _package_name = __name__
6
+
7
+ try:
8
+ __version__ = version(_package_name)
9
+ except PackageNotFoundError:
10
+ __version__ = None
11
+
12
+ from .monkeyplug import * # noqa: F401
13
+
14
+ __all__ = sorted(
15
+ [
16
+ name
17
+ for name, obj in globals().items()
18
+ if not name.startswith("_") and getattr(obj, "__module__", _package_name).startswith(_package_name + '.')
19
+ ],
20
+ key=str.casefold,
21
+ )
@@ -0,0 +1 @@
1
+ ["fuck","fucking","fucker","motherfucker","shit","shitty","bullshit","damn","goddamn","bitch","bastard","ass","asshole","dick","pussy","cock","cunt","whore","slut","nigga","nigger","tits","tit","hell","fag","faggot","douche","twat","wanker","prick","cock","dick","piss","pissed","crap","screw","screwed"," screwed up","boner","jerk","jackass"]
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env python
2
+
3
+ import os
4
+ import json
5
+ from pathlib import Path
6
+
7
+
8
+ def load_groq_api_key(api_key=None, debug=False):
9
+ """
10
+ Load Groq API key with priority order:
11
+ 1. Direct parameter
12
+ 2. GROQ_API_KEY environment variable
13
+ 3. ~/.groq/config.json file
14
+ 4. ./.groq_key (project-local file)
15
+
16
+ Args:
17
+ api_key: Direct API key parameter
18
+ debug: Enable debug output
19
+
20
+ Returns:
21
+ str: The API key if found, None otherwise
22
+ """
23
+ # Priority 1: Direct parameter
24
+ if api_key:
25
+ if debug:
26
+ import mmguero
27
+ mmguero.eprint("Using provided API key parameter")
28
+ return api_key
29
+
30
+ # Priority 2: Environment variable
31
+ env_key = os.getenv("GROQ_API_KEY")
32
+ if env_key:
33
+ if debug:
34
+ import mmguero
35
+ mmguero.eprint("Using GROQ_API_KEY environment variable")
36
+ return env_key
37
+
38
+ # Priority 3: ~/.groq/config.json file
39
+ config_path = Path.home() / ".groq" / "config.json"
40
+ if config_path.exists():
41
+ try:
42
+ with open(config_path, 'r') as f:
43
+ config = json.load(f)
44
+ if "api_key" in config:
45
+ if debug:
46
+ import mmguero
47
+ mmguero.eprint(f"Using API key from {config_path}")
48
+ return config["api_key"]
49
+ except (json.JSONDecodeError, IOError) as e:
50
+ if debug:
51
+ import mmguero
52
+ mmguero.eprint(f"Error reading {config_path}: {e}")
53
+
54
+ # Priority 4: ./.groq_key (project-local file)
55
+ local_key_path = Path(".groq_key")
56
+ if local_key_path.exists():
57
+ try:
58
+ with open(local_key_path, 'r') as f:
59
+ key = f.read().strip()
60
+ if key:
61
+ if debug:
62
+ import mmguero
63
+ mmguero.eprint(f"Using API key from {local_key_path}")
64
+ return key
65
+ except IOError as e:
66
+ if debug:
67
+ import mmguero
68
+ mmguero.eprint(f"Error reading {local_key_path}: {e}")
69
+
70
+ return None