Spaces:
Runtime error
Runtime error
Commit ·
808bf67
1
Parent(s): 4e54bd9
CLI tool
Browse filesFiles changed (15)
- .gitignore+3-1
- TechdocsAPI/backend/core/Exceptions.py+3-3
- TechdocsAPI/backend/models/inference.py+5-1
- TechdocsAPI/backend/router.py+3-7
- TechdocsAPI/backend/services/auth/ops.py+2-3
- TechdocsAPI/backend/services/db/utils/DBQueries.py-1
- frontend/pages/Code.py+2-1
- techdocs/__init__.py+1
- techdocs/cli.py+42-22
- techdocs/dtypes.pyAdded+5
- techdocs/ops.pyAdded+124
- techdocs/utils/functools.py+45-13
- techdocs/utils/subcommand_signatures.jsonAdded+45
- testing/DBQueries.py+47-1
- testing/test.py+89
14 unmodified lines1516171814 unmodified lines#pypi filesbuilddisttechdocs.egg-info14 unmodified lines15161718192014 unmodified lines#pypi filesbuilddisttechdocs.egg-infotest.py
12 unmodified lines131415161718197 unmodified lines272829303132338 unmodified lines4243444512 unmodified linesself.token_result.status = 'login_failed'def __repr__(self):return json.dumps(self.token_result)class ExistingUserException(Exception):def __init__(self, response_result: GeneralResponse):7 unmodified linesself.response_result.message[0] = 'authenticated'def __repr__(self):return json.dumps(self.response_result)class InfoNotFoundException(Exception):def __init__(self, response_result: GeneralResponse, message: str):8 unmodified linesself.response_result['message'].append(self.message)def __repr__(self):return json.dumps(self.response_result)12 unmodified lines131415161718197 unmodified lines272829303132338 unmodified lines4243444512 unmodified linesself.token_result.status = 'login_failed'def __repr__(self):return "exception.InvalidCredentialsException()"class ExistingUserException(Exception):def __init__(self, response_result: GeneralResponse):7 unmodified linesself.response_result.message[0] = 'authenticated'def __repr__(self):return "exception.ExistingUserException()"class InfoNotFoundException(Exception):def __init__(self, response_result: GeneralResponse, message: str):8 unmodified linesself.response_result['message'].append(self.message)def __repr__(self):return "exception.InfoNotFoundException()"
2 unmodified lines34562 unmodified linesfrom .generic import Baseclass Inference(Base):docstr:str2 unmodified lines3456789102 unmodified linesfrom .generic import Baseclass Inference(Base):docstr:strclass Generate(Base):code_block:strapi_key:str
21 unmodified lines222324252627289 unmodified lines383940414243444546474849508 unmodified lines596061626364656667686970717221 unmodified lines@app.get("/api/response_check", tags=["Resource Server"])def api_response_check():print("api_response_check")response_result = GeneralResponse.get_instance(data={},status="not_allowed",message=["Not authenticated"]9 unmodified linesresponse_result.message.append(db_msg)except Exception as e:print("Exception :", e)return response_result@app.post("/auth/signup", summary="Creates new user account", response_model=GeneralResponse, tags=["Auth Server"])async def signup(response: UserAuth):print("signup")response_result = GeneralResponse.get_instance(data={},status="not_allowed",message=["Not authenticated"]8 unmodified lines@app.put("/auth/regenerate_api_key",summary="Forget Password",response_model=APIKey,tags=["Auth Server"],dependencies=[Depends(JWTBearer())])async def regenerate_api_key(access_token: str = Depends(JWTBearer())):print("regenerate_api_key")user_sub=Auth.get_user_credentials(access_token)return ops_regenerate_api_key(user_sub)@app.post("/api/inference", summary="Inference", response_model=Inference, tags=["Resource Server"], dependencies=[Depends(JWTBearer())])async def inference(code_block:str, api_key: str,access_token:str=Depends(JWTBearer())):print("inference")user_sub=Auth.get_user_credentials(access_token)return ops_inference(code_block,api_key,user_sub)21 unmodified lines2223242526279 unmodified lines3738394041424344454647488 unmodified lines57585960616263646566676821 unmodified lines@app.get("/api/response_check", tags=["Resource Server"])def api_response_check():response_result = GeneralResponse.get_instance(data={},status="not_allowed",message=["Not authenticated"]9 unmodified linesresponse_result.message.append(db_msg)except Exception as e:passreturn response_result@app.post("/auth/signup", summary="Creates new user account", response_model=GeneralResponse, tags=["Auth Server"])async def signup(response: UserAuth):response_result = GeneralResponse.get_instance(data={},status="not_allowed",message=["Not authenticated"]8 unmodified lines@app.put("/auth/regenerate_api_key",summary="Forget Password",response_model=APIKey,tags=["Auth Server"],dependencies=[Depends(JWTBearer())])async def regenerate_api_key(access_token: str = Depends(JWTBearer())):user_sub=Auth.get_user_credentials(access_token)return ops_regenerate_api_key(user_sub)@app.post("/api/inference", summary="Inference", response_model=Inference, tags=["Resource Server"], dependencies=[Depends(JWTBearer())])async def inference(generate: Generate, access_token:str=Depends(JWTBearer())):user_sub=Auth.get_user_credentials(access_token)return ops_inference(generate.code_block,generate.api_key,user_sub)
2 unmodified lines34567892 unmodified lines1011021031041051061071081092 unmodified linesfrom backend.models import *from backend.services.db.utils.DBQueries import DBQueriesfrom backend.core.Exceptions import *from backend import app# import openai92 unmodified linesllm_response = app.state.llmchain.run({"instruction": source_code_message})docstring = Inference(docstr=llm_response)print(docstring)return docstring2 unmodified lines345678992 unmodified lines1021031041051061071082 unmodified linesfrom backend.models import *from backend.services.db.utils.DBQueries import DBQueriesfrom backend.core.Exceptions import *from backend.core.ExceptionHandlers import *from backend import app# import openai92 unmodified linesllm_response = app.state.llmchain.run({"instruction": source_code_message})docstring = Inference(docstr=llm_response)return docstring
12 unmodified lines1314151617181912 unmodified linesf'({",".join(cols)}) ''VALUES ').format(table_name=table_name)print(data)if isinstance(data, list):QUERY+="("+",".join(["%s" for _ in range(len(data[0]))])+")"cursor.executemany(QUERY, data)12 unmodified lines13141516171812 unmodified linesf'({",".join(cols)}) ''VALUES ').format(table_name=table_name)if isinstance(data, list):QUERY+="("+",".join(["%s" for _ in range(len(data[0]))])+")"cursor.executemany(QUERY, data)
91 unmodified lines9293949596979891 unmodified linesif st.button("🤖 Generate Documentation"):if code_input:headers['Authorization'] = f"Bearer {st.session_state.access_token}"response = query_post(base_url + '/api/inference', headers=headers, params={'code_block':code_input, 'api_key':API_KEY})docstr = response.json()["docstr"]comment_placeholder.subheader("Generated Documentation:")comment_placeholder.markdown(f"<pre><code>{docstr}</code></pre>", unsafe_allow_html=True)91 unmodified lines929394959697989991 unmodified linesif st.button("🤖 Generate Documentation"):if code_input:headers['Authorization'] = f"Bearer {st.session_state.access_token}"response = query_post(base_url + '/api/inference', headers=headers,data=json.dumps({'code_block':code_input, 'api_key':API_KEY}))docstr = response.json()["docstr"]comment_placeholder.subheader("Generated Documentation:")comment_placeholder.markdown(f"<pre><code>{docstr}</code></pre>", unsafe_allow_html=True)
1__version__ = "0.1.0"
123456789101112131415161718192021222324252627282930313233343536from .utils import parse,functoolsimport argparsedef main():parser = argparse.ArgumentParser(description='Code documentation generation',epilog="Thanks for using Techdocs")parser.add_argument('--api_key','-k',type=str,required=True,help='API key for Techdocs')parser.add_argument('--username','-u',type=str,required=True,help='Username for Techdocs')parser.add_argument('--password','-p',type=str,required=True,help='Password for Techdocs')parser.add_argument('--dir','-d',type=str,required=True,help='Root directory to be documented')parser.add_argument('--version','-v',action='version',version="%(prog)s 0.0.1")args=parser.parse_args()config = {arg[0]:arg[1] for arg in args._get_kwargs()}data = {"username":config['username'],"password":config['password']}config.update({"access_token":functools.get_access_token(data)})parse.extract_functions_from_directory(config)if __name__ == '__main__':main()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556from .ops import Ops@Ops.configure_and_build_subcommanddef main(log_info: bool = False):if log_info:print("""👋 Hi there! Welcome to techdocs. Here are some cool things you can do:💫 try out a demo with or new GUI 🚀 and explore how to use the CLI:➡️ https://techdocs.streamlit.app/💫 signup here to get an API key 👤:$ techdocs signup -u <username> -p <password> -e <email>💫 use the line below to issue a new API key 🗝️:$ techdocs apikey -u <username> -p <password>💫 use the CLI to generate documentation for your project 📚:$ techdocs generate -k <api_key> -u <username> -p <password> -d <directory>""")# parser.add_argument('--api_key','-k',type=str,required=True,help='API key for Techdocs')# parser.add_argument('--username','-u',type=str,required=True,help='Username for Techdocs')# parser.add_argument('--password','-p',type=str,required=True,help='Password for Techdocs')# parser.add_argument('--dir','-d',type=str,required=True,help='Root directory to be documented')# # parser.add_argument('--version','-v',action='version',version="%(prog)s 0.0.1")# args=parser.parse_args()# data = {# "username":config['username'],# "password":config['password']# }# config.update({"access_token":functools.get_access_token(data)})# parse.extract_functions_from_directory(config)if __name__ == '__main__':main()
12345data_types = {'str': str, 'int': int, 'float': float, 'bool': bool }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124import argparseimport jsonfrom typing import Dict, List, Optional, Any, Callable
import techdocsfrom .dtypes import data_typesfrom .utils.functools import *from .utils.parse import *
parser = argparse.ArgumentParser( description='Code documentation generation', epilog="Thanks for using Techdocs")subparsers = parser.add_subparsers(help='subcommands')
def depends_login(func: Callable): def update_config(cls: Any, config: Dict[str, Any]): data = { "username":config['username'], "password":config['password'] }
config.update({"access_token":get_access_token(data)}) return func(cls, config) return update_config
class _SubCommand: def __init__(self, name: str, help: str, args_parse: Optional[List[Dict[str, Any]]] = None, pre_compile: bool = False): self.name = name self.parser = subparsers.add_parser(name, help=help) self.parser.set_defaults(subcommand=name)
self.pre_compile = pre_compile
if args_parse and pre_compile: self.build(args_parse) else: self.arg_parse = args_parse def _run(self): raise NotImplementedError() def build(self, args_parse: Optional[List[Dict[str, Any]]] = None): if not args_parse: args_parse = self.arg_parse
if not isinstance(args_parse, list): args_parse = list(args_parse)
for args_sig in args_parse: args_sig['kwargs']['type'] = data_types[args_sig['kwargs']['type']] self.parser.add_argument(*args_sig['args'], **args_sig['kwargs']) @property def bind(self): raise PermissionError('Property bind is not allowed to be accessed') @bind.setter def bind(self, func: Callable): self._run = func self.parser.set_defaults(ops=self._run)
class Ops: sub_commands: Dict[str, _SubCommand] = {} with open('techdocs/utils/subcommand_signatures.json') as f: encoded_sub_commands = json.load(f)
if encoded_sub_commands['dynamic signatures']: sub_commands.update({sub_command['name']: _SubCommand(**sub_command, pre_compile=False) for sub_command in encoded_sub_commands['dynamic signatures'] })
if encoded_sub_commands['pre-compiled signatures']: sub_commands.update({sub_command['name']: _SubCommand(**sub_command, pre_compile=True) for sub_command in encoded_sub_commands['pre-compiled signatures'] })
@classmethod def configure_and_build_subcommand(cls, func): config = None try: args = parser.parse_args() sub_command = cls.sub_commands[args.subcommand] if not sub_command.pre_compile: sub_command.build()
sub_command.bind = cls.__getattribute__(cls(), args.subcommand) func = sub_command.parser.get_default('ops') config = {k: v for k, v in vars(args).items() if k not in ['subcommand', 'ops']}
except AttributeError as e: config = True def run_subcommand(**kwargs): return func(config) return run_subcommand
@classmethod @depends_login def generate(cls, config: Dict[str, Any]): extract_functions_from_directory(config) @classmethod @depends_login def apikey(cls, config: Dict[str, Any]): issue_api_key(config)
@classmethod def signup(cls, config: Dict[str, Any]): signup(config) @classmethod def version(cls, config: Dict[str, Any]): print(f"{techdocs.__version__}")123456789101112131415161718192021226 unmodified lines2930313233343511 unmodified lines47484950import jsonimport requestsBASE_URL = "https://caffeinecrew-techdocs.hf.space"def get_access_token(data, return_refresh_token=False):url = BASE_URL + "/auth/login"headers = {"accept": "application/json",}data = json.dumps(data)response = requests.post(url, data=data, headers=headers)access_token = response.json()['access_token']if return_refresh_token:refresh_token = response.json()['refresh_token']return access_token, refresh_tokenreturn access_token6 unmodified linesurl = BASE_URL+"/api/inference"headers={"accept":"application/json", "Authorization": f"Bearer {config['access_token']}"}code_input = code_blockresponse = requests.post(url=url, headers=headers, params={'code_block':code_input, 'api_key':config['api_key']})if response.status_code == 200:return response.json()["docstr"]else:11 unmodified lineswith open(file_path, "w",errors='ignore') as file:file.write(docstr_code)1234567891011121314151617181920212223242526276 unmodified lines3435363738394011 unmodified lines52535455565758596061626364656667686970717273747576777879808182import jsonimport requests# BASE_URL = "https://caffeinecrew-techdocs.hf.space"BASE_URL = "http://127.0.0.1:8000"def get_access_token(data, return_refresh_token=False):try:url = BASE_URL + "/auth/login"headers = {"accept": "application/json",}data = json.dumps(data)response = requests.post(url, data=data, headers=headers)access_token = response.json()['access_token']if return_refresh_token:refresh_token = response.json()['refresh_token']return access_token, refresh_tokenreturn access_tokenexcept Exception as e:print("Invlaid Credentials")return None6 unmodified linesurl = BASE_URL+"/api/inference"headers={"accept":"application/json", "Authorization": f"Bearer {config['access_token']}"}code_input = code_blockresponse = requests.post(url=url, headers=headers, data=json.dumps({'code_block':code_input, 'api_key':config['api_key']}))if response.status_code == 200:return response.json()["docstr"]else:11 unmodified lineswith open(file_path, "w",errors='ignore') as file:file.write(docstr_code)def issue_api_key(config):try:headers={"accept":"application/json", "Authorization": f"Bearer {config['access_token']}"}response = requests.put(url=BASE_URL + "/auth/regenerate_api_key", headers=headers,data=json.dumps({"username": config['username']}))if (response.status_code!=200):raise Exception("API Key Generation Failed")print(f"$ API_KEY: {response.json()['api_key']}")except Exception as e:print(f"$ {e}")def signup(config):try:headers={"accept":"application/json"}response = requests.post(url=BASE_URL + "/auth/signup", headers=headers, data=json.dumps(config))if (response.status_code==226):raise Exception("username or email already exists")elif (response.status_code!=200):raise Exception("Something went wrong, please try again later")print("Signed up successfully, please issue a new `API_KEY` to continue")except Exception as e:print(e)
123456789101112131415161718192021222324252627282930313233343536373839404142434445{ "pre-compiled signatures": [ { "name": "generate", "help": "Generate Documentation from a given directory root", "args_parse": [ {"args": ["--api_key", "-k"], "kwargs": {"type": "str", "required": true, "help": "API key for techdocs"}}, {"args": ["--username", "-u"], "kwargs": {"type": "str", "required": true, "help": "Username for techdocs"}}, {"args": ["--password", "-p"], "kwargs": {"type": "str", "required": true, "help": "Password for techdocs"}}, {"args": ["--dir", "-d"], "kwargs": {"type": "str", "required": true, "help": "Root directory to be documented"}} ] }, { "name": "apikey", "help": "Issue a new API key for techdocs", "args_parse": [ {"args": ["-username", "-u"], "kwargs": {"type": "str", "required": true, "help": "Username for techdocs"}}, {"args": ["-password", "-p"], "kwargs": {"type": "str", "required": true, "help": "Password for techdocs"}} ] }, { "name": "version", "help": "Print the version of the techdocs CLI", "args_parse": [] }, { "name": "signup", "help": "Sign up for a new techdocs account", "args_parse": [ {"args": ["-username", "-u"], "kwargs": {"type": "str", "required": true, "help": "Username for Techdocs"}}, {"args": ["-password", "-p"], "kwargs": {"type": "str", "required": true, "help": "Password for Techdocs"}}, {"args": ["-email", "-e"], "kwargs": {"type": "str", "required": true, "help": "Email for techdocs"}} ] } ], "dynamic signatures": [
]} 8 unmodified lines91011121314151617184 unmodified lines2324252627287 unmodified lines3637383940418 unmodified lines@classmethoddef insert_to_database(cls, table_name: str, data: Union[Tuple, List[Tuple]], cols: List[str]=None):con = DBConnection.get_client()cursor = con.cursor()QUERY = f"INSERT INTO {{table_name}} ({','.join(cols)}) VALUES ".format(table_name=table_name)print(data)if isinstance(data, list):QUERY += '(' + ','.join(['%s' for _ in range(len(data[0]))]) + ')'cursor.executemany(QUERY, data)4 unmodified lines@classmethoddef fetch_data_from_database(cls, table_name: str, cols_to_fetch: Union[str, List[str]], where_clause: str=None):con = DBConnection.get_client()cursor = con.cursor()if isinstance(cols_to_fetch, str):7 unmodified lines@classmethoddef update_data_in_database(cls, table_name: str, cols_to_update: Union[str, List[str]], where_clause: str=None, new_values: Union[str, List[str]]=None):con = DBConnection.get_client()cursor = con.cursor()if isinstance(cols_to_update, str):8 unmodified lines91011121314151617181920212223242526272829303132334 unmodified lines383940414243444546474849505152535455565758597 unmodified lines6768697071727374757677787980818283848586878 unmodified lines@classmethoddef insert_to_database(cls, table_name: str, data: Union[Tuple, List[Tuple]], cols: List[str]=None):"""This method is used to insert data into a specified table in the database.Args:table_name (str): The name of the table into which the data will be inserted.data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.Raises:Exception: If the data type of 'data' is not a tuple or a list of tuples.Returns:None""""\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n ""\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n "con = DBConnection.get_client()cursor = con.cursor()QUERY = f"INSERT INTO {{table_name}} ({','.join(cols)}) VALUES ".format(table_name=table_name)if isinstance(data, list):QUERY += '(' + ','.join(['%s' for _ in range(len(data[0]))]) + ')'cursor.executemany(QUERY, data)4 unmodified lines@classmethoddef fetch_data_from_database(cls, table_name: str, cols_to_fetch: Union[str, List[str]], where_clause: str=None):"""This method fetches data from a specified table in the database based on the specified column(s) and optional WHERE clause.Args:table_name (str): The name of the table from which to fetch data.cols_to_fetch (Union[str, List[str]]): The column(s) to fetch from the table. Can be a single string or a list of strings.If a single string, it will be treated as a comma-separated list of columns.where_clause (str, optional): An optional WHERE clause to filter the data. Defaults to None.Returns:List[List[str]]: A list of lists, where each inner list represents a row of data fetched from the database.The order of the columns in the inner lists corresponds to the order specified in the cols_to_fetch parameter.Raises:None"""con = DBConnection.get_client()cursor = con.cursor()if isinstance(cols_to_fetch, str):7 unmodified lines@classmethoddef update_data_in_database(cls, table_name: str, cols_to_update: Union[str, List[str]], where_clause: str=None, new_values: Union[str, List[str]]=None):"""This method updates the data in the specified table in the database.Args:table_name (str): The name of the table to be updated.cols_to_update (Union[str, List[str]]): The column(s) to be updated. If a single string, it should end with '=%s'. If a list, it should contain strings representing the column names followed by '=%s'.where_clause (str, optional): The WHERE clause to specify the conditions for the update. Defaults to None.new_values (Union[str, List[str]], optional): The new values to be updated in the specified columns. If a single string, it should be a list of values. If a list, it should contain the new values for the columns. Defaults to None.Returns:bool: Returns True if the update is successful.Raises:Exception: Raises an exception if the database connection fails."""con = DBConnection.get_client()cursor = con.cursor()if isinstance(cols_to_update, str):
123456789101112131415161718def add(a, b):return a + bdef multiply(a, b):return a * bdef subtract(a, b):return a - bdef divide(a, b):if b == 0:raise ValueError('Cannot divide by zero')return a / bdef func(*args, **kwargs):def wrapper(*args, **kwargs):return func(*args, **kwargs)return wrapper123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107def add(a, b):"""This function adds two numbers.Arguments:a (int): The first number to be added.b (int): The second number to be added.Returns:int: The sum of the two numbers."""'\n This function adds two numbers.\n\n Arguments:\n a (int): The first number to be added.\n b (int): The second number to be added.\n\n Returns:\n int: The sum of the two numbers.\n 'return a + bdef multiply(a, b):"""This function multiplies two numbers.Args:a: A number to be multiplied.This should be a numeric value (int or float).b: Another number to be multiplied.This should be a numeric value (int or float).Returns:The product of the two numbers.This will be a numeric value (int or float), representing the result of the multiplication.Raises:None"""'\n This function multiplies two numbers.\n\n Args:\n a: A number to be multiplied.\n b: Another number to be multiplied.\n\n Returns:\n The product of the two numbers.\n 'return a * bdef subtract(a, b):"""Subtracts the second number from the first.Args:a (int): The first number to be subtracted.b (int): The second number to be subtracted from the first.Returns:int: The result of the subtraction."""'\ndef subtract(a, b):\n 'return a - bdef divide(a, b):"""This function divides the first argument by the second argument.Arguments:a (float): The first number to be divided.b (float): The second number to be divided.Raises:ValueError: If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.Returns:float: The result of the division of the first argument by the second argument.""""\n This function divides the first argument by the second argument.\n\n Arguments:\n a -- The first number to be divided. It should be of type float.\n b -- The second number to be divided. It should be of type float.\n\n Raises:\n ValueError -- If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.\n\n Returns:\n float -- The result of the division of the first argument by the second argument.\n "if b == 0:raise ValueError('Cannot divide by zero')return a / bdef func(*args, **kwargs):"""Usage: query(input_string, search_terms, search_type='AND')This function searches for specified terms within the input string using a specified search type.Parameters:- input_string (str): The string to search within.- search_terms (list): A list of strings to search for within the input_string.- search_type (str, optional): Specifies how the search_terms should be searched within the input_string.Possible values: 'AND' (all search_terms must be present in the input_string), 'OR' (at least one search_term must be present in the input_string). Default is 'AND'.Returns:- search_results (list): A list of all occurrences of the search_terms within the input_string.Raises:- ValueError: If the search_type is not 'AND' or 'OR'.""""\nUsage: func(*args, **kwargs)\n\nThis function returns a wrapper function that calls the original function.\n\nParameters:\n- args (tuple): A tuple of non-keyworded arguments to pass to the function.\n- kwargs (dict): A dictionary of keyworded arguments to pass to the function.\n\nReturns:\n- wrapper (function): A new function that calls the original function with the given arguments.\n\nRaises:\n- TypeError: If the arguments passed to the wrapper function do not match the original function's signature.\n"def wrapper(*args, **kwargs):"""This function performs a specific operation on the given arguments.Arguments:arg1 -- a string argument (default: None)arg2 -- an integer argument (default: None)arg3 -- a floating point number argument (default: None)arg4 -- a boolean argument (default: None)Returns:NoneRaises:TypeError -- If any argument is not of the expected type."""'\n This function acts as a wrapper for another function, allowing it to be called with a variety of arguments.\n\n Arguments:\n *args -- any number of positional arguments (default: None)\n **kwargs -- any number of keyword arguments (default: None)\n\n Returns:\n Whatever the wrapped function returns (default: None)\n\n Raises:\n Whatever exceptions the wrapped function raises (default: None)\n 'return func(*args, **kwargs)return wrapper
.gitignore+3-1
TechdocsAPI/backend/core/Exceptions.py+3-3
TechdocsAPI/backend/models/inference.py+5-1
TechdocsAPI/backend/router.py+3-7
TechdocsAPI/backend/services/auth/ops.py+2-3
TechdocsAPI/backend/services/db/utils/DBQueries.py-1
frontend/pages/Code.py+2-1
techdocs/__init__.py+1
techdocs/cli.py+42-22
techdocs/dtypes.pyAdded+5
techdocs/ops.pyAdded+124
techdocs/utils/functools.py+45-13
techdocs/utils/subcommand_signatures.jsonAdded+45
testing/DBQueries.py+47-1
testing/test.py+89