403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/jedi/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/jedi/api/keywords.py
import pydoc
from contextlib import suppress
from typing import Dict, Optional

from jedi.inference.names import AbstractArbitraryName

try:
    # https://github.com/python/typeshed/pull/4351 adds pydoc_data
    from pydoc_data import topics  # type: ignore[import]
    pydoc_topics: Optional[Dict[str, str]] = topics.topics
except ImportError:
    # Python 3.6.8 embeddable does not have pydoc_data.
    pydoc_topics = None


class KeywordName(AbstractArbitraryName):
    api_type = 'keyword'

    def py__doc__(self):
        return imitate_pydoc(self.string_name)


def imitate_pydoc(string):
    """
    It's not possible to get the pydoc's without starting the annoying pager
    stuff.
    """
    if pydoc_topics is None:
        return ''

    h = pydoc.help
    with suppress(KeyError):
        # try to access symbols
        string = h.symbols[string]
        string, _, related = string.partition(' ')

    def get_target(s):
        return h.topics.get(s, h.keywords.get(s))

    while isinstance(string, str):
        string = get_target(string)

    try:
        # is a tuple now
        label, related = string
    except TypeError:
        return ''

    try:
        return pydoc_topics[label].strip() if pydoc_topics else ''
    except KeyError:
        return ''

Youez - 2016 - github.com/yon3zu
LinuXploit