xulbux 1.6.8__py3-none-any.whl → 1.7.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.

Potentially problematic release.


This version of xulbux might be problematic. Click here for more details.

xulbux/xx_string.py CHANGED
@@ -1,3 +1,4 @@
1
+ from typing import Any
1
2
  import json as _json
2
3
  import ast as _ast
3
4
  import re as _re
@@ -6,7 +7,7 @@ import re as _re
6
7
  class String:
7
8
 
8
9
  @staticmethod
9
- def to_type(string: str) -> any:
10
+ def to_type(string: str) -> Any:
10
11
  """Will convert a string to the found type, including complex nested structures."""
11
12
  string = string.strip()
12
13
  try:
@@ -102,4 +103,6 @@ class String:
102
103
  @staticmethod
103
104
  def split_count(string: str, count: int) -> list[str]:
104
105
  """Will split the string every `count` characters."""
106
+ if count <= 0:
107
+ raise ValueError("Count must be greater than 0.")
105
108
  return [string[i:i + count] for i in range(0, len(string), count)]
xulbux/xx_system.py CHANGED
@@ -7,26 +7,22 @@ import sys as _sys
7
7
  import os as _os
8
8
 
9
9
 
10
- # YAPF: disable
11
- class ProcessNotFoundError(Exception):
12
- pass
13
-
14
10
  class _IsElevated:
11
+
15
12
  def __get__(self, obj, owner=None):
16
13
  try:
17
14
  if _os.name == "nt":
18
15
  return _ctypes.windll.shell32.IsUserAnAdmin() != 0
19
16
  elif _os.name == "posix":
20
- return _os.geteuid() == 0
17
+ return _os.geteuid() == 0 # type: ignore[attr-defined]
21
18
  except Exception:
22
19
  pass
23
20
  return False
24
- # YAPF: enable
25
21
 
26
22
 
27
23
  class System:
28
24
 
29
- is_elevated: bool = _IsElevated()
25
+ is_elevated: bool = _IsElevated() # type: ignore[assignment]
30
26
  """Is `True` if the current process has
31
27
  elevated privileges and `False` otherwise."""
32
28
 
@@ -58,7 +54,7 @@ class System:
58
54
  if len(processes) > 2: # EXCLUDING THE PYTHON PROCESS AND PS
59
55
  raise RuntimeError("Processes are still running. Use the parameter `force=True` to restart anyway.")
60
56
  if prompt:
61
- _subprocess.Popen(["notify-send", "System Restart", prompt])
57
+ _subprocess.Popen(["notify-send", "System Restart", str(prompt)])
62
58
  _time.sleep(wait)
63
59
  try:
64
60
  _subprocess.run(["sudo", "shutdown", "-r", "now"])
@@ -99,7 +95,7 @@ class System:
99
95
  return missing
100
96
 
101
97
  @staticmethod
102
- def elevate(win_title: Optional[str] = None, args: Optional[list] = None) -> bool:
98
+ def elevate(win_title: Optional[str] = None, args: list = []) -> bool:
103
99
  """Attempts to start a new process with elevated privileges.\n
104
100
  ---------------------------------------------------------------------------------
105
101
  The param `win_title` is window the title of the elevated process.
@@ -110,7 +106,7 @@ class System:
110
106
  ---------------------------------------------------------------------------------
111
107
  Returns `True` if the current process already has elevated privileges and raises
112
108
  a `PermissionError` if the user denied the elevation or the elevation failed."""
113
- if System.is_elevated():
109
+ if System.is_elevated:
114
110
  return True
115
111
  if _os.name == "nt": # WINDOWS
116
112
  if win_title:
@@ -1,30 +1,9 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: xulbux
3
- Version: 1.6.8
3
+ Version: 1.7.0
4
4
  Summary: A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler.
5
5
  Author-email: XulbuX <xulbux.real@gmail.com>
6
- License: MIT License
7
-
8
- Copyright (c) 2024 XulbuX
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
6
+ License-Expression: MIT
28
7
  Project-URL: Bug Reports, https://github.com/XulbuX/PythonLibraryXulbuX/issues
29
8
  Project-URL: Changelog, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md
30
9
  Project-URL: Documentation, https://github.com/XulbuX/PythonLibraryXulbuX/wiki
@@ -37,7 +16,6 @@ Classifier: Programming Language :: Python :: 3
37
16
  Classifier: Programming Language :: Python :: 3.10
38
17
  Classifier: Programming Language :: Python :: 3.11
39
18
  Classifier: Programming Language :: Python :: 3.12
40
- Classifier: License :: OSI Approved :: MIT License
41
19
  Classifier: Operating System :: OS Independent
42
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
43
21
  Requires-Python: >=3.10.0
@@ -54,6 +32,7 @@ Requires-Dist: black>=23.7.0; extra == "dev"
54
32
  Requires-Dist: isort>=5.12.0; extra == "dev"
55
33
  Requires-Dist: flake8>=6.1.0; extra == "dev"
56
34
  Requires-Dist: flake8-pyproject>=1.2.3; extra == "dev"
35
+ Dynamic: license-file
57
36
 
58
37
  # **$\color{#8085FF}\Huge\textsf{XulbuX}$**
59
38
 
@@ -102,20 +81,20 @@ from xulbux import rgba, hsla, hexa
102
81
 
103
82
  ## Modules
104
83
 
105
- | Module | Short Description |
106
- | :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
107
- | <h3>[`xx_code`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
108
- | <h3>[`xx_color`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
109
- | <h3>[`xx_console`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
110
- | <h3>[`xx_data`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_data)</h3> | advanced operations with data structures (*compare, generate path ID's, pretty print/format, ...*) |
111
- | <h3>[`xx_env_path`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_env_path)</h3> | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
112
- | <h3>[`xx_file`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
113
- | <h3>[`xx_format_codes`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_format_codes)</h3> | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
114
- | <h3>`xx_json`</h3> | advanced working with json files (*read, create, update, ...*) |
115
- | <h3>`xx_path`</h3> | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
116
- | <h3>`xx_regex`</h3> | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
117
- | <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
118
- | <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
84
+ | Module | Short Description |
85
+ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- |
86
+ | [![xx_code](https://img.shields.io/badge/xx__code-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_code) | advanced code-string operations (*changing the indent, finding function calls, ...*) |
87
+ | [![xx_color](https://img.shields.io/badge/xx__color-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_color) | everything around colors (*converting, blending, searching colors in strings, ...*) |
88
+ | [![xx_console](https://img.shields.io/badge/xx__console-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_console) | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
89
+ | [![xx_data](https://img.shields.io/badge/xx__data-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_data) | advanced operations with data structures (*compare, generate path ID's, pretty print/format, ...*) |
90
+ | [![xx_env_path](https://img.shields.io/badge/xx__env__path-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_env_path) | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
91
+ | [![xx_file](https://img.shields.io/badge/xx__file-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_file) | advanced working with files (*create files, rename file-extensions, ...*) |
92
+ | [![xx_format_codes](https://img.shields.io/badge/xx__format__codes-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_format_codes) | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
93
+ | [![xx_json](https://img.shields.io/badge/xx__json-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_json) | advanced working with json files (*read, create, update, ...*) |
94
+ | [![xx_path](https://img.shields.io/badge/xx__path-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_path) | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
95
+ | ![xx_regex](https://img.shields.io/badge/xx__regex-6065FF?style=flat) | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
96
+ | [![xx_string](https://img.shields.io/badge/xx__string-6065FF?style=flat)](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string) | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
97
+ | ![xx_system](https://img.shields.io/badge/xx__system-6065FF?style=flat) | advanced system actions (*restart with message, check installed Python libs, ...*) |
119
98
 
120
99
  <br>
121
100
 
@@ -0,0 +1,21 @@
1
+ xulbux/__init__.py,sha256=TbXPioXPENwpR9t4lvqBBhV4cby0JGdIrSzzdMFYrEc,815
2
+ xulbux/_cli_.py,sha256=J4vfJHLJEYxCZzA_VJUB46w2WGShfdYFoetsLG5PfKo,3428
3
+ xulbux/_consts_.py,sha256=AuYTTmqrP2lawyVGlPLUaP1syxOoPA-ejJGH7WlwFzk,6314
4
+ xulbux/xx_code.py,sha256=w9yO-GPMeaE-xDi-L3VtpPpWpu5jOwagfMsG93aXANE,6106
5
+ xulbux/xx_color.py,sha256=ZEV9AG3MtgNMh4t4VexmBiaperan1pHO4d_VPCdv188,49923
6
+ xulbux/xx_console.py,sha256=WmH6YURaA-Y-LNB-2kZc8SuPxoZim8ZmzsuI01V9vcM,28682
7
+ xulbux/xx_data.py,sha256=nEfVwK6-ILaL3K-bLezKpG1G7117CY5ZgC3BGwANrUE,30886
8
+ xulbux/xx_env_path.py,sha256=x56mKK4lSvU5yMCAs8k0RVIqXWUJcpcHYz5HoZ_RklM,4160
9
+ xulbux/xx_file.py,sha256=KerXOvKS93zIoAt36YTYuZboSmxVFVf2WcOrDcdwXfE,2627
10
+ xulbux/xx_format_codes.py,sha256=fOFidFDBYV-rUXOlYTeKIZarfh9Q1jSUCGYyk8pg-ic,23397
11
+ xulbux/xx_json.py,sha256=V7vdfpvSe9wpktR_c8zG_Meix7x9IRmn66k5nB3HUyo,7457
12
+ xulbux/xx_path.py,sha256=lLAEVZrW0TAwCewlONFVQcQ_8tVn9LTJZVOZpeGvE5s,7673
13
+ xulbux/xx_regex.py,sha256=ejqVs4a-eCSTrSQfENoyl0AVztb8BuI2TNl-wzMQwYw,8048
14
+ xulbux/xx_string.py,sha256=QaTo0TQ9m_2USNgQNaVw5ivQt-A1E-e5x8OpIB3xIlY,5561
15
+ xulbux/xx_system.py,sha256=Tsx4wgztUg46KloqcGeiFkarDoM3EgJLXw3XNxgHBmU,6460
16
+ xulbux-1.7.0.dist-info/licenses/LICENSE,sha256=6NflEcvzFEe8_JFVNCPVwZBwBhlLLd4vqQi8WiX_Xk4,1084
17
+ xulbux-1.7.0.dist-info/METADATA,sha256=symGYQzZhSYyGcwM_dGI3FETAcqgTL-ft90CLtJoNlY,9222
18
+ xulbux-1.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ xulbux-1.7.0.dist-info/entry_points.txt,sha256=a3womfLIMZKnOFiyy-xnVb4g2qkZsHR5FbKKkljcGns,94
20
+ xulbux-1.7.0.dist-info/top_level.txt,sha256=FkK4EZajwfP36fnlrPaR98OrEvZpvdEOdW1T5zTj6og,7
21
+ xulbux-1.7.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,21 +0,0 @@
1
- xulbux/__init__.py,sha256=UY5nyn_XmeHAhiPtZmNMlc9hQRlNWbQ0uirICuihWzg,1654
2
- xulbux/_cli_.py,sha256=I1TieHnX60mlRvMaTQnon-VRuf_70dkP7sOU1aHthQY,3470
3
- xulbux/_consts_.py,sha256=b85O5sePS18z7CJgrVw0V7v88PIG9qnQ7G2bJL71odk,6287
4
- xulbux/xx_code.py,sha256=GfzpbN-41L_qfzEdkl4PWq9tbCSAlnE2xX3lPtHo1Iw,5275
5
- xulbux/xx_color.py,sha256=nwcd5_4JIRfZ99JqbCXMl4RWpic_-M361AA5zEa9Nuw,44846
6
- xulbux/xx_console.py,sha256=2ZHNxwpSoILjHk45QwzJJbtCn3WOVQ9TmkyqPpdU_3w,25860
7
- xulbux/xx_data.py,sha256=5MIEKDgbRLGkZi9Yd35XhzrWZY09oXyVLGs0BgTTHFA,30219
8
- xulbux/xx_env_path.py,sha256=WoBYywFsncX-GMvSdvrGmuajXeeuRY2l_-3GuJJXChU,4200
9
- xulbux/xx_file.py,sha256=Rij2NjxyBlwfFIN_Sc-vDJzzsn3jzgIigFQ_p6Zg80o,3246
10
- xulbux/xx_format_codes.py,sha256=5Q5RAVfL-EmhqjJMQ4wMm0MQ3r0okjNKrpdsXeodupI,22313
11
- xulbux/xx_json.py,sha256=dw2AiqMErdjW0ot4pICDBdTL6j03IrYJWJz-Lw21d4Q,5149
12
- xulbux/xx_path.py,sha256=trDke1N9ewbkQmAIqjeB9gfbTuAlzqFY2mtPtlK2Ks0,4639
13
- xulbux/xx_regex.py,sha256=rmy6stkVP-vm8j7QoIn0Z4ic_fMT9p_hs0QE6PkMcr0,7917
14
- xulbux/xx_string.py,sha256=nJBXAVNknhTE9N_4yOyCVwSSIwOyHCRlZe_D7LOgrOY,5450
15
- xulbux/xx_system.py,sha256=4WuItIeVF5cU3u3-cu3XqhtxBcap9YDJiQKTZuWsUyM,6494
16
- xulbux-1.6.8.dist-info/LICENSE,sha256=6NflEcvzFEe8_JFVNCPVwZBwBhlLLd4vqQi8WiX_Xk4,1084
17
- xulbux-1.6.8.dist-info/METADATA,sha256=D0zdyVryi5SUH7ylNmFbi5qa1dgbPt7zdn08LkgqFOQ,9673
18
- xulbux-1.6.8.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
19
- xulbux-1.6.8.dist-info/entry_points.txt,sha256=a3womfLIMZKnOFiyy-xnVb4g2qkZsHR5FbKKkljcGns,94
20
- xulbux-1.6.8.dist-info/top_level.txt,sha256=FkK4EZajwfP36fnlrPaR98OrEvZpvdEOdW1T5zTj6og,7
21
- xulbux-1.6.8.dist-info/RECORD,,