pragneshbarik commited on
Commit
e51667a
1 Parent(s): cf23c49

major refactoring, web crawl in now multithreaded

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitignore +3 -0
  2. README.md +0 -1
  3. app.py +19 -319
  4. chat_client.py +24 -21
  5. components/chat_box.py +7 -0
  6. components/generate_chat_stream.py +36 -0
  7. components/init_state.py +64 -0
  8. components/prompt_engineering_dashboard.py +68 -0
  9. components/show_source.py +8 -0
  10. components/sidebar.py +92 -0
  11. components/stream_handler.py +40 -0
  12. config.yaml +34 -0
  13. rag/Scripts/Activate.ps1 +0 -399
  14. rag/Scripts/activate +0 -66
  15. rag/Scripts/activate.bat +0 -33
  16. rag/Scripts/convert-caffe2-to-onnx.exe +0 -0
  17. rag/Scripts/convert-onnx-to-caffe2.exe +0 -0
  18. rag/Scripts/deactivate.bat +0 -21
  19. rag/Scripts/dotenv.exe +0 -0
  20. rag/Scripts/f2py.exe +0 -0
  21. rag/Scripts/huggingface-cli.exe +0 -0
  22. rag/Scripts/ipython.exe +0 -0
  23. rag/Scripts/ipython3.exe +0 -0
  24. rag/Scripts/isympy.exe +0 -0
  25. rag/Scripts/jsonschema.exe +0 -0
  26. rag/Scripts/jupyter-kernel.exe +0 -0
  27. rag/Scripts/jupyter-kernelspec.exe +0 -0
  28. rag/Scripts/jupyter-migrate.exe +0 -0
  29. rag/Scripts/jupyter-run.exe +0 -0
  30. rag/Scripts/jupyter-troubleshoot.exe +0 -0
  31. rag/Scripts/jupyter.exe +0 -0
  32. rag/Scripts/markdown-it.exe +0 -0
  33. rag/Scripts/nltk.exe +0 -0
  34. rag/Scripts/normalizer.exe +0 -0
  35. rag/Scripts/pinecone.exe +0 -0
  36. rag/Scripts/pip.exe +0 -0
  37. rag/Scripts/pip3.9.exe +0 -0
  38. rag/Scripts/pip3.exe +0 -0
  39. rag/Scripts/pygmentize.exe +0 -0
  40. rag/Scripts/python.exe +0 -0
  41. rag/Scripts/pythonw.exe +0 -0
  42. rag/Scripts/pywin32_postinstall.py +0 -783
  43. rag/Scripts/pywin32_testall.py +0 -124
  44. rag/Scripts/streamlit.cmd +0 -16
  45. rag/Scripts/streamlit.exe +0 -0
  46. rag/Scripts/torchrun.exe +0 -0
  47. rag/Scripts/tqdm.exe +0 -0
  48. rag/Scripts/transformers-cli.exe +0 -0
  49. rag/Scripts/watchmedo.exe +0 -0
  50. rag/etc/jupyter/nbconfig/notebook.d/pydeck.json +0 -5
.gitignore CHANGED
@@ -6,6 +6,9 @@ __pycache__/
6
  # C extensions
7
  *.so
8
 
 
 
 
9
  # Distribution / packaging
10
  .Python
11
  build/
 
6
  # C extensions
7
  *.so
8
 
9
+ # Win executables
10
+ *.exe
11
+ rag-env/
12
  # Distribution / packaging
13
  .Python
14
  build/
README.md CHANGED
@@ -26,7 +26,6 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
26
  GOOGLE_SEARCH_ENGINE_ID = ...
27
  GOOGLE_SEARCH_API_KEY = ...
28
  BING_SEARCH_API_KEY = ...
29
-
30
  ```
31
 
32
  4. Install requirements using
 
26
  GOOGLE_SEARCH_ENGINE_ID = ...
27
  GOOGLE_SEARCH_API_KEY = ...
28
  BING_SEARCH_API_KEY = ...
 
29
  ```
30
 
31
  4. Install requirements using
app.py CHANGED
@@ -1,19 +1,17 @@
1
  import streamlit as st
 
2
  from chat_client import chat
3
- import time
4
- from utils import gen_augmented_prompt_via_websearch, inital_prompt_engineering_dict
 
 
 
 
 
5
 
6
 
7
- COST_PER_1000_TOKENS_USD = 0.139 * 80
8
-
9
- # Not using BPE tokenizer to calculate exact number of tokens,
10
- # using the formula n_tokens = len(reponse + prompt) * 1.25
11
-
12
- CHAT_BOTS = {
13
- "Mixtral 8x7B v0.1": "mistralai/Mixtral-8x7B-Instruct-v0.1",
14
- "Mistral 7B v0.1": "mistralai/Mistral-7B-Instruct-v0.1",
15
- }
16
-
17
 
18
  st.set_page_config(
19
  page_title="Mixtral Playground",
@@ -21,325 +19,27 @@ st.set_page_config(
21
  )
22
 
23
 
24
- def init_state():
25
- if "messages" not in st.session_state:
26
- st.session_state.messages = []
27
-
28
- if "tokens_used" not in st.session_state:
29
- st.session_state.tokens_used = 0
30
-
31
- if "tps" not in st.session_state:
32
- st.session_state.tps = 0
33
-
34
- if "temp" not in st.session_state:
35
- st.session_state.temp = 0.8
36
-
37
- if "history" not in st.session_state:
38
- st.session_state.history = [
39
- [
40
- inital_prompt_engineering_dict["SYSTEM_INSTRUCTION"],
41
- inital_prompt_engineering_dict["SYSTEM_RESPONSE"],
42
- ]
43
- ]
44
-
45
- if "n_crawl" not in st.session_state:
46
- st.session_state.n_crawl = 5
47
-
48
- if "repetion_penalty" not in st.session_state:
49
- st.session_state.repetion_penalty = 1
50
-
51
- if "rag_enabled" not in st.session_state:
52
- st.session_state.rag_enabled = True
53
-
54
- if "chat_bot" not in st.session_state:
55
- st.session_state.chat_bot = "Mixtral 8x7B v0.1"
56
-
57
- if "search_vendor" not in st.session_state:
58
- st.session_state.search_vendor = "Bing"
59
-
60
- if "system_instruction" not in st.session_state:
61
- st.session_state.system_instruction = inital_prompt_engineering_dict[
62
- "SYSTEM_INSTRUCTION"
63
- ]
64
-
65
- if "system_response" not in st.session_state:
66
- st.session_state.system_instruction = inital_prompt_engineering_dict[
67
- "SYSTEM_RESPONSE"
68
- ]
69
-
70
- if "pre_context" not in st.session_state:
71
- st.session_state.pre_context = inital_prompt_engineering_dict["PRE_CONTEXT"]
72
-
73
- if "post_context" not in st.session_state:
74
- st.session_state.post_context = inital_prompt_engineering_dict["POST_CONTEXT"]
75
-
76
- if "pre_prompt" not in st.session_state:
77
- st.session_state.pre_prompt = inital_prompt_engineering_dict["PRE_PROMPT"]
78
-
79
- if "post_prompt" not in st.session_state:
80
- st.session_state.post_prompt = inital_prompt_engineering_dict["POST_PROMPT"]
81
-
82
- if "pass_prev" not in st.session_state:
83
- st.session_state.pass_prev = False
84
-
85
- if "chunk_size" not in st.session_state:
86
- st.session_state.chunk_size = 512
87
-
88
-
89
- def sidebar():
90
- def retrieval_settings():
91
- st.markdown("# Web Retrieval")
92
- st.session_state.rag_enabled = st.toggle("Activate Web Retrieval", value=True)
93
- st.session_state.search_vendor = st.radio(
94
- "Select Search Vendor",
95
- ["Bing", "Google"],
96
- disabled=not st.session_state.rag_enabled,
97
- )
98
- st.session_state.n_crawl = st.slider(
99
- label="Links to Crawl",
100
- key=1,
101
- min_value=1,
102
- max_value=10,
103
- value=4,
104
- disabled=not st.session_state.rag_enabled,
105
- )
106
- st.session_state.top_k = st.slider(
107
- label="Chunks to Retrieve via Reranker",
108
- key=2,
109
- min_value=1,
110
- max_value=20,
111
- value=5,
112
- disabled=not st.session_state.rag_enabled,
113
- )
114
-
115
- st.session_state.chunk_size = st.slider(
116
- label="Chunk Size",
117
- value=512,
118
- min_value=128,
119
- max_value=1024,
120
- step=8,
121
- disabled=not st.session_state.rag_enabled,
122
- )
123
-
124
- st.markdown("---")
125
-
126
- def model_analytics():
127
- st.markdown("# Model Analytics")
128
-
129
- st.write("Total tokens used :", st.session_state["tokens_used"])
130
- st.write("Speed :", st.session_state["tps"], " tokens/sec")
131
- st.write(
132
- "Total cost incurred :",
133
- round(
134
- COST_PER_1000_TOKENS_USD * st.session_state["tokens_used"] / 1000,
135
- 3,
136
- ),
137
- "USD",
138
- )
139
-
140
- st.markdown("---")
141
-
142
- def model_settings():
143
- st.markdown("# Model Settings")
144
-
145
- st.session_state.chat_bot = st.sidebar.radio(
146
- "Select one:", [key for key, _ in CHAT_BOTS.items()]
147
- )
148
- st.session_state.temp = st.slider(
149
- label="Temperature", min_value=0.0, max_value=1.0, step=0.1, value=0.9
150
- )
151
-
152
- st.session_state.max_tokens = st.slider(
153
- label="New tokens to generate",
154
- min_value=64,
155
- max_value=2048,
156
- step=32,
157
- value=512,
158
- )
159
-
160
- st.session_state.repetion_penalty = st.slider(
161
- label="Repetion Penalty", min_value=0.0, max_value=1.0, step=0.1, value=1.0
162
- )
163
-
164
- with st.sidebar:
165
- retrieval_settings()
166
- model_analytics()
167
- model_settings()
168
-
169
- st.markdown(
170
- """
171
- > **Created by [Pragnesh Barik](https://barik.super.site) 🔗**
172
- """
173
- )
174
-
175
-
176
- def prompt_engineering_dashboard():
177
- def engineer_prompt():
178
- st.session_state.history[0] = [
179
- st.session_state.system_instruction,
180
- st.session_state.system_response,
181
- ]
182
-
183
- with st.expander("Prompt Engineering Dashboard"):
184
- st.info(
185
- "**The input to the model follows this below template**",
186
- )
187
- st.code(
188
- """
189
- [SYSTEM INSTRUCTION]
190
- [SYSTEM RESPONSE]
191
-
192
- [... LIST OF PREV INPUTS]
193
-
194
- [PRE CONTEXT]
195
- [CONTEXT RETRIEVED FROM THE WEB]
196
- [POST CONTEXT]
197
-
198
- [PRE PROMPT]
199
- [PROMPT]
200
- [POST PROMPT]
201
- [PREV GENERATED INPUT] # Only if Pass previous prompt set True
202
-
203
- """
204
- )
205
- st.session_state.system_instruction = st.text_area(
206
- label="SYSTEM INSTRUCTION",
207
- value=inital_prompt_engineering_dict["SYSTEM_INSTRUCTION"],
208
- )
209
- st.session_state.system_response = st.text_area(
210
- "SYSTEM RESPONSE", value=inital_prompt_engineering_dict["SYSTEM_RESPONSE"]
211
- )
212
-
213
- col1, col2 = st.columns(2)
214
- with col1:
215
- st.session_state.pre_context = st.text_input(
216
- "PRE CONTEXT",
217
- value=inital_prompt_engineering_dict["PRE_CONTEXT"],
218
- disabled=not st.session_state.rag_enabled,
219
- )
220
- st.session_state.post_context = st.text_input(
221
- "POST CONTEXT",
222
- value=inital_prompt_engineering_dict["POST_CONTEXT"],
223
- disabled=not st.session_state.rag_enabled,
224
- )
225
-
226
- with col2:
227
- st.session_state.pre_prompt = st.text_input(
228
- "PRE PROMPT", value=inital_prompt_engineering_dict["PRE_PROMPT"]
229
- )
230
- st.session_state.post_prompt = st.text_input(
231
- "POST PROMPT", value=inital_prompt_engineering_dict["POST_PROMPT"]
232
- )
233
-
234
- col3, col4 = st.columns(2)
235
- with col3:
236
- st.session_state.pass_prev = st.toggle("Pass previous Output")
237
- with col4:
238
- st.button("Engineer Prompts", on_click=engineer_prompt)
239
-
240
-
241
- def header():
242
- st.write("# Mixtral Playground")
243
 
244
- prompt_engineering_dashboard()
245
 
 
246
 
247
- def chat_box():
248
- for message in st.session_state.messages:
249
- with st.chat_message(message["role"]):
250
- st.markdown(message["content"])
251
 
 
252
 
253
- def generate_chat_stream(prompt):
254
- # 1. augments prompt according to the template
255
- # 2. returns chat_stream and source links
256
- # 3. chat_stream and source links are used by stream_handler and show_source
257
- links = []
258
- if st.session_state.rag_enabled:
259
- with st.spinner("Fetching relevent documents from Web...."):
260
- prompt, links = gen_augmented_prompt_via_websearch(
261
- prompt=prompt,
262
- pre_context=st.session_state.pre_context,
263
- post_context=st.session_state.post_context,
264
- pre_prompt=st.session_state.pre_prompt,
265
- post_prompt=st.session_state.post_prompt,
266
- vendor=st.session_state.search_vendor,
267
- top_k=st.session_state.top_k,
268
- n_crawl=st.session_state.n_crawl,
269
- pass_prev=st.session_state.pass_prev,
270
- prev_output=st.session_state.history[-1][1],
271
- )
272
-
273
- with st.spinner("Generating response..."):
274
- chat_stream = chat(
275
- prompt,
276
- st.session_state.history,
277
- chat_client=CHAT_BOTS[st.session_state.chat_bot],
278
- temperature=st.session_state.temp,
279
- max_new_tokens=st.session_state.max_tokens,
280
- )
281
-
282
- return chat_stream, links
283
-
284
-
285
- def stream_handler(chat_stream, placeholder):
286
- # 1. Uses the chat_stream and streams message on placeholder
287
- # 2. returns full_response for token calculation
288
- start_time = time.time()
289
- full_response = ""
290
-
291
- for chunk in chat_stream:
292
- if chunk.token.text != "</s>":
293
- full_response += chunk.token.text
294
- placeholder.markdown(full_response + "▌")
295
- placeholder.markdown(full_response)
296
-
297
- end_time = time.time()
298
- elapsed_time = end_time - start_time
299
- total_tokens_processed = len(full_response.split())
300
- tokens_per_second = total_tokens_processed // elapsed_time
301
- len_response = (len(prompt.split()) + len(full_response.split())) * 1.25
302
- col1, col2, col3 = st.columns(3)
303
-
304
- with col1:
305
- st.write(f"**{tokens_per_second} tokens/second**")
306
-
307
- with col2:
308
- st.write(f"**{int(len_response)} tokens generated**")
309
-
310
- with col3:
311
- st.write(
312
- f"**$ {round(len_response * COST_PER_1000_TOKENS_USD / 1000, 5)} cost incurred**"
313
- )
314
-
315
- st.session_state["tps"] = tokens_per_second
316
- st.session_state["tokens_used"] = len_response + st.session_state["tokens_used"]
317
-
318
- return full_response
319
-
320
-
321
- def show_source(links):
322
- # Expander component to show source
323
- with st.expander("Show source"):
324
- for i, link in enumerate(links):
325
- st.info(f"{link}")
326
-
327
-
328
- init_state()
329
- sidebar()
330
- header()
331
- chat_box()
332
-
333
- # Main chat loop
334
  if prompt := st.chat_input("Generate Ebook"):
335
  st.chat_message("user").markdown(prompt)
336
  st.session_state.messages.append({"role": "user", "content": prompt})
337
 
338
- chat_stream, links = generate_chat_stream(prompt)
339
 
340
  with st.chat_message("assistant"):
341
  placeholder = st.empty()
342
- full_response = stream_handler(chat_stream, placeholder)
 
 
343
  if st.session_state.rag_enabled:
344
  show_source(links)
345
 
 
1
  import streamlit as st
2
+ import yaml
3
  from chat_client import chat
4
+ from components.sidebar import sidebar
5
+ from components.prompt_engineering_dashboard import prompt_engineering_dashboard
6
+ from components.stream_handler import stream_handler
7
+ from components.show_source import show_source
8
+ from components.chat_box import chat_box
9
+ from components.generate_chat_stream import generate_chat_stream
10
+ from components.init_state import init_state
11
 
12
 
13
+ with open("config.yaml", "r") as file:
14
+ config = yaml.safe_load(file)
 
 
 
 
 
 
 
 
15
 
16
  st.set_page_config(
17
  page_title="Mixtral Playground",
 
19
  )
20
 
21
 
22
+ init_state(st.session_state, config)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ st.write("# Mixtral Playground")
25
 
26
+ prompt_engineering_dashboard(st.session_state, config)
27
 
28
+ sidebar(st.session_state, config)
 
 
 
29
 
30
+ chat_box(st.session_state)
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  if prompt := st.chat_input("Generate Ebook"):
33
  st.chat_message("user").markdown(prompt)
34
  st.session_state.messages.append({"role": "user", "content": prompt})
35
 
36
+ chat_stream, links = generate_chat_stream(st.session_state, prompt, config)
37
 
38
  with st.chat_message("assistant"):
39
  placeholder = st.empty()
40
+ full_response = stream_handler(
41
+ st.session_state, chat_stream, prompt, placeholder
42
+ )
43
  if st.session_state.rag_enabled:
44
  show_source(links)
45
 
chat_client.py CHANGED
@@ -1,26 +1,31 @@
1
  from huggingface_hub import InferenceClient
2
  import os
3
  from dotenv import load_dotenv
 
4
  load_dotenv()
5
 
6
- API_TOKEN = os.getenv('HF_TOKEN')
7
 
8
 
9
  def format_prompt(message, history):
10
- prompt = "<s>"
11
- for user_prompt, bot_response in history:
12
- prompt += f"[INST] {user_prompt} [/INST]"
13
- prompt += f" {bot_response}</s> "
14
- prompt += f"[INST] {message} [/INST]"
15
- return prompt
 
16
 
17
  def chat(
18
- prompt, history, chat_client = "mistralai/Mistral-7B-Instruct-v0.1",temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
 
 
 
 
 
 
19
  ):
20
- client = InferenceClient(
21
- chat_client,
22
- token=API_TOKEN
23
- )
24
  temperature = float(temperature)
25
  if temperature < 1e-2:
26
  temperature = 1e-2
@@ -37,14 +42,12 @@ def chat(
37
 
38
  formatted_prompt = format_prompt(prompt, history)
39
 
40
- stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
41
- output = ""
42
-
43
- # for response in stream:
44
- # # print(response)
45
- # output += response.token["text"]
46
- # yield output
47
- # return output
48
-
49
 
50
  return stream
 
1
  from huggingface_hub import InferenceClient
2
  import os
3
  from dotenv import load_dotenv
4
+
5
  load_dotenv()
6
 
7
+ API_TOKEN = os.getenv("HF_TOKEN")
8
 
9
 
10
  def format_prompt(message, history):
11
+ prompt = "<s>"
12
+ for user_prompt, bot_response in history:
13
+ prompt += f"[INST] {user_prompt} [/INST]"
14
+ prompt += f" {bot_response}</s> "
15
+ prompt += f"[INST] {message} [/INST]"
16
+ return prompt
17
+
18
 
19
  def chat(
20
+ prompt,
21
+ history,
22
+ chat_client="mistralai/Mistral-7B-Instruct-v0.1",
23
+ temperature=0.9,
24
+ max_new_tokens=256,
25
+ top_p=0.95,
26
+ repetition_penalty=1.0,
27
  ):
28
+ client = InferenceClient(chat_client, token=API_TOKEN)
 
 
 
29
  temperature = float(temperature)
30
  if temperature < 1e-2:
31
  temperature = 1e-2
 
42
 
43
  formatted_prompt = format_prompt(prompt, history)
44
 
45
+ stream = client.text_generation(
46
+ formatted_prompt,
47
+ **generate_kwargs,
48
+ stream=True,
49
+ details=True,
50
+ return_full_text=False,
51
+ )
 
 
52
 
53
  return stream
components/chat_box.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ def chat_box(session_state):
5
+ for message in session_state.messages:
6
+ with st.chat_message(message["role"]):
7
+ st.markdown(message["content"])
components/generate_chat_stream.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from utils import gen_augmented_prompt_via_websearch
3
+ from chat_client import chat
4
+
5
+
6
+ def generate_chat_stream(session_state, prompt, config):
7
+ # 1. augments prompt according to the template
8
+ # 2. returns chat_stream and source links
9
+ # 3. chat_stream and source links are used by stream_handler and show_source
10
+ chat_bot_dict = config["CHAT_BOTS"]
11
+ links = []
12
+ if session_state.rag_enabled:
13
+ with st.spinner("Fetching relevent documents from Web...."):
14
+ prompt, links = gen_augmented_prompt_via_websearch(
15
+ prompt=prompt,
16
+ pre_context=session_state.pre_context,
17
+ post_context=session_state.post_context,
18
+ pre_prompt=session_state.pre_prompt,
19
+ post_prompt=session_state.post_prompt,
20
+ vendor=session_state.search_vendor,
21
+ top_k=session_state.top_k,
22
+ n_crawl=session_state.n_crawl,
23
+ pass_prev=session_state.pass_prev,
24
+ prev_output=session_state.history[-1][1],
25
+ )
26
+
27
+ with st.spinner("Generating response..."):
28
+ chat_stream = chat(
29
+ prompt,
30
+ session_state.history,
31
+ chat_client=chat_bot_dict[session_state.chat_bot],
32
+ temperature=session_state.temp,
33
+ max_new_tokens=session_state.max_tokens,
34
+ )
35
+
36
+ return chat_stream, links
components/init_state.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def init_state(session_state, config):
2
+ initial_prompt_engineering_dict = config["PROMPT_ENGINEERING_DICT"]
3
+ if "messages" not in session_state:
4
+ session_state.messages = []
5
+
6
+ if "tokens_used" not in session_state:
7
+ session_state.tokens_used = 0
8
+
9
+ if "tps" not in session_state:
10
+ session_state.tps = 0
11
+
12
+ if "temp" not in session_state:
13
+ session_state.temp = 0.8
14
+
15
+ if "history" not in session_state:
16
+ session_state.history = [
17
+ [
18
+ initial_prompt_engineering_dict["SYSTEM_INSTRUCTION"],
19
+ initial_prompt_engineering_dict["SYSTEM_RESPONSE"],
20
+ ]
21
+ ]
22
+
23
+ if "n_crawl" not in session_state:
24
+ session_state.n_crawl = 5
25
+
26
+ if "repetion_penalty" not in session_state:
27
+ session_state.repetion_penalty = 1
28
+
29
+ if "rag_enabled" not in session_state:
30
+ session_state.rag_enabled = True
31
+
32
+ if "chat_bot" not in session_state:
33
+ session_state.chat_bot = "Mixtral 8x7B v0.1"
34
+
35
+ if "search_vendor" not in session_state:
36
+ session_state.search_vendor = "Bing"
37
+
38
+ if "system_instruction" not in session_state:
39
+ session_state.system_instruction = initial_prompt_engineering_dict[
40
+ "SYSTEM_INSTRUCTION"
41
+ ]
42
+
43
+ if "system_response" not in session_state:
44
+ session_state.system_instruction = initial_prompt_engineering_dict[
45
+ "SYSTEM_RESPONSE"
46
+ ]
47
+
48
+ if "pre_context" not in session_state:
49
+ session_state.pre_context = initial_prompt_engineering_dict["PRE_CONTEXT"]
50
+
51
+ if "post_context" not in session_state:
52
+ session_state.post_context = initial_prompt_engineering_dict["POST_CONTEXT"]
53
+
54
+ if "pre_prompt" not in session_state:
55
+ session_state.pre_prompt = initial_prompt_engineering_dict["PRE_PROMPT"]
56
+
57
+ if "post_prompt" not in session_state:
58
+ session_state.post_prompt = initial_prompt_engineering_dict["POST_PROMPT"]
59
+
60
+ if "pass_prev" not in session_state:
61
+ session_state.pass_prev = False
62
+
63
+ if "chunk_size" not in session_state:
64
+ session_state.chunk_size = 512
components/prompt_engineering_dashboard.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ def prompt_engineering_dashboard(session_state, config):
5
+ inital_prompt_engineering_dict = config["PROMPT_ENGINEERING_DICT"]
6
+
7
+ def engineer_prompt():
8
+ session_state.history[0] = [
9
+ session_state.system_instruction,
10
+ session_state.system_response,
11
+ ]
12
+
13
+ with st.expander("Prompt Engineering Dashboard"):
14
+ st.info(
15
+ "**The input to the model follows this below template**",
16
+ )
17
+ st.code(
18
+ """
19
+ [SYSTEM INSTRUCTION]
20
+ [SYSTEM RESPONSE]
21
+
22
+ [... LIST OF PREV INPUTS]
23
+
24
+ [PRE CONTEXT]
25
+ [CONTEXT RETRIEVED FROM THE WEB]
26
+ [POST CONTEXT]
27
+
28
+ [PRE PROMPT]
29
+ [PROMPT]
30
+ [POST PROMPT]
31
+ [PREV GENERATED INPUT] # Only if Pass previous prompt set True
32
+
33
+ """
34
+ )
35
+ session_state.system_instruction = st.text_area(
36
+ label="SYSTEM INSTRUCTION",
37
+ value=inital_prompt_engineering_dict["SYSTEM_INSTRUCTION"],
38
+ )
39
+ session_state.system_response = st.text_area(
40
+ "SYSTEM RESPONSE", value=inital_prompt_engineering_dict["SYSTEM_RESPONSE"]
41
+ )
42
+
43
+ col1, col2 = st.columns(2)
44
+ with col1:
45
+ session_state.pre_context = st.text_input(
46
+ "PRE CONTEXT",
47
+ value=inital_prompt_engineering_dict["PRE_CONTEXT"],
48
+ disabled=not session_state.rag_enabled,
49
+ )
50
+ session_state.post_context = st.text_input(
51
+ "POST CONTEXT",
52
+ value=inital_prompt_engineering_dict["POST_CONTEXT"],
53
+ disabled=not session_state.rag_enabled,
54
+ )
55
+
56
+ with col2:
57
+ session_state.pre_prompt = st.text_input(
58
+ "PRE PROMPT", value=inital_prompt_engineering_dict["PRE_PROMPT"]
59
+ )
60
+ session_state.post_prompt = st.text_input(
61
+ "POST PROMPT", value=inital_prompt_engineering_dict["POST_PROMPT"]
62
+ )
63
+
64
+ col3, col4 = st.columns(2)
65
+ with col3:
66
+ session_state.pass_prev = st.toggle("Pass previous Output")
67
+ with col4:
68
+ st.button("Engineer Prompts", on_click=engineer_prompt)
components/show_source.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ def show_source(links):
5
+ # Expander component to show source
6
+ with st.expander("Show source"):
7
+ for i, link in enumerate(links):
8
+ st.info(f"{link}")
components/sidebar.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import yaml
3
+
4
+
5
+ def sidebar(session_state, config):
6
+ COST_PER_1000_TOKENS_USD = config["COST_PER_1000_TOKENS_USD"]
7
+ CHAT_BOTS = config["CHAT_BOTS"]
8
+
9
+ def retrieval_settings():
10
+ st.markdown("# Web Retrieval")
11
+ session_state.rag_enabled = st.toggle("Activate Web Retrieval", value=True)
12
+ session_state.search_vendor = st.radio(
13
+ "Select Search Vendor",
14
+ ["Bing", "Google"],
15
+ disabled=not session_state.rag_enabled,
16
+ )
17
+ session_state.n_crawl = st.slider(
18
+ label="Links to Crawl",
19
+ key=1,
20
+ min_value=1,
21
+ max_value=10,
22
+ value=4,
23
+ disabled=not session_state.rag_enabled,
24
+ )
25
+ session_state.top_k = st.slider(
26
+ label="Chunks to Retrieve via Reranker",
27
+ key=2,
28
+ min_value=1,
29
+ max_value=20,
30
+ value=5,
31
+ disabled=not session_state.rag_enabled,
32
+ )
33
+
34
+ session_state.chunk_size = st.slider(
35
+ label="Chunk Size",
36
+ value=512,
37
+ min_value=128,
38
+ max_value=1024,
39
+ step=8,
40
+ disabled=not session_state.rag_enabled,
41
+ )
42
+
43
+ st.markdown("---")
44
+
45
+ def model_analytics():
46
+ st.markdown("# Model Analytics")
47
+
48
+ st.write("Total tokens used :", session_state["tokens_used"])
49
+ st.write("Speed :", session_state["tps"], " tokens/sec")
50
+ st.write(
51
+ "Total cost incurred :",
52
+ round(
53
+ COST_PER_1000_TOKENS_USD * session_state["tokens_used"] / 1000,
54
+ 3,
55
+ ),
56
+ "USD",
57
+ )
58
+
59
+ st.markdown("---")
60
+
61
+ def model_settings():
62
+ st.markdown("# Model Settings")
63
+
64
+ session_state.chat_bot = st.sidebar.radio(
65
+ "Select one:", [key for key, _ in CHAT_BOTS.items()]
66
+ )
67
+ session_state.temp = st.slider(
68
+ label="Temperature", min_value=0.0, max_value=1.0, step=0.1, value=0.9
69
+ )
70
+
71
+ session_state.max_tokens = st.slider(
72
+ label="New tokens to generate",
73
+ min_value=64,
74
+ max_value=2048,
75
+ step=32,
76
+ value=512,
77
+ )
78
+
79
+ session_state.repetion_penalty = st.slider(
80
+ label="Repetion Penalty", min_value=0.0, max_value=1.0, step=0.1, value=1.0
81
+ )
82
+
83
+ with st.sidebar:
84
+ retrieval_settings()
85
+ model_analytics()
86
+ model_settings()
87
+
88
+ st.markdown(
89
+ """
90
+ > **Created by [Pragnesh Barik](https://barik.super.site) 🔗**
91
+ """
92
+ )
components/stream_handler.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import streamlit as st
3
+
4
+ COST_PER_1000_TOKENS_USD = 0.139 / 80
5
+
6
+
7
+ def stream_handler(session_state, chat_stream, prompt, placeholder):
8
+ # 1. Uses the chat_stream and streams message on placeholder
9
+ # 2. returns full_response for token calculation
10
+ start_time = time.time()
11
+ full_response = ""
12
+
13
+ for chunk in chat_stream:
14
+ if chunk.token["text"] != "</s>":
15
+ full_response += chunk.token["text"]
16
+ placeholder.markdown(full_response + "▌")
17
+ placeholder.markdown(full_response)
18
+
19
+ end_time = time.time()
20
+ elapsed_time = end_time - start_time
21
+ total_tokens_processed = len(full_response.split())
22
+ tokens_per_second = total_tokens_processed // elapsed_time
23
+ len_response = (len(prompt.split()) + len(full_response.split())) * 1.25
24
+ col1, col2, col3 = st.columns(3)
25
+
26
+ with col1:
27
+ st.write(f"**{tokens_per_second} tokens/second**")
28
+
29
+ with col2:
30
+ st.write(f"**{int(len_response)} tokens generated**")
31
+
32
+ with col3:
33
+ st.write(
34
+ f"**$ {round(len_response * COST_PER_1000_TOKENS_USD / 1000, 5)} cost incurred**"
35
+ )
36
+
37
+ session_state["tps"] = tokens_per_second
38
+ session_state["tokens_used"] = len_response + session_state["tokens_used"]
39
+
40
+ return full_response
config.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PROMPT_ENGINEERING_DICT:
2
+ SYSTEM_INSTRUCTION: |
3
+ You are a knowledgeable author on medical conditions, with a deep expertise in Huntington's disease.
4
+ You provide extensive, clear information on complex medical topics, treatments, new research and developments.
5
+ You avoid giving personal medical advice or diagnoses but offer general advice and underscore the importance of consulting healthcare professionals.
6
+ Your goal is to inform, engage, and enlighten users that inquire about Huntington's disease, offering factual data and real-life perspectives with an empathetic tone.
7
+ You use every search available including web search together with articles and information from:
8
+ - Journal of Huntington's disease
9
+ - Movement Disorders
10
+ - Neurology
11
+ - Journal of Neurology
12
+ - Neurosurgery & Psychiatry
13
+ - HDBuzz
14
+ - PubMed
15
+ - Huntington's Disease Society of America (HDSA)
16
+ - Huntington Study Group (HSG)
17
+ - Nature Reviews Neurology
18
+ - ScienceDirect
19
+ The information you provide should be understandable to laypersons, well-organized, and include credible sources, citations, and an empathetic tone.
20
+ It should educate on the scientific aspects and personal challenges of living with Huntington's Disease.
21
+ SYSTEM_RESPONSE: |
22
+ Hello! I'm an assistant trained to provide detailed and accurate information on medical conditions, including Huntington's Disease.
23
+ I'm here to help answer your questions and provide resources to help you better understand this disease and its impact on individuals and their families.
24
+ If you have any questions about HD or related topics, feel free to ask!
25
+ PRE_CONTEXT: NOW YOU ARE SEARCHING THE WEB, AND HERE ARE THE CHUNKS RETRIEVED FROM THE WEB.
26
+ POST_CONTEXT: ""
27
+ PRE_PROMPT: NOW ACCORDING TO THE CONTEXT RETRIEVED FROM THE GENERATE THE CONTENT FOR THE FOLLOWING SUBJECT
28
+ POST_PROMPT: Do not repeat yourself
29
+
30
+ CHAT_BOTS:
31
+ Mixtral 8x7B v0.1: mistralai/Mixtral-8x7B-Instruct-v0.1
32
+ Mistral 7B v0.1: mistralai/Mistral-7B-Instruct-v0.1
33
+
34
+ COST_PER_1000_TOKENS_USD: 0.001737375
rag/Scripts/Activate.ps1 DELETED
@@ -1,399 +0,0 @@
1
- <#
2
- .Synopsis
3
- Activate a Python virtual environment for the current PowerShell session.
4
-
5
- .Description
6
- Pushes the python executable for a virtual environment to the front of the
7
- $Env:PATH environment variable and sets the prompt to signify that you are
8
- in a Python virtual environment. Makes use of the command line switches as
9
- well as the `pyvenv.cfg` file values present in the virtual environment.
10
-
11
- .Parameter VenvDir
12
- Path to the directory that contains the virtual environment to activate. The
13
- default value for this is the parent of the directory that the Activate.ps1
14
- script is located within.
15
-
16
- .Parameter Prompt
17
- The prompt prefix to display when this virtual environment is activated. By
18
- default, this prompt is the name of the virtual environment folder (VenvDir)
19
- surrounded by parentheses and followed by a single space (ie. '(.venv) ').
20
-
21
- .Example
22
- Activate.ps1
23
- Activates the Python virtual environment that contains the Activate.ps1 script.
24
-
25
- .Example
26
- Activate.ps1 -Verbose
27
- Activates the Python virtual environment that contains the Activate.ps1 script,
28
- and shows extra information about the activation as it executes.
29
-
30
- .Example
31
- Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
32
- Activates the Python virtual environment located in the specified location.
33
-
34
- .Example
35
- Activate.ps1 -Prompt "MyPython"
36
- Activates the Python virtual environment that contains the Activate.ps1 script,
37
- and prefixes the current prompt with the specified string (surrounded in
38
- parentheses) while the virtual environment is active.
39
-
40
- .Notes
41
- On Windows, it may be required to enable this Activate.ps1 script by setting the
42
- execution policy for the user. You can do this by issuing the following PowerShell
43
- command:
44
-
45
- PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
46
-
47
- For more information on Execution Policies:
48
- https://go.microsoft.com/fwlink/?LinkID=135170
49
-
50
- #>
51
- Param(
52
- [Parameter(Mandatory = $false)]
53
- [String]
54
- $VenvDir,
55
- [Parameter(Mandatory = $false)]
56
- [String]
57
- $Prompt
58
- )
59
-
60
- <# Function declarations --------------------------------------------------- #>
61
-
62
- <#
63
- .Synopsis
64
- Remove all shell session elements added by the Activate script, including the
65
- addition of the virtual environment's Python executable from the beginning of
66
- the PATH variable.
67
-
68
- .Parameter NonDestructive
69
- If present, do not remove this function from the global namespace for the
70
- session.
71
-
72
- #>
73
- function global:deactivate ([switch]$NonDestructive) {
74
- # Revert to original values
75
-
76
- # The prior prompt:
77
- if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
78
- Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
79
- Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
80
- }
81
-
82
- # The prior PYTHONHOME:
83
- if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
84
- Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
85
- Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
86
- }
87
-
88
- # The prior PATH:
89
- if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
90
- Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
91
- Remove-Item -Path Env:_OLD_VIRTUAL_PATH
92
- }
93
-
94
- # Just remove the VIRTUAL_ENV altogether:
95
- if (Test-Path -Path Env:VIRTUAL_ENV) {
96
- Remove-Item -Path env:VIRTUAL_ENV
97
- }
98
-
99
- # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
100
- if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
101
- Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
102
- }
103
-
104
- # Leave deactivate function in the global namespace if requested:
105
- if (-not $NonDestructive) {
106
- Remove-Item -Path function:deactivate
107
- }
108
- }
109
-
110
- <#
111
- .Description
112
- Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
113
- given folder, and returns them in a map.
114
-
115
- For each line in the pyvenv.cfg file, if that line can be parsed into exactly
116
- two strings separated by `=` (with any amount of whitespace surrounding the =)
117
- then it is considered a `key = value` line. The left hand string is the key,
118
- the right hand is the value.
119
-
120
- If the value starts with a `'` or a `"` then the first and last character is
121
- stripped from the value before being captured.
122
-
123
- .Parameter ConfigDir
124
- Path to the directory that contains the `pyvenv.cfg` file.
125
- #>
126
- function Get-PyVenvConfig(
127
- [String]
128
- $ConfigDir
129
- ) {
130
- Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
131
-
132
- # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
133
- $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
134
-
135
- # An empty map will be returned if no config file is found.
136
- $pyvenvConfig = @{ }
137
-
138
- if ($pyvenvConfigPath) {
139
-
140
- Write-Verbose "File exists, parse `key = value` lines"
141
- $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
142
-
143
- $pyvenvConfigContent | ForEach-Object {
144
- $keyval = $PSItem -split "\s*=\s*", 2
145
- if ($keyval[0] -and $keyval[1]) {
146
- $val = $keyval[1]
147
-
148
- # Remove extraneous quotations around a string value.
149
- if ("'""".Contains($val.Substring(0, 1))) {
150
- $val = $val.Substring(1, $val.Length - 2)
151
- }
152
-
153
- $pyvenvConfig[$keyval[0]] = $val
154
- Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
155
- }
156
- }
157
- }
158
- return $pyvenvConfig
159
- }
160
-
161
-
162
- <# Begin Activate script --------------------------------------------------- #>
163
-
164
- # Determine the containing directory of this script
165
- $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
166
- $VenvExecDir = Get-Item -Path $VenvExecPath
167
-
168
- Write-Verbose "Activation script is located in path: '$VenvExecPath'"
169
- Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
170
- Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
171
-
172
- # Set values required in priority: CmdLine, ConfigFile, Default
173
- # First, get the location of the virtual environment, it might not be
174
- # VenvExecDir if specified on the command line.
175
- if ($VenvDir) {
176
- Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
177
- }
178
- else {
179
- Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
180
- $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
181
- Write-Verbose "VenvDir=$VenvDir"
182
- }
183
-
184
- # Next, read the `pyvenv.cfg` file to determine any required value such
185
- # as `prompt`.
186
- $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
187
-
188
- # Next, set the prompt from the command line, or the config file, or
189
- # just use the name of the virtual environment folder.
190
- if ($Prompt) {
191
- Write-Verbose "Prompt specified as argument, using '$Prompt'"
192
- }
193
- else {
194
- Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
195
- if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
196
- Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
197
- $Prompt = $pyvenvCfg['prompt'];
198
- }
199
- else {
200
- Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
201
- Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
202
- $Prompt = Split-Path -Path $venvDir -Leaf
203
- }
204
- }
205
-
206
- Write-Verbose "Prompt = '$Prompt'"
207
- Write-Verbose "VenvDir='$VenvDir'"
208
-
209
- # Deactivate any currently active virtual environment, but leave the
210
- # deactivate function in place.
211
- deactivate -nondestructive
212
-
213
- # Now set the environment variable VIRTUAL_ENV, used by many tools to determine
214
- # that there is an activated venv.
215
- $env:VIRTUAL_ENV = $VenvDir
216
-
217
- if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
218
-
219
- Write-Verbose "Setting prompt to '$Prompt'"
220
-
221
- # Set the prompt to include the env name
222
- # Make sure _OLD_VIRTUAL_PROMPT is global
223
- function global:_OLD_VIRTUAL_PROMPT { "" }
224
- Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
225
- New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
226
-
227
- function global:prompt {
228
- Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
229
- _OLD_VIRTUAL_PROMPT
230
- }
231
- }
232
-
233
- # Clear PYTHONHOME
234
- if (Test-Path -Path Env:PYTHONHOME) {
235
- Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
236
- Remove-Item -Path Env:PYTHONHOME
237
- }
238
-
239
- # Add the venv to the PATH
240
- Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
241
- $Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
242
-
243
- # SIG # Begin signature block
244
- # MIIc9wYJKoZIhvcNAQcCoIIc6DCCHOQCAQExDzANBglghkgBZQMEAgEFADB5Bgor
245
- # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
246
- # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCD50itN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ly9v
262
- # Y3NwLmRpZ2ljZXJ0LmNvbTBDBggrBgEFBQcwAoY3aHR0cDovL2NhY2VydHMuZGln
263
- # aWNlcnQuY29tL0RpZ2lDZXJ0QXNzdXJlZElEUm9vdENBLmNydDCBgQYDVR0fBHow
264
- # eDA6oDigNoY0aHR0cDovL2NybDQuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0QXNzdXJl
265
- # ZElEUm9vdENBLmNybDA6oDigNoY0aHR0cDovL2NybDMuZGlnaWNlcnQuY29tL0Rp
266
- # Z2lDZXJ0QXNzdXJlZElEUm9vdENBLmNybDBPBgNVHSAESDBGMDgGCmCGSAGG/WwA
267
- # AgQwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAK
268
- # BghghkgBhv1sAzAdBgNVHQ4EFgQUWsS5eyoKo6XqcQPAYPkt9mV1DlgwHwYDVR0j
269
- # BBgwFoAUReuir/SSy4IxLVGLp6chnfNtyA8wDQYJKoZIhvcNAQELBQADggEBAD7s
270
- # DVoks/Mi0RXILHwlKXaoHV0cLToaxO8wYdd+C2D9wz0PxK+L/e8q3yBVN7Dh9tGS
271
- # dQ9RtG6ljlriXiSBThCk7j9xjmMOE0ut119EefM2FAaK95xGTlz/kLEbBw6RFfu6
272
- # r7VRwo0kriTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo
273
- # +MUSaJ/PQMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qz
274
- # sIzV6Q3d9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHq
275
- # aGxEMrJmoecYpJpkUe8wggZHMIIFL6ADAgECAhADPtXtoGXRuMkd/PkqbJvYMA0G
276
- # CSqGSIb3DQEBCwUAMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJ
277
- # bmMxGTAXBgNVBAsTEHd3dy5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zXnuVE0w
308
- # 50exJvRSK3Vt4g+0vigpI3qPmDdpkf9+4Mvy0XMNcqrthw20R+PkIlMxghDOMIIQ
309
- # ygIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkw
310
- # FwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEy
311
- # IEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhADPtXtoGXRuMkd/PkqbJvYMA0G
312
- # CWCGSAFlAwQCAQUAoIGYMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisG
313
- # AQQBgjcCAQsxDjAMBgorBgEEAYI3AgEVMCwGCisGAQQBgjcCAQwxHjAcoBqAGABQ
314
- # AHkAdABoAG8AbgAgADMALgA5AC4AODAvBgkqhkiG9w0BCQQxIgQgVkkzBKWOaE6h
315
- # LZ4RPK1x031KWOzGTBHw2wSm0tSdHC0wDQYJKoZIhvcNAQEBBQAEggIAhvnfzv5s
316
- # LAI424IYB5BiplTY8igc/dXW0L9VargC6yOC4Pyzyz7MNX0iaLUfv0y3nD25u9MG
317
- # dGPeOmTfSYnPeu9H/ovvhSwj6LjV9DX1TgsfDPfQ3zs3ak51UkJGgRFj2FKbWnHc
318
- # 8zuXT7C7M9v4XrjWArswdP/+8SvOymWjYHRFM6rwcet5px6n+bYFU1dUwFV2hNFQ
319
- # 23wDFhTSATWyPGfn81q73EWrBe3cRpWgS7mfmlSt6sCHxVo5xQX2jjlYA1ttL8tu
320
- # rBZ+socFWyn82fg0nXDg/5lSapUPKSSaGu6vm8lIlpB4Z449brshSTZ2H4W+LrXu
321
- # ZSR02O/Yd+i/r+KxedyBipw35YAOGedq6ODfis/ixCMqAyo7xjX/Z+rIWHm7Yf0n
322
- # FQyya8qwjAkrx6pF1NNisXNk/Ue1Fg8d5/o0a2b2u2T6+A+/cBBqnHXqfExlPoqM
323
- # 0uIEgWJP9wKAYBbjwdC2lTFbxjnTs2iyv+99BQzU9ecWy+Tzu/woJmiQoSjzdWGc
324
- # I9mzlyqGEvQB6/Udy+K43Ykgr3noQX6SYH6Yfp0acdwitigbnosfykrkmkfdROeK
325
- # a6/+RMQqOz4KM5h277Qabadqu9yNPv6hk73pn62QpPaRGn+SRIl7ppTjRz1yOU8f
326
- # 9Y5obr2wfgVizaUnHquRKeuYbWC+mq/65xahgg19MIINeQYKKwYBBAGCNwMDATGC
327
- # DWkwgg1lBgkqhkiG9w0BBwKggg1WMIINUgIBAzEPMA0GCWCGSAFlAwQCAQUAMHcG
328
- # CyqGSIb3DQEJEAEEoGgEZjBkAgEBBglghkgBhv1sBwEwMTANBglghkgBZQMEAgEF
329
- # AAQgsX+p1he5Y83BxbjDF3wcPgaRPcA/hdudlnmnIp4fj8cCECGQNygHZHlOLsxq
330
- # r1Ok1q0YDzIwMjExMTA1MjA1NjE0WqCCCjcwggT+MIID5qADAgECAhANQkrgvjqI
331
- # /2BAIc4UAPDdMA0GCSqGSIb3DQEBCwUAMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQK
332
- # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xMTAvBgNV
333
- # BAMTKERpZ2lDZXJ0IFNIQTIgQXNzdXJlZCBJRCBUaW1lc3RhbXBpbmcgQ0EwHhcN
334
- # MjEwMTAxMDAwMDAwWhcNMzEwMTA2MDAwMDAwWjBIMQswCQYDVQQGEwJVUzEXMBUG
335
- # A1UEChMORGlnaUNlcnQsIEluYy4xIDAeBgNVBAMTF0RpZ2lDZXJ0IFRpbWVzdGFt
336
- # cCAyMDIxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwuZhhGfFivUN
337
- # CKRFymNrUdc6EUK9CnV1TZS0DFC1JhD+HchvkWsMlucaXEjvROW/m2HNFZFiWrj/
338
- # ZwucY/02aoH6KfjdK3CF3gIY83htvH35x20JPb5qdofpir34hF0edsn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4IBzjCCAcowHQYDVR0OBBYEFPS2
370
- # 4SAd/imu0uRhpbKiJbLIFzVuMB8GA1UdIwQYMBaAFEXroq/0ksuCMS1Ri6enIZ3z
371
- # bcgPMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGGMBMGA1UdJQQM
372
- # MAoGCCsGAQUFBwMIMHkGCCsGAQUFBwEBBG0wazAkBggrBgEFBQcwAYYYaHR0cDov
373
- # L29jc3AuZGlnaWNlcnQuY29tMEMGCCsGAQUFBzAChjdodHRwOi8vY2FjZXJ0cy5k
374
- # aWdpY2VydC5jb20vRGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3J0MIGBBgNVHR8E
375
- # ejB4MDqgOKA2hjRodHRwOi8vY3JsNC5kaWdpY2VydC5jb20vRGlnaUNlcnRBc3N1
376
- # cmVkSURSb290Q0EuY3JsMDqgOKA2hjRodHRwOi8vY3JsMy5kaWdpY2VydC5jb20v
377
- # RGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3JsMFAGA1UdIARJMEcwOAYKYIZIAYb9
378
- # bAACBDAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2VydC5jb20vQ1BT
379
- # MAsGCWCGSAGG/WwHATANBgkqhkiG9w0BAQsFAAOCAQEAcZUS6VGHVmnN793afKpj
380
- # erN4zwY3QITvS4S/ys8DAv3Fp8MOIEIsr3fzKx8MIVoqtwU0HWqumfgnoma/Capg
381
- # 33akOpMP+LLR2HwZYuhegiUexLoceywh4tZbLBQ1QwRostt1AuByx5jWPGTlH0gQ
382
- # GF+JOGFNYkYkh2OMkVIsrymJ5Xgf1gsUpYDXEkdws3XVk4WTfraSZ/tTYYmo9WuW
383
- # wPRYaQ18yAGxuSh1t5ljhSKMYcp5lH5Z/IwP42+1ASa2bKXuh1Eh5Fhgm7oMLStt
384
- # osR+u8QlK0cCCHxJrhO24XxCQijGGFbPQTS2Zl22dHv1VjMiLyI2skuiSpXY9aaO
385
- # Uj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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/Scripts/activate DELETED
@@ -1,66 +0,0 @@
1
- # This file must be used with "source bin/activate" *from bash*
2
- # you cannot run it directly
3
-
4
- deactivate () {
5
- # reset old environment variables
6
- if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
7
- PATH="${_OLD_VIRTUAL_PATH:-}"
8
- export PATH
9
- unset _OLD_VIRTUAL_PATH
10
- fi
11
- if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
12
- PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
13
- export PYTHONHOME
14
- unset _OLD_VIRTUAL_PYTHONHOME
15
- fi
16
-
17
- # This should detect bash and zsh, which have a hash command that must
18
- # be called to get it to forget past commands. Without forgetting
19
- # past commands the $PATH changes we made may not be respected
20
- if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
21
- hash -r 2> /dev/null
22
- fi
23
-
24
- if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
25
- PS1="${_OLD_VIRTUAL_PS1:-}"
26
- export PS1
27
- unset _OLD_VIRTUAL_PS1
28
- fi
29
-
30
- unset VIRTUAL_ENV
31
- if [ ! "${1:-}" = "nondestructive" ] ; then
32
- # Self destruct!
33
- unset -f deactivate
34
- fi
35
- }
36
-
37
- # unset irrelevant variables
38
- deactivate nondestructive
39
-
40
- VIRTUAL_ENV="E:\Projects\ebook-gen\ebook-gen\rag"
41
- export VIRTUAL_ENV
42
-
43
- _OLD_VIRTUAL_PATH="$PATH"
44
- PATH="$VIRTUAL_ENV/Scripts:$PATH"
45
- export PATH
46
-
47
- # unset PYTHONHOME if set
48
- # this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
49
- # could use `if (set -u; : $PYTHONHOME) ;` in bash
50
- if [ -n "${PYTHONHOME:-}" ] ; then
51
- _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
52
- unset PYTHONHOME
53
- fi
54
-
55
- if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
56
- _OLD_VIRTUAL_PS1="${PS1:-}"
57
- PS1="(rag) ${PS1:-}"
58
- export PS1
59
- fi
60
-
61
- # This should detect bash and zsh, which have a hash command that must
62
- # be called to get it to forget past commands. Without forgetting
63
- # past commands the $PATH changes we made may not be respected
64
- if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
65
- hash -r 2> /dev/null
66
- fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/Scripts/activate.bat DELETED
@@ -1,33 +0,0 @@
1
- @echo off
2
-
3
- rem This file is UTF-8 encoded, so we need to update the current code page while executing it
4
- for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (
5
- set _OLD_CODEPAGE=%%a
6
- )
7
- if defined _OLD_CODEPAGE (
8
- "%SystemRoot%\System32\chcp.com" 65001 > nul
9
- )
10
-
11
- set VIRTUAL_ENV=E:\Projects\ebook-gen\ebook-gen\rag
12
-
13
- if not defined PROMPT set PROMPT=$P$G
14
-
15
- if defined _OLD_VIRTUAL_PROMPT set PROMPT=%_OLD_VIRTUAL_PROMPT%
16
- if defined _OLD_VIRTUAL_PYTHONHOME set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
17
-
18
- set _OLD_VIRTUAL_PROMPT=%PROMPT%
19
- set PROMPT=(rag) %PROMPT%
20
-
21
- if defined PYTHONHOME set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
22
- set PYTHONHOME=
23
-
24
- if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%
25
- if not defined _OLD_VIRTUAL_PATH set _OLD_VIRTUAL_PATH=%PATH%
26
-
27
- set PATH=%VIRTUAL_ENV%\Scripts;%PATH%
28
-
29
- :END
30
- if defined _OLD_CODEPAGE (
31
- "%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
32
- set _OLD_CODEPAGE=
33
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/Scripts/convert-caffe2-to-onnx.exe DELETED
Binary file (106 kB)
 
rag/Scripts/convert-onnx-to-caffe2.exe DELETED
Binary file (106 kB)
 
rag/Scripts/deactivate.bat DELETED
@@ -1,21 +0,0 @@
1
- @echo off
2
-
3
- if defined _OLD_VIRTUAL_PROMPT (
4
- set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
5
- )
6
- set _OLD_VIRTUAL_PROMPT=
7
-
8
- if defined _OLD_VIRTUAL_PYTHONHOME (
9
- set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
10
- set _OLD_VIRTUAL_PYTHONHOME=
11
- )
12
-
13
- if defined _OLD_VIRTUAL_PATH (
14
- set "PATH=%_OLD_VIRTUAL_PATH%"
15
- )
16
-
17
- set _OLD_VIRTUAL_PATH=
18
-
19
- set VIRTUAL_ENV=
20
-
21
- :END
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/Scripts/dotenv.exe DELETED
Binary file (106 kB)
 
rag/Scripts/f2py.exe DELETED
Binary file (106 kB)
 
rag/Scripts/huggingface-cli.exe DELETED
Binary file (106 kB)
 
rag/Scripts/ipython.exe DELETED
Binary file (106 kB)
 
rag/Scripts/ipython3.exe DELETED
Binary file (106 kB)
 
rag/Scripts/isympy.exe DELETED
Binary file (106 kB)
 
rag/Scripts/jsonschema.exe DELETED
Binary file (106 kB)
 
rag/Scripts/jupyter-kernel.exe DELETED
Binary file (106 kB)
 
rag/Scripts/jupyter-kernelspec.exe DELETED
Binary file (106 kB)
 
rag/Scripts/jupyter-migrate.exe DELETED
Binary file (106 kB)
 
rag/Scripts/jupyter-run.exe DELETED
Binary file (106 kB)
 
rag/Scripts/jupyter-troubleshoot.exe DELETED
Binary file (106 kB)
 
rag/Scripts/jupyter.exe DELETED
Binary file (106 kB)
 
rag/Scripts/markdown-it.exe DELETED
Binary file (106 kB)
 
rag/Scripts/nltk.exe DELETED
Binary file (106 kB)
 
rag/Scripts/normalizer.exe DELETED
Binary file (106 kB)
 
rag/Scripts/pinecone.exe DELETED
Binary file (106 kB)
 
rag/Scripts/pip.exe DELETED
Binary file (106 kB)
 
rag/Scripts/pip3.9.exe DELETED
Binary file (106 kB)
 
rag/Scripts/pip3.exe DELETED
Binary file (106 kB)
 
rag/Scripts/pygmentize.exe DELETED
Binary file (106 kB)
 
rag/Scripts/python.exe DELETED
Binary file (543 kB)
 
rag/Scripts/pythonw.exe DELETED
Binary file (542 kB)
 
rag/Scripts/pywin32_postinstall.py DELETED
@@ -1,783 +0,0 @@
1
- # postinstall script for pywin32
2
- #
3
- # copies PyWinTypesxx.dll and PythonCOMxx.dll into the system directory,
4
- # and creates a pth file
5
- import glob
6
- import os
7
- import shutil
8
- import sys
9
- import sysconfig
10
-
11
- try:
12
- import winreg as winreg
13
- except:
14
- import winreg
15
-
16
- # Send output somewhere so it can be found if necessary...
17
- import tempfile
18
-
19
- tee_f = open(os.path.join(tempfile.gettempdir(), "pywin32_postinstall.log"), "w")
20
-
21
-
22
- class Tee:
23
- def __init__(self, file):
24
- self.f = file
25
-
26
- def write(self, what):
27
- if self.f is not None:
28
- try:
29
- self.f.write(what.replace("\n", "\r\n"))
30
- except IOError:
31
- pass
32
- tee_f.write(what)
33
-
34
- def flush(self):
35
- if self.f is not None:
36
- try:
37
- self.f.flush()
38
- except IOError:
39
- pass
40
- tee_f.flush()
41
-
42
-
43
- # For some unknown reason, when running under bdist_wininst we will start up
44
- # with sys.stdout as None but stderr is hooked up. This work-around allows
45
- # bdist_wininst to see the output we write and display it at the end of
46
- # the install.
47
- if sys.stdout is None:
48
- sys.stdout = sys.stderr
49
-
50
- sys.stderr = Tee(sys.stderr)
51
- sys.stdout = Tee(sys.stdout)
52
-
53
- com_modules = [
54
- # module_name, class_names
55
- ("win32com.servers.interp", "Interpreter"),
56
- ("win32com.servers.dictionary", "DictionaryPolicy"),
57
- ("win32com.axscript.client.pyscript", "PyScript"),
58
- ]
59
-
60
- # Is this a 'silent' install - ie, avoid all dialogs.
61
- # Different than 'verbose'
62
- silent = 0
63
-
64
- # Verbosity of output messages.
65
- verbose = 1
66
-
67
- root_key_name = "Software\\Python\\PythonCore\\" + sys.winver
68
-
69
- try:
70
- # When this script is run from inside the bdist_wininst installer,
71
- # file_created() and directory_created() are additional builtin
72
- # functions which write lines to Python23\pywin32-install.log. This is
73
- # a list of actions for the uninstaller, the format is inspired by what
74
- # the Wise installer also creates.
75
- file_created
76
- is_bdist_wininst = True
77
- except NameError:
78
- is_bdist_wininst = False # we know what it is not - but not what it is :)
79
-
80
- def file_created(file):
81
- pass
82
-
83
- def directory_created(directory):
84
- pass
85
-
86
- def get_root_hkey():
87
- try:
88
- winreg.OpenKey(
89
- winreg.HKEY_LOCAL_MACHINE, root_key_name, 0, winreg.KEY_CREATE_SUB_KEY
90
- )
91
- return winreg.HKEY_LOCAL_MACHINE
92
- except OSError:
93
- # Either not exist, or no permissions to create subkey means
94
- # must be HKCU
95
- return winreg.HKEY_CURRENT_USER
96
-
97
-
98
- try:
99
- create_shortcut
100
- except NameError:
101
- # Create a function with the same signature as create_shortcut provided
102
- # by bdist_wininst
103
- def create_shortcut(
104
- path, description, filename, arguments="", workdir="", iconpath="", iconindex=0
105
- ):
106
- import pythoncom
107
- from win32com.shell import shell
108
-
109
- ilink = pythoncom.CoCreateInstance(
110
- shell.CLSID_ShellLink,
111
- None,
112
- pythoncom.CLSCTX_INPROC_SERVER,
113
- shell.IID_IShellLink,
114
- )
115
- ilink.SetPath(path)
116
- ilink.SetDescription(description)
117
- if arguments:
118
- ilink.SetArguments(arguments)
119
- if workdir:
120
- ilink.SetWorkingDirectory(workdir)
121
- if iconpath or iconindex:
122
- ilink.SetIconLocation(iconpath, iconindex)
123
- # now save it.
124
- ipf = ilink.QueryInterface(pythoncom.IID_IPersistFile)
125
- ipf.Save(filename, 0)
126
-
127
- # Support the same list of "path names" as bdist_wininst.
128
- def get_special_folder_path(path_name):
129
- from win32com.shell import shell, shellcon
130
-
131
- for maybe in """
132
- CSIDL_COMMON_STARTMENU CSIDL_STARTMENU CSIDL_COMMON_APPDATA
133
- CSIDL_LOCAL_APPDATA CSIDL_APPDATA CSIDL_COMMON_DESKTOPDIRECTORY
134
- CSIDL_DESKTOPDIRECTORY CSIDL_COMMON_STARTUP CSIDL_STARTUP
135
- CSIDL_COMMON_PROGRAMS CSIDL_PROGRAMS CSIDL_PROGRAM_FILES_COMMON
136
- CSIDL_PROGRAM_FILES CSIDL_FONTS""".split():
137
- if maybe == path_name:
138
- csidl = getattr(shellcon, maybe)
139
- return shell.SHGetSpecialFolderPath(0, csidl, False)
140
- raise ValueError("%s is an unknown path ID" % (path_name,))
141
-
142
-
143
- def CopyTo(desc, src, dest):
144
- import win32api
145
- import win32con
146
-
147
- while 1:
148
- try:
149
- win32api.CopyFile(src, dest, 0)
150
- return
151
- except win32api.error as details:
152
- if details.winerror == 5: # access denied - user not admin.
153
- raise
154
- if silent:
155
- # Running silent mode - just re-raise the error.
156
- raise
157
- full_desc = (
158
- "Error %s\n\n"
159
- "If you have any Python applications running, "
160
- "please close them now\nand select 'Retry'\n\n%s"
161
- % (desc, details.strerror)
162
- )
163
- rc = win32api.MessageBox(
164
- 0, full_desc, "Installation Error", win32con.MB_ABORTRETRYIGNORE
165
- )
166
- if rc == win32con.IDABORT:
167
- raise
168
- elif rc == win32con.IDIGNORE:
169
- return
170
- # else retry - around we go again.
171
-
172
-
173
- # We need to import win32api to determine the Windows system directory,
174
- # so we can copy our system files there - but importing win32api will
175
- # load the pywintypes.dll already in the system directory preventing us
176
- # from updating them!
177
- # So, we pull the same trick pywintypes.py does, but it loads from
178
- # our pywintypes_system32 directory.
179
- def LoadSystemModule(lib_dir, modname):
180
- # See if this is a debug build.
181
- import importlib.machinery
182
- import importlib.util
183
-
184
- suffix = "_d" if "_d.pyd" in importlib.machinery.EXTENSION_SUFFIXES else ""
185
- filename = "%s%d%d%s.dll" % (
186
- modname,
187
- sys.version_info[0],
188
- sys.version_info[1],
189
- suffix,
190
- )
191
- filename = os.path.join(lib_dir, "pywin32_system32", filename)
192
- loader = importlib.machinery.ExtensionFileLoader(modname, filename)
193
- spec = importlib.machinery.ModuleSpec(name=modname, loader=loader, origin=filename)
194
- mod = importlib.util.module_from_spec(spec)
195
- spec.loader.exec_module(mod)
196
-
197
-
198
- def SetPyKeyVal(key_name, value_name, value):
199
- root_hkey = get_root_hkey()
200
- root_key = winreg.OpenKey(root_hkey, root_key_name)
201
- try:
202
- my_key = winreg.CreateKey(root_key, key_name)
203
- try:
204
- winreg.SetValueEx(my_key, value_name, 0, winreg.REG_SZ, value)
205
- if verbose:
206
- print("-> %s\\%s[%s]=%r" % (root_key_name, key_name, value_name, value))
207
- finally:
208
- my_key.Close()
209
- finally:
210
- root_key.Close()
211
-
212
-
213
- def UnsetPyKeyVal(key_name, value_name, delete_key=False):
214
- root_hkey = get_root_hkey()
215
- root_key = winreg.OpenKey(root_hkey, root_key_name)
216
- try:
217
- my_key = winreg.OpenKey(root_key, key_name, 0, winreg.KEY_SET_VALUE)
218
- try:
219
- winreg.DeleteValue(my_key, value_name)
220
- if verbose:
221
- print("-> DELETE %s\\%s[%s]" % (root_key_name, key_name, value_name))
222
- finally:
223
- my_key.Close()
224
- if delete_key:
225
- winreg.DeleteKey(root_key, key_name)
226
- if verbose:
227
- print("-> DELETE %s\\%s" % (root_key_name, key_name))
228
- except OSError as why:
229
- winerror = getattr(why, "winerror", why.errno)
230
- if winerror != 2: # file not found
231
- raise
232
- finally:
233
- root_key.Close()
234
-
235
-
236
- def RegisterCOMObjects(register=True):
237
- import win32com.server.register
238
-
239
- if register:
240
- func = win32com.server.register.RegisterClasses
241
- else:
242
- func = win32com.server.register.UnregisterClasses
243
- flags = {}
244
- if not verbose:
245
- flags["quiet"] = 1
246
- for module, klass_name in com_modules:
247
- __import__(module)
248
- mod = sys.modules[module]
249
- flags["finalize_register"] = getattr(mod, "DllRegisterServer", None)
250
- flags["finalize_unregister"] = getattr(mod, "DllUnregisterServer", None)
251
- klass = getattr(mod, klass_name)
252
- func(klass, **flags)
253
-
254
-
255
- def RegisterHelpFile(register=True, lib_dir=None):
256
- if lib_dir is None:
257
- lib_dir = sysconfig.get_paths()["platlib"]
258
- if register:
259
- # Register the .chm help file.
260
- chm_file = os.path.join(lib_dir, "PyWin32.chm")
261
- if os.path.isfile(chm_file):
262
- # This isn't recursive, so if 'Help' doesn't exist, we croak
263
- SetPyKeyVal("Help", None, None)
264
- SetPyKeyVal("Help\\Pythonwin Reference", None, chm_file)
265
- return chm_file
266
- else:
267
- print("NOTE: PyWin32.chm can not be located, so has not " "been registered")
268
- else:
269
- UnsetPyKeyVal("Help\\Pythonwin Reference", None, delete_key=True)
270
- return None
271
-
272
-
273
- def RegisterPythonwin(register=True, lib_dir=None):
274
- """Add (or remove) Pythonwin to context menu for python scripts.
275
- ??? Should probably also add Edit command for pys files also.
276
- Also need to remove these keys on uninstall, but there's no function
277
- like file_created to add registry entries to uninstall log ???
278
- """
279
- import os
280
-
281
- if lib_dir is None:
282
- lib_dir = sysconfig.get_paths()["platlib"]
283
- classes_root = get_root_hkey()
284
- ## Installer executable doesn't seem to pass anything to postinstall script indicating if it's a debug build,
285
- pythonwin_exe = os.path.join(lib_dir, "Pythonwin", "Pythonwin.exe")
286
- pythonwin_edit_command = pythonwin_exe + ' -edit "%1"'
287
-
288
- keys_vals = [
289
- (
290
- "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Pythonwin.exe",
291
- "",
292
- pythonwin_exe,
293
- ),
294
- (
295
- "Software\\Classes\\Python.File\\shell\\Edit with Pythonwin",
296
- "command",
297
- pythonwin_edit_command,
298
- ),
299
- (
300
- "Software\\Classes\\Python.NoConFile\\shell\\Edit with Pythonwin",
301
- "command",
302
- pythonwin_edit_command,
303
- ),
304
- ]
305
-
306
- try:
307
- if register:
308
- for key, sub_key, val in keys_vals:
309
- ## Since winreg only uses the character Api functions, this can fail if Python
310
- ## is installed to a path containing non-ascii characters
311
- hkey = winreg.CreateKey(classes_root, key)
312
- if sub_key:
313
- hkey = winreg.CreateKey(hkey, sub_key)
314
- winreg.SetValueEx(hkey, None, 0, winreg.REG_SZ, val)
315
- hkey.Close()
316
- else:
317
- for key, sub_key, val in keys_vals:
318
- try:
319
- if sub_key:
320
- hkey = winreg.OpenKey(classes_root, key)
321
- winreg.DeleteKey(hkey, sub_key)
322
- hkey.Close()
323
- winreg.DeleteKey(classes_root, key)
324
- except OSError as why:
325
- winerror = getattr(why, "winerror", why.errno)
326
- if winerror != 2: # file not found
327
- raise
328
- finally:
329
- # tell windows about the change
330
- from win32com.shell import shell, shellcon
331
-
332
- shell.SHChangeNotify(
333
- shellcon.SHCNE_ASSOCCHANGED, shellcon.SHCNF_IDLIST, None, None
334
- )
335
-
336
-
337
- def get_shortcuts_folder():
338
- if get_root_hkey() == winreg.HKEY_LOCAL_MACHINE:
339
- try:
340
- fldr = get_special_folder_path("CSIDL_COMMON_PROGRAMS")
341
- except OSError:
342
- # No CSIDL_COMMON_PROGRAMS on this platform
343
- fldr = get_special_folder_path("CSIDL_PROGRAMS")
344
- else:
345
- # non-admin install - always goes in this user's start menu.
346
- fldr = get_special_folder_path("CSIDL_PROGRAMS")
347
-
348
- try:
349
- install_group = winreg.QueryValue(
350
- get_root_hkey(), root_key_name + "\\InstallPath\\InstallGroup"
351
- )
352
- except OSError:
353
- vi = sys.version_info
354
- install_group = "Python %d.%d" % (vi[0], vi[1])
355
- return os.path.join(fldr, install_group)
356
-
357
-
358
- # Get the system directory, which may be the Wow64 directory if we are a 32bit
359
- # python on a 64bit OS.
360
- def get_system_dir():
361
- import win32api # we assume this exists.
362
-
363
- try:
364
- import pythoncom
365
- import win32process
366
- from win32com.shell import shell, shellcon
367
-
368
- try:
369
- if win32process.IsWow64Process():
370
- return shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_SYSTEMX86)
371
- return shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_SYSTEM)
372
- except (pythoncom.com_error, win32process.error):
373
- return win32api.GetSystemDirectory()
374
- except ImportError:
375
- return win32api.GetSystemDirectory()
376
-
377
-
378
- def fixup_dbi():
379
- # We used to have a dbi.pyd with our .pyd files, but now have a .py file.
380
- # If the user didn't uninstall, they will find the .pyd which will cause
381
- # problems - so handle that.
382
- import win32api
383
- import win32con
384
-
385
- pyd_name = os.path.join(os.path.dirname(win32api.__file__), "dbi.pyd")
386
- pyd_d_name = os.path.join(os.path.dirname(win32api.__file__), "dbi_d.pyd")
387
- py_name = os.path.join(os.path.dirname(win32con.__file__), "dbi.py")
388
- for this_pyd in (pyd_name, pyd_d_name):
389
- this_dest = this_pyd + ".old"
390
- if os.path.isfile(this_pyd) and os.path.isfile(py_name):
391
- try:
392
- if os.path.isfile(this_dest):
393
- print(
394
- "Old dbi '%s' already exists - deleting '%s'"
395
- % (this_dest, this_pyd)
396
- )
397
- os.remove(this_pyd)
398
- else:
399
- os.rename(this_pyd, this_dest)
400
- print("renamed '%s'->'%s.old'" % (this_pyd, this_pyd))
401
- file_created(this_pyd + ".old")
402
- except os.error as exc:
403
- print("FAILED to rename '%s': %s" % (this_pyd, exc))
404
-
405
-
406
- def install(lib_dir):
407
- import traceback
408
-
409
- # The .pth file is now installed as a regular file.
410
- # Create the .pth file in the site-packages dir, and use only relative paths
411
- # We used to write a .pth directly to sys.prefix - clobber it.
412
- if os.path.isfile(os.path.join(sys.prefix, "pywin32.pth")):
413
- os.unlink(os.path.join(sys.prefix, "pywin32.pth"))
414
- # The .pth may be new and therefore not loaded in this session.
415
- # Setup the paths just in case.
416
- for name in "win32 win32\\lib Pythonwin".split():
417
- sys.path.append(os.path.join(lib_dir, name))
418
- # It is possible people with old versions installed with still have
419
- # pywintypes and pythoncom registered. We no longer need this, and stale
420
- # entries hurt us.
421
- for name in "pythoncom pywintypes".split():
422
- keyname = "Software\\Python\\PythonCore\\" + sys.winver + "\\Modules\\" + name
423
- for root in winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER:
424
- try:
425
- winreg.DeleteKey(root, keyname + "\\Debug")
426
- except WindowsError:
427
- pass
428
- try:
429
- winreg.DeleteKey(root, keyname)
430
- except WindowsError:
431
- pass
432
- LoadSystemModule(lib_dir, "pywintypes")
433
- LoadSystemModule(lib_dir, "pythoncom")
434
- import win32api
435
-
436
- # and now we can get the system directory:
437
- files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
438
- if not files:
439
- raise RuntimeError("No system files to copy!!")
440
- # Try the system32 directory first - if that fails due to "access denied",
441
- # it implies a non-admin user, and we use sys.prefix
442
- for dest_dir in [get_system_dir(), sys.prefix]:
443
- # and copy some files over there
444
- worked = 0
445
- try:
446
- for fname in files:
447
- base = os.path.basename(fname)
448
- dst = os.path.join(dest_dir, base)
449
- CopyTo("installing %s" % base, fname, dst)
450
- if verbose:
451
- print("Copied %s to %s" % (base, dst))
452
- # Register the files with the uninstaller
453
- file_created(dst)
454
- worked = 1
455
- # Nuke any other versions that may exist - having
456
- # duplicates causes major headaches.
457
- bad_dest_dirs = [
458
- os.path.join(sys.prefix, "Library\\bin"),
459
- os.path.join(sys.prefix, "Lib\\site-packages\\win32"),
460
- ]
461
- if dest_dir != sys.prefix:
462
- bad_dest_dirs.append(sys.prefix)
463
- for bad_dest_dir in bad_dest_dirs:
464
- bad_fname = os.path.join(bad_dest_dir, base)
465
- if os.path.exists(bad_fname):
466
- # let exceptions go here - delete must succeed
467
- os.unlink(bad_fname)
468
- if worked:
469
- break
470
- except win32api.error as details:
471
- if details.winerror == 5:
472
- # access denied - user not admin - try sys.prefix dir,
473
- # but first check that a version doesn't already exist
474
- # in that place - otherwise that one will still get used!
475
- if os.path.exists(dst):
476
- msg = (
477
- "The file '%s' exists, but can not be replaced "
478
- "due to insufficient permissions. You must "
479
- "reinstall this software as an Administrator" % dst
480
- )
481
- print(msg)
482
- raise RuntimeError(msg)
483
- continue
484
- raise
485
- else:
486
- raise RuntimeError(
487
- "You don't have enough permissions to install the system files"
488
- )
489
-
490
- # Pythonwin 'compiles' config files - record them for uninstall.
491
- pywin_dir = os.path.join(lib_dir, "Pythonwin", "pywin")
492
- for fname in glob.glob(os.path.join(pywin_dir, "*.cfg")):
493
- file_created(fname[:-1] + "c") # .cfg->.cfc
494
-
495
- # Register our demo COM objects.
496
- try:
497
- try:
498
- RegisterCOMObjects()
499
- except win32api.error as details:
500
- if details.winerror != 5: # ERROR_ACCESS_DENIED
501
- raise
502
- print("You do not have the permissions to install COM objects.")
503
- print("The sample COM objects were not registered.")
504
- except Exception:
505
- print("FAILED to register the Python COM objects")
506
- traceback.print_exc()
507
-
508
- # There may be no main Python key in HKCU if, eg, an admin installed
509
- # python itself.
510
- winreg.CreateKey(get_root_hkey(), root_key_name)
511
-
512
- chm_file = None
513
- try:
514
- chm_file = RegisterHelpFile(True, lib_dir)
515
- except Exception:
516
- print("Failed to register help file")
517
- traceback.print_exc()
518
- else:
519
- if verbose:
520
- print("Registered help file")
521
-
522
- # misc other fixups.
523
- fixup_dbi()
524
-
525
- # Register Pythonwin in context menu
526
- try:
527
- RegisterPythonwin(True, lib_dir)
528
- except Exception:
529
- print("Failed to register pythonwin as editor")
530
- traceback.print_exc()
531
- else:
532
- if verbose:
533
- print("Pythonwin has been registered in context menu")
534
-
535
- # Create the win32com\gen_py directory.
536
- make_dir = os.path.join(lib_dir, "win32com", "gen_py")
537
- if not os.path.isdir(make_dir):
538
- if verbose:
539
- print("Creating directory %s" % (make_dir,))
540
- directory_created(make_dir)
541
- os.mkdir(make_dir)
542
-
543
- try:
544
- # create shortcuts
545
- # CSIDL_COMMON_PROGRAMS only available works on NT/2000/XP, and
546
- # will fail there if the user has no admin rights.
547
- fldr = get_shortcuts_folder()
548
- # If the group doesn't exist, then we don't make shortcuts - its
549
- # possible that this isn't a "normal" install.
550
- if os.path.isdir(fldr):
551
- dst = os.path.join(fldr, "PythonWin.lnk")
552
- create_shortcut(
553
- os.path.join(lib_dir, "Pythonwin\\Pythonwin.exe"),
554
- "The Pythonwin IDE",
555
- dst,
556
- "",
557
- sys.prefix,
558
- )
559
- file_created(dst)
560
- if verbose:
561
- print("Shortcut for Pythonwin created")
562
- # And the docs.
563
- if chm_file:
564
- dst = os.path.join(fldr, "Python for Windows Documentation.lnk")
565
- doc = "Documentation for the PyWin32 extensions"
566
- create_shortcut(chm_file, doc, dst)
567
- file_created(dst)
568
- if verbose:
569
- print("Shortcut to documentation created")
570
- else:
571
- if verbose:
572
- print("Can't install shortcuts - %r is not a folder" % (fldr,))
573
- except Exception as details:
574
- print(details)
575
-
576
- # importing win32com.client ensures the gen_py dir created - not strictly
577
- # necessary to do now, but this makes the installation "complete"
578
- try:
579
- import win32com.client # noqa
580
- except ImportError:
581
- # Don't let this error sound fatal
582
- pass
583
- print("The pywin32 extensions were successfully installed.")
584
-
585
- if is_bdist_wininst:
586
- # Open a web page with info about the .exe installers being deprecated.
587
- import webbrowser
588
-
589
- try:
590
- webbrowser.open("https://mhammond.github.io/pywin32_installers.html")
591
- except webbrowser.Error:
592
- print("Please visit https://mhammond.github.io/pywin32_installers.html")
593
-
594
-
595
- def uninstall(lib_dir):
596
- # First ensure our system modules are loaded from pywin32_system, so
597
- # we can remove the ones we copied...
598
- LoadSystemModule(lib_dir, "pywintypes")
599
- LoadSystemModule(lib_dir, "pythoncom")
600
-
601
- try:
602
- RegisterCOMObjects(False)
603
- except Exception as why:
604
- print("Failed to unregister COM objects: %s" % (why,))
605
-
606
- try:
607
- RegisterHelpFile(False, lib_dir)
608
- except Exception as why:
609
- print("Failed to unregister help file: %s" % (why,))
610
- else:
611
- if verbose:
612
- print("Unregistered help file")
613
-
614
- try:
615
- RegisterPythonwin(False, lib_dir)
616
- except Exception as why:
617
- print("Failed to unregister Pythonwin: %s" % (why,))
618
- else:
619
- if verbose:
620
- print("Unregistered Pythonwin")
621
-
622
- try:
623
- # remove gen_py directory.
624
- gen_dir = os.path.join(lib_dir, "win32com", "gen_py")
625
- if os.path.isdir(gen_dir):
626
- shutil.rmtree(gen_dir)
627
- if verbose:
628
- print("Removed directory %s" % (gen_dir,))
629
-
630
- # Remove pythonwin compiled "config" files.
631
- pywin_dir = os.path.join(lib_dir, "Pythonwin", "pywin")
632
- for fname in glob.glob(os.path.join(pywin_dir, "*.cfc")):
633
- os.remove(fname)
634
-
635
- # The dbi.pyd.old files we may have created.
636
- try:
637
- os.remove(os.path.join(lib_dir, "win32", "dbi.pyd.old"))
638
- except os.error:
639
- pass
640
- try:
641
- os.remove(os.path.join(lib_dir, "win32", "dbi_d.pyd.old"))
642
- except os.error:
643
- pass
644
-
645
- except Exception as why:
646
- print("Failed to remove misc files: %s" % (why,))
647
-
648
- try:
649
- fldr = get_shortcuts_folder()
650
- for link in ("PythonWin.lnk", "Python for Windows Documentation.lnk"):
651
- fqlink = os.path.join(fldr, link)
652
- if os.path.isfile(fqlink):
653
- os.remove(fqlink)
654
- if verbose:
655
- print("Removed %s" % (link,))
656
- except Exception as why:
657
- print("Failed to remove shortcuts: %s" % (why,))
658
- # Now remove the system32 files.
659
- files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
660
- # Try the system32 directory first - if that fails due to "access denied",
661
- # it implies a non-admin user, and we use sys.prefix
662
- try:
663
- for dest_dir in [get_system_dir(), sys.prefix]:
664
- # and copy some files over there
665
- worked = 0
666
- for fname in files:
667
- base = os.path.basename(fname)
668
- dst = os.path.join(dest_dir, base)
669
- if os.path.isfile(dst):
670
- try:
671
- os.remove(dst)
672
- worked = 1
673
- if verbose:
674
- print("Removed file %s" % (dst))
675
- except Exception:
676
- print("FAILED to remove %s" % (dst,))
677
- if worked:
678
- break
679
- except Exception as why:
680
- print("FAILED to remove system files: %s" % (why,))
681
-
682
-
683
- # NOTE: If this script is run from inside the bdist_wininst created
684
- # binary installer or uninstaller, the command line args are either
685
- # '-install' or '-remove'.
686
-
687
- # Important: From inside the binary installer this script MUST NOT
688
- # call sys.exit() or raise SystemExit, otherwise not only this script
689
- # but also the installer will terminate! (Is there a way to prevent
690
- # this from the bdist_wininst C code?)
691
-
692
-
693
- def verify_destination(location):
694
- if not os.path.isdir(location):
695
- raise argparse.ArgumentTypeError('Path "{}" does not exist!'.format(location))
696
- return location
697
-
698
-
699
- def main():
700
- import argparse
701
-
702
- parser = argparse.ArgumentParser(
703
- formatter_class=argparse.RawDescriptionHelpFormatter,
704
- description="""A post-install script for the pywin32 extensions.
705
-
706
- * Typical usage:
707
-
708
- > python pywin32_postinstall.py -install
709
-
710
- If you installed pywin32 via a .exe installer, this should be run
711
- automatically after installation, but if it fails you can run it again.
712
-
713
- If you installed pywin32 via PIP, you almost certainly need to run this to
714
- setup the environment correctly.
715
-
716
- Execute with script with a '-install' parameter, to ensure the environment
717
- is setup correctly.
718
- """,
719
- )
720
- parser.add_argument(
721
- "-install",
722
- default=False,
723
- action="store_true",
724
- help="Configure the Python environment correctly for pywin32.",
725
- )
726
- parser.add_argument(
727
- "-remove",
728
- default=False,
729
- action="store_true",
730
- help="Try and remove everything that was installed or copied.",
731
- )
732
- parser.add_argument(
733
- "-wait",
734
- type=int,
735
- help="Wait for the specified process to terminate before starting.",
736
- )
737
- parser.add_argument(
738
- "-silent",
739
- default=False,
740
- action="store_true",
741
- help='Don\'t display the "Abort/Retry/Ignore" dialog for files in use.',
742
- )
743
- parser.add_argument(
744
- "-quiet",
745
- default=False,
746
- action="store_true",
747
- help="Don't display progress messages.",
748
- )
749
- parser.add_argument(
750
- "-destination",
751
- default=sysconfig.get_paths()["platlib"],
752
- type=verify_destination,
753
- help="Location of the PyWin32 installation",
754
- )
755
-
756
- args = parser.parse_args()
757
-
758
- if not args.quiet:
759
- print("Parsed arguments are: {}".format(args))
760
-
761
- if not args.install ^ args.remove:
762
- parser.error("You need to either choose to -install or -remove!")
763
-
764
- if args.wait is not None:
765
- try:
766
- os.waitpid(args.wait, 0)
767
- except os.error:
768
- # child already dead
769
- pass
770
-
771
- silent = args.silent
772
- verbose = not args.quiet
773
-
774
- if args.install:
775
- install(args.destination)
776
-
777
- if args.remove:
778
- if not is_bdist_wininst:
779
- uninstall(args.destination)
780
-
781
-
782
- if __name__ == "__main__":
783
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/Scripts/pywin32_testall.py DELETED
@@ -1,124 +0,0 @@
1
- """A test runner for pywin32"""
2
- import os
3
- import site
4
- import subprocess
5
- import sys
6
-
7
- # locate the dirs based on where this script is - it may be either in the
8
- # source tree, or in an installed Python 'Scripts' tree.
9
- this_dir = os.path.dirname(__file__)
10
- site_packages = [
11
- site.getusersitepackages(),
12
- ] + site.getsitepackages()
13
-
14
- failures = []
15
-
16
-
17
- # Run a test using subprocess and wait for the result.
18
- # If we get an returncode != 0, we know that there was an error, but we don't
19
- # abort immediately - we run as many tests as we can.
20
- def run_test(script, cmdline_extras):
21
- dirname, scriptname = os.path.split(script)
22
- # some tests prefer to be run from their directory.
23
- cmd = [sys.executable, "-u", scriptname] + cmdline_extras
24
- print("--- Running '%s' ---" % script)
25
- sys.stdout.flush()
26
- result = subprocess.run(cmd, check=False, cwd=dirname)
27
- print("*** Test script '%s' exited with %s" % (script, result.returncode))
28
- sys.stdout.flush()
29
- if result.returncode:
30
- failures.append(script)
31
-
32
-
33
- def find_and_run(possible_locations, extras):
34
- for maybe in possible_locations:
35
- if os.path.isfile(maybe):
36
- run_test(maybe, extras)
37
- break
38
- else:
39
- raise RuntimeError(
40
- "Failed to locate a test script in one of %s" % possible_locations
41
- )
42
-
43
-
44
- def main():
45
- import argparse
46
-
47
- code_directories = [this_dir] + site_packages
48
-
49
- parser = argparse.ArgumentParser(
50
- description="A script to trigger tests in all subprojects of PyWin32."
51
- )
52
- parser.add_argument(
53
- "-no-user-interaction",
54
- default=False,
55
- action="store_true",
56
- help="(This is now the default - use `-user-interaction` to include them)",
57
- )
58
-
59
- parser.add_argument(
60
- "-user-interaction",
61
- action="store_true",
62
- help="Include tests which require user interaction",
63
- )
64
-
65
- parser.add_argument(
66
- "-skip-adodbapi",
67
- default=False,
68
- action="store_true",
69
- help="Skip the adodbapi tests; useful for CI where there's no provider",
70
- )
71
-
72
- args, remains = parser.parse_known_args()
73
-
74
- # win32, win32ui / Pythonwin
75
-
76
- extras = []
77
- if args.user_interaction:
78
- extras += ["-user-interaction"]
79
- extras.extend(remains)
80
- scripts = [
81
- "win32/test/testall.py",
82
- "Pythonwin/pywin/test/all.py",
83
- ]
84
- for script in scripts:
85
- maybes = [os.path.join(directory, script) for directory in code_directories]
86
- find_and_run(maybes, extras)
87
-
88
- # win32com
89
- maybes = [
90
- os.path.join(directory, "win32com", "test", "testall.py")
91
- for directory in [
92
- os.path.join(this_dir, "com"),
93
- ]
94
- + site_packages
95
- ]
96
- extras = remains + ["1"] # only run "level 1" tests in CI
97
- find_and_run(maybes, extras)
98
-
99
- # adodbapi
100
- if not args.skip_adodbapi:
101
- maybes = [
102
- os.path.join(directory, "adodbapi", "test", "adodbapitest.py")
103
- for directory in code_directories
104
- ]
105
- find_and_run(maybes, remains)
106
- # This script has a hard-coded sql server name in it, (and markh typically
107
- # doesn't have a different server to test on) but there is now supposed to be a server out there on the Internet
108
- # just to run these tests, so try it...
109
- maybes = [
110
- os.path.join(directory, "adodbapi", "test", "test_adodbapi_dbapi20.py")
111
- for directory in code_directories
112
- ]
113
- find_and_run(maybes, remains)
114
-
115
- if failures:
116
- print("The following scripts failed")
117
- for failure in failures:
118
- print(">", failure)
119
- sys.exit(1)
120
- print("All tests passed \\o/")
121
-
122
-
123
- if __name__ == "__main__":
124
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/Scripts/streamlit.cmd DELETED
@@ -1,16 +0,0 @@
1
- rem Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
2
- rem
3
- rem Licensed under the Apache License, Version 2.0 (the "License");
4
- rem you may not use this file except in compliance with the License.
5
- rem You may obtain a copy of the License at
6
- rem
7
- rem http://www.apache.org/licenses/LICENSE-2.0
8
- rem
9
- rem Unless required by applicable law or agreed to in writing, software
10
- rem distributed under the License is distributed on an "AS IS" BASIS,
11
- rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- rem See the License for the specific language governing permissions and
13
- rem limitations under the License.
14
-
15
- @echo OFF
16
- python -m streamlit %*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/Scripts/streamlit.exe DELETED
Binary file (106 kB)
 
rag/Scripts/torchrun.exe DELETED
Binary file (106 kB)
 
rag/Scripts/tqdm.exe DELETED
Binary file (106 kB)
 
rag/Scripts/transformers-cli.exe DELETED
Binary file (106 kB)
 
rag/Scripts/watchmedo.exe DELETED
Binary file (106 kB)
 
rag/etc/jupyter/nbconfig/notebook.d/pydeck.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "load_extensions": {
3
- "pydeck/extension": true
4
- }
5
- }