pipeline-eds 0.2.23__py3-none-any.whl → 0.2.25__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.
pipeline/cli.py CHANGED
@@ -154,11 +154,11 @@ def trend(
154
154
  queries_manager = QueriesManager(wm)
155
155
  dt_start = queries_manager.get_most_recent_successful_timestamp(api_id=zd)
156
156
  else:
157
- dt_start = pendulum.parse(starttime, strict=False)
157
+ dt_start = pendulum.parse(helpers.sanitize_date_input(starttime), strict=False)
158
158
  if endtime is None:
159
159
  dt_finish = helpers.get_now_time_rounded(wm)
160
160
  else:
161
- dt_finish = pendulum.parse(endtime, strict=False)
161
+ dt_finish = pendulum.parse(helpers.sanitize_date_input(endtime), strict=False)
162
162
 
163
163
  # Should automatically choose time step granularity based on time length; map
164
164
  if step_seconds is None:
pipeline/helpers.py CHANGED
@@ -6,6 +6,7 @@ import types
6
6
  import os
7
7
  import logging
8
8
  import socket
9
+ import re
9
10
 
10
11
  from pipeline.time_manager import TimeManager
11
12
 
@@ -120,6 +121,20 @@ def nice_step(delta_sec: int) -> int:
120
121
  if n >= target_step:
121
122
  return n
122
123
  return nice_numbers[-1]
124
+
125
+
126
+
127
+ def sanitize_date_input(date_str: str) -> str:
128
+ '''Sanitize date input strings by adding spaces where needed, to overcome error in fuzzy date parsing by the pendulum library.'''
129
+ # 1. Add space between letters and numbers
130
+ date_str = re.sub(r'([A-Za-z])(\d)', r'\1 \2', date_str)
131
+ # 2. Ensure a space after commas
132
+ date_str = re.sub(r',\s*', ', ', date_str)
133
+ # 3. Normalize multiple spaces
134
+ date_str = re.sub(r'\s+', ' ', date_str).strip()
135
+ return date_str
123
136
 
124
137
  if __name__ == "__main__":
125
- function_view()
138
+ function_view()
139
+ # Example
140
+ sanitize_date_input("December12,2024") # -> "December 12,2024"
@@ -0,0 +1,122 @@
1
+ # mulch/reg_winreg.py
2
+ import os
3
+ from pathlib import Path
4
+ import platform
5
+ if platform.system() == "Windows":
6
+ import winreg
7
+
8
+ local_app_data = Path(os.environ['LOCALAPPDATA'])
9
+ mulch_dir = local_app_data / 'mulch'
10
+ mulch_dir.mkdir(parents=True, exist_ok=True)
11
+ call_script_mulch_workspace = mulch_dir / "call-mulch-workspace.ps1"
12
+ call_script_mulch_seed = mulch_dir / "call-mulch-seed.ps1"
13
+ icon_path = r"%LOCALAPPDATA%\mulch\mulch-icon.ico"
14
+
15
+ # Helper to delete a key tree safely
16
+ def delete_key_tree(root, sub_key):
17
+ try:
18
+ with winreg.OpenKey(root, sub_key, 0, winreg.KEY_READ | winreg.KEY_WRITE) as key:
19
+ # Recursively delete subkeys
20
+ i = 0
21
+ while True:
22
+ try:
23
+ sub = winreg.EnumKey(key, i)
24
+ delete_key_tree(key, sub)
25
+ except OSError:
26
+ break
27
+ i += 1
28
+ winreg.DeleteKey(root, sub_key)
29
+ except FileNotFoundError:
30
+ pass # Key doesn't exist, that's fine
31
+
32
+ # Helper to create a shell entry
33
+ def create_shell_entry(base_key, menu_key_path, display_name, command, icon=None, position="Top", command_flags=0):
34
+ # Create the main shell key
35
+ with winreg.CreateKey(base_key, menu_key_path) as key:
36
+ winreg.SetValueEx(key, '', 0, winreg.REG_SZ, display_name)
37
+ if icon:
38
+ winreg.SetValueEx(key, "Icon", 0, winreg.REG_SZ, icon)
39
+ winreg.SetValueEx(key, "Position", 0, winreg.REG_SZ, position)
40
+ winreg.SetValueEx(key, "CommandFlags", 0, winreg.REG_DWORD, command_flags)
41
+
42
+ # Create the command subkey
43
+ with winreg.CreateKey(base_key, f"{menu_key_path}\\command") as cmd_key:
44
+ winreg.SetValueEx(cmd_key, '', 0, winreg.REG_SZ, command)
45
+
46
+ def verify_registry():
47
+ base = winreg.HKEY_CURRENT_USER
48
+ classes_key = r"Software\Classes"
49
+
50
+ required_keys = [
51
+ r"Directory\Background\shell\mulch_workspace\command",
52
+ r"Directory\shell\mulch_workspace\command",
53
+ r"Directory\Background\shell\mulch_seed\command",
54
+ r"Directory\shell\mulch_seed\command"
55
+ ]
56
+
57
+ missing = []
58
+ for k in required_keys:
59
+ try:
60
+ with winreg.OpenKey(base, classes_key + "\\" + k, 0, winreg.KEY_READ):
61
+ pass
62
+ except FileNotFoundError:
63
+ missing.append(k)
64
+
65
+ if missing:
66
+ raise RuntimeError(f"Registry keys missing after installation: {missing}")
67
+
68
+
69
+ def call():
70
+ # Base key for current user classes
71
+ base = winreg.HKEY_CURRENT_USER
72
+ classes_key = r"Software\Classes"
73
+
74
+ # Paths to remove if they exist
75
+ keys_to_remove = [
76
+ r"Directory\Background\shell\mulch_workspace",
77
+ r"Directory\shell\mulch_workspace",
78
+ r"Directory\Background\shell\mulch_seed",
79
+ r"Directory\shell\mulch_seed",
80
+ ]
81
+
82
+ # Remove existing entries
83
+ for k in keys_to_remove:
84
+ delete_key_tree(winreg.OpenKey(base, classes_key, 0, winreg.KEY_WRITE), k)
85
+
86
+ # Background right-click, mulch workspace
87
+ background_command = f'powershell.exe -NoProfile -ExecutionPolicy Bypass -File "{call_script_mulch_workspace}" "%V"'
88
+ create_shell_entry(
89
+ base_key=winreg.OpenKey(base, classes_key, 0, winreg.KEY_WRITE),
90
+ menu_key_path=r"Directory\Background\shell\mulch_workspace",
91
+ display_name='mulch workspace',
92
+ command = background_command,
93
+ icon=icon_path)
94
+
95
+ # Folder right-click, mulch workspace
96
+ folder_command = f'powershell.exe -NoProfile -ExecutionPolicy Bypass -File "{call_script_mulch_workspace}" "%L"'
97
+ create_shell_entry(
98
+ base_key = winreg.OpenKey(base, classes_key, 0, winreg.KEY_WRITE),
99
+ menu_key_path=r"Directory\shell\mulch_workspace",
100
+ display_name='mulch workspace',
101
+ command=folder_command,
102
+ icon=icon_path)
103
+
104
+ # Background right-click, mulch seed
105
+ background_command = f'powershell.exe -NoProfile -ExecutionPolicy Bypass -File "{call_script_mulch_seed}" "%V"'
106
+ create_shell_entry(
107
+ base_key=winreg.OpenKey(base, classes_key, 0, winreg.KEY_WRITE),
108
+ menu_key_path=r"Directory\Background\shell\mulch_seed",
109
+ display_name='mulch seed',
110
+ command = background_command,
111
+ icon=icon_path)
112
+
113
+ # Folder right-click, mulch seed
114
+ folder_command = f'powershell.exe -NoProfile -ExecutionPolicy Bypass -File "{call_script_mulch_seed}" "%L"'
115
+ create_shell_entry(
116
+ base_key = winreg.OpenKey(base, classes_key, 0, winreg.KEY_WRITE),
117
+ menu_key_path=r"Directory\shell\mulch_seed",
118
+ display_name='mulch seed',
119
+ command=folder_command,
120
+ icon=icon_path)
121
+
122
+ print("Registry context menu entries removed and recreated successfully!")
@@ -3,7 +3,22 @@ import toml
3
3
  import logging
4
4
  from pathlib import Path
5
5
  import sys
6
- import mulch
6
+ #import mulch
7
+ import importlib.util
8
+ import sys
9
+ from pathlib import Path
10
+
11
+ # current_dir = this pipeline repo
12
+ repo_root = Path(__file__).resolve().parents[3] # adjust if needed
13
+ mulch_path = repo_root / "mulch" / "src" / "mulch" / "__init__.py"
14
+
15
+ if not mulch_path.exists():
16
+ raise FileNotFoundError(f"Expected mulch at {mulch_path}")
17
+
18
+ spec = importlib.util.spec_from_file_location("mulch", str(mulch_path))
19
+ mulch = importlib.util.module_from_spec(spec)
20
+ sys.modules["mulch"] = mulch
21
+ spec.loader.exec_module(mulch)
7
22
 
8
23
  '''
9
24
  Goal:
@@ -313,7 +328,7 @@ class WorkspaceManager:
313
328
  pass
314
329
  #default_file.write_text("# Default workspace config\n")
315
330
  mulch_scaffold = []
316
- mulch.seed(target_dir = workspaces_dir,scaffold_dict = mulch_scaffold)
331
+ mulch.seed(target_dir = workspaces_dir,scaffold_dict = mulch_scaffold, skip_if_exists=True)
317
332
  workspace_path = workspaces_dir / "eds"
318
333
  mulch.workspace(base_path = workspaces_dir.parent, scaffold_filepath = workspaces_dir / '.mulch' / 'mulch.toml', workspace_path = workspace_path) # allow date based default if no workspace_name is provided
319
334
  return workspaces_dir
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pipeline-eds
3
- Version: 0.2.23
3
+ Version: 0.2.25
4
4
  Summary: The official API pipeline library for mulch-based projects. Key target: Emerson Ovation EDS REST API.
5
5
  License: BSD-3
6
6
  Author: George Clayton Bennett
@@ -15,7 +15,7 @@ Provides-Extra: windb
15
15
  Requires-Dist: certifi (>=2025.1.31,<2026.0.0)
16
16
  Requires-Dist: fastapi (>=0.116.1,<0.117.0)
17
17
  Requires-Dist: matplotlib (>=3.10.6,<4.0.0)
18
- Requires-Dist: mulch (==0.2.59)
18
+ Requires-Dist: mulch (>=0.2.63,<0.3.0)
19
19
  Requires-Dist: mysql-connector-python (>=9.3.0,<10.0.0)
20
20
  Requires-Dist: pendulum (>=3.1.0,<4.0.0)
21
21
  Requires-Dist: plotly (>=6.2.0,<7.0.0)
@@ -5,7 +5,7 @@ pipeline/api/eds.py,sha256=O6kHH9KsBKIXiLrT0Cj84g_UUIhjlK8vPPJbG2MP0DU,45087
5
5
  pipeline/api/rjn.py,sha256=Fhbc3tE_WgUywVJimnLzhWnxyMzGiIUu54hRFR3sdUA,7102
6
6
  pipeline/api/status_api.py,sha256=KJG7e4GXmTjqQxK3LFUcdAxj1jqzvNLJ0f9-tuisk00,202
7
7
  pipeline/calls.py,sha256=FexXJK0_fwgQMPx9dy5eFai_6xqVOsOGoEUw8yP3eSU,4187
8
- pipeline/cli.py,sha256=vXTIfJPWWaFcn-KdMa0ZVij3SgIECvrjarMXxPdVdzY,11899
8
+ pipeline/cli.py,sha256=o8DP1npD3dxgt043tEbf19RFHpMoT9fAcd8SBo8getA,11957
9
9
  pipeline/configrationmanager.py,sha256=UPqa91117jNm59vvTBE7sET1ThisqRf6B2Dhtk7x9tM,624
10
10
  pipeline/decorators.py,sha256=5fIIVqxSvQFaSI4ZkqPd3yqajzDxaRhgYwlC1jD2k5A,411
11
11
  pipeline/env.py,sha256=aVYssr6b5fVXt1GxehloyOv7fbRmuUzSQ7uQz4zwI_0,1926
@@ -13,16 +13,17 @@ pipeline/environment.py,sha256=ABXv5DAWW0EGrnE27dJNkj_aKmyD6e84RDSMyW1qKzE,1523
13
13
  pipeline/gui_fastapi_plotly_live.py,sha256=bje-W93yWb7G7A5H7Rg7BgNpfV_fjxhbl7x7zwkUCXc,3246
14
14
  pipeline/gui_mpl_live.py,sha256=JLh2YWK2SwGykik7mC_HfNMVzVVYymoEnwzSB7VHrIk,4286
15
15
  pipeline/gui_plotly_static.py,sha256=wUNTjLqsuldWRYu65w5-HDco4201FKAO5esMe2NOras,1133
16
- pipeline/helpers.py,sha256=-GGFz5t22wlFfHwtEDwWOBslzguLXXSYNzxxRBvclLI,4457
16
+ pipeline/helpers.py,sha256=8tbg0EB_7Jg3oFJxvPmb0n1QtOdqa4zIogEIOuJM2ko,5050
17
17
  pipeline/install_appdata.py,sha256=DGemGRogMVAmFzqSKladfxgLQOslIHyul2Xxq34do8A,2814
18
18
  pipeline/logging_setup.py,sha256=CAqWfchscCdzJ63Wf1dC3QGRnFnQqBELxyTmPZxsxgs,1674
19
19
  pipeline/pastehelpers.py,sha256=pkmtULW5Zk_-ffUDDp_VsGzruIjsNB1xAIPbb9jtofE,265
20
20
  pipeline/philosophy.py,sha256=QskLEpY3uZn46oyH7rHekOXiC55JqW3raThxwxaiM5U,1919
21
+ pipeline/pipeline-winreg-filler-based-on-filetype.py,sha256=O94Pub3KyrABTZShvJEsrH_Q_okuX-wJzDKw-MR2jnI,5032
21
22
  pipeline/plotbuffer.py,sha256=jCsFbT47TdR8Sq5tjj2JdhVELjRiebLPN7O4r2LjPeY,625
22
23
  pipeline/points_loader.py,sha256=4OCGLiatbP3D5hixVnYcFGThvBRYt_bf5DhNGdGw_9k,519
23
24
  pipeline/queriesmanager.py,sha256=iQRPZDnllhQ4_nI7764SgUCxA0Wy5-cA32y-7tR5vBE,5011
24
25
  pipeline/time_manager.py,sha256=gSK430SyHvhgUWLRg_z2nBiyad01v7ByyKafB138IkU,8351
25
- pipeline/workspace_manager.py,sha256=cpBecFipE7f1_xTxiE9jmQ7U7Nnk6Ovg22lxlchnzI8,15335
26
+ pipeline/workspace_manager.py,sha256=_5NwwD6vF9XthoFAiY3COwBcZ_ZcDcxrq962kwkAIDk,15872
26
27
  workspaces/default-workspace.toml,sha256=dI8y2l2WlEbIck6IZpbuQUP8-Bf48bBE1CKKsnVMc8w,300
27
28
  workspaces/eds_to_rjn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
29
  workspaces/eds_to_rjn/code/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -57,8 +58,8 @@ workspaces/eds_to_rjn/scripts/daemon_runner.py,sha256=gBCYrJ-FYPCTt_l5O07_YNrrGj
57
58
  workspaces/eds_to_rjn/secrets/README.md,sha256=tWf2bhopA0C08C8ImtHNZoPde9ub-sLMjX6EMe7lyJw,600
58
59
  workspaces/eds_to_rjn/secrets/secrets-example.yaml,sha256=qKGrKsKBC0ulDQRVbr1zkfNlr8WPWK4lg5GAvTqZ-T4,365
59
60
  workspaces/eds_to_termux/..txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- pipeline_eds-0.2.23.dist-info/entry_points.txt,sha256=jmU0FQ7-2AHXhKcj4TXPn61xLbHlycHA2lkDlRZT-pg,124
61
- pipeline_eds-0.2.23.dist-info/LICENSE,sha256=LKdx0wS1t9vFZpbRhDg_iLQ6ny-XsXRwhKAoCfrF6iA,1501
62
- pipeline_eds-0.2.23.dist-info/METADATA,sha256=MFNg7Y1hFRDcj1871HXHEJUwoLgEaYBNrxeZruBV3cM,10021
63
- pipeline_eds-0.2.23.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
64
- pipeline_eds-0.2.23.dist-info/RECORD,,
61
+ pipeline_eds-0.2.25.dist-info/entry_points.txt,sha256=jmU0FQ7-2AHXhKcj4TXPn61xLbHlycHA2lkDlRZT-pg,124
62
+ pipeline_eds-0.2.25.dist-info/LICENSE,sha256=LKdx0wS1t9vFZpbRhDg_iLQ6ny-XsXRwhKAoCfrF6iA,1501
63
+ pipeline_eds-0.2.25.dist-info/METADATA,sha256=Fy6R_D81m8bH4vFpXpvybbefdyPuBd8d1FU5MvPN2Xk,10028
64
+ pipeline_eds-0.2.25.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
65
+ pipeline_eds-0.2.25.dist-info/RECORD,,