kbasic 0.1.7__tar.gz → 0.1.8__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kbasic
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Keyan's basic utility functions.
5
5
  Requires-Dist: numpy>=2.4.2
6
6
  Requires-Dist: pylatexenc>=2.10
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "kbasic"
3
- version = "0.1.7"
3
+ version = "0.1.8"
4
4
  description = "Keyan's basic utility functions."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,3 +1,4 @@
1
+ from kbasic.environment import *
1
2
  from kbasic.audio import *
2
3
  from kbasic.array import *
3
4
  from kbasic.bar import *
@@ -0,0 +1,12 @@
1
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
2
+ # >-|===|> Imports <|===|-<
3
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
4
+ from kbasic.parsing import Folder
5
+
6
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
7
+ # >-|===|> Definitions <|===|-<
8
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
9
+ simulationDir = Folder("/Users/keyan/code/data/sims/")
10
+ figDir = videoDir = Folder("./")
11
+ frameDir = Folder("/Users/keyan/code/data/frames/")
12
+ videoDir = Folder("/Users/keyan/videos/")
@@ -0,0 +1,24 @@
1
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
2
+ # >-|===|> Imports <|===|-<
3
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
4
+ from kbasic.parsing import File, Folder
5
+
6
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
7
+ # >-|===|> Definitions <|===|-<
8
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
9
+ isAnvil: bool = Folder("/anvil").exists
10
+ isPC: bool = Folder("/Users").exists
11
+ isWindows: bool = Folder("/C:").exists
12
+ if isAnvil:
13
+ from kgsim.environment.anvil import simulationDir # so shit don't complain
14
+ from kgsim.environment.anvil import *
15
+ elif isPC:
16
+ user = File(__file__).path.lower().split('/')[2]
17
+ match user:
18
+ case 'keyan': from kgsim.environment.Keyan import *
19
+ case _: from kgsim.environment.defaultPC import *
20
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
21
+ # >-|===|> Functions <|===|-<
22
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
23
+ def available() -> list[str]:
24
+ return simulationDir.children
@@ -0,0 +1,13 @@
1
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
2
+ # >-|===|> Imports <|===|-<
3
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
4
+ from kbasic.parsing import Folder
5
+
6
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
7
+ # >-|===|> Definitions <|===|-<
8
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
9
+ anvil_user = __file__.split("/")[2]
10
+ simulationDir = Folder(f"/anvil/scratch/{anvil_user}/sims/") # default location to put/look for simulations
11
+ figDir = Folder(f"/home/{anvil_user}/turbulence/figures/") # default location for figures to go
12
+ frameDir = Folder(f"/home/{anvil_user}/frames/") # default location for frames of videos to go
13
+ videoDir = Folder(f"/home/{anvil_user}/videos/") # default location for videos to go
@@ -0,0 +1,13 @@
1
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
2
+ # >-|===|> Imports <|===|-<
3
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
4
+ from kbasic.parsing import Folder
5
+
6
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
7
+ # >-|===|> Definitions <|===|-<
8
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
9
+ user = __file__.split("/")[1]
10
+ simulationDir = Folder(f"/Users/{user}/sims/")
11
+ figDir = Folder(f"/Users/{user}/figures/")
12
+ frameDir = Folder(f"/Users/{user}/frames/")
13
+ videoDir = Folder(f"/Users/{user}/videos/")
@@ -3,6 +3,8 @@
3
3
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
4
4
  from kbasic.bar import ProgressBar, redirect_to_tqdm
5
5
  from kbasic.audio import success
6
+ from kbasic.environment import isAnvil
7
+ if isAnvil: from kbasic.environment.anvil import anvil_user
6
8
  # from kgsim.dhybridr.io import dHybridRinput
7
9
  from subprocess import check_output, DEVNULL
8
10
  from tqdm import tqdm
@@ -16,12 +18,24 @@ import numpy as np
16
18
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
17
19
  # >-|===|> Definitions <|===|-<
18
20
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
19
- _USERNAME_ = 'x-kgootkin'
20
21
  bad = ['\x1b[31m', '\x1b[34m', '\x1b[m']
21
-
22
+ ansi = {"BLACK": u"\033[0;30m","RED": u"\x1b[0;31m","GREEN": u"\033[0;32m","BROWN": u"\033[0;33m","BLUE": u"\033[0;34m","PURPLE": u"\033[0;35m","CYAN": u"\033[0;36m","WHITE": u"\033[0;37m",
23
+ "FAINT": u"\033[2m","FAINT BLACK": u"\033[2;30m","FAINT RED": u"\x1b[2;31m","FAINT GREEN": u"\033[2;32m","FAINT BROWN": u"\033[2;33m","FAINT BLUE": u"\033[2;34m","FAINT PURPLE": u"\033[2;35m","FAINT CYAN": u"\033[2;36m","FAINT WHITE": u"\033[2;37m",
24
+ "ITALIC": u"\033[3m","ITALIC BLACK": u"\033[3;30m","ITALIC RED": u"\x1b[3;31m","ITALIC GREEN": u"\033[3;32m","ITALIC BROWN": u"\033[3;33m","ITALIC BLUE": u"\033[3;34m","ITALIC PURPLE": u"\033[3;35m","ITALIC CYAN": u"\033[3;36m","ITALIC WHITE": u"\033[3;37m",
25
+ "UNDERLINE": u"\033[4m","UNDERLINE BLACK": u"\033[4;30m","UNDERLINE RED": u"\x1b[4;31m","UNDERLINE GREEN": u"\033[4;32m","UNDERLINE BROWN": u"\033[4;33m","UNDERLINE BLUE": u"\033[4;34m","UNDERLINE PURPLE": u"\033[4;35m","UNDERLINE CYAN": u"\033[4;36m","UNDERLINE WHITE": u"\033[4;37m",
26
+ "BLINK": u"\033[5m","BLINK BLACK": u"\033[5;30m","BLINK RED": u"\x1b[5;31m","BLINK GREEN": u"\033[5;32m","BLINK BROWN": u"\033[5;33m","BLINK BLUE": u"\033[5;34m","BLINK PURPLE": u"\033[5;35m","BLINK CYAN": u"\033[5;36m","BLINK WHITE": u"\033[5;37m",
27
+ "NEGATIVE": u"\033[7m","BLACK BACKGROUND": u"\033[7;30m","RED BACKGROUND": u"\x1b[7;31m","GREEN BACKGROUND": u"\033[7;32m","BROWN BACKGROUND": u"\033[7;33m","BLUE BACKGROUND": u"\033[7;34m","PURPLE BACKGROUND": u"\033[7;35m","CYAN BACKGROUND": u"\033[7;36m","WHITE BACKGROUND": u"\033[7;37m",
28
+ "END": u"\033[0m"
29
+ }
30
+ _USERNAME_ = None if not isAnvil else anvil_user
22
31
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
23
32
  # >-|===|> Functions <|===|-<
24
33
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
34
+ def pprint(text: str, option: str = 'white'):
35
+ assert option.upper() in ansi.keys(), f"must give one of {ansi.keys()} as your option. "
36
+ output = ansi[option.upper()] + text + ansi['END']
37
+ print(output)
38
+ def warn(text: str): pprint(text, 'yellow')
25
39
  def parse_shell_output(output):
26
40
  match output:
27
41
  case str(): return output
@@ -59,19 +73,6 @@ qs = anvil_queue
59
73
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
60
74
  # >-|===|> Classes <|===|-<
61
75
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
62
- class Color:
63
- HEADER = '\033[95m'
64
- OKBLUE = '\033[94m'
65
- OKCYAN = '\033[96m'
66
- OKGREEN = '\033[92m'
67
- WARNING = '\033[93m'
68
- FAIL = '\033[91m'
69
- ENDC = '\033[0m'
70
- BOLD = '\033[1m'
71
- UNDERLINE = '\033[4m'
72
- def warn(self, text: str):
73
- print(self.WARNING + text + self.ENC)
74
-
75
76
  class AnvilJob:
76
77
  def __init__(self, queue_row: str, sep="DISTINCTSEPERATOR"):
77
78
  self.sep = sep
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes