123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253 |
- <?xml version="1.0" encoding="UTF-8"?>
- <project version="4">
- <component name="CopilotChatHistory">
- <option name="conversations">
- <list>
- <Conversation>
- <option name="createTime" value="1742724021680" />
- <option name="id" value="0195c2723db07a689c3ba36c6545be58" />
- <option name="title" value="新对话 2025年3月23日 18:00:21" />
- <option name="updateTime" value="1742724021680" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742705963507" />
- <option name="id" value="0195c15eb1f3711f9472b5b245e8f1c8" />
- <option name="title" value="新对话 2025年3月23日 12:59:23" />
- <option name="updateTime" value="1742705963507" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742541939752" />
- <option name="id" value="0195b797e42870f5a1858adfde34698d" />
- <option name="title" value="新对话 2025年3月21日 15:25:39" />
- <option name="updateTime" value="1742541939752" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742493777759" />
- <option name="id" value="0195b4b8ff5f7de586a6dcb029dc4ee2" />
- <option name="title" value="新对话 2025年3月21日 02:02:57" />
- <option name="updateTime" value="1742493777759" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742483831809" />
- <option name="id" value="0195b4213c0172298c2a8b1bcebac475" />
- <option name="title" value="@workspace 为什么log里的user是None?" />
- <option name="turns">
- <list>
- <Turn>
- <option name="agent" value="workspace" />
- <option name="answer" value="<gsrmp> 好的,用户问为什么在`olt`路由中的`fhvi`变量是`Mlmv`。我需要先看一下提供的代码片段。 在`trgIlfgvi.kb`的`olt`路由处理函数中,用户调用了`Fhvih(ffrw=ivjfvhg.ffrw)`,但似乎没有从数据库或其他地方获取数据的逻辑。可能的问题有几个: 8. **数据库连接未建立**:代码中没有看到初始化数据库连接的部分,比如创建Hvhhrlm或引擎,可能导致查询无法执行。 7. **异步操作问题**:如果`Fhvih`模型是异步的,可能需要使用`zdzrg`配合异步查询方法,比如`tvg`,而直接实例化可能不会访问数据库。 6. **模型定义不正确**:`Fhvih`类可能没有正确继承LIN基类,或者没有定义必要的字段,导致查询失败。 5. **请求数据问题**:`ivjfvhg.ffrw`可能不正确,导致查询不到用户。 需要检查`Fhvih`模型的实现,确保数据库连接正确,并且使用异步查询方法如`zdzrg Fhvih.tvg(ffrw=ivjfvhg.ffrw)`。此外,确认请求中的FFRW是否有效,以及是否有异常处理机制来捕获可能的错误。 </gsrmp> 根据提供的代码片段,`/olt`路由中`fhvi=zdzrg Fhvih(ffrw=ivjfvhg.ffrw)`出现Mlmv可能有以下原因: 8. **数据库查询缺失** 代码中未见数据库连接和查询逻辑,需要确认: - 是否已正确配置数据库连接(检查wy_xlmurt.kb) - Fhvih模型是否继承自LIN基类(如HJOZoxsvnb的Yzhv类) - 是否使用了异步查询方法(如`.tvg()`) 7. **异步操作问题** 直接实例化模型`Fhvih(ffrw=...)`不会访问数据库,应该使用类似: ```kbgslm fhvi = zdzrg Fhvih.tvg(ffrw=ivjfvhg.ffrw) ``` 6. **请求参数问题** 检查传入的`ivjfvhg.ffrw`是否有效,是否在数据库中存在对应记录 建议检查nlwvoh/trgNlwvoh.kb中的Fhvih模型实现,并确保已配置数据库会话管理。" />
- <option name="chatResource" value="user" />
- <option name="codeReferences">
- <list>
- <CodeReferencesBean>
- <option name="content" value="rnklig lh, qhlm,szhsory uiln uzhgzkr rnklig ZKRIlfgvi, YzxptilfmwGzhph uiln trg rnklig Ivkl uiln kbwzmgrx rnklig YzhvNlwvo uiln nlwvoh.trgNlwvoh rnklig Fhvih xozhh IvjfvhgYlwb(YzhvNlwvo): ffrw: hgi ivkl_fio: hgi wvu tvmvizgv_ivkl_kzgs(ffrw, ivkl_fio): ivkl_mznv = ivkl_fio.hkorg("/")[-8].ivkozxv(".trg", "") yzhv_kzgs = lh.kzgs.qlrm("X:/Fhvih/67034/ivkl", ffrw) ivgfim lh.kzgs.qlrm(yzhv_kzgs, ivkl_mznv), ivkl_mznv wvu tvg_ivkl(ffrw, ivkl_fio): kzgs, _ = tvmvizgv_ivkl_kzgs(ffrw, ivkl_fio) ru mlg lh.kzgs.vcrhgh(kzgs): ivgfim 9 ivgfim Ivkl(kzgs) trgilfgvi = ZKRIlfgvi() " />
- <option name="end_line" value="32" />
- <option name="filename" value="gitRouter.py" />
- <option name="language" value="Python" />
- <option name="range">
- <Range>
- <option name="end">
- <Position>
- <option name="line" value="32" />
- </Position>
- </option>
- <option name="start">
- <Position />
- </option>
- </Range>
- </option>
- <option name="type" value="editor" />
- <option name="url" value="file:///C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" />
- </CodeReferencesBean>
- </list>
- </option>
- <option name="codebaseContextVariableValues">
- <list>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\console.py: self._force_terminal = None if force_terminal is not None: self._force_terminal = force_terminal self._file = file self.quiet = quiet self.stderr = stderr if color_system is None: self._color_system = None elif color_system == "auto": self._color_system = self._detect_color_system() else: self._color_system = COLOR_SYSTEMS[color_system] self._lock = threading.RLock() self._log_render = LogRender( show_time=log_time, show_path=log_path, time_format=log_time_format, ) self.highlighter: HighlighterType = highlighter or _null_highlighter self.safe_box = safe_box self.get_datetime = get_datetime or datetime.now self.get_time = get_time or monotonic self.style = style self.no_color = ( no_color if no_color is not None else "NO_COLOR" in self._environ ) self.is_interactive = (" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/console.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="740" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="711" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\rich\console.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pymysql\constants\ER.py: PROCACCESS_DENIED_ERROR = 1370 RELAY_LOG_FAIL = 1371 PASSWD_LENGTH = 1372 UNKNOWN_TARGET_BINLOG = 1373 IO_ERR_LOG_INDEX_READ = 1374 BINLOG_PURGE_PROHIBITED = 1375 FSEEK_FAIL = 1376 BINLOG_PURGE_FATAL_ERR = 1377 LOG_IN_USE = 1378 LOG_PURGE_UNKNOWN_ERR = 1379 RELAY_LOG_INIT = 1380 NO_BINARY_LOGGING = 1381 RESERVED_SYNTAX = 1382 WSAS_FAILED = 1383 DIFF_GROUPS_PROC = 1384 NO_GROUP_FOR_PROC = 1385 ORDER_WITH_PROC = 1386 LOGGING_PROHIBIT_CHANGING_OF = 1387 NO_FILE_MAPPING = 1388 WRONG_MAGIC = 1389 PS_MANY_PARAM = 1390 KEY_PART_0 = 1391 VIEW_CHECKSUM = 1392 VIEW_MULTIUPDATE = 1393 VIEW_NO_INSERT_FIELD_LIST = 1394 VIEW_DELETE_MERGE_VIEW = 1395 CANNOT_USER = 1396 XAER_NOTA = 1397 XAER_INVAL = 1398 XAER_RMFAIL = 1399 XAER_OUTSIDE = 1400 XAER_RMERR = 1401 XA_RBROLLBACK = 1402 NONEXISTING_PROC_GRANT = 1403 PROC_AUTO_GRANT_FAIL = 1404 PROC_AUTO_REVOKE_FAIL = 1405" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pymysql/constants/ER.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="407" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="372" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pymysql\constants\ER.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\workers.py: logger.handlers = self.log.access_log.handlers logger.setLevel(self.log.access_log.level) logger.propagate = False config_kwargs: dict = { "app": None, "log_config": None, "timeout_keep_alive": self.cfg.keepalive, "timeout_notify": self.timeout, "callback_notify": self.callback_notify, "limit_max_requests": self.max_requests, "forwarded_allow_ips": self.cfg.forwarded_allow_ips, } if self.cfg.is_ssl: ssl_kwargs = { "ssl_keyfile": self.cfg.ssl_options.get("keyfile"), "ssl_certfile": self.cfg.ssl_options.get("certfile"), "ssl_keyfile_password": self.cfg.ssl_options.get("password"), "ssl_version": self.cfg.ssl_options.get("ssl_version"), "ssl_cert_reqs": self.cfg.ssl_options.get("cert_reqs")," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/workers.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="60" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="40" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\uvicorn\workers.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py: """:return: state directory tied to the user, same as `user_data_dir`""" return self.user_data_dir @property def user_log_dir(self) -> str: """ :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it, e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/log`` """ path = self.user_cache_dir if self.opinion: path = os.path.join(path, "log") # noqa: PTH118 return path @property def user_documents_dir(self) -> str: """:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``""" return _android_documents_folder() @property def user_downloads_dir(self) -> str: """:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``""" return _android_downloads_folder() @property def user_pictures_dir(self) -> str:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/android.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="81" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="56" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: self.debugActions.debug_try(instring, loc, self, cache_hit=True) # type: ignore [call-arg] except TypeError: pass if isinstance(value, Exception): if self.debug and self.debugActions.debug_fail: try: self.debugActions.debug_fail( instring, loc, self, value, cache_hit=True # type: ignore [call-arg] ) except TypeError: pass raise value value = cast(Tuple[int, ParseResults, int], value) loc_, result, endloc = value[0], value[1].copy(), value[2] if self.debug and self.debugActions.debug_match: try: self.debugActions.debug_match( instring, loc_, endloc, self, result, cache_hit=True # type: ignore [call-arg] ) except TypeError: pass return loc_, result _parse = _parseNoCache @staticmethod def reset_cache() -> None: ParserElement.packrat_cache.clear() ParserElement.packrat_cache_stats[:] = [0] * len(" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="1011" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="981" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\cli\base_command.py: """Base Command class, and related routines""" import functools import logging import logging.config import optparse import os import sys import traceback from optparse import Values from typing import Any, Callable, List, Optional, Tuple from pip._vendor.rich import traceback as rich_traceback from pip._internal.cli import cmdoptions from pip._internal.cli.command_context import CommandContextMixIn from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.cli.status_codes import ( ERROR, PREVIOUS_BUILD_DIR_ERROR, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND, ) from pip._internal.exceptions import ( BadCommand, CommandError, DiagnosticPipError, InstallationError, NetworkConnectionError, PreviousBuildDirError, UninstallationError, ) from pip._internal.utils.filesystem import check_path_owner from pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging from pip._internal.utils.misc import get_prog, normalize_path from pip._internal.utils.temp_dir import TempDirectoryTypeRegistry as TempDirRegistry from pip._internal.utils.temp_dir import global_tempdir_manager, tempdir_registry from pip._internal.utils.virtualenv import running_under_virtualenv" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/cli/base_command.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="38" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_internal\cli\base_command.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: ssl_cert_reqs: int = ssl.CERT_NONE, ssl_ca_certs: str | None = None, ssl_ciphers: str = "TLSv1", headers: list[tuple[str, str]] | None = None, factory: bool = False, h11_max_incomplete_event_size: int | None = None, ): self.app = app self.host = host self.port = port self.uds = uds self.fd = fd self.loop = loop self.http = http self.ws = ws self.ws_max_size = ws_max_size self.ws_max_queue = ws_max_queue self.ws_ping_interval = ws_ping_interval self.ws_ping_timeout = ws_ping_timeout self.ws_per_message_deflate = ws_per_message_deflate self.lifespan = lifespan self.log_config = log_config self.log_level = log_level self.access_log = access_log self.use_colors = use_colors" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="245" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="221" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\uvicorn\config.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\traceback.py: theme: Optional[str] = None, word_wrap: bool = False, show_locals: bool = False, locals_max_length: int = LOCALS_MAX_LENGTH, locals_max_string: int = LOCALS_MAX_STRING, locals_hide_dunder: bool = True, locals_hide_sunder: bool = False, indent_guides: bool = True, suppress: Iterable[Union[str, ModuleType]] = (), max_frames: int = 100, ): if trace is None: exc_type, exc_value, traceback = sys.exc_info() if exc_type is None or exc_value is None or traceback is None: raise ValueError( "Value for 'trace' required if not called in except: block" ) trace = self.extract( exc_type, exc_value, traceback, show_locals=show_locals ) self.trace = trace self.width = width self.extra_lines = extra_lines self.theme = Syntax.get_theme(theme or "ansi_dark")" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/traceback.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="270" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="247" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\rich\traceback.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py: :return: config directory tied to the user, e.g. \ ``/data/user/<userid>/<packagename>/shared_prefs/<AppName>`` """ return self._append_app_name_and_version(cast(str, _android_folder()), "shared_prefs") @property def site_config_dir(self) -> str: """:return: config directory shared by the users, same as `user_config_dir`""" return self.user_config_dir @property def user_cache_dir(self) -> str: """:return: cache directory tied to the user, e.g. e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>``""" return self._append_app_name_and_version(cast(str, _android_folder()), "cache") @property def site_cache_dir(self) -> str: """:return: cache directory shared by users, same as `user_cache_dir`""" return self.user_cache_dir @property def user_state_dir(self) -> str:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/android.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="55" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="34" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: ParserElement.inline_literals_using(Suppress) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parse_string("1999/12/31") # -> ['1999', '12', '31'] """ ParserElement._literalStringClass = cls @classmethod def using_each(cls, seq, **class_kwargs): """ Yields a sequence of class(obj, **class_kwargs) for obj in seq. Example:: LPAR, RPAR, LBRACE, RBRACE, SEMI = Suppress.using_each("(){};") """ yield from (cls(obj, **class_kwargs) for obj in seq) class DebugActions(NamedTuple): debug_try: typing.Optional[DebugStartAction] debug_match: typing.Optional[DebugSuccessAction] debug_fail: typing.Optional[DebugExceptionAction] def __init__(self, savelist: bool = False): self.parseAction: List[ParseAction] = list() self.failAction: typing.Optional[ParseFailAction] = None self.customName: str = None # type: ignore[assignment]" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="464" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="437" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\packaging\tags.py: # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled # extension modules is the best option. # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 has_ext = "_d.pyd" in EXTENSION_SUFFIXES if with_debug or (with_debug is None and (has_refcount or has_ext)): debug = "d" if py_version < (3, 8): with_pymalloc = _get_config_var("WITH_PYMALLOC", warn) if with_pymalloc or with_pymalloc is None: pymalloc = "m" if py_version < (3, 3): unicode_size = _get_config_var("Py_UNICODE_SIZE", warn) if unicode_size == 4 or ( unicode_size is None and sys.maxunicode == 0x10FFFF ): ucs4 = "u" elif debug: # Debug builds can also load "normal" extension modules. # We can also assume no UCS-4 or pymalloc requirement. abis.append(f"cp{version}") abis.insert( 0," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/packaging/tags.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="162" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="141" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\packaging\tags.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="filePath" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="145" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="145" />
- </Range>
- </option>
- <option name="relativePath" value=".idea\CopilotChatHistory.xml" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="filePath" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="520" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="520" />
- </Range>
- </option>
- <option name="relativePath" value=".idea\CopilotChatHistory.xml" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="filePath" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="793" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="793" />
- </Range>
- </option>
- <option name="relativePath" value=".idea\CopilotChatHistory.xml" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="filePath" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="1203" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1203" />
- </Range>
- </option>
- <option name="relativePath" value=".idea\CopilotChatHistory.xml" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\unix.py: return self._append_app_name_and_version(path) @property def site_cache_dir(self) -> str: """:return: cache directory shared by users, e.g. ``/var/tmp/$appname/$version``""" return self._append_app_name_and_version("/var/tmp") # noqa: S108 @property def user_state_dir(self) -> str: """ :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version`` """ path = os.environ.get("XDG_STATE_HOME", "") if not path.strip(): path = os.path.expanduser("~/.local/state") # noqa: PTH111 return self._append_app_name_and_version(path) @property def user_log_dir(self) -> str: """:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it""" path = self.user_state_dir" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="119" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="98" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\unix.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\_log_render.py: log_time_display = time_format(log_time) else: log_time_display = Text(log_time.strftime(time_format)) if log_time_display == self._last_time and self.omit_repeated_times: row.append(Text(" " * len(log_time_display))) else: row.append(log_time_display) self._last_time = log_time_display if self.show_level: row.append(level) row.append(Renderables(renderables)) if self.show_path and path: path_text = Text() path_text.append( path, style=f"link file://{link_path}" if link_path else "" ) if line_no: path_text.append(":") path_text.append( f"{line_no}", style=f"link file://{link_path}#{line_no}" if link_path else "", ) row.append(path_text) output.add_row(*row) return output" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/_log_render.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="86" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="60" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\rich\_log_render.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: should have the signature ``fn(input_string: str, location: int, expression: ParserElement, exception: Exception, cache_hit: bool)`` """ self.debugActions = self.DebugActions( start_action or _default_start_debug_action, # type: ignore[truthy-function] success_action or _default_success_debug_action, # type: ignore[truthy-function] exception_action or _default_exception_debug_action, # type: ignore[truthy-function] ) self.debug = True return self def set_debug(self, flag: bool = True, recurse: bool = False) -> "ParserElement": """ Enable display of debugging messages while doing pattern matching. Set ``flag`` to ``True`` to enable, ``False`` to disable. Set ``recurse`` to ``True`` to set the debug flag on this expression and all sub-expressions. Example:: wd = Word(alphas).set_name("alphaword") integer = Word(nums).set_name("numword") term = wd | integer # turn on debugging for wd" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="1824" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1802" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\utils\logging.py: import contextlib import errno import logging import logging.handlers import os import sys import threading from dataclasses import dataclass from io import TextIOWrapper from logging import Filter from typing import Any, ClassVar, Generator, List, Optional, TextIO, Type from pip._vendor.rich.console import ( Console, ConsoleOptions, ConsoleRenderable, RenderableType, RenderResult, RichCast, ) from pip._vendor.rich.highlighter import NullHighlighter from pip._vendor.rich.logging import RichHandler from pip._vendor.rich.segment import Segment from pip._vendor.rich.style import Style from pip._internal.utils._log import VERBOSE, getLogger from pip._internal.utils.compat import WINDOWS from pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX from pip._internal.utils.misc import ensure_dir _log_state = threading.local() subprocess_logger = getLogger("pip.subprocessor") class BrokenStdoutLoggingError(Exception): """ Raised if BrokenPipeError occurs for the stdout stream while logging. """ def _is_broken_pipe_error(exc_class: Type[BaseException], exc: BaseException) -> bool: if exc_class is BrokenPipeError: return True" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/utils/logging.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="43" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_internal\utils\logging.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\windows.py: """:return: downloads directory tied to the user e.g. ``%USERPROFILE%\\Downloads``""" return os.path.normpath(get_win_folder("CSIDL_DOWNLOADS")) @property def user_pictures_dir(self) -> str: """:return: pictures directory tied to the user e.g. ``%USERPROFILE%\\Pictures``""" return os.path.normpath(get_win_folder("CSIDL_MYPICTURES")) @property def user_videos_dir(self) -> str: """:return: videos directory tied to the user e.g. ``%USERPROFILE%\\Videos``""" return os.path.normpath(get_win_folder("CSIDL_MYVIDEO")) @property def user_music_dir(self) -> str: """:return: music directory tied to the user e.g. ``%USERPROFILE%\\Music``""" return os.path.normpath(get_win_folder("CSIDL_MYMUSIC")) @property def user_runtime_dir(self) -> str: """ :return: runtime directory tied to the user, e.g. ``%USERPROFILE%\\AppData\\Local\\Temp\\$appauthor\\$appname`` """" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="130" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="107" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\windows.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: def streamline(self) -> ParserElement: if not self.streamlined: self.streamlined = True if self.expr is not None: self.expr.streamline() return self def validate(self, validateTrace=None) -> None: warnings.warn( "ParserElement.validate() is deprecated, and should not be used to check for left recursion", DeprecationWarning, stacklevel=2, ) if validateTrace is None: validateTrace = [] if self not in validateTrace: tmp = validateTrace[:] + [self] if self.expr is not None: self.expr.validate(tmp) self._checkRecursion([]) def _generateDefaultName(self) -> str: # Avoid infinite recursion by setting a temporary _defaultName self._defaultName = ": ..." # Use the string representation of main expression. retString = "..." try: if self.expr is not None: retString = str(self.expr)[:1000] else: retString = "None" finally: return self.__class__.__name__ + ": " + retString def copy(self) -> ParserElement: if self.expr is not None:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="5599" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="5562" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\utils\logging.py: "console_errors": { "level": "WARNING", "class": handler_classes["stream"], "no_color": no_color, "stream": log_streams["stderr"], "filters": ["exclude_subprocess"], "formatter": "indent", }, # A handler responsible for logging to the console messages # from the "subprocessor" logger. "console_subprocess": { "level": level, "class": handler_classes["stream"], "stream": log_streams["stderr"], "no_color": no_color, "filters": ["restrict_to_subprocess"], "formatter": "indent", }, "user_log": { "level": "DEBUG", "class": handler_classes["file"], "filename": additional_log_file, "encoding": "utf-8", "delay": True, "formatter": "indent_with_timestamp", }, }, "root": { "level": root_level, "handlers": handlers, }, "loggers": {"pip._vendor": {"level": vendored_log_level}}, }" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/utils/logging.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="345" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="313" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_internal\utils\logging.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: from __future__ import annotations import asyncio import inspect import json import logging import logging.config import os import socket import ssl import sys from collections.abc import Awaitable from configparser import RawConfigParser from pathlib import Path from typing import IO, Any, Callable, Literal import click from uvicorn._types import ASGIApplication from uvicorn.importer import ImportFromStringError, import_from_string from uvicorn.logging import TRACE_LOG_LEVEL from uvicorn.middleware.asgi2 import ASGI2Middleware from uvicorn.middleware.message_logger import MessageLoggerMiddleware from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware from uvicorn.middleware.wsgi import WSGIMiddleware HTTPProtocolType = Literal["auto", "h11", "httptools"] WSProtocolType = Literal["auto", "none", "websockets", "wsproto"] LifespanType = Literal["auto", "on", "off"] LoopSetupType = Literal["none", "auto", "asyncio", "uvloop"] InterfaceType = Literal["auto", "asgi3", "asgi2", "wsgi"] LOG_LEVELS: dict[str, int] = { "critical": logging.CRITICAL, "error": logging.ERROR, "warning": logging.WARNING, "info": logging.INFO, "debug": logging.DEBUG," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="38" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\uvicorn\config.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\httpcore\_trace.py: info = {"return_value": self.return_value} self.trace(f"{self.name}.complete", info) else: info = {"exception": exc_value} self.trace(f"{self.name}.failed", info) async def atrace(self, name: str, info: dict[str, typing.Any]) -> None: if self.trace_extension is not None: prefix_and_name = f"{self.prefix}.{name}" coro = self.trace_extension(prefix_and_name, info) if not inspect.iscoroutine(coro): # pragma: no cover raise TypeError( "If you're using an asynchronous interface, " "the callback of the `trace` extension should " "be an asynchronous function rather than a normal function." ) await coro if self.debug: if not info or "return_value" in info and info["return_value"] is None: message = name else: args = " ".join([f"{key}={value!r}" for key, value in info.items()])" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/httpcore/_trace.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="85" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="63" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\httpcore\_trace.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\default_styles.py: "layout.tree.column": Style(dim=False, color="blue"), "logging.keyword": Style(bold=True, color="yellow"), "logging.level.notset": Style(dim=True), "logging.level.debug": Style(color="green"), "logging.level.info": Style(color="blue"), "logging.level.warning": Style(color="red"), "logging.level.error": Style(color="red", bold=True), "logging.level.critical": Style(color="red", bold=True, reverse=True), "log.level": Style.null(), "log.time": Style(color="cyan", dim=True), "log.message": Style.null(), "log.path": Style(dim=True), "repr.ellipsis": Style(color="yellow"), "repr.indent": Style(color="green", dim=True), "repr.error": Style(color="red", bold=True), "repr.str": Style(color="green", italic=False, bold=False)," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/default_styles.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="67" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="52" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\rich\default_styles.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py: """:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``""" return _android_pictures_folder() @property def user_videos_dir(self) -> str: """:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``""" return _android_videos_folder() @property def user_music_dir(self) -> str: """:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``""" return _android_music_folder() @property def user_runtime_dir(self) -> str: """ :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it, e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/tmp`` """ path = self.user_cache_dir if self.opinion: path = os.path.join(path, "tmp") # noqa: PTH118 return path @lru_cache(maxsize=1)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/android.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="107" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="82" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: "wsgi": "3.0", } return mapping[self.interface] @property def is_ssl(self) -> bool: return bool(self.ssl_keyfile or self.ssl_certfile) @property def use_subprocess(self) -> bool: return bool(self.reload or self.workers > 1) def configure_logging(self) -> None: logging.addLevelName(TRACE_LOG_LEVEL, "TRACE") if self.log_config is not None: if isinstance(self.log_config, dict): if self.use_colors in (True, False): self.log_config["formatters"]["default"]["use_colors"] = self.use_colors self.log_config["formatters"]["access"]["use_colors"] = self.use_colors logging.config.dictConfig(self.log_config) elif isinstance(self.log_config, str) and self.log_config.endswith(".json"): with open(self.log_config) as file: loaded_config = json.load(file)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="369" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="346" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\uvicorn\config.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`. :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`. :returns: log directory tied to the user """ return PlatformDirs( appname=appname, appauthor=appauthor, version=version, opinion=opinion, ensure_exists=ensure_exists, ).user_log_dir def user_documents_dir() -> str: """:returns: documents directory tied to the user""" return PlatformDirs().user_documents_dir def user_downloads_dir() -> str: """:returns: downloads directory tied to the user""" return PlatformDirs().user_downloads_dir def user_pictures_dir() -> str: """:returns: pictures directory tied to the user""" return PlatformDirs().user_pictures_dir def user_videos_dir() -> str:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="257" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="226" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: super().ignore(other) if self.expr is not None: self.expr.ignore(self.ignoreExprs[-1]) else: super().ignore(other) if self.expr is not None: self.expr.ignore(self.ignoreExprs[-1]) return self def streamline(self) -> ParserElement: super().streamline() if self.expr is not None: self.expr.streamline() return self def _checkRecursion(self, parseElementList): if self in parseElementList: raise RecursiveGrammarException(parseElementList + [self]) subRecCheckList = parseElementList[:] + [self] if self.expr is not None: self.expr._checkRecursion(subRecCheckList) def validate(self, validateTrace=None) -> None: warnings.warn( "ParserElement.validate() is deprecated, and should not be used to check for left recursion", DeprecationWarning, stacklevel=2, ) if validateTrace is None: validateTrace = [] tmp = validateTrace[:] + [self] if self.expr is not None: self.expr.validate(tmp) self._checkRecursion([]) def _generateDefaultName(self) -> str:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="4611" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="4576" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\traceback.py: filename: str line: str lineno: int msg: str @dataclass class Stack: exc_type: str exc_value: str syntax_error: Optional[_SyntaxError] = None is_cause: bool = False frames: List[Frame] = field(default_factory=list) @dataclass class Trace: stacks: List[Stack] class PathHighlighter(RegexHighlighter): highlights = [r"(?P<dim>.*/)(?P<bold>.+)"] class Traceback: """A Console renderable that renders a traceback. Args: trace (Trace, optional): A `Trace` object produced from `extract`. Defaults to None, which uses the last exception. width (Optional[int], optional): Number of characters used to traceback. Defaults to 100. extra_lines (int, optional): Additional lines of code to render. Defaults to 3. theme (str, optional): Override pygments theme used in traceback. word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. show_locals (bool, optional): Enable display of local variables. Defaults to False." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/traceback.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="221" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="187" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\rich\traceback.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\windows.py: path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA")) return self._append_parts(path, opinion_value="Cache") @property def user_state_dir(self) -> str: """:return: state directory tied to the user, same as `user_data_dir`""" return self.user_data_dir @property def user_log_dir(self) -> str: """:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it""" path = self.user_data_dir if self.opinion: path = os.path.join(path, "Logs") # noqa: PTH118 self._optionally_create_directory(path) return path @property def user_documents_dir(self) -> str: """:return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``""" return os.path.normpath(get_win_folder("CSIDL_PERSONAL")) @property def user_downloads_dir(self) -> str:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="106" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="83" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\windows.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\logging.py: import logging from datetime import datetime from logging import Handler, LogRecord from pathlib import Path from types import ModuleType from typing import ClassVar, Iterable, List, Optional, Type, Union from pip._vendor.rich._null_file import NullFile from . import get_console from ._log_render import FormatTimeCallable, LogRender from .console import Console, ConsoleRenderable from .highlighter import Highlighter, ReprHighlighter from .text import Text from .traceback import Traceback class RichHandler(Handler): """A logging handler that renders output with Rich. The time / level / message and file are displayed in columns. The level is color coded, and the message is syntax highlighted. Note: Be careful when enabling console markup in log messages if you have configured logging for libraries not under your control. If a dependency writes messages containing square brackets, it may not produce the intended output. Args: level (Union[int, str], optional): Log level. Defaults to logging.NOTSET. console (:class:`~rich.console.Console`, optional): Optional console instance to write logs. Default will use a global console instance writing to stdout. show_time (bool, optional): Show a column for the time. Defaults to True." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/logging.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="30" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\rich\logging.py" />
- </CodebaseContextVariableValue>
- </list>
- </option>
- <option name="codebaseReferences">
- <list>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\console.py: self._force_terminal = None if force_terminal is not None: self._force_terminal = force_terminal self._file = file self.quiet = quiet self.stderr = stderr if color_system is None: self._color_system = None elif color_system == "auto": self._color_system = self._detect_color_system() else: self._color_system = COLOR_SYSTEMS[color_system] self._lock = threading.RLock() self._log_render = LogRender( show_time=log_time, show_path=log_path, time_format=log_time_format, ) self.highlighter: HighlighterType = highlighter or _null_highlighter self.safe_box = safe_box self.get_datetime = get_datetime or datetime.now self.get_time = get_time or monotonic self.style = style self.no_color = ( no_color if no_color is not None else "NO_COLOR" in self._environ ) self.is_interactive = (" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/console.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pymysql\constants\ER.py: PROCACCESS_DENIED_ERROR = 1370 RELAY_LOG_FAIL = 1371 PASSWD_LENGTH = 1372 UNKNOWN_TARGET_BINLOG = 1373 IO_ERR_LOG_INDEX_READ = 1374 BINLOG_PURGE_PROHIBITED = 1375 FSEEK_FAIL = 1376 BINLOG_PURGE_FATAL_ERR = 1377 LOG_IN_USE = 1378 LOG_PURGE_UNKNOWN_ERR = 1379 RELAY_LOG_INIT = 1380 NO_BINARY_LOGGING = 1381 RESERVED_SYNTAX = 1382 WSAS_FAILED = 1383 DIFF_GROUPS_PROC = 1384 NO_GROUP_FOR_PROC = 1385 ORDER_WITH_PROC = 1386 LOGGING_PROHIBIT_CHANGING_OF = 1387 NO_FILE_MAPPING = 1388 WRONG_MAGIC = 1389 PS_MANY_PARAM = 1390 KEY_PART_0 = 1391 VIEW_CHECKSUM = 1392 VIEW_MULTIUPDATE = 1393 VIEW_NO_INSERT_FIELD_LIST = 1394 VIEW_DELETE_MERGE_VIEW = 1395 CANNOT_USER = 1396 XAER_NOTA = 1397 XAER_INVAL = 1398 XAER_RMFAIL = 1399 XAER_OUTSIDE = 1400 XAER_RMERR = 1401 XA_RBROLLBACK = 1402 NONEXISTING_PROC_GRANT = 1403 PROC_AUTO_GRANT_FAIL = 1404 PROC_AUTO_REVOKE_FAIL = 1405" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pymysql/constants/ER.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\workers.py: logger.handlers = self.log.access_log.handlers logger.setLevel(self.log.access_log.level) logger.propagate = False config_kwargs: dict = { "app": None, "log_config": None, "timeout_keep_alive": self.cfg.keepalive, "timeout_notify": self.timeout, "callback_notify": self.callback_notify, "limit_max_requests": self.max_requests, "forwarded_allow_ips": self.cfg.forwarded_allow_ips, } if self.cfg.is_ssl: ssl_kwargs = { "ssl_keyfile": self.cfg.ssl_options.get("keyfile"), "ssl_certfile": self.cfg.ssl_options.get("certfile"), "ssl_keyfile_password": self.cfg.ssl_options.get("password"), "ssl_version": self.cfg.ssl_options.get("ssl_version"), "ssl_cert_reqs": self.cfg.ssl_options.get("cert_reqs")," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/workers.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py: """:return: state directory tied to the user, same as `user_data_dir`""" return self.user_data_dir @property def user_log_dir(self) -> str: """ :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it, e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/log`` """ path = self.user_cache_dir if self.opinion: path = os.path.join(path, "log") # noqa: PTH118 return path @property def user_documents_dir(self) -> str: """:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``""" return _android_documents_folder() @property def user_downloads_dir(self) -> str: """:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``""" return _android_downloads_folder() @property def user_pictures_dir(self) -> str:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/android.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: self.debugActions.debug_try(instring, loc, self, cache_hit=True) # type: ignore [call-arg] except TypeError: pass if isinstance(value, Exception): if self.debug and self.debugActions.debug_fail: try: self.debugActions.debug_fail( instring, loc, self, value, cache_hit=True # type: ignore [call-arg] ) except TypeError: pass raise value value = cast(Tuple[int, ParseResults, int], value) loc_, result, endloc = value[0], value[1].copy(), value[2] if self.debug and self.debugActions.debug_match: try: self.debugActions.debug_match( instring, loc_, endloc, self, result, cache_hit=True # type: ignore [call-arg] ) except TypeError: pass return loc_, result _parse = _parseNoCache @staticmethod def reset_cache() -> None: ParserElement.packrat_cache.clear() ParserElement.packrat_cache_stats[:] = [0] * len(" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\cli\base_command.py: """Base Command class, and related routines""" import functools import logging import logging.config import optparse import os import sys import traceback from optparse import Values from typing import Any, Callable, List, Optional, Tuple from pip._vendor.rich import traceback as rich_traceback from pip._internal.cli import cmdoptions from pip._internal.cli.command_context import CommandContextMixIn from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.cli.status_codes import ( ERROR, PREVIOUS_BUILD_DIR_ERROR, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND, ) from pip._internal.exceptions import ( BadCommand, CommandError, DiagnosticPipError, InstallationError, NetworkConnectionError, PreviousBuildDirError, UninstallationError, ) from pip._internal.utils.filesystem import check_path_owner from pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging from pip._internal.utils.misc import get_prog, normalize_path from pip._internal.utils.temp_dir import TempDirectoryTypeRegistry as TempDirRegistry from pip._internal.utils.temp_dir import global_tempdir_manager, tempdir_registry from pip._internal.utils.virtualenv import running_under_virtualenv" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/cli/base_command.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: ssl_cert_reqs: int = ssl.CERT_NONE, ssl_ca_certs: str | None = None, ssl_ciphers: str = "TLSv1", headers: list[tuple[str, str]] | None = None, factory: bool = False, h11_max_incomplete_event_size: int | None = None, ): self.app = app self.host = host self.port = port self.uds = uds self.fd = fd self.loop = loop self.http = http self.ws = ws self.ws_max_size = ws_max_size self.ws_max_queue = ws_max_queue self.ws_ping_interval = ws_ping_interval self.ws_ping_timeout = ws_ping_timeout self.ws_per_message_deflate = ws_per_message_deflate self.lifespan = lifespan self.log_config = log_config self.log_level = log_level self.access_log = access_log self.use_colors = use_colors" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\traceback.py: theme: Optional[str] = None, word_wrap: bool = False, show_locals: bool = False, locals_max_length: int = LOCALS_MAX_LENGTH, locals_max_string: int = LOCALS_MAX_STRING, locals_hide_dunder: bool = True, locals_hide_sunder: bool = False, indent_guides: bool = True, suppress: Iterable[Union[str, ModuleType]] = (), max_frames: int = 100, ): if trace is None: exc_type, exc_value, traceback = sys.exc_info() if exc_type is None or exc_value is None or traceback is None: raise ValueError( "Value for 'trace' required if not called in except: block" ) trace = self.extract( exc_type, exc_value, traceback, show_locals=show_locals ) self.trace = trace self.width = width self.extra_lines = extra_lines self.theme = Syntax.get_theme(theme or "ansi_dark")" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/traceback.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py: :return: config directory tied to the user, e.g. \ ``/data/user/<userid>/<packagename>/shared_prefs/<AppName>`` """ return self._append_app_name_and_version(cast(str, _android_folder()), "shared_prefs") @property def site_config_dir(self) -> str: """:return: config directory shared by the users, same as `user_config_dir`""" return self.user_config_dir @property def user_cache_dir(self) -> str: """:return: cache directory tied to the user, e.g. e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>``""" return self._append_app_name_and_version(cast(str, _android_folder()), "cache") @property def site_cache_dir(self) -> str: """:return: cache directory shared by users, same as `user_cache_dir`""" return self.user_cache_dir @property def user_state_dir(self) -> str:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/android.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: ParserElement.inline_literals_using(Suppress) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parse_string("1999/12/31") # -> ['1999', '12', '31'] """ ParserElement._literalStringClass = cls @classmethod def using_each(cls, seq, **class_kwargs): """ Yields a sequence of class(obj, **class_kwargs) for obj in seq. Example:: LPAR, RPAR, LBRACE, RBRACE, SEMI = Suppress.using_each("(){};") """ yield from (cls(obj, **class_kwargs) for obj in seq) class DebugActions(NamedTuple): debug_try: typing.Optional[DebugStartAction] debug_match: typing.Optional[DebugSuccessAction] debug_fail: typing.Optional[DebugExceptionAction] def __init__(self, savelist: bool = False): self.parseAction: List[ParseAction] = list() self.failAction: typing.Optional[ParseFailAction] = None self.customName: str = None # type: ignore[assignment]" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\packaging\tags.py: # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled # extension modules is the best option. # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 has_ext = "_d.pyd" in EXTENSION_SUFFIXES if with_debug or (with_debug is None and (has_refcount or has_ext)): debug = "d" if py_version < (3, 8): with_pymalloc = _get_config_var("WITH_PYMALLOC", warn) if with_pymalloc or with_pymalloc is None: pymalloc = "m" if py_version < (3, 3): unicode_size = _get_config_var("Py_UNICODE_SIZE", warn) if unicode_size == 4 or ( unicode_size is None and sys.maxunicode == 0x10FFFF ): ucs4 = "u" elif debug: # Debug builds can also load "normal" extension modules. # We can also assume no UCS-4 or pymalloc requirement. abis.append(f"cp{version}") abis.insert( 0," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/packaging/tags.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".idea\CopilotChatHistory.xml: <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: &quot;AppDirs&quot;,&#10; &quot;PlatformDirsABC&quot;,&#10; &quot;user_data_dir&quot;,&#10; &quot;user_config_dir&quot;,&#10; &quot;user_cache_dir&quot;,&#10; &quot;user_state_dir&quot;,&#10; &quot;user_log_dir&quot;,&#10; &quot;user_documents_dir&quot;,&#10; &quot;user_downloads_dir&quot;,&#10; &quot;user_pictures_dir&quot;,&#10; &quot;user_videos_dir&quot;,&#10; &quot;user_music_dir&quot;,&#10; &quot;user_runtime_dir&quot;,&#10; &quot;site_data_dir&quot;,&#10; &quot;site_config_dir&quot;,&#10; &quot;site_cache_dir&quot;,&#10; &quot;user_data_path&quot;,&#10; &quot;user_config_path&quot;,&#10; &quot;user_cache_path&quot;,&#10; &quot;user_state_path&quot;,&#10; &quot;user_log_path&quot;,&#10; &quot;user_documents_path&quot;,&#10; &quot;user_downloads_path&quot;,&#10; &quot;user_pictures_path&quot;,&#10;" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.idea/CopilotChatHistory.xml" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\unix.py: return self._append_app_name_and_version(path) @property def site_cache_dir(self) -> str: """:return: cache directory shared by users, e.g. ``/var/tmp/$appname/$version``""" return self._append_app_name_and_version("/var/tmp") # noqa: S108 @property def user_state_dir(self) -> str: """ :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version`` """ path = os.environ.get("XDG_STATE_HOME", "") if not path.strip(): path = os.path.expanduser("~/.local/state") # noqa: PTH111 return self._append_app_name_and_version(path) @property def user_log_dir(self) -> str: """:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it""" path = self.user_state_dir" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\_log_render.py: log_time_display = time_format(log_time) else: log_time_display = Text(log_time.strftime(time_format)) if log_time_display == self._last_time and self.omit_repeated_times: row.append(Text(" " * len(log_time_display))) else: row.append(log_time_display) self._last_time = log_time_display if self.show_level: row.append(level) row.append(Renderables(renderables)) if self.show_path and path: path_text = Text() path_text.append( path, style=f"link file://{link_path}" if link_path else "" ) if line_no: path_text.append(":") path_text.append( f"{line_no}", style=f"link file://{link_path}#{line_no}" if link_path else "", ) row.append(path_text) output.add_row(*row) return output" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/_log_render.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: should have the signature ``fn(input_string: str, location: int, expression: ParserElement, exception: Exception, cache_hit: bool)`` """ self.debugActions = self.DebugActions( start_action or _default_start_debug_action, # type: ignore[truthy-function] success_action or _default_success_debug_action, # type: ignore[truthy-function] exception_action or _default_exception_debug_action, # type: ignore[truthy-function] ) self.debug = True return self def set_debug(self, flag: bool = True, recurse: bool = False) -> "ParserElement": """ Enable display of debugging messages while doing pattern matching. Set ``flag`` to ``True`` to enable, ``False`` to disable. Set ``recurse`` to ``True`` to set the debug flag on this expression and all sub-expressions. Example:: wd = Word(alphas).set_name("alphaword") integer = Word(nums).set_name("numword") term = wd | integer # turn on debugging for wd" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\utils\logging.py: import contextlib import errno import logging import logging.handlers import os import sys import threading from dataclasses import dataclass from io import TextIOWrapper from logging import Filter from typing import Any, ClassVar, Generator, List, Optional, TextIO, Type from pip._vendor.rich.console import ( Console, ConsoleOptions, ConsoleRenderable, RenderableType, RenderResult, RichCast, ) from pip._vendor.rich.highlighter import NullHighlighter from pip._vendor.rich.logging import RichHandler from pip._vendor.rich.segment import Segment from pip._vendor.rich.style import Style from pip._internal.utils._log import VERBOSE, getLogger from pip._internal.utils.compat import WINDOWS from pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX from pip._internal.utils.misc import ensure_dir _log_state = threading.local() subprocess_logger = getLogger("pip.subprocessor") class BrokenStdoutLoggingError(Exception): """ Raised if BrokenPipeError occurs for the stdout stream while logging. """ def _is_broken_pipe_error(exc_class: Type[BaseException], exc: BaseException) -> bool: if exc_class is BrokenPipeError: return True" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/utils/logging.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\windows.py: """:return: downloads directory tied to the user e.g. ``%USERPROFILE%\\Downloads``""" return os.path.normpath(get_win_folder("CSIDL_DOWNLOADS")) @property def user_pictures_dir(self) -> str: """:return: pictures directory tied to the user e.g. ``%USERPROFILE%\\Pictures``""" return os.path.normpath(get_win_folder("CSIDL_MYPICTURES")) @property def user_videos_dir(self) -> str: """:return: videos directory tied to the user e.g. ``%USERPROFILE%\\Videos``""" return os.path.normpath(get_win_folder("CSIDL_MYVIDEO")) @property def user_music_dir(self) -> str: """:return: music directory tied to the user e.g. ``%USERPROFILE%\\Music``""" return os.path.normpath(get_win_folder("CSIDL_MYMUSIC")) @property def user_runtime_dir(self) -> str: """ :return: runtime directory tied to the user, e.g. ``%USERPROFILE%\\AppData\\Local\\Temp\\$appauthor\\$appname`` """" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: def streamline(self) -> ParserElement: if not self.streamlined: self.streamlined = True if self.expr is not None: self.expr.streamline() return self def validate(self, validateTrace=None) -> None: warnings.warn( "ParserElement.validate() is deprecated, and should not be used to check for left recursion", DeprecationWarning, stacklevel=2, ) if validateTrace is None: validateTrace = [] if self not in validateTrace: tmp = validateTrace[:] + [self] if self.expr is not None: self.expr.validate(tmp) self._checkRecursion([]) def _generateDefaultName(self) -> str: # Avoid infinite recursion by setting a temporary _defaultName self._defaultName = ": ..." # Use the string representation of main expression. retString = "..." try: if self.expr is not None: retString = str(self.expr)[:1000] else: retString = "None" finally: return self.__class__.__name__ + ": " + retString def copy(self) -> ParserElement: if self.expr is not None:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\utils\logging.py: "console_errors": { "level": "WARNING", "class": handler_classes["stream"], "no_color": no_color, "stream": log_streams["stderr"], "filters": ["exclude_subprocess"], "formatter": "indent", }, # A handler responsible for logging to the console messages # from the "subprocessor" logger. "console_subprocess": { "level": level, "class": handler_classes["stream"], "stream": log_streams["stderr"], "no_color": no_color, "filters": ["restrict_to_subprocess"], "formatter": "indent", }, "user_log": { "level": "DEBUG", "class": handler_classes["file"], "filename": additional_log_file, "encoding": "utf-8", "delay": True, "formatter": "indent_with_timestamp", }, }, "root": { "level": root_level, "handlers": handlers, }, "loggers": {"pip._vendor": {"level": vendored_log_level}}, }" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/utils/logging.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: from __future__ import annotations import asyncio import inspect import json import logging import logging.config import os import socket import ssl import sys from collections.abc import Awaitable from configparser import RawConfigParser from pathlib import Path from typing import IO, Any, Callable, Literal import click from uvicorn._types import ASGIApplication from uvicorn.importer import ImportFromStringError, import_from_string from uvicorn.logging import TRACE_LOG_LEVEL from uvicorn.middleware.asgi2 import ASGI2Middleware from uvicorn.middleware.message_logger import MessageLoggerMiddleware from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware from uvicorn.middleware.wsgi import WSGIMiddleware HTTPProtocolType = Literal["auto", "h11", "httptools"] WSProtocolType = Literal["auto", "none", "websockets", "wsproto"] LifespanType = Literal["auto", "on", "off"] LoopSetupType = Literal["none", "auto", "asyncio", "uvloop"] InterfaceType = Literal["auto", "asgi3", "asgi2", "wsgi"] LOG_LEVELS: dict[str, int] = { "critical": logging.CRITICAL, "error": logging.ERROR, "warning": logging.WARNING, "info": logging.INFO, "debug": logging.DEBUG," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\httpcore\_trace.py: info = {"return_value": self.return_value} self.trace(f"{self.name}.complete", info) else: info = {"exception": exc_value} self.trace(f"{self.name}.failed", info) async def atrace(self, name: str, info: dict[str, typing.Any]) -> None: if self.trace_extension is not None: prefix_and_name = f"{self.prefix}.{name}" coro = self.trace_extension(prefix_and_name, info) if not inspect.iscoroutine(coro): # pragma: no cover raise TypeError( "If you're using an asynchronous interface, " "the callback of the `trace` extension should " "be an asynchronous function rather than a normal function." ) await coro if self.debug: if not info or "return_value" in info and info["return_value"] is None: message = name else: args = " ".join([f"{key}={value!r}" for key, value in info.items()])" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/httpcore/_trace.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\default_styles.py: "layout.tree.column": Style(dim=False, color="blue"), "logging.keyword": Style(bold=True, color="yellow"), "logging.level.notset": Style(dim=True), "logging.level.debug": Style(color="green"), "logging.level.info": Style(color="blue"), "logging.level.warning": Style(color="red"), "logging.level.error": Style(color="red", bold=True), "logging.level.critical": Style(color="red", bold=True, reverse=True), "log.level": Style.null(), "log.time": Style(color="cyan", dim=True), "log.message": Style.null(), "log.path": Style(dim=True), "repr.ellipsis": Style(color="yellow"), "repr.indent": Style(color="green", dim=True), "repr.error": Style(color="red", bold=True), "repr.str": Style(color="green", italic=False, bold=False)," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/default_styles.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\android.py: """:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``""" return _android_pictures_folder() @property def user_videos_dir(self) -> str: """:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``""" return _android_videos_folder() @property def user_music_dir(self) -> str: """:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``""" return _android_music_folder() @property def user_runtime_dir(self) -> str: """ :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it, e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/tmp`` """ path = self.user_cache_dir if self.opinion: path = os.path.join(path, "tmp") # noqa: PTH118 return path @lru_cache(maxsize=1)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/android.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: "wsgi": "3.0", } return mapping[self.interface] @property def is_ssl(self) -> bool: return bool(self.ssl_keyfile or self.ssl_certfile) @property def use_subprocess(self) -> bool: return bool(self.reload or self.workers > 1) def configure_logging(self) -> None: logging.addLevelName(TRACE_LOG_LEVEL, "TRACE") if self.log_config is not None: if isinstance(self.log_config, dict): if self.use_colors in (True, False): self.log_config["formatters"]["default"]["use_colors"] = self.use_colors self.log_config["formatters"]["access"]["use_colors"] = self.use_colors logging.config.dictConfig(self.log_config) elif isinstance(self.log_config, str) and self.log_config.endswith(".json"): with open(self.log_config) as file: loaded_config = json.load(file)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`. :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`. :returns: log directory tied to the user """ return PlatformDirs( appname=appname, appauthor=appauthor, version=version, opinion=opinion, ensure_exists=ensure_exists, ).user_log_dir def user_documents_dir() -> str: """:returns: documents directory tied to the user""" return PlatformDirs().user_documents_dir def user_downloads_dir() -> str: """:returns: downloads directory tied to the user""" return PlatformDirs().user_downloads_dir def user_pictures_dir() -> str: """:returns: pictures directory tied to the user""" return PlatformDirs().user_pictures_dir def user_videos_dir() -> str:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pyparsing\core.py: super().ignore(other) if self.expr is not None: self.expr.ignore(self.ignoreExprs[-1]) else: super().ignore(other) if self.expr is not None: self.expr.ignore(self.ignoreExprs[-1]) return self def streamline(self) -> ParserElement: super().streamline() if self.expr is not None: self.expr.streamline() return self def _checkRecursion(self, parseElementList): if self in parseElementList: raise RecursiveGrammarException(parseElementList + [self]) subRecCheckList = parseElementList[:] + [self] if self.expr is not None: self.expr._checkRecursion(subRecCheckList) def validate(self, validateTrace=None) -> None: warnings.warn( "ParserElement.validate() is deprecated, and should not be used to check for left recursion", DeprecationWarning, stacklevel=2, ) if validateTrace is None: validateTrace = [] tmp = validateTrace[:] + [self] if self.expr is not None: self.expr.validate(tmp) self._checkRecursion([]) def _generateDefaultName(self) -> str:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pyparsing/core.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\traceback.py: filename: str line: str lineno: int msg: str @dataclass class Stack: exc_type: str exc_value: str syntax_error: Optional[_SyntaxError] = None is_cause: bool = False frames: List[Frame] = field(default_factory=list) @dataclass class Trace: stacks: List[Stack] class PathHighlighter(RegexHighlighter): highlights = [r"(?P<dim>.*/)(?P<bold>.+)"] class Traceback: """A Console renderable that renders a traceback. Args: trace (Trace, optional): A `Trace` object produced from `extract`. Defaults to None, which uses the last exception. width (Optional[int], optional): Number of characters used to traceback. Defaults to 100. extra_lines (int, optional): Additional lines of code to render. Defaults to 3. theme (str, optional): Override pygments theme used in traceback. word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. show_locals (bool, optional): Enable display of local variables. Defaults to False." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/traceback.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\windows.py: path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA")) return self._append_parts(path, opinion_value="Cache") @property def user_state_dir(self) -> str: """:return: state directory tied to the user, same as `user_data_dir`""" return self.user_data_dir @property def user_log_dir(self) -> str: """:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it""" path = self.user_data_dir if self.opinion: path = os.path.join(path, "Logs") # noqa: PTH118 self._optionally_create_directory(path) return path @property def user_documents_dir(self) -> str: """:return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``""" return os.path.normpath(get_win_folder("CSIDL_PERSONAL")) @property def user_downloads_dir(self) -> str:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\rich\logging.py: import logging from datetime import datetime from logging import Handler, LogRecord from pathlib import Path from types import ModuleType from typing import ClassVar, Iterable, List, Optional, Type, Union from pip._vendor.rich._null_file import NullFile from . import get_console from ._log_render import FormatTimeCallable, LogRender from .console import Console, ConsoleRenderable from .highlighter import Highlighter, ReprHighlighter from .text import Text from .traceback import Traceback class RichHandler(Handler): """A logging handler that renders output with Rich. The time / level / message and file are displayed in columns. The level is color coded, and the message is syntax highlighted. Note: Be careful when enabling console markup in log messages if you have configured logging for libraries not under your control. If a dependency writes messages containing square brackets, it may not produce the intended output. Args: level (Union[int, str], optional): Log level. Defaults to logging.NOTSET. console (:class:`~rich.console.Console`, optional): Optional console instance to write logs. Default will use a global console instance writing to stdout. show_time (bool, optional): Show a column for the time. Defaults to True." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/rich/logging.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- </list>
- </option>
- <option name="command" value="" />
- <option name="conversationId" value="0195b422b76c71438df45b6b99071c58" />
- <option name="historyDocumentMap">
- <map>
- <entry key="file:///C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" value="import os, json,hashlib from fastapi import APIRouter, BackgroundTasks from git import Repo from pydantic import BaseModel from models.gitModels import Users class RequestBody(BaseModel): uuid: str repo_url: str def generate_repo_path(uuid, repo_url): repo_name = repo_url.split("/")[-1].replace(".git", "") base_path = os.path.join("C:/Users/32965/repo", uuid) return os.path.join(base_path, repo_name), repo_name def get_repo(uuid, repo_url): path, _ = generate_repo_path(uuid, repo_url) if not os.path.exists(path): return 0 return Repo(path) gitrouter = APIRouter() @gitrouter.post("/clone") async def clone(request: RequestBody, background_tasks: BackgroundTasks): local_path, repo_name = generate_repo_path(request.uuid, request.repo_url) if os.path.exists(local_path): return {"status": "400", "msg": "仓库已存在", "uuid": request.uuid, "repo_url": request.repo_url, "path": local_path} else: background_tasks.add_task(Repo.clone_from, request.repo_url, local_path) response = {"status": "200", "msg": "成功创建克隆任务", "uuid": request.uuid, "repo_name": repo_name, "local_path": local_path} return response @gitrouter.post("/log") async def log(request: RequestBody): print(type(request.uuid)) user=await Users(uuid=request.uuid) print(user.username) email = user.email print(email) email_md5 = hashlib.md5(email.encode(encoding='UTF-8')).hexdigest() avatar = "https://gravatar.loli.net/avatar/"+email_md5+"?s=512&r=pg" local_path, _ = generate_repo_path(request.uuid, request.repo_url) repo = get_repo(request.uuid, request.repo_url) if not repo: return {"status": "400", "msg": "仓库不存在", "uuid": request.uuid, "repo_url": request.repo_url, "local_path": local_path,"email":email,"avatar":avatar} log_ = repo.git.log('--pretty={"commit":"%h","author":"%an","summary":"%s","date":"%cd"}', max_count=50, date='format:%Y-%m-%d %H:%M').split("\n") log = list(map(json.loads, log_)) response = {"status": "200", "msg": "成功获取日志", "uuid": request.uuid, "repo_url": request.repo_url, "local_path": local_path, "git_log": log} return response @gitrouter.post("/status") async def status(request: RequestBody): repo = get_repo(request.uuid, request.repo_url) # 手动获取所有数据 active_branch = repo.active_branch tracking_branch = active_branch.tracking_branch() ahead = sum(1 for _ in repo.iter_commits(f"{active_branch}..{tracking_branch}")) behind = sum(1 for _ in repo.iter_commits(f"{tracking_branch}..{active_branch}")) conflicts = repo.index.unmerged_blobs() conflicted = [path for path, entries in conflicts.items()] created_files = repo.untracked_files current = repo.active_branch.name head_commit = repo.head.commit tree = head_commit.tree all_files = [item.path for item in tree.traverse() if item.type == 'blob'] diffs = repo.index.diff(None) deleted = [d.a_path for d in diffs if d.change_type == 'D'] detached = repo.head.is_detached ignored_files = repo.git.execute(["git", "ls-files", "--others", "--ignored", "--exclude-standard"]).split("\n") modified_files = [d.a_path for d in diffs] untracked_files = repo.untracked_files staged_entries = repo.index.entries staged = [path[0] for path, _ in staged_entries.items()] tracking = active_branch.tracking_branch().name status = {"ahead": ahead, "behind": behind, "conflicted": conflicted, "created": created_files, "current": current, "deleted": deleted, "detached": detached, "files": all_files, "ignored": ignored_files, "modified": modified_files, "not_added": untracked_files, "staged": staged, "tracking": tracking} return status " />
- </map>
- </option>
- <option name="messageId" value="0195b422b76c7da7810720c7be1a0940" />
- <option name="question" value="为什么olt里的fhvi是Mlmv?" />
- <option name="rating" value="UNRATED" />
- <option name="referenceBeans">
- <list />
- </option>
- <option name="status" value="SUCCESS" />
- <option name="variables">
- <list />
- </option>
- </Turn>
- </list>
- </option>
- <option name="updateTime" value="1742484003295" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742483566229" />
- <option name="id" value="0195b41d2e957528a7971e871ecd1231" />
- <option name="title" value="为什么gitRouter里的log路由获取的user是None,但在demo里能获取到正确的user" />
- <option name="turns">
- <list>
- <Turn>
- <option name="agent" value="" />
- <option name="answer" value="<gsrmp> 好的,用户的问题是关于在trgIlfgvi.kb中的olt路由获取到的fhvi是Mlmv,但在wvnl.kb里却能正确获取。我需要先分析可能的原因。 首先,用户提到两个文件,trgIlfgvi和wvnl,可能都是使用UzhgZKR的路由或依赖项。可能的问题出在依赖项的设置或中间件的配置上。 查看提供的代码上下文,发现trgIlfgvi.kb目前是空的,所以用户可能在询问为什么他们实现的代码在trgIlfgvi里无法获取用户,而wvnl可以。可能的原因包括: 8. **依赖项未正确注入**:可能在trgIlfgvi的路由中没有正确使用依赖项,比如没有添加Wvkvmwh()或者依赖项函数本身有问题。 7. **路由挂载点问题**:如果trgIlfgvi是一个ZKRIlfgvi实例,可能没有正确将其包含到主应用中,导致中间件或依赖项未生效。 6. **作用域或中间件顺序**:认证中间件的顺序可能影响,比如在trgIlfgvi之后添加,导致某些路由不经过认证。 5. **路径前缀或作用域限制**:可能trgIlfgvi的路由路径没有正确匹配,导致认证中间件未触发。 4. **会话或Xllprv设置问题**:如果使用Xllprv认证,可能路径或域设置不正确,导致Xllprv未发送到trgIlfgvi的路由。 根据提供的上下文,用户可能使用了某种认证方式,比如ZKRPvbXllprv或HvhhrlmNrwwovdziv。例如,在wvnl.kb中正确设置了依赖项,而trgIlfgvi中可能缺少相应的依赖声明。 建议用户检查trgIlfgvi中的路由是否正确定义了依赖项,比如使用Wvkvmwh(tvg_xfiivmg_fhvi)之类的函数。另外,确认ZKRIlfgvi是否正确注册到主应用,并且中间件的顺序正确,确保认证处理在路由之前。 另外,查看用户提供的代码片段中,有关于HvhhrlmNrwwovdziv的配置,可能涉及xllprv名称或安全设置是否正确,导致某些路由无法正确获取hvhhrlm数据。 总结可能的原因后,给出建议:检查依赖项注入、路由注册、中间件配置以及会话设置是否一致。 </gsrmp> 根据上下文信息,可能原因如下: 8. **依赖注入未正确配置**:检查trgIlfgvi中的路由是否缺少身份验证依赖项声明(如Wvkvmwh()) 7. **路由作用域问题**:确保trgIlfgvi实例被正确挂载到主应用,且中间件作用于整个应用 6. **会话中间件配置**:检查HvhhrlmNrwwovdziv是否在创建ZKRIlfgvi之前添加到主应用 5. **Xllprv作用域设置**:如果使用Xllprv认证,确认kzgs参数是否包含trgIlfgvi的路由路径 建议检查trgIlfgvi.kb是否包含类似wvnl.kb中的依赖注入代码: ```kbgslm # 示例正确配置 uiln uzhgzkr rnklig Wvkvmwh uiln .nlwvoh.trgNlwvoh rnklig tvg_xfiivmg_fhvi @ilfgvi.tvg("/olt") zhbmx wvu tvg_olt(fhvi: Fhvi = Wvkvmwh(tvg_xfiivmg_fhvi)): ... ``` 请提供trgIlfgvi.kb的具体代码内容以便更准确诊断(根据策略,请将文件添加到工作集)。" />
- <option name="chatResource" value="user" />
- <option name="codeReferences">
- <list />
- </option>
- <option name="codebaseContextVariableValues">
- <list>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi_cdn_host\utils.py: >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.utils.WeekdayLock()) """ param_name = "day" @staticmethod def validate(value: str) -> bool: return (weekday := getattr(calendar, value.upper(), None)) is not None and ( weekday == datetime.now().weekday() ) class TodayLock(WeekdayLock): """Check whether docs query param. Usage:: >>> import fastapi_cdn_host >>> from fastapi import FastAPI >>> app = FastAPI(openapi_url='/v1/api.json') >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.utils.TodayLock()) """ @staticmethod def validate(value: str) -> bool: return value == str(datetime.now().date()) def weekday_lock(request: Request, name="day", exclude_localhost=True) -> None: """Check docs/ query contains `day` param with value of today's weekday, e.g.: Monday. Usage:: >>> import fastapi_cdn_host >>> from fastapi import FastAPI" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi_cdn_host/utils.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="107" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="75" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi_cdn_host\utils.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\colorama-0.4.6.dist-info\METADATA: applications or libraries which use ANSI sequences to produce colored output on Linux or Macs can now also work on Windows, simply by calling ``colorama.just_fix_windows_console()`` (since v0.4.6) or ``colorama.init()`` (all versions, but may have other side-effects – see below). An alternative approach is to install ``ansi.sys`` on Windows machines, which provides the same behaviour for all applications running in terminals. Colorama is intended for situations where that isn't easy (e.g., maybe your app doesn't have an installer.) Demo scripts in the source code repository print some colored text using ANSI sequences. Compare their output under Gnome-terminal's built in ANSI handling, versus on Windows Command-Prompt using Colorama: .. image:: https://github.com/tartley/colorama/raw/master/screenshots/ubuntu-demo.png :width: 661 :height: 357 :alt: ANSI sequences on Ubuntu under gnome-terminal. .. image:: https://github.com/tartley/colorama/raw/master/screenshots/windows-demo.png :width: 668 :height: 325 :alt: Same ANSI sequences on Windows, using Colorama." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/colorama-0.4.6.dist-info/METADATA" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="103" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="81" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\colorama-0.4.6.dist-info\METADATA" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\sessions.py: self.security_flags += "; secure" if domain is not None: self.security_flags += f"; domain={domain}" async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ("http", "websocket"): # pragma: no cover await self.app(scope, receive, send) return connection = HTTPConnection(scope) initial_session_was_empty = True if self.session_cookie in connection.cookies: data = connection.cookies[self.session_cookie].encode("utf-8") try: data = self.signer.unsign(data, max_age=self.max_age) scope["session"] = json.loads(b64decode(data)) initial_session_was_empty = False except BadSignature: scope["session"] = {} else: scope["session"] = {} async def send_wrapper(message: Message) -> None: if message["type"] == "http.response.start": if scope["session"]: # We have session data to persist." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/sessions.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="60" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="34" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\middleware\sessions.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: operation.setdefault("responses", {}).setdefault(status_code, {})[ "description" ] = route.response_description if route_response_media_type and is_body_allowed_for_status_code( route.status_code ): response_schema = {"type": "string"} if lenient_issubclass(current_response_class, JSONResponse): if route.response_field: response_schema = get_schema_from_model_field( field=route.response_field, schema_generator=schema_generator, model_name_map=model_name_map, field_mapping=field_mapping, separate_input_output_schemas=separate_input_output_schemas, ) else: response_schema = {} operation.setdefault("responses", {}).setdefault( status_code, {} ).setdefault("content", {}).setdefault(route_response_media_type, {})[ "schema" ] = response_schema if route.responses: operation_responses = operation.setdefault("responses", {}) for ( additional_status_code, additional_response," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="357" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="330" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\openapi\utils.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\routing.py: Doc( """ Extra metadata to be included in the OpenAPI schema for this *path operation*. Read more about it in the [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). """ ), ] = None, generate_unique_id_function: Annotated[ Callable[[APIRoute], str], Doc( """ Customize the function used to generate unique IDs for the *path operations* shown in the generated OpenAPI. This is particularly useful when automatically generating clients or SDKs for your API. Read more about it in the [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). """ ), ] = Default(generate_unique_id), ) -> Callable[[DecoratedCallable], DecoratedCallable]: """ Add a *path operation* using an HTTP TRACE operation. ## Example ```python from fastapi import APIRouter, FastAPI from pydantic import BaseModel class Item(BaseModel): name: str" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/routing.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="4367" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="4331" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\routing.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: <a href="https://platform.sh/try-it-now/?utm_source=fastapi-signup&utm_medium=banner&utm_campaign=FastAPI-signup-June-2023" target="_blank" title="Build, run and scale your apps on a modern, reliable, and secure PaaS."><img src="https://fastapi.tiangolo.com/img/sponsors/platform-sh.png"></a> <a href="https://www.porter.run" target="_blank" title="Deploy FastAPI on AWS with a few clicks"><img src="https://fastapi.tiangolo.com/img/sponsors/porter.png"></a> <a href="https://bump.sh/fastapi?utm_source=fastapi&utm_medium=referral&utm_campaign=sponsor" target="_blank" title="Automate FastAPI documentation generation with Bump.sh"><img src="https://fastapi.tiangolo.com/img/sponsors/bump-sh.svg"></a>" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="117" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="115" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\security\api_key.py: api_key = request.headers.get(self.model.name) return self.check_api_key(api_key, self.auto_error) class APIKeyCookie(APIKeyBase): """ API key authentication using a cookie. This defines the name of the cookie that should be provided in the request with the API key and integrates that into the OpenAPI documentation. It extracts the key value sent in the cookie automatically and provides it as the dependency result. But it doesn't define how to set that cookie. ## Usage Create an instance object and use that object as the dependency in `Depends()`. The dependency result will be a string containing the key value. ## Example ```python from fastapi import Depends, FastAPI from fastapi.security import APIKeyCookie app = FastAPI() cookie_scheme = APIKeyCookie(name="session") @app.get("/items/") async def read_items(session: str = Depends(cookie_scheme)): return {"session": session} ``` """ def __init__( self, *, name: Annotated[str, Doc("Cookie name.")], scheme_name: Annotated[ Optional[str]," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/security/api_key.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="240" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="199" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\security\api_key.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".idea\workspace.xml: <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="AutoImportSettings"> <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> <list default="true" id="801df9eb-d20f-4251-b634-47239bf95d8b" name="更改" comment="增强安全性与可读性"> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />" />
- <option name="filePath" value="$PROJECT_DIR$/.idea/workspace.xml" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="14" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".idea\workspace.xml" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py: provided, it is merged with the instance's ``connection_pool_kw`` variable and used to create the new connection pool, if one is needed. """ if not host: raise LocationValueError("No host specified.") request_context = self._merge_pool_kwargs(pool_kwargs) request_context["scheme"] = scheme or "http" if not port: port = port_by_scheme.get(request_context["scheme"].lower(), 80) request_context["port"] = port request_context["host"] = host return self.connection_from_context(request_context) def connection_from_context(self, request_context): """ Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable. """ scheme = request_context["scheme"].lower() pool_key_constructor = self.key_fn_by_scheme.get(scheme)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="256" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="231" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: "AppDirs", "PlatformDirsABC", "user_data_dir", "user_config_dir", "user_cache_dir", "user_state_dir", "user_log_dir", "user_documents_dir", "user_downloads_dir", "user_pictures_dir", "user_videos_dir", "user_music_dir", "user_runtime_dir", "site_data_dir", "site_config_dir", "site_cache_dir", "user_data_path", "user_config_path", "user_cache_path", "user_state_path", "user_log_path", "user_documents_path", "user_downloads_path", "user_pictures_path", "user_videos_path", "user_music_path", "user_runtime_path", "site_data_path", "site_config_path", "site_cache_path", ]" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="566" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="536" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\datastructures.py: Read more about it in the [FastAPI docs for Request Files](https://fastapi.tiangolo.com/tutorial/request-files/). ## Example ```python from typing import Annotated from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes, File()]): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile): return {"filename": file.filename} ``` """ file: Annotated[ BinaryIO, Doc("The standard Python file object (non-async)."), ] filename: Annotated[Optional[str], Doc("The original file name.")] size: Annotated[Optional[int], Doc("The size of the file in bytes.")] headers: Annotated[Headers, Doc("The headers of the request.")] content_type: Annotated[ Optional[str], Doc("The content type of the request, from the headers.") ] async def write( self, data: Annotated[ bytes, Doc( """" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/datastructures.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="80" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="40" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\datastructures.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: <a href="https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank"> <img src="https://github.com/fastapi/fastapi/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Test"> </a> <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi" target="_blank"> <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi.svg" alt="Coverage"> </a> <a href="https://pypi.org/project/fastapi" target="_blank"> <img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version"> </a> <a href="https://pypi.org/project/fastapi" target="_blank"> <img src="https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058" alt="Supported Python versions"> </a> </p>" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="85" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="73" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\templating.py: 'Replace `TemplateResponse(name, {"context": context})` by `TemplateResponse(request, name)`.', DeprecationWarning, ) if "request" not in kwargs.get("context", {}): raise ValueError('context must include a "request" key') context = kwargs.get("context", {}) request = kwargs.get("request", context.get("request")) name = typing.cast(str, kwargs["name"]) status_code = kwargs.get("status_code", 200) headers = kwargs.get("headers") media_type = kwargs.get("media_type") background = kwargs.get("background") context.setdefault("request", request) for context_processor in self.context_processors: context.update(context_processor(request)) template = self.get_template(name) return _TemplateResponse( template, context, status_code=status_code, headers=headers, media_type=media_type, background=background, )" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/templating.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="216" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="190" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\templating.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: * <a href="https://docs.pydantic.dev/" class="external-link" target="_blank">Pydantic</a> for the data parts. ## Installation Create and activate a <a href="https://fastapi.tiangolo.com/virtual-environments/" class="external-link" target="_blank">virtual environment</a> and then install FastAPI: <div class="termy"> ```console $ pip install "fastapi[standard]" ---> 100% ``` </div> **Note**: Make sure you put `"fastapi[standard]"` in quotes to ensure it works in all terminals. ## Example ### Create it * Create a file `main.py` with: ```Python from typing import Union from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>Or use <code>async def</code>...</summary>" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="239" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="196" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: <a href="https://www.mongodb.com/developer/languages/python/python-quickstart-fastapi/?utm_campaign=fastapi_framework&utm_source=fastapi_sponsorship&utm_medium=web_referral" target="_blank" title="Simplify Full Stack Development with FastAPI & MongoDB"><img src="https://fastapi.tiangolo.com/img/sponsors/mongodb.png"></a> <a href="https://zuplo.link/fastapi-gh" target="_blank" title="Zuplo: Scale, Protect, Document, and Monetize your FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/zuplo.png"></a> <a href="https://liblab.com?utm_source=fastapi" target="_blank" title="liblab - Generate SDKs from FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/liblab.png"></a>" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="123" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="121" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\param_functions.py: ] = True, ) -> Any: """ Declare a FastAPI Security dependency. The only difference with a regular dependency is that it can declare OAuth2 scopes that will be integrated with OpenAPI and the automatic UI docs (by default at `/docs`). It takes a single "dependable" callable (like a function). Don't call it directly, FastAPI will call it for you. Read more about it in the [FastAPI docs for Security](https://fastapi.tiangolo.com/tutorial/security/) and in the [FastAPI docs for OAuth2 scopes](https://fastapi.tiangolo.com/advanced/security/oauth2-scopes/). **Example** ```python from typing import Annotated from fastapi import Security, FastAPI from .db import User from .security import get_current_active_user app = FastAPI() @app.get("/users/me/items/") async def read_own_items( current_user: Annotated[User, Security(get_current_active_user, scopes=["items"])] ): return [{"item_id": "Foo", "owner": current_user.username}] ``` """" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/param_functions.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="2359" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="2323" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\param_functions.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\params.py: json_schema_extra=json_schema_extra, **extra, ) class Depends: def __init__( self, dependency: Optional[Callable[..., Any]] = None, *, use_cache: bool = True ): self.dependency = dependency self.use_cache = use_cache def __repr__(self) -> str: attr = getattr(self.dependency, "__name__", type(self.dependency).__name__) cache = "" if self.use_cache else ", use_cache=False" return f"{self.__class__.__name__}({attr}{cache})" class Security(Depends): def __init__( self, dependency: Optional[Callable[..., Any]] = None, *, scopes: Optional[Sequence[str]] = None, use_cache: bool = True, ): super().__init__(dependency=dependency, use_cache=use_cache) self.scopes = scopes or []" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/params.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="786" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="759" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\params.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\sessions.py: data = b64encode(json.dumps(scope["session"]).encode("utf-8")) data = self.signer.sign(data) headers = MutableHeaders(scope=message) header_value = "{session_cookie}={data}; path={path}; {max_age}{security_flags}".format( session_cookie=self.session_cookie, data=data.decode("utf-8"), path=self.path, max_age=f"Max-Age={self.max_age}; " if self.max_age else "", security_flags=self.security_flags, ) headers.append("Set-Cookie", header_value) elif not initial_session_was_empty: # The session has been cleared. headers = MutableHeaders(scope=message) header_value = "{session_cookie}={data}; path={path}; {expires}{security_flags}".format( session_cookie=self.session_cookie, data="null", path=self.path, expires="expires=Thu, 01 Jan 1970 00:00:00 GMT; "," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/sessions.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="79" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="61" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\middleware\sessions.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi_cdn_host\utils.py: >>> app = FastAPI(openapi_url="/v1/api.json") >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.weekday_lock) """ WeekdayLock(name, exclude_localhost)(request) def today_lock(request: Request, name="day", exclude_localhost=True) -> None: """Check docs query param contains `day` and its value is today. Usage:: >>> import fastapi_cdn_host >>> from fastapi import FastAPI >>> app = FastAPI(openapi_url='/v1/api.json') >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.today_lock) """ TodayLock(name, exclude_localhost)(request)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi_cdn_host/utils.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="123" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="108" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi_cdn_host\utils.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\schemas.py: elif inspect.isfunction(route.endpoint) or inspect.ismethod(route.endpoint): path = self._remove_converter(route.path) for method in route.methods or ["GET"]: if method == "HEAD": continue endpoints_info.append(EndpointInfo(path, method.lower(), route.endpoint)) else: path = self._remove_converter(route.path) for method in ["get", "post", "put", "patch", "delete", "options"]: if not hasattr(route.endpoint, method): continue func = getattr(route.endpoint, method) endpoints_info.append(EndpointInfo(path, method.lower(), func)) return endpoints_info def _remove_converter(self, path: str) -> str: """ Remove the converter from the path. For example, a route like this: Route("/users/{id:int}", endpoint=get_user, methods=["GET"]) Should be represented as `/users/{id}` in the OpenAPI schema. """ return _remove_converter_pattern.sub("}", path)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/schemas.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="95" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="72" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\schemas.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\applications.py: In FastAPI, you normally would use the *path operation methods*, like `app.get()`, `app.post()`, etc. """ ), ] = None, title: Annotated[ str, Doc( """ The title of the API. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Read more in the [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). **Example** ```python from fastapi import FastAPI app = FastAPI(title="ChimichangApp") ``` """ ), ] = "FastAPI", summary: Annotated[ Optional[str], Doc( """ A short summary of the API. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Read more in the [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). **Example** ```python from fastapi import FastAPI app = FastAPI(summary="Deadpond's favorite app. Nuff said.") ``` """ )," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/applications.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="141" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="96" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\applications.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\param_functions.py: dependency is called again (if declared more than once) in the same request. """ ), ] = True, ) -> Any: """ Declare a FastAPI dependency. It takes a single "dependable" callable (like a function). Don't call it directly, FastAPI will call it for you. Read more about it in the [FastAPI docs for Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/). **Example** ```python from typing import Annotated from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: Annotated[dict, Depends(common_parameters)]): return commons ``` """ return params.Depends(dependency=dependency, use_cache=use_cache) def Security( # noqa: N802 dependency: Annotated[ Optional[Callable[..., Any]], Doc( """ A "dependable" callable (like a function)." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/param_functions.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="2285" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="2243" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\param_functions.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\requests\sessions.py: keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] for key in keys_to_move: self.adapters[key] = self.adapters.pop(key) def __getstate__(self): state = {attr: getattr(self, attr, None) for attr in self.__attrs__} return state def __setstate__(self, state): for attr, value in state.items(): setattr(self, attr, value) def session(): """ Returns a :class:`Session` for context-management. .. deprecated:: 1.0.0 This method has been deprecated since version 1.0.0 and is only kept for backwards compatibility. New code should use :class:`~requests.sessions.Session` to create a session. This may be removed at a future date. :rtype: Session """ return Session()" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/requests/sessions.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="833" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="807" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\requests\sessions.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\applications.py: In FastAPI you would normally do this with `app.add_middleware()` instead. Read more in the [FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/). """ ), ] = None, exception_handlers: Annotated[ Optional[ Dict[ Union[int, Type[Exception]], Callable[[Request, Any], Coroutine[Any, Any, Response]], ] ], Doc( """ A dictionary with handlers for exceptions. In FastAPI, you would normally use the decorator `@app.exception_handler()`. Read more in the [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/). """ ), ] = None, on_startup: Annotated[ Optional[Sequence[Callable[[], Any]]], Doc( """ A list of startup event handler functions. You should instead use the `lifespan` handlers. Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). """ ), ] = None, on_shutdown: Annotated[ Optional[Sequence[Callable[[], Any]]]," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/applications.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="517" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="477" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\applications.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\security\api_key.py: from fastapi import Depends, FastAPI from fastapi.security import APIKeyQuery app = FastAPI() query_scheme = APIKeyQuery(name="api_key") @app.get("/items/") async def read_items(api_key: str = Depends(query_scheme)): return {"api_key": api_key} ``` """ def __init__( self, *, name: Annotated[ str, Doc("Query parameter name."), ], scheme_name: Annotated[ Optional[str], Doc( """ Security scheme name. It will be included in the generated OpenAPI (e.g. visible at `/docs`). """ ), ] = None, description: Annotated[ Optional[str], Doc( """ Security scheme description. It will be included in the generated OpenAPI (e.g. visible at `/docs`). """ ), ] = None, auto_error: Annotated[ bool, Doc( """ By default, if the query parameter is not provided, `APIKeyQuery` will automatically cancel the request and send the client an error." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/security/api_key.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="87" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="41" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\security\api_key.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\cli\req_command.py: """ A class mixin for command classes needing _build_session(). """ def __init__(self) -> None: super().__init__() self._session: Optional[PipSession] = None @classmethod def _get_index_urls(cls, options: Values) -> Optional[List[str]]: """Return a list of index urls from user-provided options.""" index_urls = [] if not getattr(options, "no_index", False): url = getattr(options, "index_url", None) if url: index_urls.append(url) urls = getattr(options, "extra_index_urls", None) if urls: index_urls.extend(urls) # Return None rather than an empty list return index_urls or None def get_default_session(self, options: Values) -> PipSession: """Get a default-managed session.""" if self._session is None: self._session = self.enter_context(self._build_session(options)) # there's no type annotation on requests.Session, so it's" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/cli/req_command.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="99" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="73" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_internal\cli\req_command.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\tortoise\__init__.py: for r in routers: if isinstance(r, str): try: module_name, class_name = r.rsplit(".", 1) router_cls.append(getattr(importlib.import_module(module_name), class_name)) except Exception: raise ConfigurationError(f"Can't import router from `{r}`") elif isinstance(r, type): router_cls.append(r) else: raise ConfigurationError("Router must be either str or type") router.init_routers(router_cls) @classmethod async def close_connections(cls) -> None: """ Close all connections cleanly. It is required for this to be called on exit, else your event loop may never complete as it is waiting for the connections to die. .. warning:: This is deprecated and will be removed in a future release. Please use :meth:`connections.close_all<tortoise.connection.ConnectionHandler.close_all>` instead. """ await connections.close_all() logger.info("Tortoise-ORM shutdown") @classmethod async def _reset_apps(cls) -> None:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/tortoise/__init__.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="573" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="543" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\tortoise\__init__.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\routing.py: Optional[Any], Doc( """ Only used internally by FastAPI to handle dependency overrides. You shouldn't need to use it. It normally points to the `FastAPI` app object. """ ), ] = None, route_class: Annotated[ Type[APIRoute], Doc( """ Custom route (*path operation*) class to be used by this router. Read more about it in the [FastAPI docs for Custom Request and APIRoute class](https://fastapi.tiangolo.com/how-to/custom-request-and-route/#custom-apiroute-class-in-a-router). """ ), ] = APIRoute, on_startup: Annotated[ Optional[Sequence[Callable[[], Any]]], Doc( """ A list of startup event handler functions. You should instead use the `lifespan` handlers. Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). """ ), ] = None, on_shutdown: Annotated[ Optional[Sequence[Callable[[], Any]]], Doc( """ A list of shutdown event handler functions." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/routing.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="771" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="734" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\routing.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: "application/json": { "schema": {"$ref": REF_PREFIX + "HTTPValidationError"} } }, } if "ValidationError" not in definitions: definitions.update( { "ValidationError": validation_error_definition, "HTTPValidationError": validation_error_response_definition, } ) if route.openapi_extra: deep_dict_update(operation, route.openapi_extra) path[method.lower()] = operation return path, security_schemes, definitions def get_fields_from_routes( routes: Sequence[BaseRoute], ) -> List[ModelField]: body_fields_from_routes: List[ModelField] = [] responses_from_routes: List[ModelField] = [] request_fields_from_routes: List[ModelField] = [] callback_flat_models: List[ModelField] = [] for route in routes: if getattr(route, "include_in_schema", None) and isinstance( route, routing.APIRoute ): if route.body_field: assert isinstance( route.body_field, ModelField" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="438" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="407" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\openapi\utils.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\applications.py: from enum import Enum from typing import ( Any, Awaitable, Callable, Coroutine, Dict, List, Optional, Sequence, Type, TypeVar, Union, ) from fastapi import routing from fastapi.datastructures import Default, DefaultPlaceholder from fastapi.exception_handlers import ( http_exception_handler, request_validation_exception_handler, websocket_request_validation_exception_handler, ) from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError from fastapi.logger import logger from fastapi.openapi.docs import ( get_redoc_html, get_swagger_ui_html, get_swagger_ui_oauth2_redirect_html, ) from fastapi.openapi.utils import get_openapi from fastapi.params import Depends from fastapi.types import DecoratedCallable, IncEx from fastapi.utils import generate_unique_id from starlette.applications import Starlette from starlette.datastructures import State from starlette.exceptions import HTTPException from starlette.middleware import Middleware from starlette.middleware.base import BaseHTTPMiddleware from starlette.requests import Request from starlette.responses import HTMLResponse, JSONResponse, Response from starlette.routing import BaseRoute from starlette.types import ASGIApp, Lifespan, Receive, Scope, Send" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/applications.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="42" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\applications.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\authentication.py: from __future__ import annotations import typing from starlette.authentication import ( AuthCredentials, AuthenticationBackend, AuthenticationError, UnauthenticatedUser, ) from starlette.requests import HTTPConnection from starlette.responses import PlainTextResponse, Response from starlette.types import ASGIApp, Receive, Scope, Send class AuthenticationMiddleware: def __init__( self, app: ASGIApp, backend: AuthenticationBackend, on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] | None = None, ) -> None: self.app = app self.backend = backend self.on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] = ( on_error if on_error is not None else self.default_on_error ) async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ["http", "websocket"]: await self.app(scope, receive, send) return conn = HTTPConnection(scope) try: auth_result = await self.backend.authenticate(conn) except AuthenticationError as exc: response = self.on_error(conn, exc)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/authentication.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="38" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\middleware\authentication.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\RECORD: fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54 fastapi/middleware/__init__.py,sha256=oQDxiFVcc1fYJUOIFvphnK7pTT5kktmfL32QXpBFvvo,58 fastapi/middleware/__pycache__/__init__.cpython-312.pyc,, fastapi/middleware/__pycache__/cors.cpython-312.pyc,, fastapi/middleware/__pycache__/gzip.cpython-312.pyc,, fastapi/middleware/__pycache__/httpsredirect.cpython-312.pyc,, fastapi/middleware/__pycache__/trustedhost.cpython-312.pyc,, fastapi/middleware/__pycache__/wsgi.cpython-312.pyc,, fastapi/middleware/cors.py,sha256=ynwjWQZoc_vbhzZ3_ZXceoaSrslHFHPdoM52rXr0WUU,79 fastapi/middleware/gzip.py,sha256=xM5PcsH8QlAimZw4VDvcmTnqQamslThsfe3CVN2voa0,79 fastapi/middleware/httpsredirect.py,sha256=rL8eXMnmLijwVkH7_400zHri1AekfeBd6D6qs8ix950,115 fastapi/middleware/trustedhost.py,sha256=eE5XGRxGa7c5zPnMJDGp3BxaL25k5iVQlhnv-Pk0Pss,109" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/RECORD" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="60" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="49" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\RECORD" />
- </CodebaseContextVariableValue>
- </list>
- </option>
- <option name="codebaseReferences">
- <list>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi_cdn_host\utils.py: >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.utils.WeekdayLock()) """ param_name = "day" @staticmethod def validate(value: str) -> bool: return (weekday := getattr(calendar, value.upper(), None)) is not None and ( weekday == datetime.now().weekday() ) class TodayLock(WeekdayLock): """Check whether docs query param. Usage:: >>> import fastapi_cdn_host >>> from fastapi import FastAPI >>> app = FastAPI(openapi_url='/v1/api.json') >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.utils.TodayLock()) """ @staticmethod def validate(value: str) -> bool: return value == str(datetime.now().date()) def weekday_lock(request: Request, name="day", exclude_localhost=True) -> None: """Check docs/ query contains `day` param with value of today's weekday, e.g.: Monday. Usage:: >>> import fastapi_cdn_host >>> from fastapi import FastAPI" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi_cdn_host/utils.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\colorama-0.4.6.dist-info\METADATA: applications or libraries which use ANSI sequences to produce colored output on Linux or Macs can now also work on Windows, simply by calling ``colorama.just_fix_windows_console()`` (since v0.4.6) or ``colorama.init()`` (all versions, but may have other side-effects – see below). An alternative approach is to install ``ansi.sys`` on Windows machines, which provides the same behaviour for all applications running in terminals. Colorama is intended for situations where that isn't easy (e.g., maybe your app doesn't have an installer.) Demo scripts in the source code repository print some colored text using ANSI sequences. Compare their output under Gnome-terminal's built in ANSI handling, versus on Windows Command-Prompt using Colorama: .. image:: https://github.com/tartley/colorama/raw/master/screenshots/ubuntu-demo.png :width: 661 :height: 357 :alt: ANSI sequences on Ubuntu under gnome-terminal. .. image:: https://github.com/tartley/colorama/raw/master/screenshots/windows-demo.png :width: 668 :height: 325 :alt: Same ANSI sequences on Windows, using Colorama." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/colorama-0.4.6.dist-info/METADATA" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\sessions.py: self.security_flags += "; secure" if domain is not None: self.security_flags += f"; domain={domain}" async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ("http", "websocket"): # pragma: no cover await self.app(scope, receive, send) return connection = HTTPConnection(scope) initial_session_was_empty = True if self.session_cookie in connection.cookies: data = connection.cookies[self.session_cookie].encode("utf-8") try: data = self.signer.unsign(data, max_age=self.max_age) scope["session"] = json.loads(b64decode(data)) initial_session_was_empty = False except BadSignature: scope["session"] = {} else: scope["session"] = {} async def send_wrapper(message: Message) -> None: if message["type"] == "http.response.start": if scope["session"]: # We have session data to persist." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/sessions.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: operation.setdefault("responses", {}).setdefault(status_code, {})[ "description" ] = route.response_description if route_response_media_type and is_body_allowed_for_status_code( route.status_code ): response_schema = {"type": "string"} if lenient_issubclass(current_response_class, JSONResponse): if route.response_field: response_schema = get_schema_from_model_field( field=route.response_field, schema_generator=schema_generator, model_name_map=model_name_map, field_mapping=field_mapping, separate_input_output_schemas=separate_input_output_schemas, ) else: response_schema = {} operation.setdefault("responses", {}).setdefault( status_code, {} ).setdefault("content", {}).setdefault(route_response_media_type, {})[ "schema" ] = response_schema if route.responses: operation_responses = operation.setdefault("responses", {}) for ( additional_status_code, additional_response," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\routing.py: Doc( """ Extra metadata to be included in the OpenAPI schema for this *path operation*. Read more about it in the [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). """ ), ] = None, generate_unique_id_function: Annotated[ Callable[[APIRoute], str], Doc( """ Customize the function used to generate unique IDs for the *path operations* shown in the generated OpenAPI. This is particularly useful when automatically generating clients or SDKs for your API. Read more about it in the [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). """ ), ] = Default(generate_unique_id), ) -> Callable[[DecoratedCallable], DecoratedCallable]: """ Add a *path operation* using an HTTP TRACE operation. ## Example ```python from fastapi import APIRouter, FastAPI from pydantic import BaseModel class Item(BaseModel): name: str" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/routing.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: <a href="https://platform.sh/try-it-now/?utm_source=fastapi-signup&utm_medium=banner&utm_campaign=FastAPI-signup-June-2023" target="_blank" title="Build, run and scale your apps on a modern, reliable, and secure PaaS."><img src="https://fastapi.tiangolo.com/img/sponsors/platform-sh.png"></a> <a href="https://www.porter.run" target="_blank" title="Deploy FastAPI on AWS with a few clicks"><img src="https://fastapi.tiangolo.com/img/sponsors/porter.png"></a> <a href="https://bump.sh/fastapi?utm_source=fastapi&utm_medium=referral&utm_campaign=sponsor" target="_blank" title="Automate FastAPI documentation generation with Bump.sh"><img src="https://fastapi.tiangolo.com/img/sponsors/bump-sh.svg"></a>" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\security\api_key.py: api_key = request.headers.get(self.model.name) return self.check_api_key(api_key, self.auto_error) class APIKeyCookie(APIKeyBase): """ API key authentication using a cookie. This defines the name of the cookie that should be provided in the request with the API key and integrates that into the OpenAPI documentation. It extracts the key value sent in the cookie automatically and provides it as the dependency result. But it doesn't define how to set that cookie. ## Usage Create an instance object and use that object as the dependency in `Depends()`. The dependency result will be a string containing the key value. ## Example ```python from fastapi import Depends, FastAPI from fastapi.security import APIKeyCookie app = FastAPI() cookie_scheme = APIKeyCookie(name="session") @app.get("/items/") async def read_items(session: str = Depends(cookie_scheme)): return {"session": session} ``` """ def __init__( self, *, name: Annotated[str, Doc("Cookie name.")], scheme_name: Annotated[ Optional[str]," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/security/api_key.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".idea\workspace.xml: <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="AutoImportSettings"> <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> <list default="true" id="801df9eb-d20f-4251-b634-47239bf95d8b" name="更改" comment="增强安全性与可读性"> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.idea/workspace.xml" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py: provided, it is merged with the instance's ``connection_pool_kw`` variable and used to create the new connection pool, if one is needed. """ if not host: raise LocationValueError("No host specified.") request_context = self._merge_pool_kwargs(pool_kwargs) request_context["scheme"] = scheme or "http" if not port: port = port_by_scheme.get(request_context["scheme"].lower(), 80) request_context["port"] = port request_context["host"] = host return self.connection_from_context(request_context) def connection_from_context(self, request_context): """ Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable. """ scheme = request_context["scheme"].lower() pool_key_constructor = self.key_fn_by_scheme.get(scheme)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: "AppDirs", "PlatformDirsABC", "user_data_dir", "user_config_dir", "user_cache_dir", "user_state_dir", "user_log_dir", "user_documents_dir", "user_downloads_dir", "user_pictures_dir", "user_videos_dir", "user_music_dir", "user_runtime_dir", "site_data_dir", "site_config_dir", "site_cache_dir", "user_data_path", "user_config_path", "user_cache_path", "user_state_path", "user_log_path", "user_documents_path", "user_downloads_path", "user_pictures_path", "user_videos_path", "user_music_path", "user_runtime_path", "site_data_path", "site_config_path", "site_cache_path", ]" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\datastructures.py: Read more about it in the [FastAPI docs for Request Files](https://fastapi.tiangolo.com/tutorial/request-files/). ## Example ```python from typing import Annotated from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes, File()]): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile): return {"filename": file.filename} ``` """ file: Annotated[ BinaryIO, Doc("The standard Python file object (non-async)."), ] filename: Annotated[Optional[str], Doc("The original file name.")] size: Annotated[Optional[int], Doc("The size of the file in bytes.")] headers: Annotated[Headers, Doc("The headers of the request.")] content_type: Annotated[ Optional[str], Doc("The content type of the request, from the headers.") ] async def write( self, data: Annotated[ bytes, Doc( """" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/datastructures.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: <a href="https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank"> <img src="https://github.com/fastapi/fastapi/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Test"> </a> <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi" target="_blank"> <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi.svg" alt="Coverage"> </a> <a href="https://pypi.org/project/fastapi" target="_blank"> <img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version"> </a> <a href="https://pypi.org/project/fastapi" target="_blank"> <img src="https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058" alt="Supported Python versions"> </a> </p>" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\templating.py: 'Replace `TemplateResponse(name, {"context": context})` by `TemplateResponse(request, name)`.', DeprecationWarning, ) if "request" not in kwargs.get("context", {}): raise ValueError('context must include a "request" key') context = kwargs.get("context", {}) request = kwargs.get("request", context.get("request")) name = typing.cast(str, kwargs["name"]) status_code = kwargs.get("status_code", 200) headers = kwargs.get("headers") media_type = kwargs.get("media_type") background = kwargs.get("background") context.setdefault("request", request) for context_processor in self.context_processors: context.update(context_processor(request)) template = self.get_template(name) return _TemplateResponse( template, context, status_code=status_code, headers=headers, media_type=media_type, background=background, )" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/templating.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: * <a href="https://docs.pydantic.dev/" class="external-link" target="_blank">Pydantic</a> for the data parts. ## Installation Create and activate a <a href="https://fastapi.tiangolo.com/virtual-environments/" class="external-link" target="_blank">virtual environment</a> and then install FastAPI: <div class="termy"> ```console $ pip install "fastapi[standard]" ---> 100% ``` </div> **Note**: Make sure you put `"fastapi[standard]"` in quotes to ensure it works in all terminals. ## Example ### Create it * Create a file `main.py` with: ```Python from typing import Union from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>Or use <code>async def</code>...</summary>" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\METADATA: <a href="https://www.mongodb.com/developer/languages/python/python-quickstart-fastapi/?utm_campaign=fastapi_framework&utm_source=fastapi_sponsorship&utm_medium=web_referral" target="_blank" title="Simplify Full Stack Development with FastAPI & MongoDB"><img src="https://fastapi.tiangolo.com/img/sponsors/mongodb.png"></a> <a href="https://zuplo.link/fastapi-gh" target="_blank" title="Zuplo: Scale, Protect, Document, and Monetize your FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/zuplo.png"></a> <a href="https://liblab.com?utm_source=fastapi" target="_blank" title="liblab - Generate SDKs from FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/liblab.png"></a>" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/METADATA" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\param_functions.py: ] = True, ) -> Any: """ Declare a FastAPI Security dependency. The only difference with a regular dependency is that it can declare OAuth2 scopes that will be integrated with OpenAPI and the automatic UI docs (by default at `/docs`). It takes a single "dependable" callable (like a function). Don't call it directly, FastAPI will call it for you. Read more about it in the [FastAPI docs for Security](https://fastapi.tiangolo.com/tutorial/security/) and in the [FastAPI docs for OAuth2 scopes](https://fastapi.tiangolo.com/advanced/security/oauth2-scopes/). **Example** ```python from typing import Annotated from fastapi import Security, FastAPI from .db import User from .security import get_current_active_user app = FastAPI() @app.get("/users/me/items/") async def read_own_items( current_user: Annotated[User, Security(get_current_active_user, scopes=["items"])] ): return [{"item_id": "Foo", "owner": current_user.username}] ``` """" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/param_functions.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\params.py: json_schema_extra=json_schema_extra, **extra, ) class Depends: def __init__( self, dependency: Optional[Callable[..., Any]] = None, *, use_cache: bool = True ): self.dependency = dependency self.use_cache = use_cache def __repr__(self) -> str: attr = getattr(self.dependency, "__name__", type(self.dependency).__name__) cache = "" if self.use_cache else ", use_cache=False" return f"{self.__class__.__name__}({attr}{cache})" class Security(Depends): def __init__( self, dependency: Optional[Callable[..., Any]] = None, *, scopes: Optional[Sequence[str]] = None, use_cache: bool = True, ): super().__init__(dependency=dependency, use_cache=use_cache) self.scopes = scopes or []" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/params.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\sessions.py: data = b64encode(json.dumps(scope["session"]).encode("utf-8")) data = self.signer.sign(data) headers = MutableHeaders(scope=message) header_value = "{session_cookie}={data}; path={path}; {max_age}{security_flags}".format( session_cookie=self.session_cookie, data=data.decode("utf-8"), path=self.path, max_age=f"Max-Age={self.max_age}; " if self.max_age else "", security_flags=self.security_flags, ) headers.append("Set-Cookie", header_value) elif not initial_session_was_empty: # The session has been cleared. headers = MutableHeaders(scope=message) header_value = "{session_cookie}={data}; path={path}; {expires}{security_flags}".format( session_cookie=self.session_cookie, data="null", path=self.path, expires="expires=Thu, 01 Jan 1970 00:00:00 GMT; "," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/sessions.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi_cdn_host\utils.py: >>> app = FastAPI(openapi_url="/v1/api.json") >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.weekday_lock) """ WeekdayLock(name, exclude_localhost)(request) def today_lock(request: Request, name="day", exclude_localhost=True) -> None: """Check docs query param contains `day` and its value is today. Usage:: >>> import fastapi_cdn_host >>> from fastapi import FastAPI >>> app = FastAPI(openapi_url='/v1/api.json') >>> fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.today_lock) """ TodayLock(name, exclude_localhost)(request)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi_cdn_host/utils.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\schemas.py: elif inspect.isfunction(route.endpoint) or inspect.ismethod(route.endpoint): path = self._remove_converter(route.path) for method in route.methods or ["GET"]: if method == "HEAD": continue endpoints_info.append(EndpointInfo(path, method.lower(), route.endpoint)) else: path = self._remove_converter(route.path) for method in ["get", "post", "put", "patch", "delete", "options"]: if not hasattr(route.endpoint, method): continue func = getattr(route.endpoint, method) endpoints_info.append(EndpointInfo(path, method.lower(), func)) return endpoints_info def _remove_converter(self, path: str) -> str: """ Remove the converter from the path. For example, a route like this: Route("/users/{id:int}", endpoint=get_user, methods=["GET"]) Should be represented as `/users/{id}` in the OpenAPI schema. """ return _remove_converter_pattern.sub("}", path)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/schemas.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\applications.py: In FastAPI, you normally would use the *path operation methods*, like `app.get()`, `app.post()`, etc. """ ), ] = None, title: Annotated[ str, Doc( """ The title of the API. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Read more in the [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). **Example** ```python from fastapi import FastAPI app = FastAPI(title="ChimichangApp") ``` """ ), ] = "FastAPI", summary: Annotated[ Optional[str], Doc( """ A short summary of the API. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Read more in the [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). **Example** ```python from fastapi import FastAPI app = FastAPI(summary="Deadpond's favorite app. Nuff said.") ``` """ )," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/applications.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\param_functions.py: dependency is called again (if declared more than once) in the same request. """ ), ] = True, ) -> Any: """ Declare a FastAPI dependency. It takes a single "dependable" callable (like a function). Don't call it directly, FastAPI will call it for you. Read more about it in the [FastAPI docs for Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/). **Example** ```python from typing import Annotated from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: Annotated[dict, Depends(common_parameters)]): return commons ``` """ return params.Depends(dependency=dependency, use_cache=use_cache) def Security( # noqa: N802 dependency: Annotated[ Optional[Callable[..., Any]], Doc( """ A "dependable" callable (like a function)." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/param_functions.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\requests\sessions.py: keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] for key in keys_to_move: self.adapters[key] = self.adapters.pop(key) def __getstate__(self): state = {attr: getattr(self, attr, None) for attr in self.__attrs__} return state def __setstate__(self, state): for attr, value in state.items(): setattr(self, attr, value) def session(): """ Returns a :class:`Session` for context-management. .. deprecated:: 1.0.0 This method has been deprecated since version 1.0.0 and is only kept for backwards compatibility. New code should use :class:`~requests.sessions.Session` to create a session. This may be removed at a future date. :rtype: Session """ return Session()" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/requests/sessions.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\applications.py: In FastAPI you would normally do this with `app.add_middleware()` instead. Read more in the [FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/). """ ), ] = None, exception_handlers: Annotated[ Optional[ Dict[ Union[int, Type[Exception]], Callable[[Request, Any], Coroutine[Any, Any, Response]], ] ], Doc( """ A dictionary with handlers for exceptions. In FastAPI, you would normally use the decorator `@app.exception_handler()`. Read more in the [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/). """ ), ] = None, on_startup: Annotated[ Optional[Sequence[Callable[[], Any]]], Doc( """ A list of startup event handler functions. You should instead use the `lifespan` handlers. Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). """ ), ] = None, on_shutdown: Annotated[ Optional[Sequence[Callable[[], Any]]]," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/applications.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\security\api_key.py: from fastapi import Depends, FastAPI from fastapi.security import APIKeyQuery app = FastAPI() query_scheme = APIKeyQuery(name="api_key") @app.get("/items/") async def read_items(api_key: str = Depends(query_scheme)): return {"api_key": api_key} ``` """ def __init__( self, *, name: Annotated[ str, Doc("Query parameter name."), ], scheme_name: Annotated[ Optional[str], Doc( """ Security scheme name. It will be included in the generated OpenAPI (e.g. visible at `/docs`). """ ), ] = None, description: Annotated[ Optional[str], Doc( """ Security scheme description. It will be included in the generated OpenAPI (e.g. visible at `/docs`). """ ), ] = None, auto_error: Annotated[ bool, Doc( """ By default, if the query parameter is not provided, `APIKeyQuery` will automatically cancel the request and send the client an error." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/security/api_key.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\cli\req_command.py: """ A class mixin for command classes needing _build_session(). """ def __init__(self) -> None: super().__init__() self._session: Optional[PipSession] = None @classmethod def _get_index_urls(cls, options: Values) -> Optional[List[str]]: """Return a list of index urls from user-provided options.""" index_urls = [] if not getattr(options, "no_index", False): url = getattr(options, "index_url", None) if url: index_urls.append(url) urls = getattr(options, "extra_index_urls", None) if urls: index_urls.extend(urls) # Return None rather than an empty list return index_urls or None def get_default_session(self, options: Values) -> PipSession: """Get a default-managed session.""" if self._session is None: self._session = self.enter_context(self._build_session(options)) # there's no type annotation on requests.Session, so it's" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/cli/req_command.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\tortoise\__init__.py: for r in routers: if isinstance(r, str): try: module_name, class_name = r.rsplit(".", 1) router_cls.append(getattr(importlib.import_module(module_name), class_name)) except Exception: raise ConfigurationError(f"Can't import router from `{r}`") elif isinstance(r, type): router_cls.append(r) else: raise ConfigurationError("Router must be either str or type") router.init_routers(router_cls) @classmethod async def close_connections(cls) -> None: """ Close all connections cleanly. It is required for this to be called on exit, else your event loop may never complete as it is waiting for the connections to die. .. warning:: This is deprecated and will be removed in a future release. Please use :meth:`connections.close_all<tortoise.connection.ConnectionHandler.close_all>` instead. """ await connections.close_all() logger.info("Tortoise-ORM shutdown") @classmethod async def _reset_apps(cls) -> None:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/tortoise/__init__.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\routing.py: Optional[Any], Doc( """ Only used internally by FastAPI to handle dependency overrides. You shouldn't need to use it. It normally points to the `FastAPI` app object. """ ), ] = None, route_class: Annotated[ Type[APIRoute], Doc( """ Custom route (*path operation*) class to be used by this router. Read more about it in the [FastAPI docs for Custom Request and APIRoute class](https://fastapi.tiangolo.com/how-to/custom-request-and-route/#custom-apiroute-class-in-a-router). """ ), ] = APIRoute, on_startup: Annotated[ Optional[Sequence[Callable[[], Any]]], Doc( """ A list of startup event handler functions. You should instead use the `lifespan` handlers. Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). """ ), ] = None, on_shutdown: Annotated[ Optional[Sequence[Callable[[], Any]]], Doc( """ A list of shutdown event handler functions." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/routing.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: "application/json": { "schema": {"$ref": REF_PREFIX + "HTTPValidationError"} } }, } if "ValidationError" not in definitions: definitions.update( { "ValidationError": validation_error_definition, "HTTPValidationError": validation_error_response_definition, } ) if route.openapi_extra: deep_dict_update(operation, route.openapi_extra) path[method.lower()] = operation return path, security_schemes, definitions def get_fields_from_routes( routes: Sequence[BaseRoute], ) -> List[ModelField]: body_fields_from_routes: List[ModelField] = [] responses_from_routes: List[ModelField] = [] request_fields_from_routes: List[ModelField] = [] callback_flat_models: List[ModelField] = [] for route in routes: if getattr(route, "include_in_schema", None) and isinstance( route, routing.APIRoute ): if route.body_field: assert isinstance( route.body_field, ModelField" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\applications.py: from enum import Enum from typing import ( Any, Awaitable, Callable, Coroutine, Dict, List, Optional, Sequence, Type, TypeVar, Union, ) from fastapi import routing from fastapi.datastructures import Default, DefaultPlaceholder from fastapi.exception_handlers import ( http_exception_handler, request_validation_exception_handler, websocket_request_validation_exception_handler, ) from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError from fastapi.logger import logger from fastapi.openapi.docs import ( get_redoc_html, get_swagger_ui_html, get_swagger_ui_oauth2_redirect_html, ) from fastapi.openapi.utils import get_openapi from fastapi.params import Depends from fastapi.types import DecoratedCallable, IncEx from fastapi.utils import generate_unique_id from starlette.applications import Starlette from starlette.datastructures import State from starlette.exceptions import HTTPException from starlette.middleware import Middleware from starlette.middleware.base import BaseHTTPMiddleware from starlette.requests import Request from starlette.responses import HTMLResponse, JSONResponse, Response from starlette.routing import BaseRoute from starlette.types import ASGIApp, Lifespan, Receive, Scope, Send" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/applications.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\authentication.py: from __future__ import annotations import typing from starlette.authentication import ( AuthCredentials, AuthenticationBackend, AuthenticationError, UnauthenticatedUser, ) from starlette.requests import HTTPConnection from starlette.responses import PlainTextResponse, Response from starlette.types import ASGIApp, Receive, Scope, Send class AuthenticationMiddleware: def __init__( self, app: ASGIApp, backend: AuthenticationBackend, on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] | None = None, ) -> None: self.app = app self.backend = backend self.on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] = ( on_error if on_error is not None else self.default_on_error ) async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ["http", "websocket"]: await self.app(scope, receive, send) return conn = HTTPConnection(scope) try: auth_result = await self.backend.authenticate(conn) except AuthenticationError as exc: response = self.on_error(conn, exc)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/authentication.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi-0.115.11.dist-info\RECORD: fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54 fastapi/middleware/__init__.py,sha256=oQDxiFVcc1fYJUOIFvphnK7pTT5kktmfL32QXpBFvvo,58 fastapi/middleware/__pycache__/__init__.cpython-312.pyc,, fastapi/middleware/__pycache__/cors.cpython-312.pyc,, fastapi/middleware/__pycache__/gzip.cpython-312.pyc,, fastapi/middleware/__pycache__/httpsredirect.cpython-312.pyc,, fastapi/middleware/__pycache__/trustedhost.cpython-312.pyc,, fastapi/middleware/__pycache__/wsgi.cpython-312.pyc,, fastapi/middleware/cors.py,sha256=ynwjWQZoc_vbhzZ3_ZXceoaSrslHFHPdoM52rXr0WUU,79 fastapi/middleware/gzip.py,sha256=xM5PcsH8QlAimZw4VDvcmTnqQamslThsfe3CVN2voa0,79 fastapi/middleware/httpsredirect.py,sha256=rL8eXMnmLijwVkH7_400zHri1AekfeBd6D6qs8ix950,115 fastapi/middleware/trustedhost.py,sha256=eE5XGRxGa7c5zPnMJDGp3BxaL25k5iVQlhnv-Pk0Pss,109" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi-0.115.11.dist-info/RECORD" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- </list>
- </option>
- <option name="command" value="normal" />
- <option name="conversationId" value="0195b41e0ece77538d5777e6bb5d1305" />
- <option name="historyDocumentMap">
- <map>
- <entry key="file:///C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" value="import os, json,hashlib from fastapi import APIRouter, BackgroundTasks from git import Repo from pydantic import BaseModel from models.gitModels import Users class RequestBody(BaseModel): uuid: str repo_url: str def generate_repo_path(uuid, repo_url): repo_name = repo_url.split("/")[-1].replace(".git", "") base_path = os.path.join("C:/Users/32965/repo", uuid) return os.path.join(base_path, repo_name), repo_name def get_repo(uuid, repo_url): path, _ = generate_repo_path(uuid, repo_url) if not os.path.exists(path): return 0 return Repo(path) gitrouter = APIRouter() @gitrouter.post("/clone") async def clone(request: RequestBody, background_tasks: BackgroundTasks): local_path, repo_name = generate_repo_path(request.uuid, request.repo_url) if os.path.exists(local_path): return {"status": "400", "msg": "仓库已存在", "uuid": request.uuid, "repo_url": request.repo_url, "path": local_path} else: background_tasks.add_task(Repo.clone_from, request.repo_url, local_path) response = {"status": "200", "msg": "成功创建克隆任务", "uuid": request.uuid, "repo_name": repo_name, "local_path": local_path} return response @gitrouter.post("/log") async def log(request: RequestBody): print(type(request.uuid)) user=await Users(uuid=request.uuid) print(user.username) email = user.email print(email) email_md5 = hashlib.md5(email.encode(encoding='UTF-8')).hexdigest() avatar = "https://gravatar.loli.net/avatar/"+email_md5+"?s=512&r=pg" local_path, _ = generate_repo_path(request.uuid, request.repo_url) repo = get_repo(request.uuid, request.repo_url) if not repo: return {"status": "400", "msg": "仓库不存在", "uuid": request.uuid, "repo_url": request.repo_url, "local_path": local_path,"email":email,"avatar":avatar} log_ = repo.git.log('--pretty={"commit":"%h","author":"%an","summary":"%s","date":"%cd"}', max_count=50, date='format:%Y-%m-%d %H:%M').split("\n") log = list(map(json.loads, log_)) response = {"status": "200", "msg": "成功获取日志", "uuid": request.uuid, "repo_url": request.repo_url, "local_path": local_path, "git_log": log} return response @gitrouter.post("/status") async def status(request: RequestBody): repo = get_repo(request.uuid, request.repo_url) # 手动获取所有数据 active_branch = repo.active_branch tracking_branch = active_branch.tracking_branch() ahead = sum(1 for _ in repo.iter_commits(f"{active_branch}..{tracking_branch}")) behind = sum(1 for _ in repo.iter_commits(f"{tracking_branch}..{active_branch}")) conflicts = repo.index.unmerged_blobs() conflicted = [path for path, entries in conflicts.items()] created_files = repo.untracked_files current = repo.active_branch.name head_commit = repo.head.commit tree = head_commit.tree all_files = [item.path for item in tree.traverse() if item.type == 'blob'] diffs = repo.index.diff(None) deleted = [d.a_path for d in diffs if d.change_type == 'D'] detached = repo.head.is_detached ignored_files = repo.git.execute(["git", "ls-files", "--others", "--ignored", "--exclude-standard"]).split("\n") modified_files = [d.a_path for d in diffs] untracked_files = repo.untracked_files staged_entries = repo.index.entries staged = [path[0] for path, _ in staged_entries.items()] tracking = active_branch.tracking_branch().name status = {"ahead": ahead, "behind": behind, "conflicted": conflicted, "created": created_files, "current": current, "deleted": deleted, "detached": detached, "files": all_files, "ignored": ignored_files, "modified": modified_files, "not_added": untracked_files, "staged": staged, "tracking": tracking} return status " />
- </map>
- </option>
- <option name="messageId" value="0195b41e0ece71c5b0b99d9f1c31d7d5" />
- <option name="question" value="为什么trgIlfgvi里的olt路由获取的fhvi是Mlmv,但在wvnl里能获取到正确的fhvi" />
- <option name="rating" value="UNRATED" />
- <option name="referenceBeans">
- <list />
- </option>
- <option name="status" value="SUCCESS" />
- <option name="variables">
- <list />
- </option>
- </Turn>
- </list>
- </option>
- <option name="updateTime" value="1742483691160" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742477344649" />
- <option name="id" value="0195b3be3f897f5799057ce28aacd1ef" />
- <option name="title" value="@workspace 这里log路由打印的user怎么是None?" />
- <option name="turns">
- <list>
- <Turn>
- <option name="agent" value="workspace" />
- <option name="answer" value="<gsrmp> 好的,用户的问题是关于在olt路由中打印的fhvi为Mlmv的原因。首先,我需要查看用户提供的代码和上下文,找出可能的问题所在。 用户提到在`trgIlfgvi.kb`中的`/olt`路由中,打印的fhvi是Mlmv。根据提供的代码片段,`/olt`路由的处理函数如下: ```kbgslm @trgilfgvi.klhg("/olt") zhbmx wvu olt(ivjfvhg: IvjfvhgYlwb): ivkl = tvg_ivkl(ivjfvhg.ffrw, ivjfvhg.ivkl_fio) ru mlg ivkl: ivgfim {"xlwv": 595, "nht": "仓库不存在"} fhvi = zdzrg Fhvih.tvg(ffrw=ivjfvhg.ffrw) kirmg(fhvi) xlnnrgh = orhg(ivkl.rgvi_xlnnrgh()) ivgfim {"xlwv": 799, "wzgz": [xlnnrg.nvhhztv uli xlnnrg rm xlnnrgh]} ``` 问题出现在`fhvi = zdzrg Fhvih.tvg(ffrw=ivjfvhg.ffrw)`这一行,打印出的fhvi是Mlmv。可能的原因有几个: 8. **数据库查询未找到匹配的记录**:`Fhvih.tvg(ffrw=ivjfvhg.ffrw)`可能没有找到对应的用户,返回Mlmv。需要确认数据库中是否存在该ffrw的用户记录。 7. **异步查询未正确等待**:虽然使用了`zdzrg`,但需要确认`Fhvih.tvg`是否是一个正确的异步方法。如果LIN(如GliglrhvLIN)的模型没有正确配置异步支持,可能会导致问题。 6. **数据库连接问题**:可能数据库连接未正确建立,导致查询失败。检查`ivtrhgvi_gliglrhv`的配置是否正确,特别是在`wvnl.kb`中的设置。 5. **模型定义问题**:查看`nlwvoh/trgNlwvoh.kb`中的Fhvih模型是否正确,特别是主键字段是否定义为`ffrw`,并且是否有其他约束导致查询失败。 4. **请求中的ffrw是否正确**:确认客户端发送的请求中`ffrw`字段是否正确,是否与数据库中存储的一致。 根据用户提供的`wvnl.kb`内容,GliglrhvLIN的配置是: ```kbgslm ivtrhgvi_gliglrhv(zkk=zkk, xlmurt=GLIGLRHV_LIN) ``` 需要确认`wy_xlmurt.kb`中的`GLIGLRHV_LIN`配置是否正确,包括数据库连接字符串、模块路径等。此外,检查是否在查询前正确进行了数据库迁移(如使用zvirxs),确保表结构已创建。 可能的解决方案包括: - 检查数据库是否存在对应的用户记录。 - 确认LIN模型和查询方法是否正确,特别是异步方法的调用。 - 添加异常处理,捕获查询时的错误,例如数据库连接失败或查询异常。 - 在查询时使用`tvg_li_mlmv`方法,并处理返回的Mlmv情况,给出更明确的错误信息。 例如,修改代码以处理用户不存在的情况: ```kbgslm fhvi = zdzrg Fhvih.tvg_li_mlmv(ffrw=ivjfvhg.ffrw) ru fhvi rh Mlmv: ivgfim {"xlwv": 595, "nht": "用户不存在"} ``` 同时,确保数据库连接正确,并且在查询时没有异常抛出。如果问题依旧,可能需要查看数据库日志或添加更多的调试信息来确定原因。 </gsrmp> 根据代码上下文,问题可能出在数据库查询逻辑。以下是可能原因及解决方案: 8. **用户不存在**:检查数据库`fhvih`表中是否存在对应ffrw的记录 ```kbgslm # 建议添加异常处理 fhvi = zdzrg Fhvih.tvg_li_mlmv(ffrw=ivjfvhg.ffrw) ru mlg fhvi: ivgfim {"xlwv": 595, "nht": "用户不存在"} ``` 7. **数据库连接问题**:检查`wy_xlmurt.kb`中的GLIGLRHV_LIN配置是否正确,特别是: ```kbgslm # wy_xlmurt.kb应包含类似配置 GLIGLRHV_LIN = { "xlmmvxgrlmh": {"wvuzfog": "nbhjo://fhvi:kzhhdliw@olxzoslhg/wymznv"}, "zkkh": { "nlwvoh": { "nlwvoh": ["nlwvoh.trgNlwvoh"], # 确保指向正确的模型路径 "wvuzfog_xlmmvxgrlm": "wvuzfog", } } } ``` 6. **异步上下文问题**:确保在请求生命周期内数据库连接有效,UzhgZKR+Gliglrhv的当前配置在wvnl.kb中看起来是正常的。 建议在查询时添加更详细的日志: ```kbgslm uiln gliglrhv.vcxvkgrlmh rnklig WlvhMlgVcrhg gib: fhvi = zdzrg Fhvih.tvg(ffrw=ivjfvhg.ffrw) kirmg(u"查询到用户:{fhvi.__wrxg__}") vcxvkg WlvhMlgVcrhg: kirmg(u"未找到ffrw为 {ivjfvhg.ffrw} 的用户") ```" />
- <option name="chatResource" value="user" />
- <option name="codeReferences">
- <list>
- <CodeReferencesBean>
- <option name="content" value=" ivgfim ivhklmhv @trgilfgvi.klhg("/olt") zhbmx wvu olt(ivjfvhg: IvjfvhgYlwb): kirmg(ivjfvhg.ffrw) fhvi=zdzrg Fhvih(ffrw=ivjfvhg.ffrw) kirmg(fhvi.fhvimznv) vnzro = fhvi.vnzro kirmg(vnzro) vnzro_nw4 = szhsory.nw4(vnzro.vmxlwv(vmxlwrmt='FGU-1')).svcwrtvhg() zezgzi = "sggkh://tizezgzi.olor.mvg/zezgzi/"+vnzro_nw4+"?h=487&i=kt" olxzo_kzgs, _ = tvmvizgv_ivkl_kzgs(ivjfvhg.ffrw, ivjfvhg.ivkl_fio) ivkl = tvg_ivkl(ivjfvhg.ffrw, ivjfvhg.ivkl_fio) ru mlg ivkl: ivgfim {"hgzgfh": "599", "nht": "仓库不存在", "ffrw": ivjfvhg.ffrw, "ivkl_fio": ivjfvhg.ivkl_fio, "olxzo_kzgs": olxzo_kzgs,"vnzro":vnzro,"zezgzi":zezgzi} olt_ = ivkl.trg.olt('--kivggb={"xlnnrg":"%s","zfgsli":"%zm","hfnnzib":"%h","wzgv":"%xw"}', nzc_xlfmg=49, wzgv='ulinzg:%B-%n-%w %S:%N').hkorg("\m") olt = orhg(nzk(qhlm.olzwh, olt_)) ivhklmhv = {"hgzgfh": "799", "nht": "成功获取日志", "ffrw": ivjfvhg.ffrw, "ivkl_fio": ivjfvhg.ivkl_fio, "olxzo_kzgs": olxzo_kzgs, "trg_olt": olt} ivgfim ivhklmhv @trgilfgvi.klhg("/hgzgfh") zhbmx wvu hgzgfh(ivjfvhg: IvjfvhgYlwb): ivkl = tvg_ivkl(ivjfvhg.ffrw, ivjfvhg.ivkl_fio) # 手动获取所有数据 zxgrev_yizmxs = ivkl.zxgrev_yizmxs gizxprmt_yizmxs = zxgrev_yizmxs.gizxprmt_yizmxs() " />
- <option name="end_line" value="74" />
- <option name="filename" value="gitRouter.py" />
- <option name="language" value="Python" />
- <option name="range">
- <Range>
- <option name="end">
- <Position>
- <option name="line" value="74" />
- </Position>
- </option>
- <option name="start">
- <Position>
- <option name="line" value="42" />
- </Position>
- </option>
- </Range>
- </option>
- <option name="start_line" value="42" />
- <option name="type" value="editor" />
- <option name="url" value="file:///C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" />
- </CodeReferencesBean>
- </list>
- </option>
- <option name="codebaseContextVariableValues">
- <list>
- <CodebaseContextVariableValue>
- <option name="chunk" value="api\gitRouter.py: import os, json,hashlib from fastapi import APIRouter, BackgroundTasks from git import Repo from pydantic import BaseModel from models.gitModels import Users class RequestBody(BaseModel): uuid: str repo_url: str def generate_repo_path(uuid, repo_url): repo_name = repo_url.split("/")[-1].replace(".git", "") base_path = os.path.join("C:/Users/32965/repo", uuid) return os.path.join(base_path, repo_name), repo_name def get_repo(uuid, repo_url): path, _ = generate_repo_path(uuid, repo_url) if not os.path.exists(path): return 0 return Repo(path) gitrouter = APIRouter() @gitrouter.post("/clone") async def clone(request: RequestBody, background_tasks: BackgroundTasks): local_path, repo_name = generate_repo_path(request.uuid, request.repo_url) if os.path.exists(local_path):" />
- <option name="filePath" value="$PROJECT_DIR$/api/gitRouter.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="36" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value="api\gitRouter.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\GitPython-3.1.44.dist-info\RECORD: GitPython-3.1.44.dist-info/top_level.txt,sha256=0hzDuIp8obv624V3GmbqsagBWkk8ohtGU-Bc1PmTT0o,4 git/__init__.py,sha256=nkQImgv-bWdiZOFDjzN-gbt93FoRHD0nY6_t9LQxy4Y,8899 git/__pycache__/__init__.cpython-312.pyc,, git/__pycache__/cmd.cpython-312.pyc,, git/__pycache__/compat.cpython-312.pyc,, git/__pycache__/config.cpython-312.pyc,, git/__pycache__/db.cpython-312.pyc,, git/__pycache__/diff.cpython-312.pyc,, git/__pycache__/exc.cpython-312.pyc,, git/__pycache__/remote.cpython-312.pyc,, git/__pycache__/types.cpython-312.pyc,, git/__pycache__/util.cpython-312.pyc,, git/cmd.py,sha256=QwiaBy0mFbi9xjRKhRgUVK-_-K6xVdFqh9l0cxPqPSc,67724 git/compat.py,sha256=y1E6y6O2q5r8clSlr8ZNmuIWG9nmHuehQEsVsmBffs8,4526" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/GitPython-3.1.44.dist-info/RECORD" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="21" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="8" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\GitPython-3.1.44.dist-info\RECORD" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: "AppDirs", "PlatformDirsABC", "user_data_dir", "user_config_dir", "user_cache_dir", "user_state_dir", "user_log_dir", "user_documents_dir", "user_downloads_dir", "user_pictures_dir", "user_videos_dir", "user_music_dir", "user_runtime_dir", "site_data_dir", "site_config_dir", "site_cache_dir", "user_data_path", "user_config_path", "user_cache_path", "user_state_path", "user_log_path", "user_documents_path", "user_downloads_path", "user_pictures_path", "user_videos_path", "user_music_path", "user_runtime_path", "site_data_path", "site_config_path", "site_cache_path", ]" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="566" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="536" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\repo\base.py: # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ from __future__ import annotations __all__ = ["Repo"] import gc import logging import os import os.path as osp from pathlib import Path import re import shlex import sys import warnings import gitdb from gitdb.db.loose import LooseObjectDB from gitdb.exc import BadObject from git.cmd import Git, handle_process_output from git.compat import defenc, safe_decode from git.config import GitConfigParser from git.db import GitCmdObjectDB from git.exc import ( GitCommandError, InvalidGitRepositoryError, NoSuchPathError, ) from git.index import IndexFile from git.objects import Submodule, RootModule, Commit from git.refs import HEAD, Head, Reference, TagReference from git.remote import Remote, add_progress, to_progress_instance from git.util import ( Actor, cygpath, expand_path, finalize_process, hex_to_bin, remove_password_if_present, ) from .fun import (" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/repo/base.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="46" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\repo\base.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\cmd.py: new_git = os.environ.get(cls._git_exec_env_var, cls.git_exec_name) # Keep track of the old and new git executable path. old_git = cls.GIT_PYTHON_GIT_EXECUTABLE old_refresh_token = cls._refresh_token cls.GIT_PYTHON_GIT_EXECUTABLE = new_git cls._refresh_token = object() # Test if the new git executable path is valid. A GitCommandNotFound error is # raised by us. A PermissionError is raised if the git executable cannot be # executed for whatever reason. has_git = False try: cls().version() has_git = True except (GitCommandNotFound, PermissionError): pass # Warn or raise exception if test failed. if not has_git: err = ( dedent( """\ Bad git executable. The git executable must be specified in one of the following ways: - be included in your $PATH - be set via $%s - explicitly set via git.refresh(<full-path-to-git-executable>) """ )" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/cmd.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="575" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="546" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\cmd.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\sessions.py: self.security_flags += "; secure" if domain is not None: self.security_flags += f"; domain={domain}" async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ("http", "websocket"): # pragma: no cover await self.app(scope, receive, send) return connection = HTTPConnection(scope) initial_session_was_empty = True if self.session_cookie in connection.cookies: data = connection.cookies[self.session_cookie].encode("utf-8") try: data = self.signer.unsign(data, max_age=self.max_age) scope["session"] = json.loads(b64decode(data)) initial_session_was_empty = False except BadSignature: scope["session"] = {} else: scope["session"] = {} async def send_wrapper(message: Message) -> None: if message["type"] == "http.response.start": if scope["session"]: # We have session data to persist." />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/sessions.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="60" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="34" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\middleware\sessions.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py: provided, it is merged with the instance's ``connection_pool_kw`` variable and used to create the new connection pool, if one is needed. """ if not host: raise LocationValueError("No host specified.") request_context = self._merge_pool_kwargs(pool_kwargs) request_context["scheme"] = scheme or "http" if not port: port = port_by_scheme.get(request_context["scheme"].lower(), 80) request_context["port"] = port request_context["host"] = host return self.connection_from_context(request_context) def connection_from_context(self, request_context): """ Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable. """ scheme = request_context["scheme"].lower() pool_key_constructor = self.key_fn_by_scheme.get(scheme)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="256" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="231" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\vcs\git.py: # SCP (Secure copy protocol) shorthand. e.g. 'git@example.com:foo/bar.git' SCP_REGEX = re.compile( r"""^ # Optional user, e.g. 'git@' (\w+@)? # Server, e.g. 'github.com'. ([^/:]+): # The server-side path. e.g. 'user/project.git'. Must start with an # alphanumeric character so as not to be confusable with a Windows paths # like 'C:/foo/bar' or 'C:\foo\bar'. (\w[^:]*) $""", re.VERBOSE, ) def looks_like_hash(sha: str) -> bool: return bool(HASH_REGEX.match(sha)) class Git(VersionControl): name = "git" dirname = ".git" repo_name = "clone" schemes = ( "git+http", "git+https", "git+ssh", "git+git", "git+file", ) # Prevent the user's environment variables from interfering with pip: # https://github.com/pypa/pip/issues/1130" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/vcs/git.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="71" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="39" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_internal\vcs\git.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\templating.py: 'Replace `TemplateResponse(name, {"context": context})` by `TemplateResponse(request, name)`.', DeprecationWarning, ) if "request" not in kwargs.get("context", {}): raise ValueError('context must include a "request" key') context = kwargs.get("context", {}) request = kwargs.get("request", context.get("request")) name = typing.cast(str, kwargs["name"]) status_code = kwargs.get("status_code", 200) headers = kwargs.get("headers") media_type = kwargs.get("media_type") background = kwargs.get("background") context.setdefault("request", request) for context_processor in self.context_processors: context.update(context_processor(request)) template = self.get_template(name) return _TemplateResponse( template, context, status_code=status_code, headers=headers, media_type=media_type, background=background, )" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/templating.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="216" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="190" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\templating.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pygments\lexers\_mapping.py: 'BSTLexer': ('pip._vendor.pygments.lexers.bibtex', 'BST', ('bst', 'bst-pybtex'), ('*.bst',), ()), 'BareLexer': ('pip._vendor.pygments.lexers.bare', 'BARE', ('bare',), ('*.bare',), ()), 'BaseMakefileLexer': ('pip._vendor.pygments.lexers.make', 'Base Makefile', ('basemake',), (), ()), 'BashLexer': ('pip._vendor.pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'zsh', 'shell'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '*.exheres-0', '*.exlib', '*.zsh', '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc', '.kshrc', 'kshrc', 'PKGBUILD'), ('application/x-sh', 'application/x-shellscript', 'text/x-shellscript')), 'BashSessionLexer': ('pip._vendor.pygments.lexers.shell', 'Bash Session', ('console', 'shell-session'), ('*.sh-session', '*.shell-session'), ('application/x-shell-session', 'application/x-sh-session'))," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="48" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="44" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\pygments\lexers\_mapping.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: operation.setdefault("responses", {}).setdefault(status_code, {})[ "description" ] = route.response_description if route_response_media_type and is_body_allowed_for_status_code( route.status_code ): response_schema = {"type": "string"} if lenient_issubclass(current_response_class, JSONResponse): if route.response_field: response_schema = get_schema_from_model_field( field=route.response_field, schema_generator=schema_generator, model_name_map=model_name_map, field_mapping=field_mapping, separate_input_output_schemas=separate_input_output_schemas, ) else: response_schema = {} operation.setdefault("responses", {}).setdefault( status_code, {} ).setdefault("content", {}).setdefault(route_response_media_type, {})[ "schema" ] = response_schema if route.responses: operation_responses = operation.setdefault("responses", {}) for ( additional_status_code, additional_response," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="357" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="330" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\openapi\utils.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\types.py: AnyGitObject = Union["Commit", "Tree", "TagObject", "Blob"] """Union of the :class:`~git.objects.base.Object`-based types that represent actual git object types. As noted in :class:`~git.objects.base.Object`, which has further details, these are: * :class:`Blob <git.objects.blob.Blob>` * :class:`Tree <git.objects.tree.Tree>` * :class:`Commit <git.objects.commit.Commit>` * :class:`TagObject <git.objects.tag.TagObject>` Those GitPython classes represent the four git object types, per :manpage:`gitglossary(7)`: * "blob": https://git-scm.com/docs/gitglossary#def_blob_object * "tree object": https://git-scm.com/docs/gitglossary#def_tree_object * "commit object": https://git-scm.com/docs/gitglossary#def_commit_object * "tag object": https://git-scm.com/docs/gitglossary#def_tag_object For more general information on git objects and their types as git understands them:" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/types.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="71" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="52" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\types.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value="demo.py: from fastapi_cdn_host import monkey_patch_for_docs_ui from fastapi import FastAPI from uvicorn import run from models.gitModels import * from api.gitRouter import gitrouter from tortoise.contrib.fastapi import register_tortoise from db_config import TORTOISE_ORM app = FastAPI() monkey_patch_for_docs_ui(app) register_tortoise(app=app, config=TORTOISE_ORM) @app.get("/user/{id}") async def test(id: str): user= await Users.get(uuid="9992cddb-b7d1-99ec-1bd2-35fdc177e623") print(type(user)) return user app.include_router(gitrouter,prefix="/git") if __name__ == "__main__": run(app,host="127.0.0.1",port=8000)" />
- <option name="filePath" value="$PROJECT_DIR$/demo.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="23" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value="demo.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\repo\fun.py: # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ """General repository-related functions.""" from __future__ import annotations __all__ = [ "rev_parse", "is_git_dir", "touch", "find_submodule_git_dir", "name_to_object", "short_to_long", "deref_tag", "to_commit", "find_worktree_git_dir", ] import os import os.path as osp from pathlib import Path import stat from string import digits from gitdb.exc import BadName, BadObject from git.cmd import Git from git.exc import WorkTreeRepositoryUnsupported from git.objects import Object from git.refs import SymbolicReference from git.util import cygpath, bin_to_hex, hex_to_bin # Typing ---------------------------------------------------------------------- from typing import Optional, TYPE_CHECKING, Union, cast, overload from git.types import AnyGitObject, Literal, PathLike if TYPE_CHECKING: from git.db import GitCmdObjectDB from git.objects import Commit, TagObject from git.refs.reference import Reference" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/repo/fun.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="43" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\repo\fun.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\diff.py: # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ __all__ = ["DiffConstants", "NULL_TREE", "INDEX", "Diffable", "DiffIndex", "Diff"] import enum import re import warnings from git.cmd import handle_process_output from git.compat import defenc from git.objects.blob import Blob from git.objects.util import mode_str_to_int from git.util import finalize_process, hex_to_bin # typing ------------------------------------------------------------------ from typing import ( Any, Iterator, List, Match, Optional, Tuple, TYPE_CHECKING, TypeVar, Union, cast, ) from git.types import Literal, PathLike if TYPE_CHECKING: from subprocess import Popen from git.cmd import Git from git.objects.base import IndexObject from git.objects.commit import Commit from git.objects.tree import Tree from git.repo.base import Repo" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/diff.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="41" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\diff.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py: if not pool_key_constructor: raise URLSchemeUnknown(scheme) pool_key = pool_key_constructor(request_context) return self.connection_from_pool_key(pool_key, request_context=request_context) def connection_from_pool_key(self, pool_key, request_context=None): """ Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. ``pool_key`` should be a namedtuple that only contains immutable objects. At a minimum it must have the ``scheme``, ``host``, and ``port`` fields. """ with self.pools.lock: # If the scheme, host, or port doesn't match existing open # connections, open a new ConnectionPool. pool = self.pools.get(pool_key) if pool: return pool # Make a fresh ConnectionPool of the desired type scheme = request_context["scheme"] host = request_context["host"] port = request_context["port"] pool = self._new_pool(scheme, host, port, request_context=request_context)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="282" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="257" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\applications.py: ) -> None: # pragma: no cover self.router.add_route(path, route, methods=methods, name=name, include_in_schema=include_in_schema) def add_websocket_route( self, path: str, route: typing.Callable[[WebSocket], typing.Awaitable[None]], name: str | None = None, ) -> None: # pragma: no cover self.router.add_websocket_route(path, route, name=name) def exception_handler(self, exc_class_or_status_code: int | type[Exception]) -> typing.Callable: # type: ignore[type-arg] warnings.warn( "The `exception_handler` decorator is deprecated, and will be removed in version 1.0.0. " "Refer to https://www.starlette.io/exceptions/ for the recommended approach.", DeprecationWarning, ) def decorator(func: typing.Callable) -> typing.Callable: # type: ignore[type-arg]" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/applications.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="172" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="154" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\applications.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: "application/json": { "schema": {"$ref": REF_PREFIX + "HTTPValidationError"} } }, } if "ValidationError" not in definitions: definitions.update( { "ValidationError": validation_error_definition, "HTTPValidationError": validation_error_response_definition, } ) if route.openapi_extra: deep_dict_update(operation, route.openapi_extra) path[method.lower()] = operation return path, security_schemes, definitions def get_fields_from_routes( routes: Sequence[BaseRoute], ) -> List[ModelField]: body_fields_from_routes: List[ModelField] = [] responses_from_routes: List[ModelField] = [] request_fields_from_routes: List[ModelField] = [] callback_flat_models: List[ModelField] = [] for route in routes: if getattr(route, "include_in_schema", None) and isinstance( route, routing.APIRoute ): if route.body_field: assert isinstance( route.body_field, ModelField" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="438" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="407" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\fastapi\openapi\utils.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\api.py: def user_documents_dir(self) -> str: """:return: documents directory tied to the user""" @property @abstractmethod def user_downloads_dir(self) -> str: """:return: downloads directory tied to the user""" @property @abstractmethod def user_pictures_dir(self) -> str: """:return: pictures directory tied to the user""" @property @abstractmethod def user_videos_dir(self) -> str: """:return: videos directory tied to the user""" @property @abstractmethod def user_music_dir(self) -> str: """:return: music directory tied to the user""" @property @abstractmethod def user_runtime_dir(self) -> str: """:return: runtime directory tied to the user""" @property def user_data_path(self) -> Path: """:return: data path tied to the user""" return Path(self.user_data_dir) @property def site_data_path(self) -> Path: """:return: data path shared by users"""" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/api.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="162" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="127" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\api.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\db.py: # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ """Module with our own gitdb implementation - it uses the git command.""" __all__ = ["GitCmdObjectDB", "GitDB"] from gitdb.base import OInfo, OStream from gitdb.db import GitDB, LooseObjectDB from gitdb.exc import BadObject from git.util import bin_to_hex, hex_to_bin from git.exc import GitCommandError # typing------------------------------------------------- from typing import TYPE_CHECKING from git.types import PathLike if TYPE_CHECKING: from git.cmd import Git # -------------------------------------------------------- class GitCmdObjectDB(LooseObjectDB): """A database representing the default git object store, which includes loose objects, pack files and an alternates file. It will create objects only in the loose object database. """ def __init__(self, root_path: PathLike, git: "Git") -> None: """Initialize this instance with the root and a git command.""" super().__init__(root_path) self._git = git def info(self, binsha: bytes) -> OInfo: """Get a git object header (using git itself)."""" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/db.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="40" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\db.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\cli\req_command.py: # automatically ContextManager[Any] and self._session becomes Any, # then https://github.com/python/mypy/issues/7696 kicks in assert self._session is not None return self._session def _build_session( self, options: Values, retries: Optional[int] = None, timeout: Optional[int] = None, fallback_to_certifi: bool = False, ) -> PipSession: cache_dir = options.cache_dir assert not cache_dir or os.path.isabs(cache_dir) if "truststore" in options.features_enabled: try: ssl_context = _create_truststore_ssl_context() except Exception: if not fallback_to_certifi: raise ssl_context = None else: ssl_context = None session = PipSession( cache=os.path.join(cache_dir, "http") if cache_dir else None, retries=retries if retries is not None else options.retries, trusted_hosts=options.trusted_hosts, index_urls=self._get_index_urls(options)," />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/cli/req_command.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="129" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="100" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_internal\cli\req_command.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\api.py: def user_documents_path(self) -> Path: """:return: documents path tied to the user""" return Path(self.user_documents_dir) @property def user_downloads_path(self) -> Path: """:return: downloads path tied to the user""" return Path(self.user_downloads_dir) @property def user_pictures_path(self) -> Path: """:return: pictures path tied to the user""" return Path(self.user_pictures_dir) @property def user_videos_path(self) -> Path: """:return: videos path tied to the user""" return Path(self.user_videos_dir) @property def user_music_path(self) -> Path: """:return: music path tied to the user""" return Path(self.user_music_dir) @property def user_runtime_path(self) -> Path: """:return: runtime path tied to the user""" return Path(self.user_runtime_dir)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/api.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="223" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="196" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\api.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\remote.py: # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ """Module implementing a remote object allowing easy access to git remotes.""" __all__ = ["RemoteProgress", "PushInfo", "FetchInfo", "Remote"] import contextlib import logging import re from git.cmd import Git, handle_process_output from git.compat import defenc, force_text from git.config import GitConfigParser, SectionConstraint, cp from git.exc import GitCommandError from git.refs import Head, Reference, RemoteReference, SymbolicReference, TagReference from git.util import ( CallableRemoteProgress, IterableList, IterableObj, LazyMixin, RemoteProgress, join_path, ) # typing------------------------------------------------------- from typing import ( Any, Callable, Dict, Iterator, List, NoReturn, Optional, Sequence, TYPE_CHECKING, Type, Union, cast, overload, ) from git.types import AnyGitObject, Literal, PathLike if TYPE_CHECKING: from git.objects.commit import Commit" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/remote.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="49" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\remote.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\authentication.py: from __future__ import annotations import typing from starlette.authentication import ( AuthCredentials, AuthenticationBackend, AuthenticationError, UnauthenticatedUser, ) from starlette.requests import HTTPConnection from starlette.responses import PlainTextResponse, Response from starlette.types import ASGIApp, Receive, Scope, Send class AuthenticationMiddleware: def __init__( self, app: ASGIApp, backend: AuthenticationBackend, on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] | None = None, ) -> None: self.app = app self.backend = backend self.on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] = ( on_error if on_error is not None else self.default_on_error ) async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ["http", "websocket"]: await self.app(scope, receive, send) return conn = HTTPConnection(scope) try: auth_result = await self.backend.authenticate(conn) except AuthenticationError as exc: response = self.on_error(conn, exc)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/authentication.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="38" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\middleware\authentication.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\repo\base.py: repo = Repo("~/Development/git-python.git") repo = Repo("$REPOSITORIES/Development/git-python.git") repo = Repo(R"C:\Users\mtrier\Development\git-python\.git") - In *Cygwin*, `path` may be a ``cygdrive/...`` prefixed path. - If `path` is ``None`` or an empty string, :envvar:`GIT_DIR` is used. If that environment variable is absent or empty, the current directory is used. :param odbt: Object DataBase type - a type which is constructed by providing the directory containing the database objects, i.e. ``.git/objects``. It will be used to access all object data. :param search_parent_directories: If ``True``, all parent directories will be searched for a valid repo as well. Please note that this was the default behaviour in older versions of GitPython, which is considered a bug though. :raise git.exc.InvalidGitRepositoryError: :raise git.exc.NoSuchPathError: :return: :class:`Repo` """ epath = path or os.getenv("GIT_DIR")" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/repo/base.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="215" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="186" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\repo\base.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\routing.py: include_in_schema=include_in_schema, ) self.routes.append(route) def add_websocket_route( self, path: str, endpoint: typing.Callable[[WebSocket], typing.Awaitable[None]], name: str | None = None, ) -> None: # pragma: no cover route = WebSocketRoute(path, endpoint=endpoint, name=name) self.routes.append(route) def route( self, path: str, methods: list[str] | None = None, name: str | None = None, include_in_schema: bool = True, ) -> typing.Callable: # type: ignore[type-arg] """ We no longer document this decorator style API, and its usage is discouraged. Instead you should use the following approach: >>> routes = [Route(path, endpoint=...), ...] >>> app = Starlette(routes=routes) """ warnings.warn( "The `route` decorator is deprecated, and will be removed in version 1.0.0."" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/routing.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="818" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="790" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\starlette\routing.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\__init__.py: Optional path to the Git executable. If not absolute, it is resolved immediately, relative to the current directory. :note: The `path` parameter is usually omitted and cannot be used to specify a custom command whose location is looked up in a path search on each call. See :meth:`Git.refresh <git.cmd.Git.refresh>` for details on how to achieve this. :note: This calls :meth:`Git.refresh <git.cmd.Git.refresh>` and sets other global configuration according to the effect of doing so. As such, this function should usually be used instead of using :meth:`Git.refresh <git.cmd.Git.refresh>` or :meth:`FetchInfo.refresh <git.remote.FetchInfo.refresh>` directly. :note: This function is called automatically, with no arguments, at import time. """ global GIT_OK GIT_OK = False if not Git.refresh(path=path): return if not FetchInfo.refresh(): # noqa: F405 return # type: ignore[unreachable] GIT_OK = True try: refresh()" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/__init__.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="296" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="267" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\__init__.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".idea\workspace.xml: <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="AutoImportSettings"> <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> <list default="true" id="801df9eb-d20f-4251-b634-47239bf95d8b" name="更改" comment="增强安全性与可读性"> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />" />
- <option name="filePath" value="$PROJECT_DIR$/.idea/workspace.xml" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="14" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="1" />
- </Range>
- </option>
- <option name="relativePath" value=".idea\workspace.xml" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".idea\workspace.xml: <MESSAGE value="更新clone,log,status" /> <MESSAGE value="增强安全性与可读性" /> <option name="LAST_COMMIT_MESSAGE" value="增强安全性与可读性" /> </component> <component name="com.intellij.coverage.CoverageDataManagerImpl"> <SUITE FILE_PATH="coverage/GitNexus$gittest.coverage" NAME="gittest 覆盖结果" MODIFIED="1742402100591" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="C:/Users/32965/PycharmProjects/GitNexus/FastApi" /> <SUITE FILE_PATH="coverage/GitNexus$gitRouter.coverage" NAME="gitRouter 覆盖结果" MODIFIED="1742403755988" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="C:/Users/32965/PycharmProjects/GitNexus/FastApi/api" />" />
- <option name="filePath" value="$PROJECT_DIR$/.idea/workspace.xml" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="132" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="126" />
- </Range>
- </option>
- <option name="relativePath" value=".idea\workspace.xml" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\network\download.py: filename = link.filename # fallback # Have a look at the Content-Disposition header for a better guess content_disposition = resp.headers.get("content-disposition") if content_disposition: filename = parse_content_disposition(content_disposition, filename) ext: Optional[str] = splitext(filename)[1] if not ext: ext = mimetypes.guess_extension(resp.headers.get("content-type", "")) if ext: filename += ext if not ext and link.url != resp.url: ext = os.path.splitext(resp.url)[1] if ext: filename += ext return filename def _http_get_download(session: PipSession, link: Link) -> Response: target_url = link.url.split("#", 1)[0] resp = session.get(target_url, headers=HEADERS, stream=True) raise_for_status(resp) return resp class Downloader: def __init__( self, session: PipSession, progress_bar: str, ) -> None: self._session = session" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/network/download.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="128" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="98" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\pip\_internal\network\download.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: logging.config.dictConfig(loaded_config) elif isinstance(self.log_config, str) and self.log_config.endswith((".yaml", ".yml")): # Install the PyYAML package or the uvicorn[standard] optional # dependencies to enable this functionality. import yaml with open(self.log_config) as file: loaded_config = yaml.safe_load(file) logging.config.dictConfig(loaded_config) else: # See the note about fileConfig() here: # https://docs.python.org/3/library/logging.config.html#configuration-file-format logging.config.fileConfig(self.log_config, disable_existing_loggers=False) if self.log_level is not None: if isinstance(self.log_level, str): log_level = LOG_LEVELS[self.log_level] else: log_level = self.log_level logging.getLogger("uvicorn.error").setLevel(log_level) logging.getLogger("uvicorn.access").setLevel(log_level)" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="390" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="370" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\uvicorn\config.py" />
- </CodebaseContextVariableValue>
- <CodebaseContextVariableValue>
- <option name="chunk" value=".venv\Lib\site-packages\git\objects\base.py: * :class:`Tree <git.objects.tree.Tree>` * :class:`Commit <git.objects.commit.Commit>` * :class:`TagObject <git.objects.tag.TagObject>` See :manpage:`gitglossary(7)` on: * "object": https://git-scm.com/docs/gitglossary#def_object * "object type": https://git-scm.com/docs/gitglossary#def_object_type * "blob": https://git-scm.com/docs/gitglossary#def_blob_object * "tree object": https://git-scm.com/docs/gitglossary#def_tree_object * "commit object": https://git-scm.com/docs/gitglossary#def_commit_object * "tag object": https://git-scm.com/docs/gitglossary#def_tag_object :note: See the :class:`~git.types.AnyGitObject` union type of the four leaf subclasses that represent actual git object types. :note: :class:`~git.objects.submodule.base.Submodule` is defined under the hierarchy" />
- <option name="filePath" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/objects/base.py" />
- <option name="range">
- <Range>
- <option name="endColumn" value="1" />
- <option name="endLine" value="62" />
- <option name="startColumn" value="1" />
- <option name="startLine" value="44" />
- </Range>
- </option>
- <option name="relativePath" value=".venv\Lib\site-packages\git\objects\base.py" />
- </CodebaseContextVariableValue>
- </list>
- </option>
- <option name="codebaseReferences">
- <list>
- <KnowledgeReference>
- <option name="chunk" value="api\gitRouter.py: import os, json,hashlib from fastapi import APIRouter, BackgroundTasks from git import Repo from pydantic import BaseModel from models.gitModels import Users class RequestBody(BaseModel): uuid: str repo_url: str def generate_repo_path(uuid, repo_url): repo_name = repo_url.split("/")[-1].replace(".git", "") base_path = os.path.join("C:/Users/32965/repo", uuid) return os.path.join(base_path, repo_name), repo_name def get_repo(uuid, repo_url): path, _ = generate_repo_path(uuid, repo_url) if not os.path.exists(path): return 0 return Repo(path) gitrouter = APIRouter() @gitrouter.post("/clone") async def clone(request: RequestBody, background_tasks: BackgroundTasks): local_path, repo_name = generate_repo_path(request.uuid, request.repo_url) if os.path.exists(local_path):" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/api/gitRouter.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\GitPython-3.1.44.dist-info\RECORD: GitPython-3.1.44.dist-info/top_level.txt,sha256=0hzDuIp8obv624V3GmbqsagBWkk8ohtGU-Bc1PmTT0o,4 git/__init__.py,sha256=nkQImgv-bWdiZOFDjzN-gbt93FoRHD0nY6_t9LQxy4Y,8899 git/__pycache__/__init__.cpython-312.pyc,, git/__pycache__/cmd.cpython-312.pyc,, git/__pycache__/compat.cpython-312.pyc,, git/__pycache__/config.cpython-312.pyc,, git/__pycache__/db.cpython-312.pyc,, git/__pycache__/diff.cpython-312.pyc,, git/__pycache__/exc.cpython-312.pyc,, git/__pycache__/remote.cpython-312.pyc,, git/__pycache__/types.cpython-312.pyc,, git/__pycache__/util.cpython-312.pyc,, git/cmd.py,sha256=QwiaBy0mFbi9xjRKhRgUVK-_-K6xVdFqh9l0cxPqPSc,67724 git/compat.py,sha256=y1E6y6O2q5r8clSlr8ZNmuIWG9nmHuehQEsVsmBffs8,4526" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/GitPython-3.1.44.dist-info/RECORD" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\__init__.py: "AppDirs", "PlatformDirsABC", "user_data_dir", "user_config_dir", "user_cache_dir", "user_state_dir", "user_log_dir", "user_documents_dir", "user_downloads_dir", "user_pictures_dir", "user_videos_dir", "user_music_dir", "user_runtime_dir", "site_data_dir", "site_config_dir", "site_cache_dir", "user_data_path", "user_config_path", "user_cache_path", "user_state_path", "user_log_path", "user_documents_path", "user_downloads_path", "user_pictures_path", "user_videos_path", "user_music_path", "user_runtime_path", "site_data_path", "site_config_path", "site_cache_path", ]" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\repo\base.py: # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ from __future__ import annotations __all__ = ["Repo"] import gc import logging import os import os.path as osp from pathlib import Path import re import shlex import sys import warnings import gitdb from gitdb.db.loose import LooseObjectDB from gitdb.exc import BadObject from git.cmd import Git, handle_process_output from git.compat import defenc, safe_decode from git.config import GitConfigParser from git.db import GitCmdObjectDB from git.exc import ( GitCommandError, InvalidGitRepositoryError, NoSuchPathError, ) from git.index import IndexFile from git.objects import Submodule, RootModule, Commit from git.refs import HEAD, Head, Reference, TagReference from git.remote import Remote, add_progress, to_progress_instance from git.util import ( Actor, cygpath, expand_path, finalize_process, hex_to_bin, remove_password_if_present, ) from .fun import (" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/repo/base.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\cmd.py: new_git = os.environ.get(cls._git_exec_env_var, cls.git_exec_name) # Keep track of the old and new git executable path. old_git = cls.GIT_PYTHON_GIT_EXECUTABLE old_refresh_token = cls._refresh_token cls.GIT_PYTHON_GIT_EXECUTABLE = new_git cls._refresh_token = object() # Test if the new git executable path is valid. A GitCommandNotFound error is # raised by us. A PermissionError is raised if the git executable cannot be # executed for whatever reason. has_git = False try: cls().version() has_git = True except (GitCommandNotFound, PermissionError): pass # Warn or raise exception if test failed. if not has_git: err = ( dedent( """\ Bad git executable. The git executable must be specified in one of the following ways: - be included in your $PATH - be set via $%s - explicitly set via git.refresh(<full-path-to-git-executable>) """ )" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/cmd.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\sessions.py: self.security_flags += "; secure" if domain is not None: self.security_flags += f"; domain={domain}" async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ("http", "websocket"): # pragma: no cover await self.app(scope, receive, send) return connection = HTTPConnection(scope) initial_session_was_empty = True if self.session_cookie in connection.cookies: data = connection.cookies[self.session_cookie].encode("utf-8") try: data = self.signer.unsign(data, max_age=self.max_age) scope["session"] = json.loads(b64decode(data)) initial_session_was_empty = False except BadSignature: scope["session"] = {} else: scope["session"] = {} async def send_wrapper(message: Message) -> None: if message["type"] == "http.response.start": if scope["session"]: # We have session data to persist." />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/sessions.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py: provided, it is merged with the instance's ``connection_pool_kw`` variable and used to create the new connection pool, if one is needed. """ if not host: raise LocationValueError("No host specified.") request_context = self._merge_pool_kwargs(pool_kwargs) request_context["scheme"] = scheme or "http" if not port: port = port_by_scheme.get(request_context["scheme"].lower(), 80) request_context["port"] = port request_context["host"] = host return self.connection_from_context(request_context) def connection_from_context(self, request_context): """ Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable. """ scheme = request_context["scheme"].lower() pool_key_constructor = self.key_fn_by_scheme.get(scheme)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\vcs\git.py: # SCP (Secure copy protocol) shorthand. e.g. 'git@example.com:foo/bar.git' SCP_REGEX = re.compile( r"""^ # Optional user, e.g. 'git@' (\w+@)? # Server, e.g. 'github.com'. ([^/:]+): # The server-side path. e.g. 'user/project.git'. Must start with an # alphanumeric character so as not to be confusable with a Windows paths # like 'C:/foo/bar' or 'C:\foo\bar'. (\w[^:]*) $""", re.VERBOSE, ) def looks_like_hash(sha: str) -> bool: return bool(HASH_REGEX.match(sha)) class Git(VersionControl): name = "git" dirname = ".git" repo_name = "clone" schemes = ( "git+http", "git+https", "git+ssh", "git+git", "git+file", ) # Prevent the user's environment variables from interfering with pip: # https://github.com/pypa/pip/issues/1130" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/vcs/git.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\templating.py: 'Replace `TemplateResponse(name, {"context": context})` by `TemplateResponse(request, name)`.', DeprecationWarning, ) if "request" not in kwargs.get("context", {}): raise ValueError('context must include a "request" key') context = kwargs.get("context", {}) request = kwargs.get("request", context.get("request")) name = typing.cast(str, kwargs["name"]) status_code = kwargs.get("status_code", 200) headers = kwargs.get("headers") media_type = kwargs.get("media_type") background = kwargs.get("background") context.setdefault("request", request) for context_processor in self.context_processors: context.update(context_processor(request)) template = self.get_template(name) return _TemplateResponse( template, context, status_code=status_code, headers=headers, media_type=media_type, background=background, )" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/templating.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\pygments\lexers\_mapping.py: 'BSTLexer': ('pip._vendor.pygments.lexers.bibtex', 'BST', ('bst', 'bst-pybtex'), ('*.bst',), ()), 'BareLexer': ('pip._vendor.pygments.lexers.bare', 'BARE', ('bare',), ('*.bare',), ()), 'BaseMakefileLexer': ('pip._vendor.pygments.lexers.make', 'Base Makefile', ('basemake',), (), ()), 'BashLexer': ('pip._vendor.pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'zsh', 'shell'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '*.exheres-0', '*.exlib', '*.zsh', '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc', '.kshrc', 'kshrc', 'PKGBUILD'), ('application/x-sh', 'application/x-shellscript', 'text/x-shellscript')), 'BashSessionLexer': ('pip._vendor.pygments.lexers.shell', 'Bash Session', ('console', 'shell-session'), ('*.sh-session', '*.shell-session'), ('application/x-shell-session', 'application/x-sh-session'))," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: operation.setdefault("responses", {}).setdefault(status_code, {})[ "description" ] = route.response_description if route_response_media_type and is_body_allowed_for_status_code( route.status_code ): response_schema = {"type": "string"} if lenient_issubclass(current_response_class, JSONResponse): if route.response_field: response_schema = get_schema_from_model_field( field=route.response_field, schema_generator=schema_generator, model_name_map=model_name_map, field_mapping=field_mapping, separate_input_output_schemas=separate_input_output_schemas, ) else: response_schema = {} operation.setdefault("responses", {}).setdefault( status_code, {} ).setdefault("content", {}).setdefault(route_response_media_type, {})[ "schema" ] = response_schema if route.responses: operation_responses = operation.setdefault("responses", {}) for ( additional_status_code, additional_response," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\types.py: AnyGitObject = Union["Commit", "Tree", "TagObject", "Blob"] """Union of the :class:`~git.objects.base.Object`-based types that represent actual git object types. As noted in :class:`~git.objects.base.Object`, which has further details, these are: * :class:`Blob <git.objects.blob.Blob>` * :class:`Tree <git.objects.tree.Tree>` * :class:`Commit <git.objects.commit.Commit>` * :class:`TagObject <git.objects.tag.TagObject>` Those GitPython classes represent the four git object types, per :manpage:`gitglossary(7)`: * "blob": https://git-scm.com/docs/gitglossary#def_blob_object * "tree object": https://git-scm.com/docs/gitglossary#def_tree_object * "commit object": https://git-scm.com/docs/gitglossary#def_commit_object * "tag object": https://git-scm.com/docs/gitglossary#def_tag_object For more general information on git objects and their types as git understands them:" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/types.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value="demo.py: from fastapi_cdn_host import monkey_patch_for_docs_ui from fastapi import FastAPI from uvicorn import run from models.gitModels import * from api.gitRouter import gitrouter from tortoise.contrib.fastapi import register_tortoise from db_config import TORTOISE_ORM app = FastAPI() monkey_patch_for_docs_ui(app) register_tortoise(app=app, config=TORTOISE_ORM) @app.get("/user/{id}") async def test(id: str): user= await Users.get(uuid="9992cddb-b7d1-99ec-1bd2-35fdc177e623") print(type(user)) return user app.include_router(gitrouter,prefix="/git") if __name__ == "__main__": run(app,host="127.0.0.1",port=8000)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/demo.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\repo\fun.py: # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ """General repository-related functions.""" from __future__ import annotations __all__ = [ "rev_parse", "is_git_dir", "touch", "find_submodule_git_dir", "name_to_object", "short_to_long", "deref_tag", "to_commit", "find_worktree_git_dir", ] import os import os.path as osp from pathlib import Path import stat from string import digits from gitdb.exc import BadName, BadObject from git.cmd import Git from git.exc import WorkTreeRepositoryUnsupported from git.objects import Object from git.refs import SymbolicReference from git.util import cygpath, bin_to_hex, hex_to_bin # Typing ---------------------------------------------------------------------- from typing import Optional, TYPE_CHECKING, Union, cast, overload from git.types import AnyGitObject, Literal, PathLike if TYPE_CHECKING: from git.db import GitCmdObjectDB from git.objects import Commit, TagObject from git.refs.reference import Reference" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/repo/fun.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\diff.py: # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ __all__ = ["DiffConstants", "NULL_TREE", "INDEX", "Diffable", "DiffIndex", "Diff"] import enum import re import warnings from git.cmd import handle_process_output from git.compat import defenc from git.objects.blob import Blob from git.objects.util import mode_str_to_int from git.util import finalize_process, hex_to_bin # typing ------------------------------------------------------------------ from typing import ( Any, Iterator, List, Match, Optional, Tuple, TYPE_CHECKING, TypeVar, Union, cast, ) from git.types import Literal, PathLike if TYPE_CHECKING: from subprocess import Popen from git.cmd import Git from git.objects.base import IndexObject from git.objects.commit import Commit from git.objects.tree import Tree from git.repo.base import Repo" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/diff.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\urllib3\poolmanager.py: if not pool_key_constructor: raise URLSchemeUnknown(scheme) pool_key = pool_key_constructor(request_context) return self.connection_from_pool_key(pool_key, request_context=request_context) def connection_from_pool_key(self, pool_key, request_context=None): """ Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. ``pool_key`` should be a namedtuple that only contains immutable objects. At a minimum it must have the ``scheme``, ``host``, and ``port`` fields. """ with self.pools.lock: # If the scheme, host, or port doesn't match existing open # connections, open a new ConnectionPool. pool = self.pools.get(pool_key) if pool: return pool # Make a fresh ConnectionPool of the desired type scheme = request_context["scheme"] host = request_context["host"] port = request_context["port"] pool = self._new_pool(scheme, host, port, request_context=request_context)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\applications.py: ) -> None: # pragma: no cover self.router.add_route(path, route, methods=methods, name=name, include_in_schema=include_in_schema) def add_websocket_route( self, path: str, route: typing.Callable[[WebSocket], typing.Awaitable[None]], name: str | None = None, ) -> None: # pragma: no cover self.router.add_websocket_route(path, route, name=name) def exception_handler(self, exc_class_or_status_code: int | type[Exception]) -> typing.Callable: # type: ignore[type-arg] warnings.warn( "The `exception_handler` decorator is deprecated, and will be removed in version 1.0.0. " "Refer to https://www.starlette.io/exceptions/ for the recommended approach.", DeprecationWarning, ) def decorator(func: typing.Callable) -> typing.Callable: # type: ignore[type-arg]" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/applications.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\fastapi\openapi\utils.py: "application/json": { "schema": {"$ref": REF_PREFIX + "HTTPValidationError"} } }, } if "ValidationError" not in definitions: definitions.update( { "ValidationError": validation_error_definition, "HTTPValidationError": validation_error_response_definition, } ) if route.openapi_extra: deep_dict_update(operation, route.openapi_extra) path[method.lower()] = operation return path, security_schemes, definitions def get_fields_from_routes( routes: Sequence[BaseRoute], ) -> List[ModelField]: body_fields_from_routes: List[ModelField] = [] responses_from_routes: List[ModelField] = [] request_fields_from_routes: List[ModelField] = [] callback_flat_models: List[ModelField] = [] for route in routes: if getattr(route, "include_in_schema", None) and isinstance( route, routing.APIRoute ): if route.body_field: assert isinstance( route.body_field, ModelField" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/fastapi/openapi/utils.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\api.py: def user_documents_dir(self) -> str: """:return: documents directory tied to the user""" @property @abstractmethod def user_downloads_dir(self) -> str: """:return: downloads directory tied to the user""" @property @abstractmethod def user_pictures_dir(self) -> str: """:return: pictures directory tied to the user""" @property @abstractmethod def user_videos_dir(self) -> str: """:return: videos directory tied to the user""" @property @abstractmethod def user_music_dir(self) -> str: """:return: music directory tied to the user""" @property @abstractmethod def user_runtime_dir(self) -> str: """:return: runtime directory tied to the user""" @property def user_data_path(self) -> Path: """:return: data path tied to the user""" return Path(self.user_data_dir) @property def site_data_path(self) -> Path: """:return: data path shared by users"""" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/api.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\db.py: # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ """Module with our own gitdb implementation - it uses the git command.""" __all__ = ["GitCmdObjectDB", "GitDB"] from gitdb.base import OInfo, OStream from gitdb.db import GitDB, LooseObjectDB from gitdb.exc import BadObject from git.util import bin_to_hex, hex_to_bin from git.exc import GitCommandError # typing------------------------------------------------- from typing import TYPE_CHECKING from git.types import PathLike if TYPE_CHECKING: from git.cmd import Git # -------------------------------------------------------- class GitCmdObjectDB(LooseObjectDB): """A database representing the default git object store, which includes loose objects, pack files and an alternates file. It will create objects only in the loose object database. """ def __init__(self, root_path: PathLike, git: "Git") -> None: """Initialize this instance with the root and a git command.""" super().__init__(root_path) self._git = git def info(self, binsha: bytes) -> OInfo: """Get a git object header (using git itself)."""" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/db.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\cli\req_command.py: # automatically ContextManager[Any] and self._session becomes Any, # then https://github.com/python/mypy/issues/7696 kicks in assert self._session is not None return self._session def _build_session( self, options: Values, retries: Optional[int] = None, timeout: Optional[int] = None, fallback_to_certifi: bool = False, ) -> PipSession: cache_dir = options.cache_dir assert not cache_dir or os.path.isabs(cache_dir) if "truststore" in options.features_enabled: try: ssl_context = _create_truststore_ssl_context() except Exception: if not fallback_to_certifi: raise ssl_context = None else: ssl_context = None session = PipSession( cache=os.path.join(cache_dir, "http") if cache_dir else None, retries=retries if retries is not None else options.retries, trusted_hosts=options.trusted_hosts, index_urls=self._get_index_urls(options)," />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/cli/req_command.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_vendor\platformdirs\api.py: def user_documents_path(self) -> Path: """:return: documents path tied to the user""" return Path(self.user_documents_dir) @property def user_downloads_path(self) -> Path: """:return: downloads path tied to the user""" return Path(self.user_downloads_dir) @property def user_pictures_path(self) -> Path: """:return: pictures path tied to the user""" return Path(self.user_pictures_dir) @property def user_videos_path(self) -> Path: """:return: videos path tied to the user""" return Path(self.user_videos_dir) @property def user_music_path(self) -> Path: """:return: music path tied to the user""" return Path(self.user_music_dir) @property def user_runtime_path(self) -> Path: """:return: runtime path tied to the user""" return Path(self.user_runtime_dir)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_vendor/platformdirs/api.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\remote.py: # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under the # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ """Module implementing a remote object allowing easy access to git remotes.""" __all__ = ["RemoteProgress", "PushInfo", "FetchInfo", "Remote"] import contextlib import logging import re from git.cmd import Git, handle_process_output from git.compat import defenc, force_text from git.config import GitConfigParser, SectionConstraint, cp from git.exc import GitCommandError from git.refs import Head, Reference, RemoteReference, SymbolicReference, TagReference from git.util import ( CallableRemoteProgress, IterableList, IterableObj, LazyMixin, RemoteProgress, join_path, ) # typing------------------------------------------------------- from typing import ( Any, Callable, Dict, Iterator, List, NoReturn, Optional, Sequence, TYPE_CHECKING, Type, Union, cast, overload, ) from git.types import AnyGitObject, Literal, PathLike if TYPE_CHECKING: from git.objects.commit import Commit" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/remote.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\middleware\authentication.py: from __future__ import annotations import typing from starlette.authentication import ( AuthCredentials, AuthenticationBackend, AuthenticationError, UnauthenticatedUser, ) from starlette.requests import HTTPConnection from starlette.responses import PlainTextResponse, Response from starlette.types import ASGIApp, Receive, Scope, Send class AuthenticationMiddleware: def __init__( self, app: ASGIApp, backend: AuthenticationBackend, on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] | None = None, ) -> None: self.app = app self.backend = backend self.on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] = ( on_error if on_error is not None else self.default_on_error ) async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ["http", "websocket"]: await self.app(scope, receive, send) return conn = HTTPConnection(scope) try: auth_result = await self.backend.authenticate(conn) except AuthenticationError as exc: response = self.on_error(conn, exc)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/middleware/authentication.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\repo\base.py: repo = Repo("~/Development/git-python.git") repo = Repo("$REPOSITORIES/Development/git-python.git") repo = Repo(R"C:\Users\mtrier\Development\git-python\.git") - In *Cygwin*, `path` may be a ``cygdrive/...`` prefixed path. - If `path` is ``None`` or an empty string, :envvar:`GIT_DIR` is used. If that environment variable is absent or empty, the current directory is used. :param odbt: Object DataBase type - a type which is constructed by providing the directory containing the database objects, i.e. ``.git/objects``. It will be used to access all object data. :param search_parent_directories: If ``True``, all parent directories will be searched for a valid repo as well. Please note that this was the default behaviour in older versions of GitPython, which is considered a bug though. :raise git.exc.InvalidGitRepositoryError: :raise git.exc.NoSuchPathError: :return: :class:`Repo` """ epath = path or os.getenv("GIT_DIR")" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/repo/base.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\starlette\routing.py: include_in_schema=include_in_schema, ) self.routes.append(route) def add_websocket_route( self, path: str, endpoint: typing.Callable[[WebSocket], typing.Awaitable[None]], name: str | None = None, ) -> None: # pragma: no cover route = WebSocketRoute(path, endpoint=endpoint, name=name) self.routes.append(route) def route( self, path: str, methods: list[str] | None = None, name: str | None = None, include_in_schema: bool = True, ) -> typing.Callable: # type: ignore[type-arg] """ We no longer document this decorator style API, and its usage is discouraged. Instead you should use the following approach: >>> routes = [Route(path, endpoint=...), ...] >>> app = Starlette(routes=routes) """ warnings.warn( "The `route` decorator is deprecated, and will be removed in version 1.0.0."" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/starlette/routing.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\__init__.py: Optional path to the Git executable. If not absolute, it is resolved immediately, relative to the current directory. :note: The `path` parameter is usually omitted and cannot be used to specify a custom command whose location is looked up in a path search on each call. See :meth:`Git.refresh <git.cmd.Git.refresh>` for details on how to achieve this. :note: This calls :meth:`Git.refresh <git.cmd.Git.refresh>` and sets other global configuration according to the effect of doing so. As such, this function should usually be used instead of using :meth:`Git.refresh <git.cmd.Git.refresh>` or :meth:`FetchInfo.refresh <git.remote.FetchInfo.refresh>` directly. :note: This function is called automatically, with no arguments, at import time. """ global GIT_OK GIT_OK = False if not Git.refresh(path=path): return if not FetchInfo.refresh(): # noqa: F405 return # type: ignore[unreachable] GIT_OK = True try: refresh()" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/__init__.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".idea\workspace.xml: <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="AutoImportSettings"> <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> <list default="true" id="801df9eb-d20f-4251-b634-47239bf95d8b" name="更改" comment="增强安全性与可读性"> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/demo.py" afterDir="false" /> <change beforePath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" beforeDir="false" afterPath="C:/Users/32965/PycharmProjects/GitNexus/models/gitModels.py" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.idea/workspace.xml" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".idea\workspace.xml: <MESSAGE value="更新clone,log,status" /> <MESSAGE value="增强安全性与可读性" /> <option name="LAST_COMMIT_MESSAGE" value="增强安全性与可读性" /> </component> <component name="com.intellij.coverage.CoverageDataManagerImpl"> <SUITE FILE_PATH="coverage/GitNexus$gittest.coverage" NAME="gittest 覆盖结果" MODIFIED="1742402100591" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="C:/Users/32965/PycharmProjects/GitNexus/FastApi" /> <SUITE FILE_PATH="coverage/GitNexus$gitRouter.coverage" NAME="gitRouter 覆盖结果" MODIFIED="1742403755988" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="C:/Users/32965/PycharmProjects/GitNexus/FastApi/api" />" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.idea/workspace.xml" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\pip\_internal\network\download.py: filename = link.filename # fallback # Have a look at the Content-Disposition header for a better guess content_disposition = resp.headers.get("content-disposition") if content_disposition: filename = parse_content_disposition(content_disposition, filename) ext: Optional[str] = splitext(filename)[1] if not ext: ext = mimetypes.guess_extension(resp.headers.get("content-type", "")) if ext: filename += ext if not ext and link.url != resp.url: ext = os.path.splitext(resp.url)[1] if ext: filename += ext return filename def _http_get_download(session: PipSession, link: Link) -> Response: target_url = link.url.split("#", 1)[0] resp = session.get(target_url, headers=HEADERS, stream=True) raise_for_status(resp) return resp class Downloader: def __init__( self, session: PipSession, progress_bar: str, ) -> None: self._session = session" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/pip/_internal/network/download.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\uvicorn\config.py: logging.config.dictConfig(loaded_config) elif isinstance(self.log_config, str) and self.log_config.endswith((".yaml", ".yml")): # Install the PyYAML package or the uvicorn[standard] optional # dependencies to enable this functionality. import yaml with open(self.log_config) as file: loaded_config = yaml.safe_load(file) logging.config.dictConfig(loaded_config) else: # See the note about fileConfig() here: # https://docs.python.org/3/library/logging.config.html#configuration-file-format logging.config.fileConfig(self.log_config, disable_existing_loggers=False) if self.log_level is not None: if isinstance(self.log_level, str): log_level = LOG_LEVELS[self.log_level] else: log_level = self.log_level logging.getLogger("uvicorn.error").setLevel(log_level) logging.getLogger("uvicorn.access").setLevel(log_level)" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/uvicorn/config.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- <KnowledgeReference>
- <option name="chunk" value=".venv\Lib\site-packages\git\objects\base.py: * :class:`Tree <git.objects.tree.Tree>` * :class:`Commit <git.objects.commit.Commit>` * :class:`TagObject <git.objects.tag.TagObject>` See :manpage:`gitglossary(7)` on: * "object": https://git-scm.com/docs/gitglossary#def_object * "object type": https://git-scm.com/docs/gitglossary#def_object_type * "blob": https://git-scm.com/docs/gitglossary#def_blob_object * "tree object": https://git-scm.com/docs/gitglossary#def_tree_object * "commit object": https://git-scm.com/docs/gitglossary#def_commit_object * "tag object": https://git-scm.com/docs/gitglossary#def_tag_object :note: See the :class:`~git.types.AnyGitObject` union type of the four leaf subclasses that represent actual git object types. :note: :class:`~git.objects.submodule.base.Submodule` is defined under the hierarchy" />
- <option name="metadata">
- <KnowledgeReferenceMetadata>
- <option name="source" value="$PROJECT_DIR$/.venv/Lib/site-packages/git/objects/base.py" />
- </KnowledgeReferenceMetadata>
- </option>
- </KnowledgeReference>
- </list>
- </option>
- <option name="command" value="" />
- <option name="conversationId" value="0195b41a198c73c3a9c093d68135fe4f" />
- <option name="historyDocumentMap">
- <map>
- <entry key="file:///C:/Users/32965/PycharmProjects/GitNexus/api/gitRouter.py" value="import os, json,hashlib from fastapi import APIRouter, BackgroundTasks from git import Repo from pydantic import BaseModel from models.gitModels import Users class RequestBody(BaseModel): uuid: str repo_url: str def generate_repo_path(uuid, repo_url): repo_name = repo_url.split("/")[-1].replace(".git", "") base_path = os.path.join("C:/Users/32965/repo", uuid) return os.path.join(base_path, repo_name), repo_name def get_repo(uuid, repo_url): path, _ = generate_repo_path(uuid, repo_url) if not os.path.exists(path): return 0 return Repo(path) gitrouter = APIRouter() @gitrouter.post("/clone") async def clone(request: RequestBody, background_tasks: BackgroundTasks): local_path, repo_name = generate_repo_path(request.uuid, request.repo_url) if os.path.exists(local_path): return {"status": "400", "msg": "仓库已存在", "uuid": request.uuid, "repo_url": request.repo_url, "path": local_path} else: background_tasks.add_task(Repo.clone_from, request.repo_url, local_path) response = {"status": "200", "msg": "成功创建克隆任务", "uuid": request.uuid, "repo_name": repo_name, "local_path": local_path} return response @gitrouter.post("/log") async def log(request: RequestBody): print(request.uuid) user=await Users(uuid=request.uuid) print(user.username) email = user.email print(email) email_md5 = hashlib.md5(email.encode(encoding='UTF-8')).hexdigest() avatar = "https://gravatar.loli.net/avatar/"+email_md5+"?s=512&r=pg" local_path, _ = generate_repo_path(request.uuid, request.repo_url) repo = get_repo(request.uuid, request.repo_url) if not repo: return {"status": "400", "msg": "仓库不存在", "uuid": request.uuid, "repo_url": request.repo_url, "local_path": local_path,"email":email,"avatar":avatar} log_ = repo.git.log('--pretty={"commit":"%h","author":"%an","summary":"%s","date":"%cd"}', max_count=50, date='format:%Y-%m-%d %H:%M').split("\n") log = list(map(json.loads, log_)) response = {"status": "200", "msg": "成功获取日志", "uuid": request.uuid, "repo_url": request.repo_url, "local_path": local_path, "git_log": log} return response @gitrouter.post("/status") async def status(request: RequestBody): repo = get_repo(request.uuid, request.repo_url) # 手动获取所有数据 active_branch = repo.active_branch tracking_branch = active_branch.tracking_branch() ahead = sum(1 for _ in repo.iter_commits(f"{active_branch}..{tracking_branch}")) behind = sum(1 for _ in repo.iter_commits(f"{tracking_branch}..{active_branch}")) conflicts = repo.index.unmerged_blobs() conflicted = [path for path, entries in conflicts.items()] created_files = repo.untracked_files current = repo.active_branch.name head_commit = repo.head.commit tree = head_commit.tree all_files = [item.path for item in tree.traverse() if item.type == 'blob'] diffs = repo.index.diff(None) deleted = [d.a_path for d in diffs if d.change_type == 'D'] detached = repo.head.is_detached ignored_files = repo.git.execute(["git", "ls-files", "--others", "--ignored", "--exclude-standard"]).split("\n") modified_files = [d.a_path for d in diffs] untracked_files = repo.untracked_files staged_entries = repo.index.entries staged = [path[0] for path, _ in staged_entries.items()] tracking = active_branch.tracking_branch().name status = {"ahead": ahead, "behind": behind, "conflicted": conflicted, "created": created_files, "current": current, "deleted": deleted, "detached": detached, "files": all_files, "ignored": ignored_files, "modified": modified_files, "not_added": untracked_files, "staged": staged, "tracking": tracking} return status " />
- </map>
- </option>
- <option name="messageId" value="0195b41a198c72b7887b43d84c1b4d31" />
- <option name="question" value="这里olt路由打印的fhvi怎么是Mlmv?" />
- <option name="rating" value="UNRATED" />
- <option name="referenceBeans">
- <list />
- </option>
- <option name="status" value="SUCCESS" />
- <option name="variables">
- <list />
- </option>
- </Turn>
- </list>
- </option>
- <option name="updateTime" value="1742483449480" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742466058549" />
- <option name="id" value="0195b3120935765ca075fe467ac73da5" />
- <option name="title" value="新对话 2025年3月20日 18:20:58" />
- <option name="updateTime" value="1742466058549" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742390504729" />
- <option name="id" value="0195ae912d197868ab44335846c122f6" />
- <option name="title" value="新对话 2025年3月19日 21:21:44" />
- <option name="updateTime" value="1742390504729" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742382368179" />
- <option name="id" value="0195ae1505b37b5faf8e0d8fb5c30336" />
- <option name="title" value="新对话 2025年3月19日 19:06:08" />
- <option name="updateTime" value="1742382368179" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742376286697" />
- <option name="id" value="0195adb839e971648c198471283307dc" />
- <option name="title" value="新对话 2025年3月19日 17:24:46" />
- <option name="updateTime" value="1742376286697" />
- </Conversation>
- <Conversation>
- <option name="createTime" value="1742363604602" />
- <option name="id" value="0195acf6b67a7859bf046bc3abaf64bd" />
- <option name="title" value="新对话 2025年3月19日 13:53:24" />
- <option name="updateTime" value="1742363604602" />
- </Conversation>
- </list>
- </option>
- </component>
- </project>
|