Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +45 -0
- .gitignore +2 -0
- RAG.py +104 -0
- README.md +23 -13
- __pycache__/RAG.cpython-310.pyc +0 -0
- __pycache__/RAG.cpython-312.pyc +0 -0
- __pycache__/gradio_app.cpython-310.pyc +0 -0
- __pycache__/retrieve_documents.cpython-310.pyc +0 -0
- __pycache__/retrieve_documents.cpython-312.pyc +0 -0
- api_keys.json +7 -0
- gradio_app.py +93 -0
- myenv/bin/Activate.ps1 +247 -0
- myenv/bin/__pycache__/jp.cpython-312.pyc +0 -0
- myenv/bin/activate +70 -0
- myenv/bin/activate.csh +27 -0
- myenv/bin/activate.fish +69 -0
- myenv/bin/chroma +8 -0
- myenv/bin/coloredlogs +8 -0
- myenv/bin/dotenv +8 -0
- myenv/bin/f2py +8 -0
- myenv/bin/fastapi +8 -0
- myenv/bin/fastavro +8 -0
- myenv/bin/fonttools +8 -0
- myenv/bin/gradio +8 -0
- myenv/bin/httpx +8 -0
- myenv/bin/huggingface-cli +8 -0
- myenv/bin/humanfriendly +8 -0
- myenv/bin/isympy +8 -0
- myenv/bin/jp.py +54 -0
- myenv/bin/jsondiff +41 -0
- myenv/bin/jsonpatch +107 -0
- myenv/bin/jsonpointer +67 -0
- myenv/bin/langchain-server +8 -0
- myenv/bin/langsmith +8 -0
- myenv/bin/markdown-it +8 -0
- myenv/bin/normalizer +8 -0
- myenv/bin/onnxruntime_test +8 -0
- myenv/bin/opentelemetry-bootstrap +8 -0
- myenv/bin/opentelemetry-instrument +8 -0
- myenv/bin/pip +8 -0
- myenv/bin/pip3 +8 -0
- myenv/bin/pip3.12 +8 -0
- myenv/bin/pyftmerge +8 -0
- myenv/bin/pyftsubset +8 -0
- myenv/bin/pygmentize +8 -0
- myenv/bin/pyproject-build +8 -0
- myenv/bin/pyrsa-decrypt +8 -0
- myenv/bin/pyrsa-encrypt +8 -0
- myenv/bin/pyrsa-keygen +8 -0
- myenv/bin/pyrsa-priv2pub +8 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,48 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
myenv/bin/python filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
myenv/bin/python3 filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
myenv/bin/python3.12 filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
myenv/bin/ruff filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
myenv/lib/python3.12/site-packages/PIL/_imaging.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
myenv/lib/python3.12/site-packages/aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
myenv/lib/python3.12/site-packages/fastavro/_logical_writers.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
myenv/lib/python3.12/site-packages/fastavro/_read.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
myenv/lib/python3.12/site-packages/fastavro/_schema.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
myenv/lib/python3.12/site-packages/fastavro/_write.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
myenv/lib/python3.12/site-packages/fontTools/cu2qu/cu2qu.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
myenv/lib/python3.12/site-packages/fontTools/feaLib/lexer.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
myenv/lib/python3.12/site-packages/fontTools/misc/bezierTools.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
myenv/lib/python3.12/site-packages/fontTools/pens/momentsPen.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
myenv/lib/python3.12/site-packages/fontTools/qu2cu/qu2cu.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
myenv/lib/python3.12/site-packages/fontTools/varLib/iup.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
myenv/lib/python3.12/site-packages/gradio/frpc_linux_amd64_v0.2 filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
myenv/lib/python3.12/site-packages/greenlet/_greenlet.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
myenv/lib/python3.12/site-packages/grpc/_cython/cygrpc.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
myenv/lib/python3.12/site-packages/hnswlib.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
myenv/lib/python3.12/site-packages/kiwisolver/_cext.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
myenv/lib/python3.12/site-packages/kubernetes/client/api/__pycache__/core_v1_api.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
myenv/lib/python3.12/site-packages/numpy/core/_multiarray_umath.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
myenv/lib/python3.12/site-packages/numpy/core/_simd.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
myenv/lib/python3.12/site-packages/numpy.libs/libgfortran-040039e1.so.5.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
myenv/lib/python3.12/site-packages/numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
myenv/lib/python3.12/site-packages/onnxruntime/capi/libonnxruntime.so.1.19.0 filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
myenv/lib/python3.12/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
myenv/lib/python3.12/site-packages/pandas/_libs/algos.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
myenv/lib/python3.12/site-packages/pandas/_libs/groupby.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
myenv/lib/python3.12/site-packages/pandas/_libs/hashtable.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
myenv/lib/python3.12/site-packages/pandas/_libs/interval.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
myenv/lib/python3.12/site-packages/pandas/_libs/join.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
myenv/lib/python3.12/site-packages/pandas/_libs/tslibs/offsets.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
myenv/lib/python3.12/site-packages/pillow.libs/libfreetype-be14bf51.so.6.20.1 filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
myenv/lib/python3.12/site-packages/pillow.libs/libharfbuzz-89381d8f.so.0.60850.0 filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
myenv/lib/python3.12/site-packages/pydantic_core/_pydantic_core.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
myenv/lib/python3.12/site-packages/pysqlite3/_sqlite3.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
myenv/lib/python3.12/site-packages/pysqlite3_binary.libs/libsqlite3-a3ea561f.so.0.8.6 filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
myenv/lib/python3.12/site-packages/sqlalchemy/cyextension/collections.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
myenv/lib/python3.12/site-packages/sympy/polys/benchmarks/__pycache__/bench_solvers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
myenv/lib/python3.12/site-packages/tokenizers/tokenizers.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
myenv/lib/python3.12/site-packages/uvloop/loop.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
myenv/lib/python3.12/site-packages/watchfiles/_rust_notify.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
myenv/lib/python3.12/site-packages/yaml/_yaml.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# api_keys.json
|
| 2 |
+
google_search_api.ipynb
|
RAG.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain_text_splitters import RecursiveCharacterTextSplitter
|
| 2 |
+
from retrieve_documents import retrieve_relevant_documents
|
| 3 |
+
from langchain_cohere import ChatCohere, CohereEmbeddings
|
| 4 |
+
from langchain_core.output_parsers import StrOutputParser
|
| 5 |
+
from langchain_core.runnables import RunnablePassthrough
|
| 6 |
+
from langchain_core.prompts import ChatPromptTemplate
|
| 7 |
+
from langchain_core.prompts.chat import HumanMessagePromptTemplate
|
| 8 |
+
from langchain_core.prompts.prompt import PromptTemplate
|
| 9 |
+
import json
|
| 10 |
+
import pathlib
|
| 11 |
+
|
| 12 |
+
__import__('pysqlite3')
|
| 13 |
+
import sys
|
| 14 |
+
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
|
| 15 |
+
from langchain_chroma import Chroma
|
| 16 |
+
|
| 17 |
+
class RAG_with_memory:
|
| 18 |
+
def __init__(self, retriever=None):
|
| 19 |
+
self.file_loc = pathlib.Path(__file__).parent.resolve()
|
| 20 |
+
with open(self.file_loc / "prompts/search.txt", "r") as f:
|
| 21 |
+
self.raw_prompt_text = f.read()
|
| 22 |
+
with open(self.file_loc / "prompts/rewrite_query.txt", "r") as f:
|
| 23 |
+
self.raw_query_rewrite_text = f.read()
|
| 24 |
+
self.retriever = retriever
|
| 25 |
+
self.reset()
|
| 26 |
+
|
| 27 |
+
def load_history(self, history):
|
| 28 |
+
self.history = ""
|
| 29 |
+
for item in history:
|
| 30 |
+
if item["role"] == "user":
|
| 31 |
+
self.history += "Human: " + item["content"] + "\n"
|
| 32 |
+
else:
|
| 33 |
+
self.history += "AI: " + item["content"] + "\n"
|
| 34 |
+
self.history += "\n"
|
| 35 |
+
|
| 36 |
+
def add_retriever(self, retriever):
|
| 37 |
+
self.retriever = retriever
|
| 38 |
+
|
| 39 |
+
def reset(self):
|
| 40 |
+
with open(self.file_loc / "api_keys.json", "r") as f:
|
| 41 |
+
api_keys = json.load(f)
|
| 42 |
+
COHERE_API_KEY = api_keys["cohere"]
|
| 43 |
+
self.llm = ChatCohere(model="command-r", cohere_api_key=COHERE_API_KEY)
|
| 44 |
+
self.history = ""
|
| 45 |
+
|
| 46 |
+
def rewrite_query(self, original_query):
|
| 47 |
+
print("Rewriting query")
|
| 48 |
+
prompt_text = self.raw_query_rewrite_text.format(history=self.history, query="{query}")
|
| 49 |
+
prompt_template = PromptTemplate(
|
| 50 |
+
input_variables=['query'],
|
| 51 |
+
template=prompt_text
|
| 52 |
+
)
|
| 53 |
+
chain = (
|
| 54 |
+
{"query" : RunnablePassthrough()}
|
| 55 |
+
| prompt_template
|
| 56 |
+
| self.llm
|
| 57 |
+
| StrOutputParser()
|
| 58 |
+
)
|
| 59 |
+
return chain.invoke(original_query)
|
| 60 |
+
|
| 61 |
+
def generate(self, query):
|
| 62 |
+
# TODO: Generate should take a retriever, not constructor
|
| 63 |
+
if self.retriever is None:
|
| 64 |
+
raise Exception("Retriever must non-None")
|
| 65 |
+
print("Prompting LLM")
|
| 66 |
+
prompt_text = self.raw_prompt_text.format(history=self.history, context="{context}", question="{question}")
|
| 67 |
+
prompt_template = PromptTemplate(
|
| 68 |
+
input_variables=['context', 'question'],
|
| 69 |
+
template=prompt_text
|
| 70 |
+
)
|
| 71 |
+
rag_chain = (
|
| 72 |
+
{"context": self.retriever | format_docs, "question": RunnablePassthrough()}
|
| 73 |
+
| prompt_template
|
| 74 |
+
| self.llm
|
| 75 |
+
| StrOutputParser()
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
response = rag_chain.invoke(query)
|
| 79 |
+
self.history += "Human: " + query + "\n"
|
| 80 |
+
self.history += "AI: " + response + "\n"
|
| 81 |
+
print("Done")
|
| 82 |
+
return response
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def format_docs(docs):
|
| 86 |
+
return "\n\n".join(doc.page_content for doc in docs)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def create_vector_store(documents, embedding):
|
| 90 |
+
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
|
| 91 |
+
splits = text_splitter.split_documents(documents)
|
| 92 |
+
vectorstore = Chroma.from_documents(documents=splits, embedding=embedding)
|
| 93 |
+
return vectorstore
|
| 94 |
+
|
| 95 |
+
def get_retriever_links(query, api_key_file):
|
| 96 |
+
documents, links = retrieve_relevant_documents(query, api_key_file)
|
| 97 |
+
|
| 98 |
+
with open(api_key_file, "r") as f:
|
| 99 |
+
api_keys = json.load(f)
|
| 100 |
+
COHERE_API_KEY = api_keys["cohere"]
|
| 101 |
+
embedding_model = CohereEmbeddings(cohere_api_key=COHERE_API_KEY, model='embed-english-v3.0')
|
| 102 |
+
print("Splitting Documents + Loading into vectorstore")
|
| 103 |
+
vectorstore = create_vector_store(documents, embedding_model)
|
| 104 |
+
return vectorstore.as_retriever(), links
|
README.md
CHANGED
|
@@ -1,13 +1,23 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Term
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Term-4-Project
|
| 3 |
+
app_file: new_app.py
|
| 4 |
+
sdk: gradio
|
| 5 |
+
sdk_version: 4.41.0
|
| 6 |
+
---
|
| 7 |
+
# PerplexityClone
|
| 8 |
+
|
| 9 |
+
Demo: [https://huggingface.co/spaces/YashSax/PerplexityClone](https://huggingface.co/spaces/YashSax/PerplexityClone)
|
| 10 |
+
|
| 11 |
+
Chat Version Demo (multi-turn + retrieval for each step + query rewrite): [Google Drive Link](https://drive.google.com/file/d/1LCS4RdyI46WhfJabGGkIrgFJFWZq7cDK/view)
|
| 12 |
+
|
| 13 |
+
A clone of [perplexity.ai](perplexity.ai), an LLM and RAG-powered search engine using LangChain, Chroma Vector Store, and Cohere Text Generation and Embedding Models. Frontend designed using Gradio.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
|
| 17 |
+
### Overview
|
| 18 |
+
|
| 19 |
+
1) The user's query is passed through the Google Search API to create a corpus of the 10 most recent and relevant webpages.
|
| 20 |
+
2) The documents are split and stored into a Chroma vector store
|
| 21 |
+
3) Using Cohere's text embedding model, relevant snippets are collected using embedding similarity
|
| 22 |
+
4) The relevant snippets are compiled into context for the RAG application
|
| 23 |
+
5) The prompt and context are fed into Cohere's Command-R Text Generation LLM, and the output and documents are presented to the user.
|
__pycache__/RAG.cpython-310.pyc
ADDED
|
Binary file (4.26 kB). View file
|
|
|
__pycache__/RAG.cpython-312.pyc
ADDED
|
Binary file (6.55 kB). View file
|
|
|
__pycache__/gradio_app.cpython-310.pyc
ADDED
|
Binary file (2.76 kB). View file
|
|
|
__pycache__/retrieve_documents.cpython-310.pyc
ADDED
|
Binary file (2.39 kB). View file
|
|
|
__pycache__/retrieve_documents.cpython-312.pyc
ADDED
|
Binary file (3.43 kB). View file
|
|
|
api_keys.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cohere" : "I1hYw0mB1k8kmJsyQgY7pQbDREXhymZPOkdY2PxZ",
|
| 3 |
+
"google" : {
|
| 4 |
+
"search_engine_id" : "361b24b4932254e6f",
|
| 5 |
+
"api_key" : "AIzaSyAwmOjZ_OE0bOhSAPsNiUtSAAuAAAtPQdo"
|
| 6 |
+
}
|
| 7 |
+
}
|
gradio_app.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from RAG import get_retriever_links, RAG_with_memory
|
| 3 |
+
import requests
|
| 4 |
+
|
| 5 |
+
rag_llm = None
|
| 6 |
+
searched = False
|
| 7 |
+
DEFAULT_FAVICON_URL = "https://www.nasa.gov/favicon.ico"
|
| 8 |
+
|
| 9 |
+
def get_favicon_url(link):
|
| 10 |
+
from urllib.parse import urlparse
|
| 11 |
+
domain = urlparse(link).netloc
|
| 12 |
+
url = f"https://{domain}/favicon.ico"
|
| 13 |
+
if favicon_exists(url):
|
| 14 |
+
return url
|
| 15 |
+
return DEFAULT_FAVICON_URL
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def favicon_exists(url):
|
| 19 |
+
try:
|
| 20 |
+
response = requests.head(url)
|
| 21 |
+
return response.status_code == 200
|
| 22 |
+
except requests.RequestException:
|
| 23 |
+
return False
|
| 24 |
+
|
| 25 |
+
def chatbot_response(message, history):
|
| 26 |
+
if not searched:
|
| 27 |
+
return "Please enter a query above before asking follow-up questions."
|
| 28 |
+
return rag_llm.generate(message)
|
| 29 |
+
|
| 30 |
+
# Function to simulate a search operation
|
| 31 |
+
def search(query):
|
| 32 |
+
global rag_llm
|
| 33 |
+
global searched
|
| 34 |
+
searched = True
|
| 35 |
+
|
| 36 |
+
retriever, sources = get_retriever_links(query, "./api_keys.json")
|
| 37 |
+
rag_llm = RAG_with_memory(retriever)
|
| 38 |
+
response = rag_llm.generate(query)
|
| 39 |
+
|
| 40 |
+
sources_html = ''.join([
|
| 41 |
+
f"""
|
| 42 |
+
<a href='{source['link']}' target='_blank' style='display: inline-block; text-decoration: none; color: black; margin-right: 10px; border: 1px solid #ccc; padding: 10px; border-radius: 5px;'>
|
| 43 |
+
<div style='display: flex; align-items: center;'>
|
| 44 |
+
<img src='{get_favicon_url(source['link'])}' alt='favicon' style='width: 16px; height: 16px; margin-right: 8px;'>
|
| 45 |
+
<span>{source['title']}</span>
|
| 46 |
+
</div>
|
| 47 |
+
</a>
|
| 48 |
+
""" for source in sources
|
| 49 |
+
])
|
| 50 |
+
|
| 51 |
+
reponse_html = f"<div style='border: 1px solid #ccc; padding: 10px; border-radius: 5px;'>{response}</div>"
|
| 52 |
+
|
| 53 |
+
return sources_html, reponse_html
|
| 54 |
+
|
| 55 |
+
# Define the Gradio interface
|
| 56 |
+
with gr.Blocks(css=".output-box { background-color: #1c1c1c; color: white; padding: 10px; border-radius: 10px; }") as demo:
|
| 57 |
+
gr.Markdown(
|
| 58 |
+
"""
|
| 59 |
+
## Custom LLM with Real-Time Capabilities
|
| 60 |
+
This Project is part of Term 4 Project Course under Prof. Anusha Reddy.
|
| 61 |
+
Made with Love by Dhenenjay Yadav & Neerav Doshi
|
| 62 |
+
"""
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
query_input = gr.Textbox(label="Enter your query", placeholder="Type your search query here...", lines=1)
|
| 66 |
+
search_button = gr.Button("Search")
|
| 67 |
+
|
| 68 |
+
sources_box = gr.HTML("<div class='output-box' style='display: none;'><h3>Sources</h3><div id='sources-content'></div></div>", label="Sources")
|
| 69 |
+
response_output = gr.Markdown("<div class='output-box' style='display: none;'><h3>Answer</h3></div>", label="Answer")
|
| 70 |
+
|
| 71 |
+
search_button.click(
|
| 72 |
+
fn=search,
|
| 73 |
+
inputs=query_input,
|
| 74 |
+
outputs=[sources_box, response_output]
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
gr.HTML("""
|
| 78 |
+
<script>
|
| 79 |
+
function showResults() {
|
| 80 |
+
document.querySelectorAll('.output-box').forEach(el => el.style.display = 'block');
|
| 81 |
+
}
|
| 82 |
+
document.querySelector('button').addEventListener('click', showResults);
|
| 83 |
+
</script>
|
| 84 |
+
""")
|
| 85 |
+
|
| 86 |
+
gr.Row([sources_box])
|
| 87 |
+
gr.Row([response_output])
|
| 88 |
+
|
| 89 |
+
gr.ChatInterface(chatbot_response, title="Follow-up Questions")
|
| 90 |
+
|
| 91 |
+
if __name__ == "__main__":
|
| 92 |
+
# Launch the Gradio interface
|
| 93 |
+
demo.launch(share=True)
|
myenv/bin/Activate.ps1
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 VIRTUAL_ENV_PROMPT altogether.
|
| 100 |
+
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
| 101 |
+
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
| 105 |
+
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
| 106 |
+
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
# Leave deactivate function in the global namespace if requested:
|
| 110 |
+
if (-not $NonDestructive) {
|
| 111 |
+
Remove-Item -Path function:deactivate
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
<#
|
| 116 |
+
.Description
|
| 117 |
+
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
| 118 |
+
given folder, and returns them in a map.
|
| 119 |
+
|
| 120 |
+
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
| 121 |
+
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
| 122 |
+
then it is considered a `key = value` line. The left hand string is the key,
|
| 123 |
+
the right hand is the value.
|
| 124 |
+
|
| 125 |
+
If the value starts with a `'` or a `"` then the first and last character is
|
| 126 |
+
stripped from the value before being captured.
|
| 127 |
+
|
| 128 |
+
.Parameter ConfigDir
|
| 129 |
+
Path to the directory that contains the `pyvenv.cfg` file.
|
| 130 |
+
#>
|
| 131 |
+
function Get-PyVenvConfig(
|
| 132 |
+
[String]
|
| 133 |
+
$ConfigDir
|
| 134 |
+
) {
|
| 135 |
+
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
| 136 |
+
|
| 137 |
+
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
| 138 |
+
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
| 139 |
+
|
| 140 |
+
# An empty map will be returned if no config file is found.
|
| 141 |
+
$pyvenvConfig = @{ }
|
| 142 |
+
|
| 143 |
+
if ($pyvenvConfigPath) {
|
| 144 |
+
|
| 145 |
+
Write-Verbose "File exists, parse `key = value` lines"
|
| 146 |
+
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
| 147 |
+
|
| 148 |
+
$pyvenvConfigContent | ForEach-Object {
|
| 149 |
+
$keyval = $PSItem -split "\s*=\s*", 2
|
| 150 |
+
if ($keyval[0] -and $keyval[1]) {
|
| 151 |
+
$val = $keyval[1]
|
| 152 |
+
|
| 153 |
+
# Remove extraneous quotations around a string value.
|
| 154 |
+
if ("'""".Contains($val.Substring(0, 1))) {
|
| 155 |
+
$val = $val.Substring(1, $val.Length - 2)
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
$pyvenvConfig[$keyval[0]] = $val
|
| 159 |
+
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
return $pyvenvConfig
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
<# Begin Activate script --------------------------------------------------- #>
|
| 168 |
+
|
| 169 |
+
# Determine the containing directory of this script
|
| 170 |
+
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
| 171 |
+
$VenvExecDir = Get-Item -Path $VenvExecPath
|
| 172 |
+
|
| 173 |
+
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
| 174 |
+
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
| 175 |
+
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
| 176 |
+
|
| 177 |
+
# Set values required in priority: CmdLine, ConfigFile, Default
|
| 178 |
+
# First, get the location of the virtual environment, it might not be
|
| 179 |
+
# VenvExecDir if specified on the command line.
|
| 180 |
+
if ($VenvDir) {
|
| 181 |
+
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
| 182 |
+
}
|
| 183 |
+
else {
|
| 184 |
+
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
| 185 |
+
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
| 186 |
+
Write-Verbose "VenvDir=$VenvDir"
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
# Next, read the `pyvenv.cfg` file to determine any required value such
|
| 190 |
+
# as `prompt`.
|
| 191 |
+
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
| 192 |
+
|
| 193 |
+
# Next, set the prompt from the command line, or the config file, or
|
| 194 |
+
# just use the name of the virtual environment folder.
|
| 195 |
+
if ($Prompt) {
|
| 196 |
+
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
| 197 |
+
}
|
| 198 |
+
else {
|
| 199 |
+
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
| 200 |
+
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
| 201 |
+
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
| 202 |
+
$Prompt = $pyvenvCfg['prompt'];
|
| 203 |
+
}
|
| 204 |
+
else {
|
| 205 |
+
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
| 206 |
+
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
| 207 |
+
$Prompt = Split-Path -Path $venvDir -Leaf
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
Write-Verbose "Prompt = '$Prompt'"
|
| 212 |
+
Write-Verbose "VenvDir='$VenvDir'"
|
| 213 |
+
|
| 214 |
+
# Deactivate any currently active virtual environment, but leave the
|
| 215 |
+
# deactivate function in place.
|
| 216 |
+
deactivate -nondestructive
|
| 217 |
+
|
| 218 |
+
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
| 219 |
+
# that there is an activated venv.
|
| 220 |
+
$env:VIRTUAL_ENV = $VenvDir
|
| 221 |
+
|
| 222 |
+
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
| 223 |
+
|
| 224 |
+
Write-Verbose "Setting prompt to '$Prompt'"
|
| 225 |
+
|
| 226 |
+
# Set the prompt to include the env name
|
| 227 |
+
# Make sure _OLD_VIRTUAL_PROMPT is global
|
| 228 |
+
function global:_OLD_VIRTUAL_PROMPT { "" }
|
| 229 |
+
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
| 230 |
+
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
| 231 |
+
|
| 232 |
+
function global:prompt {
|
| 233 |
+
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
| 234 |
+
_OLD_VIRTUAL_PROMPT
|
| 235 |
+
}
|
| 236 |
+
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
# Clear PYTHONHOME
|
| 240 |
+
if (Test-Path -Path Env:PYTHONHOME) {
|
| 241 |
+
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
| 242 |
+
Remove-Item -Path Env:PYTHONHOME
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
# Add the venv to the PATH
|
| 246 |
+
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
| 247 |
+
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
myenv/bin/__pycache__/jp.cpython-312.pyc
ADDED
|
Binary file (3.18 kB). View file
|
|
|
myenv/bin/activate
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Call hash to forget past commands. Without forgetting
|
| 18 |
+
# past commands the $PATH changes we made may not be respected
|
| 19 |
+
hash -r 2> /dev/null
|
| 20 |
+
|
| 21 |
+
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
| 22 |
+
PS1="${_OLD_VIRTUAL_PS1:-}"
|
| 23 |
+
export PS1
|
| 24 |
+
unset _OLD_VIRTUAL_PS1
|
| 25 |
+
fi
|
| 26 |
+
|
| 27 |
+
unset VIRTUAL_ENV
|
| 28 |
+
unset VIRTUAL_ENV_PROMPT
|
| 29 |
+
if [ ! "${1:-}" = "nondestructive" ] ; then
|
| 30 |
+
# Self destruct!
|
| 31 |
+
unset -f deactivate
|
| 32 |
+
fi
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
# unset irrelevant variables
|
| 36 |
+
deactivate nondestructive
|
| 37 |
+
|
| 38 |
+
# on Windows, a path can contain colons and backslashes and has to be converted:
|
| 39 |
+
if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ] ; then
|
| 40 |
+
# transform D:\path\to\venv to /d/path/to/venv on MSYS
|
| 41 |
+
# and to /cygdrive/d/path/to/venv on Cygwin
|
| 42 |
+
export VIRTUAL_ENV=$(cygpath "/workspaces/Term-Bpt/myenv")
|
| 43 |
+
else
|
| 44 |
+
# use the path as-is
|
| 45 |
+
export VIRTUAL_ENV="/workspaces/Term-Bpt/myenv"
|
| 46 |
+
fi
|
| 47 |
+
|
| 48 |
+
_OLD_VIRTUAL_PATH="$PATH"
|
| 49 |
+
PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 50 |
+
export PATH
|
| 51 |
+
|
| 52 |
+
# unset PYTHONHOME if set
|
| 53 |
+
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
| 54 |
+
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
| 55 |
+
if [ -n "${PYTHONHOME:-}" ] ; then
|
| 56 |
+
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
| 57 |
+
unset PYTHONHOME
|
| 58 |
+
fi
|
| 59 |
+
|
| 60 |
+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
| 61 |
+
_OLD_VIRTUAL_PS1="${PS1:-}"
|
| 62 |
+
PS1="(myenv) ${PS1:-}"
|
| 63 |
+
export PS1
|
| 64 |
+
VIRTUAL_ENV_PROMPT="(myenv) "
|
| 65 |
+
export VIRTUAL_ENV_PROMPT
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
# Call hash to forget past commands. Without forgetting
|
| 69 |
+
# past commands the $PATH changes we made may not be respected
|
| 70 |
+
hash -r 2> /dev/null
|
myenv/bin/activate.csh
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file must be used with "source bin/activate.csh" *from csh*.
|
| 2 |
+
# You cannot run it directly.
|
| 3 |
+
|
| 4 |
+
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
| 5 |
+
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
| 6 |
+
|
| 7 |
+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
|
| 8 |
+
|
| 9 |
+
# Unset irrelevant variables.
|
| 10 |
+
deactivate nondestructive
|
| 11 |
+
|
| 12 |
+
setenv VIRTUAL_ENV "/workspaces/Term-Bpt/myenv"
|
| 13 |
+
|
| 14 |
+
set _OLD_VIRTUAL_PATH="$PATH"
|
| 15 |
+
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
set _OLD_VIRTUAL_PROMPT="$prompt"
|
| 19 |
+
|
| 20 |
+
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
| 21 |
+
set prompt = "(myenv) $prompt"
|
| 22 |
+
setenv VIRTUAL_ENV_PROMPT "(myenv) "
|
| 23 |
+
endif
|
| 24 |
+
|
| 25 |
+
alias pydoc python -m pydoc
|
| 26 |
+
|
| 27 |
+
rehash
|
myenv/bin/activate.fish
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
| 2 |
+
# (https://fishshell.com/). You cannot run it directly.
|
| 3 |
+
|
| 4 |
+
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
| 5 |
+
# reset old environment variables
|
| 6 |
+
if test -n "$_OLD_VIRTUAL_PATH"
|
| 7 |
+
set -gx PATH $_OLD_VIRTUAL_PATH
|
| 8 |
+
set -e _OLD_VIRTUAL_PATH
|
| 9 |
+
end
|
| 10 |
+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
| 11 |
+
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
| 12 |
+
set -e _OLD_VIRTUAL_PYTHONHOME
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
| 16 |
+
set -e _OLD_FISH_PROMPT_OVERRIDE
|
| 17 |
+
# prevents error when using nested fish instances (Issue #93858)
|
| 18 |
+
if functions -q _old_fish_prompt
|
| 19 |
+
functions -e fish_prompt
|
| 20 |
+
functions -c _old_fish_prompt fish_prompt
|
| 21 |
+
functions -e _old_fish_prompt
|
| 22 |
+
end
|
| 23 |
+
end
|
| 24 |
+
|
| 25 |
+
set -e VIRTUAL_ENV
|
| 26 |
+
set -e VIRTUAL_ENV_PROMPT
|
| 27 |
+
if test "$argv[1]" != "nondestructive"
|
| 28 |
+
# Self-destruct!
|
| 29 |
+
functions -e deactivate
|
| 30 |
+
end
|
| 31 |
+
end
|
| 32 |
+
|
| 33 |
+
# Unset irrelevant variables.
|
| 34 |
+
deactivate nondestructive
|
| 35 |
+
|
| 36 |
+
set -gx VIRTUAL_ENV "/workspaces/Term-Bpt/myenv"
|
| 37 |
+
|
| 38 |
+
set -gx _OLD_VIRTUAL_PATH $PATH
|
| 39 |
+
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
| 40 |
+
|
| 41 |
+
# Unset PYTHONHOME if set.
|
| 42 |
+
if set -q PYTHONHOME
|
| 43 |
+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
| 44 |
+
set -e PYTHONHOME
|
| 45 |
+
end
|
| 46 |
+
|
| 47 |
+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
| 48 |
+
# fish uses a function instead of an env var to generate the prompt.
|
| 49 |
+
|
| 50 |
+
# Save the current fish_prompt function as the function _old_fish_prompt.
|
| 51 |
+
functions -c fish_prompt _old_fish_prompt
|
| 52 |
+
|
| 53 |
+
# With the original prompt function renamed, we can override with our own.
|
| 54 |
+
function fish_prompt
|
| 55 |
+
# Save the return status of the last command.
|
| 56 |
+
set -l old_status $status
|
| 57 |
+
|
| 58 |
+
# Output the venv prompt; color taken from the blue of the Python logo.
|
| 59 |
+
printf "%s%s%s" (set_color 4B8BBE) "(myenv) " (set_color normal)
|
| 60 |
+
|
| 61 |
+
# Restore the return status of the previous command.
|
| 62 |
+
echo "exit $old_status" | .
|
| 63 |
+
# Output the original/"old" prompt.
|
| 64 |
+
_old_fish_prompt
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
| 68 |
+
set -gx VIRTUAL_ENV_PROMPT "(myenv) "
|
| 69 |
+
end
|
myenv/bin/chroma
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from chromadb.cli.cli import app
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(app())
|
myenv/bin/coloredlogs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from coloredlogs.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/dotenv
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from dotenv.__main__ import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|
myenv/bin/f2py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from numpy.f2py.f2py2e import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/fastapi
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fastapi.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/fastavro
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fastavro.__main__ import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/fonttools
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fontTools.__main__ import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/gradio
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from gradio.cli import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|
myenv/bin/httpx
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from httpx import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/huggingface-cli
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from huggingface_hub.commands.huggingface_cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/humanfriendly
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from humanfriendly.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/isympy
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from isympy import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/jp.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
import json
|
| 5 |
+
import argparse
|
| 6 |
+
from pprint import pformat
|
| 7 |
+
|
| 8 |
+
import jmespath
|
| 9 |
+
from jmespath import exceptions
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
parser = argparse.ArgumentParser()
|
| 14 |
+
parser.add_argument('expression')
|
| 15 |
+
parser.add_argument('-f', '--filename',
|
| 16 |
+
help=('The filename containing the input data. '
|
| 17 |
+
'If a filename is not given then data is '
|
| 18 |
+
'read from stdin.'))
|
| 19 |
+
parser.add_argument('--ast', action='store_true',
|
| 20 |
+
help=('Pretty print the AST, do not search the data.'))
|
| 21 |
+
args = parser.parse_args()
|
| 22 |
+
expression = args.expression
|
| 23 |
+
if args.ast:
|
| 24 |
+
# Only print the AST
|
| 25 |
+
expression = jmespath.compile(args.expression)
|
| 26 |
+
sys.stdout.write(pformat(expression.parsed))
|
| 27 |
+
sys.stdout.write('\n')
|
| 28 |
+
return 0
|
| 29 |
+
if args.filename:
|
| 30 |
+
with open(args.filename, 'r') as f:
|
| 31 |
+
data = json.load(f)
|
| 32 |
+
else:
|
| 33 |
+
data = sys.stdin.read()
|
| 34 |
+
data = json.loads(data)
|
| 35 |
+
try:
|
| 36 |
+
sys.stdout.write(json.dumps(
|
| 37 |
+
jmespath.search(expression, data), indent=4, ensure_ascii=False))
|
| 38 |
+
sys.stdout.write('\n')
|
| 39 |
+
except exceptions.ArityError as e:
|
| 40 |
+
sys.stderr.write("invalid-arity: %s\n" % e)
|
| 41 |
+
return 1
|
| 42 |
+
except exceptions.JMESPathTypeError as e:
|
| 43 |
+
sys.stderr.write("invalid-type: %s\n" % e)
|
| 44 |
+
return 1
|
| 45 |
+
except exceptions.UnknownFunctionError as e:
|
| 46 |
+
sys.stderr.write("unknown-function: %s\n" % e)
|
| 47 |
+
return 1
|
| 48 |
+
except exceptions.ParseError as e:
|
| 49 |
+
sys.stderr.write("syntax-error: %s\n" % e)
|
| 50 |
+
return 1
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
if __name__ == '__main__':
|
| 54 |
+
sys.exit(main())
|
myenv/bin/jsondiff
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
from __future__ import print_function
|
| 5 |
+
|
| 6 |
+
import sys
|
| 7 |
+
import json
|
| 8 |
+
import jsonpatch
|
| 9 |
+
import argparse
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
parser = argparse.ArgumentParser(description='Diff two JSON files')
|
| 13 |
+
parser.add_argument('FILE1', type=argparse.FileType('r'))
|
| 14 |
+
parser.add_argument('FILE2', type=argparse.FileType('r'))
|
| 15 |
+
parser.add_argument('--indent', type=int, default=None,
|
| 16 |
+
help='Indent output by n spaces')
|
| 17 |
+
parser.add_argument('-u', '--preserve-unicode', action='store_true',
|
| 18 |
+
help='Output Unicode character as-is without using Code Point')
|
| 19 |
+
parser.add_argument('-v', '--version', action='version',
|
| 20 |
+
version='%(prog)s ' + jsonpatch.__version__)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def main():
|
| 24 |
+
try:
|
| 25 |
+
diff_files()
|
| 26 |
+
except KeyboardInterrupt:
|
| 27 |
+
sys.exit(1)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def diff_files():
|
| 31 |
+
""" Diffs two JSON files and prints a patch """
|
| 32 |
+
args = parser.parse_args()
|
| 33 |
+
doc1 = json.load(args.FILE1)
|
| 34 |
+
doc2 = json.load(args.FILE2)
|
| 35 |
+
patch = jsonpatch.make_patch(doc1, doc2)
|
| 36 |
+
if patch.patch:
|
| 37 |
+
print(json.dumps(patch.patch, indent=args.indent, ensure_ascii=not(args.preserve_unicode)))
|
| 38 |
+
sys.exit(1)
|
| 39 |
+
|
| 40 |
+
if __name__ == "__main__":
|
| 41 |
+
main()
|
myenv/bin/jsonpatch
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
import sys
|
| 5 |
+
import os.path
|
| 6 |
+
import json
|
| 7 |
+
import jsonpatch
|
| 8 |
+
import tempfile
|
| 9 |
+
import argparse
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
parser = argparse.ArgumentParser(
|
| 13 |
+
description='Apply a JSON patch on a JSON file')
|
| 14 |
+
parser.add_argument('ORIGINAL', type=argparse.FileType('r'),
|
| 15 |
+
help='Original file')
|
| 16 |
+
parser.add_argument('PATCH', type=argparse.FileType('r'),
|
| 17 |
+
nargs='?', default=sys.stdin,
|
| 18 |
+
help='Patch file (read from stdin if omitted)')
|
| 19 |
+
parser.add_argument('--indent', type=int, default=None,
|
| 20 |
+
help='Indent output by n spaces')
|
| 21 |
+
parser.add_argument('-b', '--backup', action='store_true',
|
| 22 |
+
help='Back up ORIGINAL if modifying in-place')
|
| 23 |
+
parser.add_argument('-i', '--in-place', action='store_true',
|
| 24 |
+
help='Modify ORIGINAL in-place instead of to stdout')
|
| 25 |
+
parser.add_argument('-v', '--version', action='version',
|
| 26 |
+
version='%(prog)s ' + jsonpatch.__version__)
|
| 27 |
+
parser.add_argument('-u', '--preserve-unicode', action='store_true',
|
| 28 |
+
help='Output Unicode character as-is without using Code Point')
|
| 29 |
+
|
| 30 |
+
def main():
|
| 31 |
+
try:
|
| 32 |
+
patch_files()
|
| 33 |
+
except KeyboardInterrupt:
|
| 34 |
+
sys.exit(1)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def patch_files():
|
| 38 |
+
""" Diffs two JSON files and prints a patch """
|
| 39 |
+
args = parser.parse_args()
|
| 40 |
+
doc = json.load(args.ORIGINAL)
|
| 41 |
+
patch = json.load(args.PATCH)
|
| 42 |
+
result = jsonpatch.apply_patch(doc, patch)
|
| 43 |
+
|
| 44 |
+
if args.in_place:
|
| 45 |
+
dirname = os.path.abspath(os.path.dirname(args.ORIGINAL.name))
|
| 46 |
+
|
| 47 |
+
try:
|
| 48 |
+
# Attempt to replace the file atomically. We do this by
|
| 49 |
+
# creating a temporary file in the same directory as the
|
| 50 |
+
# original file so we can atomically move the new file over
|
| 51 |
+
# the original later. (This is done in the same directory
|
| 52 |
+
# because atomic renames do not work across mount points.)
|
| 53 |
+
|
| 54 |
+
fd, pathname = tempfile.mkstemp(dir=dirname)
|
| 55 |
+
fp = os.fdopen(fd, 'w')
|
| 56 |
+
atomic = True
|
| 57 |
+
|
| 58 |
+
except OSError:
|
| 59 |
+
# We failed to create the temporary file for an atomic
|
| 60 |
+
# replace, so fall back to non-atomic mode by backing up
|
| 61 |
+
# the original (if desired) and writing a new file.
|
| 62 |
+
|
| 63 |
+
if args.backup:
|
| 64 |
+
os.rename(args.ORIGINAL.name, args.ORIGINAL.name + '.orig')
|
| 65 |
+
fp = open(args.ORIGINAL.name, 'w')
|
| 66 |
+
atomic = False
|
| 67 |
+
|
| 68 |
+
else:
|
| 69 |
+
# Since we're not replacing the original file in-place, write
|
| 70 |
+
# the modified JSON to stdout instead.
|
| 71 |
+
|
| 72 |
+
fp = sys.stdout
|
| 73 |
+
|
| 74 |
+
# By this point we have some sort of file object we can write the
|
| 75 |
+
# modified JSON to.
|
| 76 |
+
|
| 77 |
+
json.dump(result, fp, indent=args.indent, ensure_ascii=not(args.preserve_unicode))
|
| 78 |
+
fp.write('\n')
|
| 79 |
+
|
| 80 |
+
if args.in_place:
|
| 81 |
+
# Close the new file. If we aren't replacing atomically, this
|
| 82 |
+
# is our last step, since everything else is already in place.
|
| 83 |
+
|
| 84 |
+
fp.close()
|
| 85 |
+
|
| 86 |
+
if atomic:
|
| 87 |
+
try:
|
| 88 |
+
# Complete the atomic replace by linking the original
|
| 89 |
+
# to a backup (if desired), fixing up the permissions
|
| 90 |
+
# on the temporary file, and moving it into place.
|
| 91 |
+
|
| 92 |
+
if args.backup:
|
| 93 |
+
os.link(args.ORIGINAL.name, args.ORIGINAL.name + '.orig')
|
| 94 |
+
os.chmod(pathname, os.stat(args.ORIGINAL.name).st_mode)
|
| 95 |
+
os.rename(pathname, args.ORIGINAL.name)
|
| 96 |
+
|
| 97 |
+
except OSError:
|
| 98 |
+
# In the event we could not actually do the atomic
|
| 99 |
+
# replace, unlink the original to move it out of the
|
| 100 |
+
# way and finally move the temporary file into place.
|
| 101 |
+
|
| 102 |
+
os.unlink(args.ORIGINAL.name)
|
| 103 |
+
os.rename(pathname, args.ORIGINAL.name)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
if __name__ == "__main__":
|
| 107 |
+
main()
|
myenv/bin/jsonpointer
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
import argparse
|
| 6 |
+
import json
|
| 7 |
+
import sys
|
| 8 |
+
|
| 9 |
+
import jsonpointer
|
| 10 |
+
|
| 11 |
+
parser = argparse.ArgumentParser(
|
| 12 |
+
description='Resolve a JSON pointer on JSON files')
|
| 13 |
+
|
| 14 |
+
# Accept pointer as argument or as file
|
| 15 |
+
ptr_group = parser.add_mutually_exclusive_group(required=True)
|
| 16 |
+
|
| 17 |
+
ptr_group.add_argument('-f', '--pointer-file', type=argparse.FileType('r'),
|
| 18 |
+
nargs='?',
|
| 19 |
+
help='File containing a JSON pointer expression')
|
| 20 |
+
|
| 21 |
+
ptr_group.add_argument('POINTER', type=str, nargs='?',
|
| 22 |
+
help='A JSON pointer expression')
|
| 23 |
+
|
| 24 |
+
parser.add_argument('FILE', type=argparse.FileType('r'), nargs='+',
|
| 25 |
+
help='Files for which the pointer should be resolved')
|
| 26 |
+
parser.add_argument('--indent', type=int, default=None,
|
| 27 |
+
help='Indent output by n spaces')
|
| 28 |
+
parser.add_argument('-v', '--version', action='version',
|
| 29 |
+
version='%(prog)s ' + jsonpointer.__version__)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def main():
|
| 33 |
+
try:
|
| 34 |
+
resolve_files()
|
| 35 |
+
except KeyboardInterrupt:
|
| 36 |
+
sys.exit(1)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_pointer(args):
|
| 40 |
+
if args.POINTER:
|
| 41 |
+
ptr = args.POINTER
|
| 42 |
+
elif args.pointer_file:
|
| 43 |
+
ptr = args.pointer_file.read().strip()
|
| 44 |
+
else:
|
| 45 |
+
parser.print_usage()
|
| 46 |
+
sys.exit(1)
|
| 47 |
+
|
| 48 |
+
return ptr
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def resolve_files():
|
| 52 |
+
""" Resolve a JSON pointer on JSON files """
|
| 53 |
+
args = parser.parse_args()
|
| 54 |
+
|
| 55 |
+
ptr = parse_pointer(args)
|
| 56 |
+
|
| 57 |
+
for f in args.FILE:
|
| 58 |
+
doc = json.load(f)
|
| 59 |
+
try:
|
| 60 |
+
result = jsonpointer.resolve_pointer(doc, ptr)
|
| 61 |
+
print(json.dumps(result, indent=args.indent))
|
| 62 |
+
except jsonpointer.JsonPointerException as e:
|
| 63 |
+
print('Could not resolve pointer: %s' % str(e), file=sys.stderr)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
if __name__ == "__main__":
|
| 67 |
+
main()
|
myenv/bin/langchain-server
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from langchain.server import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/langsmith
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from langsmith.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/markdown-it
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from markdown_it.cli.parse import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/normalizer
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from charset_normalizer.cli import cli_detect
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli_detect())
|
myenv/bin/onnxruntime_test
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from onnxruntime.tools.onnxruntime_test import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/opentelemetry-bootstrap
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from opentelemetry.instrumentation.bootstrap import run
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(run())
|
myenv/bin/opentelemetry-instrument
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from opentelemetry.instrumentation.auto_instrumentation import run
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(run())
|
myenv/bin/pip
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pip3
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pip3.12
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pyftmerge
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fontTools.merge import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pyftsubset
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fontTools.subset import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pygmentize
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pygments.cmdline import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pyproject-build
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from build.__main__ import entrypoint
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(entrypoint())
|
myenv/bin/pyrsa-decrypt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from rsa.cli import decrypt
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(decrypt())
|
myenv/bin/pyrsa-encrypt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from rsa.cli import encrypt
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(encrypt())
|
myenv/bin/pyrsa-keygen
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from rsa.cli import keygen
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(keygen())
|
myenv/bin/pyrsa-priv2pub
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspaces/Term-Bpt/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from rsa.util import private_to_public
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(private_to_public())
|