content
stringlengths
1
103k
path
stringlengths
8
216
filename
stringlengths
2
179
language
stringclasses
15 values
size_bytes
int64
2
189k
quality_score
float64
0.5
0.95
complexity
float64
0
1
documentation_ratio
float64
0
1
repository
stringclasses
5 values
stars
int64
0
1k
created_date
stringdate
2023-07-10 19:21:08
2025-07-09 19:11:45
license
stringclasses
4 values
is_test
bool
2 classes
file_hash
stringlengths
32
32
#!/usr/bin/env python\n"""\ndisplay environment information that is frequently\nused to troubleshoot installations of Jupyter or IPython\n"""\n\nfrom __future__ import annotations\n\nimport os\nimport platform\nimport subprocess\nimport sys\nfrom typing import Any, Optional, Union\n\n\ndef subs(cmd: Union[list[str], str]) -> Optional[str]:\n """\n get data from commands that we need to run outside of python\n """\n try:\n stdout = subprocess.check_output(cmd) # noqa: S603\n return stdout.decode("utf-8", "replace").strip()\n except (OSError, subprocess.CalledProcessError):\n return None\n\n\ndef get_data() -> dict[str, Any]:\n """\n returns a dict of various user environment data\n """\n env: dict[str, Any] = {}\n env["path"] = os.environ.get("PATH")\n env["sys_path"] = sys.path\n env["sys_exe"] = sys.executable\n env["sys_version"] = sys.version\n env["platform"] = platform.platform()\n # FIXME: which on Windows?\n if sys.platform == "win32":\n env["where"] = subs(["where", "jupyter"])\n env["which"] = None\n else:\n env["which"] = subs(["which", "-a", "jupyter"])\n env["where"] = None\n env["pip"] = subs([sys.executable, "-m", "pip", "list"])\n env["conda"] = subs(["conda", "list"])\n env["conda-env"] = subs(["conda", "env", "export"])\n return env\n\n\ndef main() -> None:\n """\n print out useful info\n """\n # pylint: disable=superfluous-parens\n # args = get_args()\n if "_ARGCOMPLETE" in os.environ:\n # No arguments to complete, the script can be slow to run to completion,\n # so in case someone tries to complete jupyter troubleshoot just exit early\n return\n\n environment_data = get_data()\n\n print("$PATH:")\n for directory in environment_data["path"].split(os.pathsep):\n print(f"\t{directory}")\n\n print("\nsys.path:")\n for directory in environment_data["sys_path"]:\n print(f"\t{directory}")\n\n print("\nsys.executable:")\n print(f"\t{environment_data['sys_exe']}")\n\n print("\nsys.version:")\n if "\n" in environment_data["sys_version"]:\n for data in environment_data["sys_version"].split("\n"):\n print(f"\t{data}")\n else:\n print(f"\t{environment_data['sys_version']}")\n\n print("\nplatform.platform():")\n print(f"\t{environment_data['platform']}")\n\n if environment_data["which"]:\n print("\nwhich -a jupyter:")\n for line in environment_data["which"].split("\n"):\n print(f"\t{line}")\n\n if environment_data["where"]:\n print("\nwhere jupyter:")\n for line in environment_data["where"].split("\n"):\n print(f"\t{line}")\n\n if environment_data["pip"]:\n print("\npip list:")\n for package in environment_data["pip"].split("\n"):\n print(f"\t{package}")\n\n if environment_data["conda"]:\n print("\nconda list:")\n for package in environment_data["conda"].split("\n"):\n print(f"\t{package}")\n\n if environment_data["conda-env"]:\n print("\nconda env:")\n for package in environment_data["conda-env"].split("\n"):\n print(f"\t{package}")\n\n\nif __name__ == "__main__":\n main()\n
.venv\Lib\site-packages\jupyter_core\troubleshoot.py
troubleshoot.py
Python
3,192
0.95
0.189189
0.066667
python-kit
192
2024-02-15T16:26:51.190808
MIT
false
a28467923cf4ca8908a49787df74f6e8
"""\nstore the current version info of the jupyter_core.\n"""\n\nfrom __future__ import annotations\n\nimport re\n\n# Version string must appear intact for hatch versioning\n__version__ = "5.8.1"\n\n# Build up version_info tuple for backwards compatibility\npattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"\nmatch = re.match(pattern, __version__)\nassert match is not None\nparts: list[object] = [int(match[part]) for part in ["major", "minor", "patch"]]\nif match["rest"]:\n parts.append(match["rest"])\nversion_info = tuple(parts)\n
.venv\Lib\site-packages\jupyter_core\version.py
version.py
Python
539
0.95
0.210526
0.133333
python-kit
51
2025-03-10T16:23:32.267192
BSD-3-Clause
false
2d3d9a5a5be83e6be3404d509b036d20
from __future__ import annotations\n\nfrom .version import __version__, version_info # noqa: F401\n
.venv\Lib\site-packages\jupyter_core\__init__.py
__init__.py
Python
97
0.75
0
0
python-kit
496
2025-06-01T07:30:56.066383
BSD-3-Clause
false
51964b00169e2c70eddb8dfab1eaf307
"""Launch the root jupyter command"""\n\nfrom __future__ import annotations\n\nfrom .command import main\n\nmain()\n
.venv\Lib\site-packages\jupyter_core\__main__.py
__main__.py
Python
109
0.85
0
0
awesome-app
583
2024-02-25T01:33:39.213400
MIT
false
6c95ee344f40df42d83fa593fbcb0771
# Copyright (c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\nfrom __future__ import annotations\n\nimport asyncio\nimport atexit\nimport errno\nimport inspect\nimport sys\nimport threading\nimport warnings\nfrom contextvars import ContextVar\nfrom pathlib import Path\nfrom types import FrameType\nfrom typing import Any, Awaitable, Callable, TypeVar, cast\n\n\ndef ensure_dir_exists(path: str | Path, mode: int = 0o777) -> None:\n """Ensure that a directory exists\n\n If it doesn't exist, try to create it, protecting against a race condition\n if another process is doing the same.\n The default permissions are determined by the current umask.\n """\n try:\n Path(path).mkdir(parents=True, mode=mode)\n except OSError as e:\n if e.errno != errno.EEXIST:\n raise\n if not Path(path).is_dir():\n msg = f"{path!r} exists but is not a directory"\n raise OSError(msg)\n\n\ndef _get_frame(level: int) -> FrameType | None:\n """Get the frame at the given stack level."""\n # sys._getframe is much faster than inspect.stack, but isn't guaranteed to\n # exist in all python implementations, so we fall back to inspect.stack()\n\n # We need to add one to level to account for this get_frame call.\n if hasattr(sys, "_getframe"):\n frame = sys._getframe(level + 1)\n else:\n frame = inspect.stack(context=0)[level + 1].frame\n return frame\n\n\n# This function is from https://github.com/python/cpython/issues/67998\n# (https://bugs.python.org/file39550/deprecated_module_stacklevel.diff) and\n# calculates the appropriate stacklevel for deprecations to target the\n# deprecation for the caller, no matter how many internal stack frames we have\n# added in the process. For example, with the deprecation warning in the\n# __init__ below, the appropriate stacklevel will change depending on how deep\n# the inheritance hierarchy is.\ndef _external_stacklevel(internal: list[str]) -> int:\n """Find the stacklevel of the first frame that doesn't contain any of the given internal strings\n\n The depth will be 1 at minimum in order to start checking at the caller of\n the function that called this utility method.\n """\n # Get the level of my caller's caller\n level = 2\n frame = _get_frame(level)\n\n # Normalize the path separators:\n normalized_internal = [str(Path(s)) for s in internal]\n\n # climb the stack frames while we see internal frames\n while frame and any(s in str(Path(frame.f_code.co_filename)) for s in normalized_internal):\n level += 1\n frame = frame.f_back\n\n # Return the stack level from the perspective of whoever called us (i.e., one level up)\n return level - 1\n\n\ndef deprecation(message: str, internal: str | list[str] = "jupyter_core/") -> None:\n """Generate a deprecation warning targeting the first frame that is not 'internal'\n\n internal is a string or list of strings, which if they appear in filenames in the\n frames, the frames will be considered internal. Changing this can be useful if, for example,\n we know that our internal code is calling out to another library.\n """\n _internal: list[str]\n _internal = [internal] if isinstance(internal, str) else internal\n\n # stack level of the first external frame from here\n stacklevel = _external_stacklevel(_internal)\n\n # The call to .warn adds one frame, so bump the stacklevel up by one\n warnings.warn(message, DeprecationWarning, stacklevel=stacklevel + 1)\n\n\nT = TypeVar("T")\n\n\nclass _TaskRunner:\n """A task runner that runs an asyncio event loop on a background thread."""\n\n def __init__(self) -> None:\n self.__io_loop: asyncio.AbstractEventLoop | None = None\n self.__runner_thread: threading.Thread | None = None\n self.__lock = threading.Lock()\n atexit.register(self._close)\n\n def _close(self) -> None:\n if self.__io_loop:\n self.__io_loop.stop()\n\n def _runner(self) -> None:\n loop = self.__io_loop\n assert loop is not None\n try:\n loop.run_forever()\n finally:\n loop.close()\n\n def run(self, coro: Any) -> Any:\n """Synchronously run a coroutine on a background thread."""\n with self.__lock:\n name = f"{threading.current_thread().name} - runner"\n if self.__io_loop is None:\n self.__io_loop = asyncio.new_event_loop()\n self.__runner_thread = threading.Thread(target=self._runner, daemon=True, name=name)\n self.__runner_thread.start()\n fut = asyncio.run_coroutine_threadsafe(coro, self.__io_loop)\n return fut.result(None)\n\n\n_runner_map: dict[str, _TaskRunner] = {}\n_loop: ContextVar[asyncio.AbstractEventLoop | None] = ContextVar("_loop", default=None)\n\n\ndef run_sync(coro: Callable[..., Awaitable[T]]) -> Callable[..., T]:\n """Wraps coroutine in a function that blocks until it has executed.\n\n Parameters\n ----------\n coro : coroutine-function\n The coroutine-function to be executed.\n\n Returns\n -------\n result :\n Whatever the coroutine-function returns.\n """\n\n assert inspect.iscoroutinefunction(coro)\n\n def wrapped(*args: Any, **kwargs: Any) -> Any:\n name = threading.current_thread().name\n inner = coro(*args, **kwargs)\n try:\n asyncio.get_running_loop()\n except RuntimeError:\n # No loop running, run the loop for this thread.\n loop = ensure_event_loop()\n return loop.run_until_complete(inner)\n\n # Loop is currently running in this thread,\n # use a task runner.\n if name not in _runner_map:\n _runner_map[name] = _TaskRunner()\n return _runner_map[name].run(inner)\n\n wrapped.__doc__ = coro.__doc__\n return wrapped\n\n\ndef ensure_event_loop(prefer_selector_loop: bool = False) -> asyncio.AbstractEventLoop:\n # Get the loop for this thread, or create a new one.\n loop = _loop.get()\n if loop is not None and not loop.is_closed():\n return loop\n try:\n loop = asyncio.get_running_loop()\n except RuntimeError:\n if sys.platform == "win32" and prefer_selector_loop:\n loop = asyncio.WindowsSelectorEventLoopPolicy().new_event_loop()\n else:\n loop = asyncio.new_event_loop()\n asyncio.set_event_loop(loop)\n _loop.set(loop)\n return loop\n\n\nasync def ensure_async(obj: Awaitable[T] | T) -> T:\n """Convert a non-awaitable object to a coroutine if needed,\n and await it if it was not already awaited.\n\n This function is meant to be called on the result of calling a function,\n when that function could either be asynchronous or not.\n """\n if inspect.isawaitable(obj):\n obj = cast(Awaitable[T], obj)\n try:\n result = await obj\n except RuntimeError as e:\n if str(e) == "cannot reuse already awaited coroutine":\n # obj is already the coroutine's result\n return cast(T, obj)\n raise\n return result\n return obj\n
.venv\Lib\site-packages\jupyter_core\utils\__init__.py
__init__.py
Python
7,070
0.95
0.264706
0.141104
awesome-app
387
2024-08-26T18:56:56.174433
GPL-3.0
false
95950443f7b9a46a7fa8096db56ec6fb
\n\n
.venv\Lib\site-packages\jupyter_core\utils\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
9,694
0.95
0.176471
0.013158
awesome-app
643
2025-03-10T05:12:48.179222
Apache-2.0
false
e629397fbc040748fc9eea5a0426d803
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\application.cpython-313.pyc
application.cpython-313.pyc
Other
14,418
0.95
0.045455
0
node-utils
526
2024-02-29T11:34:09.379994
GPL-3.0
false
d8d4d1d0772265619fb31bfb7723d898
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\command.cpython-313.pyc
command.cpython-313.pyc
Other
17,364
0.95
0.072581
0.00885
node-utils
526
2023-12-22T19:39:46.767701
GPL-3.0
false
a279b50e42dea9c4ee72a6d1a944deef
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\migrate.cpython-313.pyc
migrate.cpython-313.pyc
Other
12,171
0.95
0.04321
0.007353
python-kit
268
2024-04-22T23:25:09.991983
BSD-3-Clause
false
bb52b560766fafabab1105e41ad60ba9
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\paths.cpython-313.pyc
paths.cpython-313.pyc
Other
41,721
0.95
0.061181
0.007444
python-kit
743
2024-12-06T20:33:06.537539
BSD-3-Clause
false
cc33f70558372470688d358fe5c8a850
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\troubleshoot.cpython-313.pyc
troubleshoot.cpython-313.pyc
Other
4,425
0.8
0
0
awesome-app
814
2024-07-19T19:45:11.391666
Apache-2.0
false
766fa18fcb98a746a31cc078adfa0ae3
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\version.cpython-313.pyc
version.cpython-313.pyc
Other
864
0.8
0
0
python-kit
755
2025-05-19T10:46:30.126882
Apache-2.0
false
82a8e1c94e3b3c3941beeb62fc692396
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
311
0.7
0
0
react-lib
525
2025-05-18T00:02:30.707380
GPL-3.0
false
0c6706209bd0ec96882bb6deffa2cc97
\n\n
.venv\Lib\site-packages\jupyter_core\__pycache__\__main__.cpython-313.pyc
__main__.cpython-313.pyc
Other
346
0.7
0
0
python-kit
88
2024-08-28T06:41:36.034715
BSD-3-Clause
false
b25947b18a4aa9b7f638415f6dc7d834
[console_scripts]\njupyter = jupyter_core.command:main\njupyter-migrate = jupyter_core.migrate:main\njupyter-troubleshoot = jupyter_core.troubleshoot:main\n
.venv\Lib\site-packages\jupyter_core-5.8.1.dist-info\entry_points.txt
entry_points.txt
Other
152
0.7
0
0
vue-tools
261
2025-02-17T13:28:29.444865
MIT
false
044e4a5cd8b73da36366766a338b7e5f
pip\n
.venv\Lib\site-packages\jupyter_core-5.8.1.dist-info\INSTALLER
INSTALLER
Other
4
0.5
0
0
react-lib
469
2025-01-01T17:03:22.517549
MIT
false
365c9bfeb7d89244f2ce01c1de44cb85
Metadata-Version: 2.4\nName: jupyter_core\nVersion: 5.8.1\nSummary: Jupyter core package. A base package on which Jupyter projects rely.\nProject-URL: Homepage, https://jupyter.org\nProject-URL: Documentation, https://jupyter-core.readthedocs.io/\nProject-URL: Source, https://github.com/jupyter/jupyter_core\nProject-URL: Tracker, https://github.com/jupyter/jupyter_core/issues\nAuthor-email: Jupyter Development Team <jupyter@googlegroups.org>\nLicense-Expression: BSD-3-Clause\nLicense-File: LICENSE\nClassifier: Framework :: Jupyter\nClassifier: Intended Audience :: Developers\nClassifier: Intended Audience :: Science/Research\nClassifier: Intended Audience :: System Administrators\nClassifier: Programming Language :: Python\nClassifier: Programming Language :: Python :: 3\nRequires-Python: >=3.8\nRequires-Dist: platformdirs>=2.5\nRequires-Dist: pywin32>=300; sys_platform == 'win32' and platform_python_implementation != 'PyPy'\nRequires-Dist: traitlets>=5.3\nProvides-Extra: docs\nRequires-Dist: intersphinx-registry; extra == 'docs'\nRequires-Dist: myst-parser; extra == 'docs'\nRequires-Dist: pydata-sphinx-theme; extra == 'docs'\nRequires-Dist: sphinx-autodoc-typehints; extra == 'docs'\nRequires-Dist: sphinxcontrib-spelling; extra == 'docs'\nRequires-Dist: traitlets; extra == 'docs'\nProvides-Extra: test\nRequires-Dist: ipykernel; extra == 'test'\nRequires-Dist: pre-commit; extra == 'test'\nRequires-Dist: pytest-cov; extra == 'test'\nRequires-Dist: pytest-timeout; extra == 'test'\nRequires-Dist: pytest<9; extra == 'test'\nDescription-Content-Type: text/plain\n\nThere is no reason to install this package on its own.
.venv\Lib\site-packages\jupyter_core-5.8.1.dist-info\METADATA
METADATA
Other
1,603
0.8
0
0
awesome-app
349
2023-12-01T23:47:47.097274
BSD-3-Clause
false
18b37b552ac38e5f2005801bd233fc2a
../../Scripts/jupyter-migrate.exe,sha256=xFPSea6J8ZtgmXSu_V01LgSbLH1HMtM4oerwhwKjpCU,108421\n../../Scripts/jupyter-troubleshoot.exe,sha256=8o7xAbSRLIWL4du0eABRaiB7UrWSHDgddsHtUygQmzY,108426\n../../Scripts/jupyter.exe,sha256=CaJFros0zDTohnOdn7AsuvB703aMFcrHV1IqHIvZXRQ,108421\n__pycache__/jupyter.cpython-313.pyc,,\njupyter.py,sha256=kBEriJ7f1nd8X6VH6dfrJefy81PUyRXk36aHlDV95xk,156\njupyter_core-5.8.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4\njupyter_core-5.8.1.dist-info/METADATA,sha256=Iz1pJHK-6iEw0Ua6hSf-Dce5s_GxTzlO3xPDKhXGsyc,1603\njupyter_core-5.8.1.dist-info/RECORD,,\njupyter_core-5.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87\njupyter_core-5.8.1.dist-info/entry_points.txt,sha256=EiJLUbf5Zt207UYCs4ILxYA_EzbMSo8pC98nk7gIfUI,152\njupyter_core-5.8.1.dist-info/licenses/LICENSE,sha256=RI8YNfX6CN0HUIjkb3b3PrmsnCrvCmyIFr4G0w71ksc,1536\njupyter_core/__init__.py,sha256=V1l87PR0VEmAjbms74SBsNrsvT7Epsg_QLPkjT-RSjQ,97\njupyter_core/__main__.py,sha256=tdL8bGU9uLkaMXqsuqL6V199XURLgmsE3JNka-A7RZo,109\njupyter_core/__pycache__/__init__.cpython-313.pyc,,\njupyter_core/__pycache__/__main__.cpython-313.pyc,,\njupyter_core/__pycache__/application.cpython-313.pyc,,\njupyter_core/__pycache__/command.cpython-313.pyc,,\njupyter_core/__pycache__/migrate.cpython-313.pyc,,\njupyter_core/__pycache__/paths.cpython-313.pyc,,\njupyter_core/__pycache__/troubleshoot.cpython-313.pyc,,\njupyter_core/__pycache__/version.cpython-313.pyc,,\njupyter_core/application.py,sha256=5eFplo9UPYk7r2PhGM04aSO5WrPReAxlWMat2vb8efs,10398\njupyter_core/command.py,sha256=RNmBdDb4ysUXxXTraTRJih4YkZL61DJk74CmotpALGI,15721\njupyter_core/migrate.py,sha256=Yhk-zhPidrKFBP6qzoffiUP3F9QmnTwDc4o8YHlXsdg,8696\njupyter_core/paths.py,sha256=B-ik6M51PnPQYX99hJJ-Hf_vNmDMZEPy5CAvGJ9UgTw,38804\njupyter_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0\njupyter_core/troubleshoot.py,sha256=fKTDCTFtui9k8EIcFfIDwVtFcVGBBiNkzemhrf07k0U,3192\njupyter_core/utils/__init__.py,sha256=8nYreftbPFXXn0d74z29Fzf_StkTg6iY-HCIRGMXblY,7070\njupyter_core/utils/__pycache__/__init__.cpython-313.pyc,,\njupyter_core/version.py,sha256=VuQpRGietTXdCF97Or55cwjr3VM3ZsB9K1LBV3i3agY,539\n
.venv\Lib\site-packages\jupyter_core-5.8.1.dist-info\RECORD
RECORD
Other
2,208
0.7
0
0
vue-tools
118
2025-01-15T01:35:54.374757
BSD-3-Clause
false
39d4040aaa31fc117f39a3382856fe71
Wheel-Version: 1.0\nGenerator: hatchling 1.27.0\nRoot-Is-Purelib: true\nTag: py3-none-any\n
.venv\Lib\site-packages\jupyter_core-5.8.1.dist-info\WHEEL
WHEEL
Other
87
0.5
0
0
node-utils
496
2023-10-31T08:17:56.943738
GPL-3.0
false
e2fcb0ad9ea59332c808928b4b439e7a
BSD 3-Clause License\n\n- Copyright (c) 2015-, Jupyter Development Team\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n
.venv\Lib\site-packages\jupyter_core-5.8.1.dist-info\licenses\LICENSE
LICENSE
Other
1,536
0.7
0
0
react-lib
830
2024-03-13T03:55:28.937021
GPL-3.0
false
a5cc41e8bc83e8e689ce2c7bb0ceba14
"""The cli for jupyter events."""\nfrom __future__ import annotations\n\nimport json\nimport pathlib\nimport platform\n\nimport click\nfrom jsonschema import ValidationError\nfrom rich.console import Console\nfrom rich.json import JSON\nfrom rich.markup import escape\nfrom rich.padding import Padding\nfrom rich.style import Style\n\nfrom jupyter_events.schema import EventSchema, EventSchemaFileAbsent, EventSchemaLoadingError\n\nWIN = platform.system() == "Windows"\n\n\nclass RC:\n """Return code enum."""\n\n OK = 0\n INVALID = 1\n UNPARSABLE = 2\n NOT_FOUND = 3\n\n\nclass EMOJI:\n """Terminal emoji enum"""\n\n X = "XX" if WIN else "\u274c"\n OK = "OK" if WIN else "\u2714"\n\n\nconsole = Console()\nerror_console = Console(stderr=True)\n\n\n@click.group()\n@click.version_option()\ndef main() -> None:\n """A simple CLI tool to quickly validate JSON schemas against\n Jupyter Event's custom validator.\n\n You can see Jupyter Event's meta-schema here:\n\n https://raw.githubusercontent.com/jupyter/jupyter_events/main/jupyter_events/schemas/event-metaschema.yml\n """\n\n\n@click.command()\n@click.argument("schema")\n@click.pass_context\ndef validate(ctx: click.Context, schema: str) -> int:\n """Validate a SCHEMA against Jupyter Event's meta schema.\n\n SCHEMA can be a JSON/YAML string or filepath to a schema.\n """\n console.rule("Validating the following schema", style=Style(color="blue"))\n\n _schema = None\n try:\n # attempt to read schema as a serialized string\n _schema = EventSchema._load_schema(schema)\n except EventSchemaLoadingError:\n # pass here to avoid printing traceback of this exception if next block\n # excepts\n pass\n\n # if not a serialized schema string, try to interpret it as a path to schema file\n if _schema is None:\n schema_path = pathlib.Path(schema)\n try:\n _schema = EventSchema._load_schema(schema_path)\n except (EventSchemaLoadingError, EventSchemaFileAbsent) as e:\n # no need for full tracestack for user error exceptions. just print\n # the error message and return\n error_console.print(f"[bold red]ERROR[/]: {e}")\n return ctx.exit(RC.UNPARSABLE)\n\n # Print what was found.\n schema_json = JSON(json.dumps(_schema))\n console.print(Padding(schema_json, (1, 0, 1, 4)))\n # Now validate this schema against the meta-schema.\n try:\n EventSchema(_schema)\n console.rule("Results", style=Style(color="green"))\n out = Padding(f"[green]{EMOJI.OK}[white] Nice work! This schema is valid.", (1, 0, 1, 0))\n console.print(out)\n return ctx.exit(RC.OK)\n except ValidationError as err:\n error_console.rule("Results", style=Style(color="red"))\n error_console.print(f"[red]{EMOJI.X} [white]The schema failed to validate.")\n error_console.print("\nWe found the following error with your schema:")\n out = escape(str(err)) # type:ignore[assignment]\n error_console.print(Padding(out, (1, 0, 1, 4)))\n return ctx.exit(RC.INVALID)\n\n\nmain.add_command(validate)\n
.venv\Lib\site-packages\jupyter_events\cli.py
cli.py
Python
3,087
0.95
0.156863
0.102564
vue-tools
374
2023-08-29T01:31:17.604729
Apache-2.0
false
6102d0c211dc4c12aea3af794681dc24
"""\nEmit structured, discrete events when various actions happen.\n"""\nfrom __future__ import annotations\n\nimport asyncio\nimport copy\nimport json\nimport logging\nimport typing as t\nimport warnings\nfrom datetime import datetime, timezone\nfrom importlib.metadata import version\n\nfrom jsonschema import ValidationError\nfrom packaging.version import parse\nfrom traitlets import Dict, Instance, Set, default\nfrom traitlets.config import Config, LoggingConfigurable\n\nfrom .schema import SchemaType\nfrom .schema_registry import SchemaRegistry\nfrom .traits import Handlers\nfrom .validators import JUPYTER_EVENTS_CORE_VALIDATOR\n\n# Check if the version is greater than 3.1.0\nversion_info = version("python-json-logger")\nif parse(version_info) >= parse("3.1.0"):\n from pythonjsonlogger.json import JsonFormatter\nelse:\n from pythonjsonlogger.jsonlogger import JsonFormatter # type: ignore[attr-defined]\n\n# Increment this version when the metadata included with each event\n# changes.\nEVENTS_METADATA_VERSION = 1\n\n\nclass SchemaNotRegistered(Warning):\n """A warning to raise when an event is given to the logger\n but its schema has not be registered with the EventLogger\n """\n\n\nclass ModifierError(Exception):\n """An exception to raise when a modifier does not\n show the proper signature.\n """\n\n\nclass CoreMetadataError(Exception):\n """An exception raised when event core metadata is not valid."""\n\n\n# Only show this warning on the first instance\n# of each event type that fails to emit.\nwarnings.simplefilter("once", SchemaNotRegistered)\n\n\nclass ListenerError(Exception):\n """An exception to raise when a listener does not\n show the proper signature.\n """\n\n\nclass EventLogger(LoggingConfigurable):\n """\n An Event logger for emitting structured events.\n\n Event schemas must be registered with the\n EventLogger using the `register_schema` or\n `register_schema_file` methods. Every schema\n will be validated against Jupyter Event's metaschema.\n """\n\n handlers = Handlers(\n default_value=None,\n allow_none=True,\n help="""A list of logging.Handler instances to send events to.\n\n When set to None (the default), all events are discarded.\n """,\n ).tag(config=True)\n\n schemas = Instance(\n SchemaRegistry,\n help="""The SchemaRegistry for caching validated schemas\n and their jsonschema validators.\n """,\n )\n\n _modifiers = Dict({}, help="A mapping of schemas to their list of modifiers.")\n\n _modified_listeners = Dict({}, help="A mapping of schemas to the listeners of modified events.")\n\n _unmodified_listeners = Dict(\n {}, help="A mapping of schemas to the listeners of unmodified/raw events."\n )\n\n _active_listeners: set[asyncio.Task[t.Any]] = Set() # type:ignore[assignment]\n\n async def gather_listeners(self) -> list[t.Any]:\n """Gather all of the active listeners."""\n return await asyncio.gather(*self._active_listeners, return_exceptions=True)\n\n @default("schemas")\n def _default_schemas(self) -> SchemaRegistry:\n return SchemaRegistry()\n\n def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:\n """Initialize the logger."""\n # We need to initialize the configurable before\n # adding the logging handlers.\n super().__init__(*args, **kwargs)\n # Use a unique name for the logger so that multiple instances of EventLog do not write\n # to each other's handlers.\n log_name = __name__ + "." + str(id(self))\n self._logger = logging.getLogger(log_name)\n # We don't want events to show up in the default logs\n self._logger.propagate = False\n # We will use log.info to emit\n self._logger.setLevel(logging.INFO)\n # Add each handler to the logger and format the handlers.\n if self.handlers:\n for handler in self.handlers:\n self.register_handler(handler)\n\n def _load_config(\n self,\n cfg: Config,\n section_names: list[str] | None = None, # noqa: ARG002\n traits: list[str] | None = None, # type:ignore[override] # noqa: ARG002\n ) -> None:\n """Load EventLogger traits from a Config object, patching the\n handlers trait in the Config object to avoid deepcopy errors.\n """\n my_cfg = self._find_my_config(cfg)\n handlers: list[logging.Handler] = my_cfg.pop("handlers", [])\n\n # Turn handlers list into a pickeable function\n def get_handlers() -> list[logging.Handler]:\n return handlers\n\n my_cfg["handlers"] = get_handlers\n\n # Build a new eventlog config object.\n eventlogger_cfg = Config({"EventLogger": my_cfg})\n super()._load_config(eventlogger_cfg, section_names=None, traits=None)\n\n def register_event_schema(self, schema: SchemaType) -> None:\n """Register this schema with the schema registry.\n\n Get this registered schema using the EventLogger.schema.get() method.\n """\n event_schema = self.schemas.register(schema) # type:ignore[arg-type]\n key = event_schema.id\n # It's possible that listeners and modifiers have been added for this\n # schema before the schema is registered.\n if key not in self._modifiers:\n self._modifiers[key] = set()\n if key not in self._modified_listeners:\n self._modified_listeners[key] = set()\n if key not in self._unmodified_listeners:\n self._unmodified_listeners[key] = set()\n\n def register_handler(self, handler: logging.Handler) -> None:\n """Register a new logging handler to the Event Logger.\n\n All outgoing messages will be formatted as a JSON string.\n """\n\n def _handle_message_field(record: t.Any, **kwargs: t.Any) -> str:\n """Python's logger always emits the "message" field with\n the value as "null" unless it's present in the schema/data.\n Message happens to be a common field for event logs,\n so special case it here and only emit it if "message"\n is found the in the schema's property list.\n """\n schema = self.schemas.get(record["__schema__"])\n if "message" not in schema.properties:\n del record["message"]\n return json.dumps(record, **kwargs)\n\n formatter = JsonFormatter(\n json_serializer=_handle_message_field,\n )\n handler.setFormatter(formatter)\n self._logger.addHandler(handler)\n if handler not in self.handlers:\n self.handlers.append(handler)\n\n def remove_handler(self, handler: logging.Handler) -> None:\n """Remove a logging handler from the logger and list of handlers."""\n self._logger.removeHandler(handler)\n if handler in self.handlers:\n self.handlers.remove(handler)\n\n def add_modifier(\n self,\n *,\n schema_id: str | None = None,\n modifier: t.Callable[[str, dict[str, t.Any]], dict[str, t.Any]],\n ) -> None:\n """Add a modifier (callable) to a registered event.\n\n Parameters\n ----------\n modifier: Callable\n A callable function/method that executes when the named event occurs.\n This method enforces a string signature for modifiers:\n\n (schema_id: str, data: dict) -> dict:\n """\n # Ensure that this is a callable function/method\n if not callable(modifier):\n msg = "`modifier` must be a callable" # type:ignore[unreachable]\n raise TypeError(msg)\n\n # If the schema ID and version is given, only add\n # this modifier to that schema\n if schema_id:\n # If the schema hasn't been added yet,\n # start a placeholder set.\n modifiers = self._modifiers.get(schema_id, set())\n modifiers.add(modifier)\n self._modifiers[schema_id] = modifiers\n return\n for id_ in self._modifiers:\n if schema_id is None or id_ == schema_id:\n self._modifiers[id_].add(modifier)\n\n def remove_modifier(\n self,\n *,\n schema_id: str | None = None,\n modifier: t.Callable[[str, dict[str, t.Any]], dict[str, t.Any]],\n ) -> None:\n """Remove a modifier from an event or all events.\n\n Parameters\n ----------\n schema_id: str\n If given, remove this modifier only for a specific event type.\n modifier: Callable[[str, dict], dict]\n\n The modifier to remove.\n """\n # If schema_id is given remove the modifier from this schema.\n if schema_id:\n self._modifiers[schema_id].discard(modifier)\n # If no schema_id is given, remove the modifier from all events.\n else:\n for schema_id in self.schemas.schema_ids:\n # Remove the modifier if it is found in the list.\n self._modifiers[schema_id].discard(modifier)\n self._modifiers[schema_id].discard(modifier)\n\n def add_listener(\n self,\n *,\n modified: bool = True,\n schema_id: str | None = None,\n listener: t.Callable[[EventLogger, str, dict[str, t.Any]], t.Coroutine[t.Any, t.Any, None]],\n ) -> None:\n """Add a listener (callable) to a registered event.\n\n Parameters\n ----------\n modified: bool\n If True (default), listens to the data after it has been mutated/modified\n by the list of modifiers.\n schema_id: str\n $id of the schema\n listener: Callable\n A callable function/method that executes when the named event occurs.\n """\n if not callable(listener):\n msg = "`listener` must be a callable" # type:ignore[unreachable]\n raise TypeError(msg)\n\n # If the schema ID and version is given, only add\n # this modifier to that schema\n if schema_id:\n if modified:\n # If the schema hasn't been added yet,\n # start a placeholder set.\n listeners = self._modified_listeners.get(schema_id, set())\n listeners.add(listener)\n self._modified_listeners[schema_id] = listeners\n return\n listeners = self._unmodified_listeners.get(schema_id, set())\n listeners.add(listener)\n self._unmodified_listeners[schema_id] = listeners\n return\n for id_ in self.schemas.schema_ids:\n if schema_id is None or id_ == schema_id:\n if modified:\n self._modified_listeners[id_].add(listener)\n else:\n self._unmodified_listeners[id_].add(listener)\n\n def remove_listener(\n self,\n *,\n schema_id: str | None = None,\n listener: t.Callable[[EventLogger, str, dict[str, t.Any]], t.Coroutine[t.Any, t.Any, None]],\n ) -> None:\n """Remove a listener from an event or all events.\n\n Parameters\n ----------\n schema_id: str\n If given, remove this modifier only for a specific event type.\n\n listener: Callable[[EventLogger, str, dict], dict]\n The modifier to remove.\n """\n # If schema_id is given remove the listener from this schema.\n if schema_id:\n self._modified_listeners[schema_id].discard(listener)\n self._unmodified_listeners[schema_id].discard(listener)\n # If no schema_id is given, remove the listener from all events.\n else:\n for schema_id in self.schemas.schema_ids:\n # Remove the listener if it is found in the list.\n self._modified_listeners[schema_id].discard(listener)\n self._unmodified_listeners[schema_id].discard(listener)\n\n def emit(\n self, *, schema_id: str, data: dict[str, t.Any], timestamp_override: datetime | None = None\n ) -> dict[str, t.Any] | None:\n """\n Record given event with schema has occurred.\n\n Parameters\n ----------\n schema_id: str\n $id of the schema\n data: dict\n The event to record\n timestamp_override: datetime, optional\n Optionally override the event timestamp. By default it is set to the current timestamp.\n\n Returns\n -------\n dict\n The recorded event data\n """\n # If no handlers are routing these events, there's no need to proceed.\n if (\n not self.handlers\n and not self._modified_listeners.get(schema_id)\n and not self._unmodified_listeners.get(schema_id)\n ):\n return None\n\n # If the schema hasn't been registered, raise a warning to make sure\n # this was intended.\n if schema_id not in self.schemas:\n warnings.warn(\n f"{schema_id} has not been registered yet. If "\n "this was not intentional, please register the schema using the "\n "`register_event_schema` method.",\n SchemaNotRegistered,\n stacklevel=2,\n )\n return None\n\n schema = self.schemas.get(schema_id)\n\n # Deep copy the data and modify the copy.\n modified_data = copy.deepcopy(data)\n for modifier in self._modifiers[schema.id]:\n modified_data = modifier(schema_id=schema_id, data=modified_data)\n\n if self._unmodified_listeners[schema.id]:\n # Process this event, i.e. validate and modify (in place)\n self.schemas.validate_event(schema_id, data)\n\n # Validate the modified data.\n self.schemas.validate_event(schema_id, modified_data)\n\n # Generate the empty event capsule.\n timestamp = (\n datetime.now(tz=timezone.utc) if timestamp_override is None else timestamp_override\n )\n capsule = {\n "__timestamp__": timestamp.isoformat() + "Z",\n "__schema__": schema_id,\n "__schema_version__": schema.version,\n "__metadata_version__": EVENTS_METADATA_VERSION,\n }\n try:\n JUPYTER_EVENTS_CORE_VALIDATOR.validate(capsule)\n except ValidationError as err:\n raise CoreMetadataError from err\n\n capsule.update(modified_data)\n\n self._logger.info(capsule)\n\n # callback for removing from finished listeners\n # from active listeners set.\n def _listener_task_done(task: asyncio.Task[t.Any]) -> None:\n # If an exception happens, log it to the main\n # applications logger\n err = task.exception()\n if err:\n self.log.error(err)\n self._active_listeners.discard(task)\n\n # Loop over listeners and execute them.\n for listener in self._modified_listeners[schema_id]:\n # Schedule this listener as a task and add\n # it to the list of active listeners\n task = asyncio.create_task(\n listener(\n logger=self,\n schema_id=schema_id,\n data=modified_data,\n )\n )\n self._active_listeners.add(task)\n\n # Adds the task and cleans it up later if needed.\n task.add_done_callback(_listener_task_done)\n\n for listener in self._unmodified_listeners[schema_id]:\n task = asyncio.create_task(listener(logger=self, schema_id=schema_id, data=data))\n self._active_listeners.add(task)\n\n # Remove task from active listeners once its finished.\n def _listener_task_done(task: asyncio.Task[t.Any]) -> None:\n # If an exception happens, log it to the main\n # applications logger\n err = task.exception()\n if err:\n self.log.error(err)\n self._active_listeners.discard(task)\n\n # Adds the task and cleans it up later if needed.\n task.add_done_callback(_listener_task_done)\n\n return capsule\n
.venv\Lib\site-packages\jupyter_events\logger.py
logger.py
Python
16,120
0.95
0.165158
0.145161
vue-tools
107
2025-05-24T16:34:16.262736
GPL-3.0
false
bb73ce85023632a8fc6d4df994c55f8a
"""Fixtures for use with jupyter events."""\nfrom __future__ import annotations\n\nimport io\nimport json\nimport logging\nfrom typing import Any, Callable\n\nimport pytest\n\nfrom jupyter_events import EventLogger\n\n\n@pytest.fixture\ndef jp_event_sink() -> io.StringIO:\n """A stream for capture events."""\n return io.StringIO()\n\n\n@pytest.fixture\ndef jp_event_handler(jp_event_sink: io.StringIO) -> logging.Handler:\n """A logging handler that captures any events emitted by the event handler"""\n return logging.StreamHandler(jp_event_sink)\n\n\n@pytest.fixture\ndef jp_read_emitted_events(\n jp_event_handler: logging.Handler, jp_event_sink: io.StringIO\n) -> Callable[..., list[str] | None]:\n """Reads list of events since last time it was called."""\n\n def _read() -> list[str] | None:\n jp_event_handler.flush()\n event_buf = jp_event_sink.getvalue().strip()\n output = [json.loads(item) for item in event_buf.split("\n")] if event_buf else None\n # Clear the sink.\n jp_event_sink.truncate(0)\n jp_event_sink.seek(0)\n return output\n\n return _read\n\n\n@pytest.fixture\ndef jp_event_schemas() -> list[Any]:\n """A list of schema references.\n\n Each item should be one of the following:\n - string of serialized JSON/YAML content representing a schema\n - a pathlib.Path object pointing to a schema file on disk\n - a dictionary with the schema data.\n """\n return []\n\n\n@pytest.fixture\ndef jp_event_logger(jp_event_handler: logging.Handler, jp_event_schemas: list[Any]) -> EventLogger:\n """A pre-configured event logger for tests."""\n logger = EventLogger()\n for schema in jp_event_schemas:\n logger.register_event_schema(schema)\n logger.register_handler(handler=jp_event_handler)\n return logger\n
.venv\Lib\site-packages\jupyter_events\pytest_plugin.py
pytest_plugin.py
Python
1,778
0.95
0.190476
0.021277
node-utils
467
2025-03-08T04:43:20.247229
GPL-3.0
true
a21ee8c3bd4af97f1594bc55bbf2d25b
"""Event schema objects."""\nfrom __future__ import annotations\n\nimport json\nfrom pathlib import Path, PurePath\nfrom typing import Any, Union\n\nfrom jsonschema import FormatChecker, validators\nfrom referencing import Registry\nfrom referencing.jsonschema import DRAFT7\n\ntry:\n from jsonschema.protocols import Validator\nexcept ImportError:\n Validator = Any # type:ignore[assignment, misc]\n\nfrom . import yaml\nfrom .validators import draft7_format_checker, validate_schema\n\n\nclass EventSchemaUnrecognized(Exception):\n """An error for an unrecognized event schema."""\n\n\nclass EventSchemaLoadingError(Exception):\n """An error for an event schema loading error."""\n\n\nclass EventSchemaFileAbsent(Exception):\n """An error for an absent event schema file."""\n\n\nSchemaType = Union[dict[str, Any], str, PurePath]\n\n\nclass EventSchema:\n """A validated schema that can be used.\n\n On instantiation, validate the schema against\n Jupyter Event's metaschema.\n\n Parameters\n ----------\n schema: dict or str\n JSON schema to validate against Jupyter Events.\n\n validator_class: jsonschema.validators\n The validator class from jsonschema used to validate instances\n of this event schema. The schema itself will be validated\n against Jupyter Event's metaschema to ensure that\n any schema registered here follows the expected form\n of Jupyter Events.\n\n registry:\n Registry for nested JSON schema references.\n """\n\n def __init__(\n self,\n schema: SchemaType,\n validator_class: type[Validator] = validators.Draft7Validator, # type:ignore[assignment]\n format_checker: FormatChecker = draft7_format_checker,\n registry: Registry[Any] | None = None,\n ):\n """Initialize an event schema."""\n _schema = self._load_schema(schema)\n # Validate the schema against Jupyter Events metaschema.\n validate_schema(_schema)\n\n if registry is None:\n registry = DRAFT7.create_resource(_schema) @ Registry()\n\n # Create a validator for this schema\n self._validator = validator_class(_schema, registry=registry, format_checker=format_checker) # type: ignore[call-arg]\n self._schema = _schema\n\n def __repr__(self) -> str:\n """A string repr for an event schema."""\n return json.dumps(self._schema, indent=2)\n\n @staticmethod\n def _ensure_yaml_loaded(schema: SchemaType, was_str: bool = False) -> None:\n """Ensures schema was correctly loaded into a dictionary. Raises\n EventSchemaLoadingError otherwise."""\n if isinstance(schema, dict):\n return\n\n error_msg = "Could not deserialize schema into a dictionary."\n\n def intended_as_path(schema: str) -> bool:\n path = Path(schema)\n return path.match("*.yml") or path.match("*.yaml") or path.match("*.json")\n\n # detect whether the user specified a string but intended a PurePath to\n # generate a more helpful error message\n if was_str and intended_as_path(schema): # type:ignore[arg-type]\n error_msg += " Paths to schema files must be explicitly wrapped in a Pathlib object."\n else:\n error_msg += " Double check the schema and ensure it is in the proper form."\n\n raise EventSchemaLoadingError(error_msg)\n\n @staticmethod\n def _load_schema(schema: SchemaType) -> dict[str, Any]:\n """Load a JSON schema from different sources/data types.\n\n `schema` could be a dictionary or serialized string representing the\n schema itself or a Pathlib object representing a schema file on disk.\n\n Returns a dictionary with schema data.\n """\n\n # if schema is already a dictionary, return it\n if isinstance(schema, dict):\n return schema\n\n # if schema is PurePath, ensure file exists at path and then load from file\n if isinstance(schema, PurePath):\n if not Path(schema).exists():\n msg = f'Schema file not present at path "{schema}".'\n raise EventSchemaFileAbsent(msg)\n\n loaded_schema = yaml.load(schema)\n EventSchema._ensure_yaml_loaded(loaded_schema)\n return loaded_schema # type:ignore[no-any-return]\n\n # finally, if schema is string, attempt to deserialize and return the output\n if isinstance(schema, str):\n # note the diff b/w load v.s. loads\n loaded_schema = yaml.loads(schema)\n EventSchema._ensure_yaml_loaded(loaded_schema, was_str=True)\n return loaded_schema # type:ignore[no-any-return]\n\n msg = f"Expected a dictionary, string, or PurePath, but instead received {schema.__class__.__name__}." # type:ignore[unreachable]\n raise EventSchemaUnrecognized(msg)\n\n @property\n def id(self) -> str:\n """Schema $id field."""\n return self._schema["$id"] # type:ignore[no-any-return]\n\n @property\n def version(self) -> int:\n """Schema's version."""\n return self._schema["version"] # type:ignore[no-any-return]\n\n @property\n def properties(self) -> dict[str, Any]:\n return self._schema["properties"] # type:ignore[no-any-return]\n\n def validate(self, data: dict[str, Any]) -> None:\n """Validate an incoming instance of this event schema."""\n self._validator.validate(data)\n
.venv\Lib\site-packages\jupyter_events\schema.py
schema.py
Python
5,384
0.95
0.202614
0.070175
react-lib
586
2023-08-01T01:15:53.239144
BSD-3-Clause
false
6ff6f51b60318933cc6f0b58d46240dc
""""An event schema registry."""\nfrom __future__ import annotations\n\nfrom typing import Any\n\nfrom .schema import EventSchema\n\n\nclass SchemaRegistryException(Exception):\n """Exception class for Jupyter Events Schema Registry Errors."""\n\n\nclass SchemaRegistry:\n """A convenient API for storing and searching a group of schemas."""\n\n def __init__(self, schemas: dict[str, EventSchema] | None = None):\n """Initialize the registry."""\n self._schemas: dict[str, EventSchema] = schemas or {}\n\n def __contains__(self, key: str) -> bool:\n """Syntax sugar to check if a schema is found in the registry"""\n return key in self._schemas\n\n def __repr__(self) -> str:\n """The str repr of the registry."""\n return ",\n".join([str(s) for s in self._schemas.values()])\n\n def _add(self, schema_obj: EventSchema) -> None:\n if schema_obj.id in self._schemas:\n msg = (\n f"The schema, {schema_obj.id}, is already "\n "registered. Try removing it and registering it again."\n )\n raise SchemaRegistryException(msg)\n self._schemas[schema_obj.id] = schema_obj\n\n @property\n def schema_ids(self) -> list[str]:\n return list(self._schemas.keys())\n\n def register(self, schema: dict[str, Any] | (str | EventSchema)) -> EventSchema:\n """Add a valid schema to the registry.\n\n All schemas are validated against the Jupyter Events meta-schema\n found here:\n """\n if not isinstance(schema, EventSchema):\n schema = EventSchema(schema)\n self._add(schema)\n return schema\n\n def get(self, id_: str) -> EventSchema:\n """Fetch a given schema. If the schema is not found,\n this will raise a KeyError.\n """\n try:\n return self._schemas[id_]\n except KeyError:\n msg = (\n f"The requested schema, {id_}, was not found in the "\n "schema registry. Are you sure it was previously registered?"\n )\n raise KeyError(msg) from None\n\n def remove(self, id_: str) -> None:\n """Remove a given schema. If the schema is not found,\n this will raise a KeyError.\n """\n try:\n del self._schemas[id_]\n except KeyError:\n msg = (\n f"The requested schema, {id_}, was not found in the "\n "schema registry. Are you sure it was previously registered?"\n )\n raise KeyError(msg) from None\n\n def validate_event(self, id_: str, data: dict[str, Any]) -> None:\n """Validate an event against a schema within this\n registry.\n """\n schema = self.get(id_)\n schema.validate(data)\n
.venv\Lib\site-packages\jupyter_events\schema_registry.py
schema_registry.py
Python
2,762
0.85
0.240964
0
vue-tools
328
2024-10-30T01:19:32.167339
BSD-3-Clause
false
41007da5420029ec5bd6deaf76c14c3e
"""Trait types for events."""\nfrom __future__ import annotations\n\nimport logging\nimport typing as t\n\nfrom traitlets import TraitError, TraitType\n\nbaseclass = TraitType\nif t.TYPE_CHECKING:\n baseclass = TraitType[t.Any, t.Any] # type:ignore[misc]\n\n\nclass Handlers(baseclass): # type:ignore[type-arg]\n """A trait that takes a list of logging handlers and converts\n it to a callable that returns that list (thus, making this\n trait pickleable).\n """\n\n info_text = "a list of logging handlers"\n\n def validate_elements(self, obj: t.Any, value: t.Any) -> None:\n """Validate the elements of an object."""\n if len(value) > 0:\n # Check that all elements are logging handlers.\n for el in value:\n if isinstance(el, logging.Handler) is False:\n self.element_error(obj)\n\n def element_error(self, obj: t.Any) -> None:\n """Raise an error for bad elements."""\n msg = f"Elements in the '{self.name}' trait of an {obj.__class__.__name__} instance must be Python `logging` handler instances."\n raise TraitError(msg)\n\n def validate(self, obj: t.Any, value: t.Any) -> t.Any:\n """Validate an object."""\n # If given a callable, call it and set the\n # value of this trait to the returned list.\n # Verify that the callable returns a list\n # of logging handler instances.\n if callable(value):\n out = value()\n self.validate_elements(obj, out)\n return out\n # If a list, check it's elements to verify\n # that each element is a logging handler instance.\n if isinstance(value, list):\n self.validate_elements(obj, value)\n return value\n self.error(obj, value)\n return None # type:ignore[unreachable]\n
.venv\Lib\site-packages\jupyter_events\traits.py
traits.py
Python
1,818
0.95
0.235294
0.166667
python-kit
703
2024-12-16T20:34:54.057600
MIT
false
bcd3d8657c4bb47adc7cd8d95d19f0e6
"""\nVarious utilities\n"""\nfrom __future__ import annotations\n\n\nclass JupyterEventsVersionWarning(UserWarning):\n """Emitted when an event schema version is an `int` when it should be `str`."""\n
.venv\Lib\site-packages\jupyter_events\utils.py
utils.py
Python
195
0.85
0.125
0
awesome-app
793
2024-05-31T12:36:28.881698
MIT
false
c765d5cd7ab2af16eb52f089ba1141ae
"""Event validators."""\nfrom __future__ import annotations\n\nimport pathlib\nimport warnings\nfrom typing import Any\n\nimport jsonschema\nfrom jsonschema import Draft7Validator, ValidationError\nfrom referencing import Registry\nfrom referencing.jsonschema import DRAFT7\n\nfrom . import yaml\nfrom .utils import JupyterEventsVersionWarning\n\ndraft7_format_checker = (\n Draft7Validator.FORMAT_CHECKER\n if hasattr(Draft7Validator, "FORMAT_CHECKER")\n else jsonschema.draft7_format_checker\n)\n\n\nMETASCHEMA_PATH = pathlib.Path(__file__).parent.joinpath("schemas")\n\nEVENT_METASCHEMA_FILEPATH = METASCHEMA_PATH.joinpath("event-metaschema.yml")\nEVENT_METASCHEMA = yaml.load(EVENT_METASCHEMA_FILEPATH)\n\nEVENT_CORE_SCHEMA_FILEPATH = METASCHEMA_PATH.joinpath("event-core-schema.yml")\nEVENT_CORE_SCHEMA = yaml.load(EVENT_CORE_SCHEMA_FILEPATH)\n\nPROPERTY_METASCHEMA_FILEPATH = METASCHEMA_PATH.joinpath("property-metaschema.yml")\nPROPERTY_METASCHEMA = yaml.load(PROPERTY_METASCHEMA_FILEPATH)\n\nSCHEMA_STORE = {\n EVENT_METASCHEMA["$id"]: EVENT_METASCHEMA,\n PROPERTY_METASCHEMA["$id"]: PROPERTY_METASCHEMA,\n EVENT_CORE_SCHEMA["$id"]: EVENT_CORE_SCHEMA,\n}\n\nresources = [\n DRAFT7.create_resource(each)\n for each in (EVENT_METASCHEMA, PROPERTY_METASCHEMA, EVENT_CORE_SCHEMA)\n]\nMETASCHEMA_REGISTRY: Registry[Any] = resources @ Registry()\n\nJUPYTER_EVENTS_SCHEMA_VALIDATOR = Draft7Validator(\n schema=EVENT_METASCHEMA,\n registry=METASCHEMA_REGISTRY,\n format_checker=draft7_format_checker,\n)\n\nJUPYTER_EVENTS_CORE_VALIDATOR = Draft7Validator(\n schema=EVENT_CORE_SCHEMA,\n registry=METASCHEMA_REGISTRY,\n format_checker=draft7_format_checker,\n)\n\n\ndef validate_schema(schema: dict[str, Any]) -> None:\n """Validate a schema dict."""\n try:\n # If the `version` attribute is an integer, coerce to string.\n # TODO: remove this in a future version.\n if "version" in schema and isinstance(schema["version"], int):\n schema["version"] = str(schema["version"])\n msg = (\n "The `version` property of an event schema must be a string. "\n "It has been type coerced, but in a future version of this "\n "library, it will fail to validate. Please update schema: "\n f"{schema['$id']}"\n )\n warnings.warn(JupyterEventsVersionWarning(msg), stacklevel=2)\n # Validate the schema against Jupyter Events metaschema.\n JUPYTER_EVENTS_SCHEMA_VALIDATOR.validate(schema)\n except ValidationError as err:\n reserved_property_msg = " does not match '^(?!__.*)'"\n if reserved_property_msg in str(err):\n idx = str(err).find(reserved_property_msg)\n bad_property = str(err)[:idx].strip()\n msg = (\n f"{bad_property} is an invalid property name because it "\n "starts with `__`. Properties starting with 'dunder' "\n "are reserved as special meta-fields for Jupyter Events to use."\n )\n raise ValidationError(msg) from err\n raise err\n
.venv\Lib\site-packages\jupyter_events\validators.py
validators.py
Python
3,060
0.95
0.081395
0.042254
node-utils
539
2024-06-21T16:13:52.770161
MIT
false
710d9b8cfe300940261280d30b1e07aa
"""Yaml utilities."""\nfrom __future__ import annotations\n\nfrom pathlib import Path, PurePath\nfrom typing import Any\n\nfrom yaml import dump as ydump\nfrom yaml import load as yload\n\ntry:\n from yaml import CSafeDumper as SafeDumper\n from yaml import CSafeLoader as SafeLoader\nexcept ImportError: # pragma: no cover\n from yaml import SafeDumper, SafeLoader # type:ignore[assignment]\n\n\ndef loads(stream: Any) -> Any:\n """Load yaml from a stream."""\n return yload(stream, Loader=SafeLoader)\n\n\ndef dumps(stream: Any) -> str:\n """Parse the first YAML document in a stream as an object."""\n return ydump(stream, Dumper=SafeDumper)\n\n\ndef load(fpath: str | PurePath) -> Any:\n """Load yaml from a file."""\n # coerce PurePath into Path, then read its contents\n data = Path(str(fpath)).read_text(encoding="utf-8")\n return loads(data)\n\n\ndef dump(data: Any, outpath: str | PurePath) -> None:\n """Parse the a YAML document in a file as an object."""\n Path(outpath).write_text(dumps(data), encoding="utf-8")\n
.venv\Lib\site-packages\jupyter_events\yaml.py
yaml.py
Python
1,031
0.95
0.138889
0.04
node-utils
941
2023-07-21T15:08:14.664622
GPL-3.0
false
26bec98b1c486b6cd61ff48733e98577
"""\nstore the current version info of jupyter-events.\n"""\nfrom __future__ import annotations\n\nimport re\n\n# Version string must appear intact for hatch versioning\n__version__ = "0.12.0"\n\n# Build up version_info tuple for backwards compatibility\npattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"\nmatch = re.match(pattern, __version__)\nassert match is not None\nparts: list[object] = [int(match[part]) for part in ["major", "minor", "patch"]]\nif match["rest"]:\n parts.append(match["rest"])\nversion_info = tuple(parts)\n\nkernel_protocol_version_info = (5, 3)\nkernel_protocol_version = "{}.{}".format(*kernel_protocol_version_info)\n
.venv\Lib\site-packages\jupyter_events\_version.py
_version.py
Python
648
0.95
0.190476
0.117647
node-utils
564
2023-11-04T10:17:01.149258
MIT
false
1fc07c02379924d02404daf6ad548aee
# flake8: noqa\nfrom ._version import __version__\nfrom .logger import EVENTS_METADATA_VERSION, EventLogger\nfrom .schema import EventSchema\n\n__all__ = ["__version__", "EVENTS_METADATA_VERSION", "EventLogger", "EventSchema"]\n
.venv\Lib\site-packages\jupyter_events\__init__.py
__init__.py
Python
222
0.95
0
0.2
python-kit
954
2023-08-31T11:24:14.896237
MIT
false
11928613ab239fd5863af007a239fcdc
$schema: http://json-schema.org/draft-07/schema\n$id: http://event.jupyter.org/event-schema\nversion: "1"\ntitle: Event Schema\ndescription: |\n A schema for validating any Jupyter Event.\ntype: object\nproperties:\n __metadata_version__:\n title: Metadata Version\n type: number\n const: 1\n __schema_version__:\n title: Schema Version\n type: string\n __schema__:\n title: Schema ID\n type: string\n __timestamp__:\n title: Event Timestamp\n type: string\n format: datetime\nrequired:\n - __metadata_version__\n - __schema__\n - __schema_version__\n - __timestamp__\n
.venv\Lib\site-packages\jupyter_events\schemas\event-core-schema.yml
event-core-schema.yml
YAML
581
0.95
0.037037
0
vue-tools
809
2024-11-10T18:56:19.693450
BSD-3-Clause
false
1421c66f67e4f0e71d15794fb8d0ba78
$schema: http://json-schema.org/draft-07/schema\n$id: http://event.jupyter.org/event-metaschema\nversion: "1"\ntitle: Event Metaschema\ndescription: |\n A meta schema for validating that all registered Jupyter Event\n schemas are appropriately defined.\ntype: object\nproperties:\n version:\n type: string\n title:\n type: string\n description:\n type: string\n properties:\n type: object\n additionalProperties:\n $ref: http://event.jupyter.org/property-metaschema\n propertyNames:\n pattern: ^(?!__.*)\npatternProperties:\n "\\$id":\n type: string\n format: uri\n\nrequired:\n - $id\n - version\n - properties\n
.venv\Lib\site-packages\jupyter_events\schemas\event-metaschema.yml
event-metaschema.yml
YAML
627
0.95
0.033333
0
node-utils
372
2025-02-27T15:33:12.092228
GPL-3.0
false
94379b82c30fed9ca5ae785f4ef4cd27
$schema: http://json-schema.org/draft-07/schema\n$id: http://event.jupyter.org/property-metaschema\nversion: "1"\ntitle: Property Metaschema\ndescription: |\n A metaschema for validating properties within\n an event schema\n\nproperties:\n title:\n type: string\n description:\n type: string\n properties:\n type: object\n additionalProperties:\n $ref: http://event.jupyter.org/property-metaschema\n propertyNames:\n pattern: ^(?!__.*)\n\n items:\n $ref: http://event.jupyter.org/property-metaschema\n\nadditionalProperties:\n $ref: http://event.jupyter.org/property-metaschema\n\npropertyNames:\n pattern: ^(?!__.*)\n
.venv\Lib\site-packages\jupyter_events\schemas\property-metaschema.yml
property-metaschema.yml
YAML
626
0.8
0.035714
0
awesome-app
826
2024-01-23T20:03:13.037154
GPL-3.0
false
5739003243bb35ad290238c98b255b21
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\cli.cpython-313.pyc
cli.cpython-313.pyc
Other
4,765
0.8
0.020833
0
react-lib
354
2023-10-04T03:22:51.803411
MIT
false
10d3ed586c7f8af441485235a767fdd4
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\logger.cpython-313.pyc
logger.cpython-313.pyc
Other
17,182
0.95
0.047619
0.005882
node-utils
821
2024-05-05T05:07:04.548255
BSD-3-Clause
false
b686b6d59ba3a19a31a53679d8572222
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\pytest_plugin.cpython-313.pyc
pytest_plugin.cpython-313.pyc
Other
3,039
0.8
0.085714
0
python-kit
738
2023-10-15T04:17:07.264066
GPL-3.0
true
48f193b294f0fc1992c932a60df12b78
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\schema.cpython-313.pyc
schema.cpython-313.pyc
Other
6,888
0.95
0.101695
0
python-kit
393
2024-01-21T03:44:46.503137
Apache-2.0
false
6237679fde22e9b6074d19bfd7b6b451
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\schema_registry.cpython-313.pyc
schema_registry.cpython-313.pyc
Other
4,423
0.95
0.093023
0
react-lib
936
2025-05-19T18:14:41.618472
Apache-2.0
false
8e7e0dac8d6536a6f961465efa630b8f
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\traits.cpython-313.pyc
traits.cpython-313.pyc
Other
2,423
0.8
0.111111
0
python-kit
797
2024-12-19T14:09:00.405495
Apache-2.0
false
c27e9b52bed1d31b6fc9e22fba39d35e
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\utils.cpython-313.pyc
utils.cpython-313.pyc
Other
629
0.8
0
0
react-lib
419
2024-12-19T15:04:46.470280
BSD-3-Clause
false
9edefc1fce1170e4e1c0a230e290a845
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\validators.cpython-313.pyc
validators.cpython-313.pyc
Other
3,456
0.8
0.041667
0
react-lib
614
2024-08-03T07:44:33.479275
BSD-3-Clause
false
922ae5ccfba299dabcfff0e0ac842d25
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\yaml.cpython-313.pyc
yaml.cpython-313.pyc
Other
1,719
0.7
0
0
python-kit
155
2024-11-08T22:59:50.337998
Apache-2.0
false
9d917b364c37d53c45fd8833d5053c93
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\_version.cpython-313.pyc
_version.cpython-313.pyc
Other
1,004
0.8
0
0
awesome-app
283
2023-09-18T09:12:26.932616
BSD-3-Clause
false
67fb2155df6134504c1156230d1b8776
\n\n
.venv\Lib\site-packages\jupyter_events\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
400
0.7
0
0
awesome-app
438
2024-07-06T20:50:04.856931
MIT
false
e9aa6f38c3e98816a84c8e1d88e3e0bf
[console_scripts]\njupyter-events = jupyter_events.cli:main\n
.venv\Lib\site-packages\jupyter_events-0.12.0.dist-info\entry_points.txt
entry_points.txt
Other
59
0.5
0
0
vue-tools
344
2025-04-01T23:05:35.378471
Apache-2.0
false
4bad5b5c639bfb089808312056be117d
pip\n
.venv\Lib\site-packages\jupyter_events-0.12.0.dist-info\INSTALLER
INSTALLER
Other
4
0.5
0
0
vue-tools
158
2025-03-10T22:27:33.770542
Apache-2.0
false
365c9bfeb7d89244f2ce01c1de44cb85
Metadata-Version: 2.4\nName: jupyter-events\nVersion: 0.12.0\nSummary: Jupyter Event System library\nProject-URL: Homepage, http://jupyter.org\nProject-URL: documentation, https://jupyter-events.readthedocs.io/\nProject-URL: repository, https://github.com/jupyter/jupyter_events.git\nProject-URL: changelog, https://github.com/jupyter/jupyter_events/blob/main/CHANGELOG.md\nAuthor-email: Jupyter Development Team <jupyter@googlegroups.com>\nLicense: BSD 3-Clause License\n \n Copyright (c) 2022-, Jupyter Development Team\n \n All rights reserved.\n \n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n \n 1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n \n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n \n 3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n \n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\nLicense-File: LICENSE\nKeywords: Jupyter,JupyterLab\nClassifier: Intended Audience :: Developers\nClassifier: Intended Audience :: Science/Research\nClassifier: Intended Audience :: System Administrators\nClassifier: License :: OSI Approved :: BSD License\nClassifier: Programming Language :: Python\nClassifier: Programming Language :: Python :: 3\nRequires-Python: >=3.9\nRequires-Dist: jsonschema[format-nongpl]>=4.18.0\nRequires-Dist: packaging\nRequires-Dist: python-json-logger>=2.0.4\nRequires-Dist: pyyaml>=5.3\nRequires-Dist: referencing\nRequires-Dist: rfc3339-validator\nRequires-Dist: rfc3986-validator>=0.1.1\nRequires-Dist: traitlets>=5.3\nProvides-Extra: cli\nRequires-Dist: click; extra == 'cli'\nRequires-Dist: rich; extra == 'cli'\nProvides-Extra: docs\nRequires-Dist: jupyterlite-sphinx; extra == 'docs'\nRequires-Dist: myst-parser; extra == 'docs'\nRequires-Dist: pydata-sphinx-theme>=0.16; extra == 'docs'\nRequires-Dist: sphinx>=8; extra == 'docs'\nRequires-Dist: sphinxcontrib-spelling; extra == 'docs'\nProvides-Extra: test\nRequires-Dist: click; extra == 'test'\nRequires-Dist: pre-commit; extra == 'test'\nRequires-Dist: pytest-asyncio>=0.19.0; extra == 'test'\nRequires-Dist: pytest-console-scripts; extra == 'test'\nRequires-Dist: pytest>=7.0; extra == 'test'\nRequires-Dist: rich; extra == 'test'\nDescription-Content-Type: text/markdown\n\n# Jupyter Events\n\n[![Build Status](https://github.com/jupyter/jupyter_events/actions/workflows/python-tests.yml/badge.svg?query=branch%3Amain++)](https://github.com/jupyter/jupyter_events/actions/workflows/python-tests.yml/badge.svg?query=branch%3Amain++)\n[![Documentation Status](https://readthedocs.org/projects/jupyter-events/badge/?version=latest)](http://jupyter-events.readthedocs.io/en/latest/?badge=latest)\n\n_An event system for Jupyter Applications and extensions._\n\nJupyter Events enables Jupyter Python Applications (e.g. Jupyter Server, JupyterLab Server, JupyterHub, etc.) to emit **events**—structured data describing things happening inside the application. Other software (e.g. client applications like JupyterLab) can _listen_ and respond to these events.\n\n## Install\n\nInstall Jupyter Events directly from PyPI:\n\n```\npip install jupyter_events\n```\n\nor conda-forge:\n\n```\nconda install -c conda-forge jupyter_events\n```\n\n## Documentation\n\nDocumentation is available at [jupyter-events.readthedocs.io](https://jupyter-events.readthedocs.io).\n\n## About the Jupyter Development Team\n\nThe Jupyter Development Team is the set of all contributors to the Jupyter project.\nThis includes all of the Jupyter subprojects.\n\nThe core team that coordinates development on GitHub can be found here:\nhttps://github.com/jupyter/.\n\n## Our Copyright Policy\n\nJupyter uses a shared copyright model. Each contributor maintains copyright\nover their contributions to Jupyter. But, it is important to note that these\ncontributions are typically only changes to the repositories. Thus, the Jupyter\nsource code, in its entirety is not the copyright of any single person or\ninstitution. Instead, it is the collective copyright of the entire Jupyter\nDevelopment Team. If individual contributors want to maintain a record of what\nchanges/contributions they have specific copyright on, they should indicate\ntheir copyright in the commit message of the change, when they commit the\nchange to one of the Jupyter repositories.\n\nWith this in mind, the following banner should be used in any source code file\nto indicate the copyright and license terms:\n\n```\n# Copyright (c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\n```\n
.venv\Lib\site-packages\jupyter_events-0.12.0.dist-info\METADATA
METADATA
Other
5,787
0.95
0.007813
0.067961
awesome-app
567
2024-07-06T00:36:38.053140
GPL-3.0
false
d9d18816180cecc593a0ff3dfc021d0f
../../Scripts/jupyter-events.exe,sha256=NOeTwrxPm3Di_Sil3HQZo3x3uvYJR_jRmdcPr3Tl3Nw,108419\njupyter_events-0.12.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4\njupyter_events-0.12.0.dist-info/METADATA,sha256=pHork5eVbW3MHMr3onsyQju9RznnUbelFOg9mgPJPpo,5787\njupyter_events-0.12.0.dist-info/RECORD,,\njupyter_events-0.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87\njupyter_events-0.12.0.dist-info/entry_points.txt,sha256=2m4yQ3ryTYp08umCUeXBqQ1LKiw3tpbJPsuTzPnyiN4,59\njupyter_events-0.12.0.dist-info/licenses/LICENSE,sha256=gEBbVGDWL7cDLWLkcg-hmaW-AYZMkA8bneebyBHv2DY,1534\njupyter_events/__init__.py,sha256=7x-3YYx7hia9cj_ffx1S5pxPYtEI_dFKwb0Z5D2eKw8,222\njupyter_events/__pycache__/__init__.cpython-313.pyc,,\njupyter_events/__pycache__/_version.cpython-313.pyc,,\njupyter_events/__pycache__/cli.cpython-313.pyc,,\njupyter_events/__pycache__/logger.cpython-313.pyc,,\njupyter_events/__pycache__/pytest_plugin.cpython-313.pyc,,\njupyter_events/__pycache__/schema.cpython-313.pyc,,\njupyter_events/__pycache__/schema_registry.cpython-313.pyc,,\njupyter_events/__pycache__/traits.cpython-313.pyc,,\njupyter_events/__pycache__/utils.cpython-313.pyc,,\njupyter_events/__pycache__/validators.cpython-313.pyc,,\njupyter_events/__pycache__/yaml.cpython-313.pyc,,\njupyter_events/_version.py,sha256=QJlU2Nrx_yR8pW8qa98IVWGjspnB9aO0lW_hIGD9GSI,648\njupyter_events/cli.py,sha256=_CJmk71UAJ4TX1w7WiR__hUKIFBky8j2K2euq0ZY0Xc,3087\njupyter_events/logger.py,sha256=ODUm5hEtCIVCRkcsuhEfhac_7sEto-tiVFOW53hpFg0,16120\njupyter_events/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0\njupyter_events/pytest_plugin.py,sha256=G0GCz7Q_3yHtAt9z0AoqZNV-bQbv553vvj2MMDzy7eI,1778\njupyter_events/schema.py,sha256=ClLw7lfAH6TF5l9VIH7L5QGDJklFWkSiNH104VSzSMI,5384\njupyter_events/schema_registry.py,sha256=CniwonSQo3Mc0tRLL-iVdsmtoaB4jfuKmmdJK8bj940,2762\njupyter_events/schemas/event-core-schema.yml,sha256=59tahG2eWuoxbfPaqJ8Vw1yarksVgGNCK8kDihdTBX0,581\njupyter_events/schemas/event-metaschema.yml,sha256=RfwT8qlh2O3vp9u66IyWmmI1jFDt16SLcmL2tjUynJA,627\njupyter_events/schemas/property-metaschema.yml,sha256=gXEuRHUhXlTD4AcDm1rwmqgEVEwx-4zDkjfDkDFxlfo,626\njupyter_events/traits.py,sha256=94dTgUoqTTao_HPPvHAYUwaeKqr4FUEV27jVunEgpgM,1818\njupyter_events/utils.py,sha256=LULSPDjewAfjTZuK4Sp8-P9acI3nln8qbSw09jJNyyk,195\njupyter_events/validators.py,sha256=ZuqgJCoskBqavfWo3KuAKqBjEK4p_5qeiWkFUI0r-c0,3060\njupyter_events/yaml.py,sha256=E_sBt0VjbhpFyu1LMCgG2z1ZtX66Cyaj-YkTCjdTRGk,1031\n
.venv\Lib\site-packages\jupyter_events-0.12.0.dist-info\RECORD
RECORD
Other
2,532
0.7
0
0
node-utils
170
2024-07-29T21:01:46.978278
GPL-3.0
false
d391854c0f49de72dcb85241efd77c25
Wheel-Version: 1.0\nGenerator: hatchling 1.27.0\nRoot-Is-Purelib: true\nTag: py3-none-any\n
.venv\Lib\site-packages\jupyter_events-0.12.0.dist-info\WHEEL
WHEEL
Other
87
0.5
0
0
node-utils
832
2023-09-20T23:18:47.014152
BSD-3-Clause
false
e2fcb0ad9ea59332c808928b4b439e7a
BSD 3-Clause License\n\nCopyright (c) 2022-, Jupyter Development Team\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n
.venv\Lib\site-packages\jupyter_events-0.12.0.dist-info\licenses\LICENSE
LICENSE
Other
1,534
0.7
0
0
react-lib
750
2024-06-12T13:12:04.010360
Apache-2.0
false
469c300e985ff0b264c3ba21b4fae725
""" special constants used throughout jupyter_lsp\n"""\n\n# the current `entry_point` to use for python-based spec finders\nEP_SPEC_V1 = "jupyter_lsp_spec_v1"\n\n# the current `entry_point`s to use for python-based listeners\nEP_LISTENER_ALL_V1 = "jupyter_lsp_listener_all_v1"\nEP_LISTENER_CLIENT_V1 = "jupyter_lsp_listener_client_v1"\nEP_LISTENER_SERVER_V1 = "jupyter_lsp_listener_server_v1"\n\n# jupyter*config.d where language_servers can be defined\nAPP_CONFIG_D_SECTIONS = ["_", "_notebook_", "_server_"]\n
.venv\Lib\site-packages\jupyter_lsp\constants.py
constants.py
Python
498
0.8
0.153846
0.3
awesome-app
915
2023-10-23T03:23:13.434671
Apache-2.0
false
e84af245e5eb4c3c9499adf27eb8c1ff
""" tornado handler for managing and communicating with language servers\n"""\n\nfrom typing import Optional, Text\n\nfrom jupyter_core.utils import ensure_async\nfrom jupyter_server.base.handlers import APIHandler, JupyterHandler\nfrom jupyter_server.utils import url_path_join as ujoin\nfrom tornado import web\nfrom tornado.websocket import WebSocketHandler\n\ntry:\n from jupyter_server.auth.decorator import authorized\nexcept ImportError:\n\n def authorized(method): # type: ignore\n """A no-op fallback for `jupyter_server 1.x`"""\n return method\n\n\ntry:\n from jupyter_server.base.websocket import WebSocketMixin\nexcept ImportError:\n from jupyter_server.base.zmqhandlers import WebSocketMixin\n\nfrom .manager import LanguageServerManager\nfrom .schema import SERVERS_RESPONSE\nfrom .specs.utils import censored_spec\n\nAUTH_RESOURCE = "lsp"\n\n\nclass BaseHandler(APIHandler):\n manager = None # type: LanguageServerManager\n\n def initialize(self, manager: LanguageServerManager):\n self.manager = manager\n\n\nclass BaseJupyterHandler(JupyterHandler):\n manager = None # type: LanguageServerManager\n\n def initialize(self, manager: LanguageServerManager):\n self.manager = manager\n\n\nclass LanguageServerWebSocketHandler( # type: ignore\n WebSocketMixin, WebSocketHandler, BaseJupyterHandler\n):\n """Setup tornado websocket to route to language server sessions.\n\n The logic of `get` and `pre_get` methods is derived from jupyter-server ws handlers,\n and should be kept in sync to follow best practice established by upstream; see:\n https://github.com/jupyter-server/jupyter_server/blob/v2.12.5/jupyter_server/services/kernels/websocket.py#L36\n """\n\n auth_resource = AUTH_RESOURCE\n\n language_server: Optional[Text] = None\n\n async def pre_get(self):\n """Handle a pre_get."""\n # authenticate first\n # authenticate the request before opening the websocket\n user = self.current_user\n if user is None:\n self.log.warning("Couldn't authenticate WebSocket connection")\n raise web.HTTPError(403)\n\n if not hasattr(self, "authorizer"):\n return\n\n # authorize the user.\n is_authorized = await ensure_async(\n self.authorizer.is_authorized(self, user, "execute", AUTH_RESOURCE)\n )\n if not is_authorized:\n raise web.HTTPError(403)\n\n async def get(self, *args, **kwargs):\n """Get an event socket."""\n await self.pre_get()\n res = super().get(*args, **kwargs)\n if res is not None:\n await res\n\n async def open(self, language_server):\n await self.manager.ready()\n self.language_server = language_server\n self.manager.subscribe(self)\n self.log.debug("[{}] Opened a handler".format(self.language_server))\n super().open()\n\n async def on_message(self, message):\n self.log.debug("[{}] Handling a message".format(self.language_server))\n await self.manager.on_client_message(message, self)\n\n def on_close(self):\n self.manager.unsubscribe(self)\n self.log.debug("[{}] Closed a handler".format(self.language_server))\n\n\nclass LanguageServersHandler(BaseHandler):\n """Reports the status of all current servers\n\n Response should conform to schema in schema/servers.schema.json\n """\n\n auth_resource = AUTH_RESOURCE\n validator = SERVERS_RESPONSE\n\n @web.authenticated\n @authorized\n async def get(self):\n """finish with the JSON representations of the sessions"""\n await self.manager.ready()\n\n response = {\n "version": 2,\n "sessions": {\n language_server: session.to_json()\n for language_server, session in self.manager.sessions.items()\n },\n "specs": {\n key: censored_spec(spec)\n for key, spec in self.manager.all_language_servers.items()\n },\n }\n\n errors = list(self.validator.iter_errors(response))\n\n if errors: # pragma: no cover\n self.log.warning("{} validation errors: {}".format(len(errors), errors))\n\n self.finish(response)\n\n\ndef add_handlers(nbapp):\n """Add Language Server routes to the notebook server web application"""\n lsp_url = ujoin(nbapp.base_url, "lsp")\n re_langservers = "(?P<language_server>.*)"\n\n opts = {"manager": nbapp.language_server_manager}\n\n nbapp.web_app.add_handlers(\n ".*",\n [\n (ujoin(lsp_url, "status"), LanguageServersHandler, opts),\n (\n ujoin(lsp_url, "ws", re_langservers),\n LanguageServerWebSocketHandler,\n opts,\n ),\n ],\n )\n
.venv\Lib\site-packages\jupyter_lsp\handlers.py
handlers.py
Python
4,727
0.95
0.16129
0.025862
awesome-app
643
2024-10-31T04:22:28.068387
GPL-3.0
false
cbadc0c66ceeddead5e14e0418462d40
""" A configurable frontend for stdio-based Language Servers\n"""\n\nimport asyncio\nimport os\nimport sys\nimport traceback\nfrom typing import Dict, Text, Tuple, cast\n\n# See compatibility note on `group` keyword in\n# https://docs.python.org/3/library/importlib.metadata.html#entry-points\nif sys.version_info < (3, 10): # pragma: no cover\n from importlib_metadata import entry_points\nelse: # pragma: no cover\n from importlib.metadata import entry_points\n\nfrom jupyter_core.paths import jupyter_config_path\nfrom jupyter_server.services.config import ConfigManager\n\ntry:\n from jupyter_server.transutils import _i18n as _\nexcept ImportError: # pragma: no cover\n from jupyter_server.transutils import _\n\nfrom traitlets import Bool\nfrom traitlets import Dict as Dict_\nfrom traitlets import Instance\nfrom traitlets import List as List_\nfrom traitlets import Unicode, default\n\nfrom .constants import (\n APP_CONFIG_D_SECTIONS,\n EP_LISTENER_ALL_V1,\n EP_LISTENER_CLIENT_V1,\n EP_LISTENER_SERVER_V1,\n EP_SPEC_V1,\n)\nfrom .schema import LANGUAGE_SERVER_SPEC_MAP\nfrom .session import LanguageServerSession\nfrom .trait_types import LoadableCallable, Schema\nfrom .types import (\n KeyedLanguageServerSpecs,\n LanguageServerManagerAPI,\n MessageScope,\n SpecBase,\n SpecMaker,\n)\n\n\nclass LanguageServerManager(LanguageServerManagerAPI):\n """Manage language servers"""\n\n conf_d_language_servers = Schema( # type:ignore[assignment]\n validator=LANGUAGE_SERVER_SPEC_MAP,\n help=_("extra language server specs, keyed by implementation, from conf.d"),\n ) # type: KeyedLanguageServerSpecs\n\n language_servers = Schema( # type:ignore[assignment]\n validator=LANGUAGE_SERVER_SPEC_MAP,\n help=_("a dict of language server specs, keyed by implementation"),\n ).tag(\n config=True\n ) # type: KeyedLanguageServerSpecs\n\n autodetect: bool = Bool( # type:ignore[assignment]\n True, help=_("try to find known language servers in sys.prefix (and elsewhere)")\n ).tag(config=True)\n\n sessions: Dict[Tuple[Text], LanguageServerSession] = (\n Dict_( # type:ignore[assignment]\n trait=Instance(LanguageServerSession),\n default_value={},\n help="sessions keyed by language server name",\n )\n )\n\n virtual_documents_dir = Unicode(\n help="""Path to virtual documents relative to the content manager root\n directory.\n\n Its default value can be set with JP_LSP_VIRTUAL_DIR and fallback to\n '.virtual_documents'.\n """\n ).tag(config=True)\n\n _ready = Bool(\n help="""Whether the manager has been initialized""", default_value=False\n )\n\n all_listeners = List_( # type:ignore[var-annotated]\n trait=LoadableCallable # type:ignore[arg-type]\n ).tag(config=True)\n server_listeners = List_( # type:ignore[var-annotated]\n trait=LoadableCallable # type:ignore[arg-type]\n ).tag(config=True)\n client_listeners = List_( # type:ignore[var-annotated]\n trait=LoadableCallable # type:ignore[arg-type]\n ).tag(config=True)\n\n @default("language_servers")\n def _default_language_servers(self):\n return {}\n\n @default("virtual_documents_dir")\n def _default_virtual_documents_dir(self):\n return os.getenv("JP_LSP_VIRTUAL_DIR", ".virtual_documents")\n\n @default("conf_d_language_servers")\n def _default_conf_d_language_servers(self) -> KeyedLanguageServerSpecs:\n language_servers: KeyedLanguageServerSpecs = {}\n\n manager = ConfigManager(read_config_path=jupyter_config_path())\n\n for app in APP_CONFIG_D_SECTIONS:\n language_servers.update(\n **manager.get(f"jupyter{app}config")\n .get(self.__class__.__name__, {})\n .get("language_servers", {})\n )\n\n return language_servers\n\n def __init__(self, **kwargs: Dict):\n """Before starting, perform all necessary configuration"""\n self.all_language_servers: KeyedLanguageServerSpecs = {}\n self._language_servers_from_config: KeyedLanguageServerSpecs = {}\n super().__init__(**kwargs)\n\n def initialize(self, *args, **kwargs):\n self.init_language_servers()\n self.init_listeners()\n self.init_sessions()\n self._ready = True\n\n async def ready(self):\n while not self._ready: # pragma: no cover\n await asyncio.sleep(0.1)\n return True\n\n def init_language_servers(self) -> None:\n """determine the final language server configuration."""\n # copy the language servers before anybody monkeys with them\n self._language_servers_from_config = dict(self.language_servers)\n self.language_servers = self._collect_language_servers(only_installed=True)\n self.all_language_servers = self._collect_language_servers(only_installed=False)\n\n def _collect_language_servers(\n self, only_installed: bool\n ) -> KeyedLanguageServerSpecs:\n language_servers: KeyedLanguageServerSpecs = {}\n\n language_servers_from_config = dict(self._language_servers_from_config)\n language_servers_from_config.update(self.conf_d_language_servers)\n\n if self.autodetect:\n language_servers.update(\n self._autodetect_language_servers(only_installed=only_installed)\n )\n\n # restore config\n language_servers.update(language_servers_from_config)\n\n # coalesce the servers, allowing a user to opt-out by specifying `[]`\n return {key: spec for key, spec in language_servers.items() if spec.get("argv")}\n\n def init_sessions(self):\n """create, but do not initialize all sessions"""\n sessions = {}\n for language_server, spec in self.language_servers.items():\n sessions[language_server] = LanguageServerSession(\n language_server=language_server, spec=spec, parent=self\n )\n self.sessions = sessions\n\n def init_listeners(self):\n """register traitlets-configured listeners"""\n\n scopes = {\n MessageScope.ALL: [self.all_listeners, EP_LISTENER_ALL_V1],\n MessageScope.CLIENT: [self.client_listeners, EP_LISTENER_CLIENT_V1],\n MessageScope.SERVER: [self.server_listeners, EP_LISTENER_SERVER_V1],\n }\n for scope, trt_ep in scopes.items():\n listeners, entry_point = trt_ep\n\n for ept in entry_points(group=entry_point): # pragma: no cover\n try:\n listeners.append(ept.load())\n except Exception as err:\n self.log.warning("Failed to load entry point %s: %s", ept.name, err)\n\n for listener in listeners:\n self.__class__.register_message_listener(scope=scope.value)(listener)\n\n def subscribe(self, handler):\n """subscribe a handler to session, or sta"""\n session = self.sessions.get(handler.language_server)\n\n if session is None:\n self.log.error(\n "[{}] no session: handler subscription failed".format(\n handler.language_server\n )\n )\n return\n\n session.handlers = set([handler]) | session.handlers\n\n async def on_client_message(self, message, handler):\n await self.wait_for_listeners(\n MessageScope.CLIENT, message, handler.language_server\n )\n session = self.sessions.get(handler.language_server)\n\n if session is None:\n self.log.error(\n "[{}] no session: client message dropped".format(\n handler.language_server\n )\n )\n return\n\n session.write(message)\n\n async def on_server_message(self, message, session):\n language_servers = [\n ls_key for ls_key, sess in self.sessions.items() if sess == session\n ]\n\n for language_servers in language_servers:\n await self.wait_for_listeners(\n MessageScope.SERVER, message, language_servers\n )\n\n for handler in session.handlers:\n handler.write_message(message)\n\n def unsubscribe(self, handler):\n session = self.sessions.get(handler.language_server)\n\n if session is None:\n self.log.error(\n "[{}] no session: handler unsubscription failed".format(\n handler.language_server\n )\n )\n return\n\n session.handlers = [h for h in session.handlers if h != handler]\n\n def _autodetect_language_servers(self, only_installed: bool):\n _entry_points = None\n\n try:\n _entry_points = entry_points(group=EP_SPEC_V1)\n except Exception: # pragma: no cover\n self.log.exception("Failed to load entry_points")\n\n skipped_servers = []\n\n for ep in _entry_points or []:\n try:\n spec_finder: SpecMaker = ep.load()\n except Exception as err: # pragma: no cover\n self.log.warning(\n _("Failed to load language server spec finder `{}`: \n{}").format(\n ep.name, err\n )\n )\n continue\n\n try:\n if only_installed:\n if hasattr(spec_finder, "is_installed"):\n spec_finder_from_base = cast(SpecBase, spec_finder)\n if not spec_finder_from_base.is_installed(self):\n skipped_servers.append(ep.name)\n continue\n specs = spec_finder(self) or {}\n except Exception as err: # pragma: no cover\n self.log.warning(\n _(\n "Failed to fetch commands from language server spec finder"\n " `{}`:\n{}"\n ).format(ep.name, err)\n )\n traceback.print_exc()\n\n continue\n\n errors = list(LANGUAGE_SERVER_SPEC_MAP.iter_errors(specs))\n\n if errors: # pragma: no cover\n self.log.warning(\n _(\n "Failed to validate commands from language server spec finder"\n " `{}`:\n{}"\n ).format(ep.name, errors)\n )\n continue\n\n for key, spec in specs.items():\n yield key, spec\n\n if skipped_servers:\n self.log.info(\n _("Skipped non-installed server(s): {}").format(\n ", ".join(skipped_servers)\n )\n )\n\n\n# the listener decorator\nlsp_message_listener = LanguageServerManager.register_message_listener # noqa\n
.venv\Lib\site-packages\jupyter_lsp\manager.py
manager.py
Python
10,792
0.95
0.156051
0.027559
python-kit
208
2023-10-18T14:06:50.476237
GPL-3.0
false
1fee56625797470c6c7291958f29697d
"""\nDerived from\n\n> https://github.com/rudolfwalter/pygdbmi/blob/0.7.4.2/pygdbmi/gdbcontroller.py\n> MIT License https://github.com/rudolfwalter/pygdbmi/blob/master/LICENSE\n> Copyright (c) 2016 Chad Smith <grassfedcode <at> gmail.com>\n"""\n\nimport os\n\nif os.name == "nt": # pragma: no cover\n import msvcrt\n from ctypes import POINTER, WinError, byref, windll, wintypes # type: ignore\n from ctypes.wintypes import BOOL, DWORD, HANDLE # type: ignore\nelse: # pragma: no cover\n import fcntl\n\n\ndef make_non_blocking(file_obj): # pragma: no cover\n """\n make file object non-blocking\n\n Windows doesn't have the fcntl module, but someone on\n stack overflow supplied this code as an answer, and it works\n http://stackoverflow.com/a/34504971/2893090\n """\n\n if os.name == "nt":\n LPDWORD = POINTER(DWORD)\n PIPE_NOWAIT = wintypes.DWORD(0x00000001)\n\n SetNamedPipeHandleState = windll.kernel32.SetNamedPipeHandleState\n SetNamedPipeHandleState.argtypes = [HANDLE, LPDWORD, LPDWORD, LPDWORD]\n SetNamedPipeHandleState.restype = BOOL\n\n h = msvcrt.get_osfhandle(file_obj.fileno())\n\n res = windll.kernel32.SetNamedPipeHandleState(h, byref(PIPE_NOWAIT), None, None)\n if res == 0:\n raise ValueError(WinError())\n\n else:\n # Set the file status flag (F_SETFL) on the pipes to be non-blocking\n # so we can attempt to read from a pipe with no new data without locking\n # the program up\n fcntl.fcntl(file_obj, fcntl.F_SETFL, os.O_NONBLOCK)\n
.venv\Lib\site-packages\jupyter_lsp\non_blocking.py
non_blocking.py
Python
1,546
0.95
0.086957
0.085714
node-utils
447
2024-11-06T15:47:28.938816
MIT
false
5a108904595635506ca322a0f2e8b6d1
import os\nimport re\nfrom pathlib import Path\nfrom typing import Union\nfrom urllib.parse import unquote, urlparse\n\nRE_PATH_ANCHOR = r"^file://([^/]+|/[A-Z]:)"\n\n\ndef normalized_uri(root_dir):\n """Attempt to make an LSP rootUri from a ContentsManager root_dir\n\n Special care must be taken around windows paths: the canonical form of\n windows drives and UNC paths is lower case\n """\n root_uri = Path(root_dir).expanduser().resolve().as_uri()\n root_uri = re.sub(\n RE_PATH_ANCHOR, lambda m: "file://{}".format(m.group(1).lower()), root_uri\n )\n return root_uri\n\n\ndef file_uri_to_path(file_uri):\n """Return a path string for give file:/// URI.\n\n Respect the different path convention on Windows.\n Based on https://stackoverflow.com/a/57463161/6646912, BSD 0\n """\n windows_path = os.name == "nt"\n file_uri_parsed = urlparse(file_uri)\n file_uri_path_unquoted = unquote(file_uri_parsed.path)\n if windows_path and file_uri_path_unquoted.startswith("/"):\n result = file_uri_path_unquoted[1:] # pragma: no cover\n else:\n result = file_uri_path_unquoted # pragma: no cover\n return result\n\n\ndef is_relative(root: Union[str, Path], path: Union[str, Path]) -> bool:\n """Return if path is relative to root"""\n try:\n Path(path).resolve().relative_to(Path(root).resolve())\n return True\n except ValueError:\n return False\n
.venv\Lib\site-packages\jupyter_lsp\paths.py
paths.py
Python
1,405
0.95
0.155556
0
react-lib
116
2023-09-19T14:38:01.896564
GPL-3.0
false
e9ece4d59f6a37405efe2c3824e7ba5a
""" add language server support to the running jupyter notebook application\n"""\n\nimport json\nfrom pathlib import Path\n\nimport traitlets\nfrom tornado import ioloop\n\nfrom .handlers import add_handlers\nfrom .manager import LanguageServerManager\nfrom .paths import normalized_uri\n\n\nasync def initialize(nbapp, virtual_documents_uri): # pragma: no cover\n """Perform lazy initialization."""\n import concurrent.futures\n\n from .virtual_documents_shadow import setup_shadow_filesystem\n\n manager: LanguageServerManager = nbapp.language_server_manager\n\n with concurrent.futures.ThreadPoolExecutor() as pool:\n await nbapp.io_loop.run_in_executor(pool, manager.initialize)\n\n servers_requiring_disk_access = [\n server_id\n for server_id, server in manager.language_servers.items()\n if server.get("requires_documents_on_disk", True)\n ]\n\n if any(servers_requiring_disk_access):\n nbapp.log.debug(\n "[lsp] Servers that requested virtual documents on disk: %s",\n servers_requiring_disk_access,\n )\n setup_shadow_filesystem(virtual_documents_uri=virtual_documents_uri)\n else:\n nbapp.log.debug(\n "[lsp] None of the installed servers require virtual documents"\n " disabling shadow filesystem."\n )\n\n nbapp.log.debug(\n "[lsp] The following Language Servers will be available: {}".format(\n json.dumps(manager.language_servers, indent=2, sort_keys=True)\n )\n )\n\n\ndef load_jupyter_server_extension(nbapp):\n """create a LanguageServerManager and add handlers"""\n nbapp.add_traits(language_server_manager=traitlets.Instance(LanguageServerManager))\n manager = nbapp.language_server_manager = LanguageServerManager(parent=nbapp)\n\n contents = nbapp.contents_manager\n page_config = nbapp.web_app.settings.setdefault("page_config_data", {})\n\n root_uri = ""\n virtual_documents_uri = ""\n\n # try to set the rootUri from the contents manager path\n if hasattr(contents, "root_dir"):\n root_uri = normalized_uri(contents.root_dir)\n nbapp.log.debug("[lsp] rootUri will be %s", root_uri)\n virtual_documents_uri = normalized_uri(\n Path(contents.root_dir) / manager.virtual_documents_dir\n )\n nbapp.log.debug("[lsp] virtualDocumentsUri will be %s", virtual_documents_uri)\n else: # pragma: no cover\n nbapp.log.warn(\n "[lsp] %s did not appear to have a root_dir, could not set rootUri",\n contents,\n )\n page_config.update(rootUri=root_uri, virtualDocumentsUri=virtual_documents_uri)\n\n add_handlers(nbapp)\n\n if hasattr(nbapp, "io_loop"):\n io_loop = nbapp.io_loop\n else:\n # handle jupyter_server 1.x\n io_loop = ioloop.IOLoop.current()\n\n io_loop.call_later(0, initialize, nbapp, virtual_documents_uri)\n
.venv\Lib\site-packages\jupyter_lsp\serverextension.py
serverextension.py
Python
2,862
0.95
0.094118
0.030303
awesome-app
791
2025-05-10T16:51:47.759823
Apache-2.0
false
6a8868f8ed5501dc032aea3a1c11f721
""" A session for managing a language server process\n"""\n\nimport asyncio\nimport atexit\nimport os\nimport string\nimport subprocess\nfrom datetime import datetime, timezone\n\nfrom tornado.ioloop import IOLoop\nfrom tornado.queues import Queue\nfrom tornado.websocket import WebSocketHandler\nfrom traitlets import Bunch, Instance, Set, Unicode, UseEnum, observe\nfrom traitlets.config import LoggingConfigurable\n\nfrom . import stdio\nfrom .schema import LANGUAGE_SERVER_SPEC\nfrom .specs.utils import censored_spec\nfrom .trait_types import Schema\nfrom .types import SessionStatus\n\n\nclass LanguageServerSession(LoggingConfigurable):\n """Manage a session for a connection to a language server"""\n\n language_server = Unicode(help="the language server implementation name")\n spec = Schema(LANGUAGE_SERVER_SPEC)\n\n # run-time specifics\n process = Instance(\n subprocess.Popen, help="the language server subprocess", allow_none=True\n )\n writer = Instance(stdio.LspStdIoWriter, help="the JSON-RPC writer", allow_none=True)\n reader = Instance(stdio.LspStdIoReader, help="the JSON-RPC reader", allow_none=True)\n from_lsp = Instance(\n Queue, help="a queue for string messages from the server", allow_none=True\n )\n to_lsp = Instance(\n Queue, help="a queue for string message to the server", allow_none=True\n )\n handlers = Set(\n trait=Instance(WebSocketHandler),\n default_value=[],\n help="the currently subscribed websockets",\n )\n status = UseEnum(SessionStatus, default_value=SessionStatus.NOT_STARTED)\n last_handler_message_at = Instance(datetime, allow_none=True)\n last_server_message_at = Instance(datetime, allow_none=True)\n\n _tasks = None\n\n _skip_serialize = ["argv", "debug_argv"]\n\n def __init__(self, *args, **kwargs):\n """set up the required traitlets and exit behavior for a session"""\n super().__init__(*args, **kwargs)\n atexit.register(self.stop)\n\n def __repr__(self): # pragma: no cover\n return (\n "<LanguageServerSession(" "language_server={language_server}, argv={argv})>"\n ).format(language_server=self.language_server, **self.spec)\n\n def to_json(self):\n return dict(\n handler_count=len(self.handlers),\n status=self.status.value,\n last_server_message_at=(\n self.last_server_message_at.isoformat()\n if self.last_server_message_at\n else None\n ),\n last_handler_message_at=(\n self.last_handler_message_at.isoformat()\n if self.last_handler_message_at\n else None\n ),\n spec=censored_spec(self.spec),\n )\n\n def initialize(self):\n """(re)initialize a language server session"""\n self.stop()\n self.status = SessionStatus.STARTING\n self.init_queues()\n self.init_process()\n self.init_writer()\n self.init_reader()\n\n loop = asyncio.get_event_loop()\n self._tasks = [\n loop.create_task(coro())\n for coro in [self._read_lsp, self._write_lsp, self._broadcast_from_lsp]\n ]\n\n self.status = SessionStatus.STARTED\n\n def stop(self):\n """clean up all of the state of the session"""\n\n self.status = SessionStatus.STOPPING\n\n if self.process:\n self.process.terminate()\n self.process = None\n if self.reader:\n self.reader.close()\n self.reader = None\n if self.writer:\n self.writer.close()\n self.writer = None\n\n if self._tasks:\n [task.cancel() for task in self._tasks]\n\n self.status = SessionStatus.STOPPED\n\n @observe("handlers")\n def _on_handlers(self, change: Bunch):\n """re-initialize if someone starts listening, or stop if nobody is"""\n if change["new"] and not self.process:\n self.initialize()\n elif not change["new"] and self.process:\n self.stop()\n\n def write(self, message):\n """wrapper around the write queue to keep it mostly internal"""\n self.last_handler_message_at = self.now()\n IOLoop.current().add_callback(self.to_lsp.put_nowait, message)\n\n def now(self):\n return datetime.now(timezone.utc)\n\n def init_process(self):\n """start the language server subprocess"""\n self.process = subprocess.Popen(\n self.spec["argv"],\n stdin=subprocess.PIPE,\n stdout=subprocess.PIPE,\n env=self.substitute_env(self.spec.get("env", {}), os.environ),\n bufsize=0,\n )\n\n def init_queues(self):\n """create the queues"""\n self.from_lsp = Queue()\n self.to_lsp = Queue()\n\n def init_reader(self):\n """create the stdout reader (from the language server)"""\n self.reader = stdio.LspStdIoReader(\n stream=self.process.stdout, queue=self.from_lsp, parent=self\n )\n\n def init_writer(self):\n """create the stdin writer (to the language server)"""\n self.writer = stdio.LspStdIoWriter(\n stream=self.process.stdin, queue=self.to_lsp, parent=self\n )\n\n def substitute_env(self, env, base):\n final_env = base.copy()\n\n for key, value in env.items():\n final_env.update({key: string.Template(value).safe_substitute(base)})\n\n return final_env\n\n async def _read_lsp(self):\n await self.reader.read()\n\n async def _write_lsp(self):\n await self.writer.write()\n\n async def _broadcast_from_lsp(self):\n """loop for reading messages from the queue of messages from the language\n server\n """\n async for message in self.from_lsp:\n self.last_server_message_at = self.now()\n await self.parent.on_server_message(message, self)\n self.from_lsp.task_done()\n
.venv\Lib\site-packages\jupyter_lsp\session.py
session.py
Python
5,908
0.95
0.196721
0.006667
node-utils
24
2025-02-09T18:19:22.254617
GPL-3.0
false
a263b18bc834697c839c21fc267a67a8
""" Language Server stdio-mode readers\n\nParts of this code are derived from:\n\n> https://github.com/palantir/python-jsonrpc-server/blob/0.2.0/pyls_jsonrpc/streams.py#L83 # noqa\n> https://github.com/palantir/python-jsonrpc-server/blob/45ed1931e4b2e5100cc61b3992c16d6f68af2e80/pyls_jsonrpc/streams.py # noqa\n> > MIT License https://github.com/palantir/python-jsonrpc-server/blob/0.2.0/LICENSE\n> > Copyright 2018 Palantir Technologies, Inc.\n"""\n\n# pylint: disable=broad-except\nimport asyncio\nimport io\nimport os\nfrom concurrent.futures import ThreadPoolExecutor\nfrom typing import List, Optional, Text\n\nfrom tornado.concurrent import run_on_executor\nfrom tornado.gen import convert_yielded\nfrom tornado.httputil import HTTPHeaders\nfrom tornado.ioloop import IOLoop\nfrom tornado.queues import Queue\nfrom traitlets import Float, Instance, default\nfrom traitlets.config import LoggingConfigurable\n\nfrom .non_blocking import make_non_blocking\n\n\nclass LspStdIoBase(LoggingConfigurable):\n """Non-blocking, queued base for communicating with stdio Language Servers"""\n\n executor = None\n\n stream = Instance( # type:ignore[assignment]\n io.RawIOBase, help="the stream to read/write"\n ) # type: io.RawIOBase\n queue = Instance(Queue, help="queue to get/put")\n\n def __repr__(self): # pragma: no cover\n return "<{}(parent={})>".format(self.__class__.__name__, self.parent)\n\n def __init__(self, **kwargs):\n super().__init__(**kwargs)\n self.log.debug("%s initialized", self)\n self.executor = ThreadPoolExecutor(max_workers=1)\n\n def close(self):\n self.stream.close()\n self.log.debug("%s closed", self)\n\n\nclass LspStdIoReader(LspStdIoBase):\n """Language Server stdio Reader\n\n Because non-blocking (but still synchronous) IO is used, rudimentary\n exponential backoff is used.\n """\n\n max_wait = Float(help="maximum time to wait on idle stream").tag(config=True)\n min_wait = Float(0.05, help="minimum time to wait on idle stream").tag(config=True)\n next_wait = Float(0.05, help="next time to wait on idle stream").tag(config=True)\n\n @default("max_wait")\n def _default_max_wait(self):\n return 0.1 if os.name == "nt" else self.min_wait * 2\n\n async def sleep(self):\n """Simple exponential backoff for sleeping"""\n if self.stream.closed: # pragma: no cover\n return\n self.next_wait = min(self.next_wait * 2, self.max_wait)\n try:\n await asyncio.sleep(self.next_wait)\n except Exception: # pragma: no cover\n pass\n\n def wake(self):\n """Reset the wait time"""\n self.wait = self.min_wait\n\n async def read(self) -> None:\n """Read from a Language Server until it is closed"""\n make_non_blocking(self.stream)\n\n while not self.stream.closed:\n message = None\n try:\n message = await self.read_one()\n\n if not message:\n await self.sleep()\n continue\n else:\n self.wake()\n\n IOLoop.current().add_callback(self.queue.put_nowait, message)\n except Exception as e: # pragma: no cover\n self.log.exception(\n "%s couldn't enqueue message: %s (%s)", self, message, e\n )\n await self.sleep()\n\n async def _read_content(\n self, length: int, max_parts=1000, max_empties=200\n ) -> Optional[bytes]:\n """Read the full length of the message unless exceeding max_parts or\n max_empties empty reads occur.\n\n See https://github.com/jupyter-lsp/jupyterlab-lsp/issues/450\n\n Crucial docs or read():\n "If the argument is positive, and the underlying raw\n stream is not interactive, multiple raw reads may be issued\n to satisfy the byte count (unless EOF is reached first)"\n\n Args:\n - length: the content length\n - max_parts: prevent absurdly long messages (1000 parts is several MBs):\n 1 part is usually sufficient but not enough for some long\n messages 2 or 3 parts are often needed.\n """\n raw = None\n raw_parts: List[bytes] = []\n received_size = 0\n while received_size < length and len(raw_parts) < max_parts and max_empties > 0:\n part = None\n try:\n part = self.stream.read(length - received_size)\n except OSError: # pragma: no cover\n pass\n if part is None:\n max_empties -= 1\n await self.sleep()\n continue\n received_size += len(part)\n raw_parts.append(part)\n\n if raw_parts:\n raw = b"".join(raw_parts)\n if len(raw) != length: # pragma: no cover\n self.log.warning(\n f"Readout and content-length mismatch: {len(raw)} vs {length};"\n f"remaining empties: {max_empties}; remaining parts: {max_parts}"\n )\n\n return raw\n\n async def read_one(self) -> Text:\n """Read a single message"""\n message = ""\n headers = HTTPHeaders()\n\n line = await convert_yielded(self._readline())\n\n if line:\n while line and line.strip():\n headers.parse_line(line)\n line = await convert_yielded(self._readline())\n\n content_length = int(headers.get("content-length", "0"))\n\n if content_length:\n raw = await self._read_content(length=content_length)\n if raw is not None:\n message = raw.decode("utf-8").strip()\n else: # pragma: no cover\n self.log.warning(\n "%s failed to read message of length %s",\n self,\n content_length,\n )\n\n return message\n\n @run_on_executor\n def _readline(self) -> Text:\n """Read a line (or immediately return None)"""\n try:\n return self.stream.readline().decode("utf-8").strip()\n except OSError: # pragma: no cover\n return ""\n\n\nclass LspStdIoWriter(LspStdIoBase):\n """Language Server stdio Writer"""\n\n async def write(self) -> None:\n """Write to a Language Server until it closes"""\n while not self.stream.closed:\n message = await self.queue.get()\n try:\n body = message.encode("utf-8")\n response = "Content-Length: {}\r\n\r\n{}".format(len(body), message)\n await convert_yielded(self._write_one(response.encode("utf-8")))\n except Exception: # pragma: no cover\n self.log.exception("%s couldn't write message: %s", self, response)\n finally:\n self.queue.task_done()\n\n @run_on_executor\n def _write_one(self, message) -> None:\n self.stream.write(message)\n self.stream.flush()\n
.venv\Lib\site-packages\jupyter_lsp\stdio.py
stdio.py
Python
7,031
0.95
0.17734
0.006135
vue-tools
732
2023-11-17T05:44:12.173553
MIT
false
3d17bd6a584ec2d592d6814bc0c19194
import traitlets\n\n\nclass Schema(traitlets.Any):\n """any... but validated by a jsonschema.Validator"""\n\n _validator = None\n\n def __init__(self, validator, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self._validator = validator\n\n def validate(self, obj, value):\n errors = list(self._validator.iter_errors(value))\n if errors:\n raise traitlets.TraitError(\n ("""schema errors:\n""" """\t{}\n""" """for:\n""" """{}""").format(\n "\n\t".join([error.message for error in errors]), value\n )\n )\n return value\n\n\nclass LoadableCallable(traitlets.TraitType):\n """A trait which (maybe) loads a callable."""\n\n info_text = "a loadable callable"\n\n def validate(self, obj, value):\n if isinstance(value, str):\n try:\n value = traitlets.import_item(value)\n except Exception:\n self.error(obj, value)\n\n if callable(value):\n return value\n else:\n self.error(obj, value)\n
.venv\Lib\site-packages\jupyter_lsp\trait_types.py
trait_types.py
Python
1,076
0.85
0.282051
0
python-kit
216
2024-09-23T17:05:35.338245
MIT
false
84c47fd2bc9e09835c76038e9a5ab27d
""" API used by spec finders and manager\n"""\n\nimport asyncio\nimport enum\nimport json\nimport pathlib\nimport re\nimport shutil\nimport subprocess\nimport sys\nfrom functools import lru_cache\nfrom typing import (\n TYPE_CHECKING,\n Any,\n Awaitable,\n Callable,\n Dict,\n List,\n Optional,\n Pattern,\n Text,\n Union,\n cast,\n)\n\ntry:\n from jupyter_server.transutils import _i18n as _\nexcept ImportError: # pragma: no cover\n from jupyter_server.transutils import _\n\nfrom traitlets import Any as Any_\nfrom traitlets import Instance\nfrom traitlets import List as List_\nfrom traitlets import Unicode, default\nfrom traitlets.config import LoggingConfigurable\n\nLanguageServerSpec = Dict[Text, Any]\nLanguageServerMessage = Dict[Text, Any]\nKeyedLanguageServerSpecs = Dict[Text, LanguageServerSpec]\n\nif TYPE_CHECKING: # pragma: no cover\n from typing_extensions import Protocol\n\n class HandlerListenerCallback(Protocol):\n def __call__(\n self,\n scope: Text,\n message: LanguageServerMessage,\n language_server: Text,\n manager: "LanguageServerManagerAPI",\n ) -> Awaitable[None]: ...\n\n\nclass SessionStatus(enum.Enum):\n """States in which a language server session can be"""\n\n NOT_STARTED = "not_started"\n STARTING = "starting"\n STARTED = "started"\n STOPPING = "stopping"\n STOPPED = "stopped"\n\n\nclass MessageScope(enum.Enum):\n """Scopes for message listeners"""\n\n ALL = "all"\n CLIENT = "client"\n SERVER = "server"\n\n\nclass MessageListener(object):\n """A base listener implementation"""\n\n language_server: Optional[Pattern[Text]] = None\n method: Optional[Pattern[Text]] = None\n\n def __init__(\n self,\n listener: "HandlerListenerCallback",\n language_server: Optional[Text],\n method: Optional[Text],\n ):\n self.listener = listener\n self.language_server = re.compile(language_server) if language_server else None\n self.method = re.compile(method) if method else None\n\n async def __call__(\n self,\n scope: Text,\n message: LanguageServerMessage,\n language_server: Text,\n manager: "LanguageServerManagerAPI",\n ) -> None:\n """actually dispatch the message to the listener and capture any errors"""\n try:\n await self.listener(\n scope=scope,\n message=message,\n language_server=language_server,\n manager=manager,\n )\n except Exception: # pragma: no cover\n manager.log.warn(\n "[lsp] error in listener %s for message %s",\n self.listener,\n message,\n exc_info=True,\n )\n\n def wants(self, message: LanguageServerMessage, language_server: Text):\n """whether this listener wants a particular message\n\n `method` is currently the only message content discriminator, but not\n all messages will have a `method`\n """\n if self.method:\n method = message.get("method")\n\n if method is None or re.match(self.method, method) is None:\n return False\n return self.language_server is None or re.match(\n self.language_server, language_server\n )\n\n def __repr__(self):\n return (\n "<MessageListener"\n " listener={self.listener},"\n " method={self.method},"\n " language_server={self.language_server}>"\n ).format(self=self)\n\n\nclass HasListeners:\n _listeners = {\n str(scope.value): [] for scope in MessageScope\n } # type: Dict[Text, List[MessageListener]]\n\n log: Any = Instance("logging.Logger")\n\n @classmethod\n def register_message_listener(\n cls,\n scope: Text,\n language_server: Optional[Text] = None,\n method: Optional[Text] = None,\n ):\n """register a listener for language server protocol messages"""\n\n def inner(listener: "HandlerListenerCallback") -> "HandlerListenerCallback":\n cls.unregister_message_listener(listener)\n cls._listeners[scope].append(\n MessageListener(\n listener=listener, language_server=language_server, method=method\n )\n )\n return listener\n\n return inner\n\n @classmethod\n def unregister_message_listener(cls, listener: "HandlerListenerCallback"):\n """unregister a listener for language server protocol messages"""\n for scope in MessageScope:\n cls._listeners[str(scope.value)] = [\n lst\n for lst in cls._listeners[str(scope.value)]\n if lst.listener != listener\n ]\n\n async def wait_for_listeners(\n self, scope: MessageScope, message_str: Text, language_server: Text\n ) -> None:\n scope_val = str(scope.value)\n listeners = self._listeners[scope_val] + self._listeners[MessageScope.ALL.value]\n\n if listeners:\n message = json.loads(message_str)\n\n futures = [\n listener(\n scope_val,\n message=message,\n language_server=language_server,\n manager=cast("LanguageServerManagerAPI", self),\n )\n for listener in listeners\n if listener.wants(message, language_server)\n ]\n\n if futures:\n await asyncio.gather(*futures)\n\n\nclass LanguageServerManagerAPI(LoggingConfigurable, HasListeners):\n """Public API that can be used for python-based spec finders and listeners"""\n\n language_servers: KeyedLanguageServerSpecs\n\n nodejs = Unicode(help=_("path to nodejs executable")).tag(config=True)\n\n node_roots = List_(\n trait=Any_(),\n default_value=[],\n help=_("absolute paths in which to seek node_modules"),\n ).tag(config=True)\n\n extra_node_roots = List_(\n trait=Any_(),\n default_value=[],\n help=_("additional absolute paths to seek node_modules first"),\n ).tag(config=True)\n\n def find_node_module(self, *path_frag):\n """look through the node_module roots to find the given node module"""\n all_roots = self.extra_node_roots + self.node_roots\n found = None\n\n for candidate_root in all_roots:\n candidate = pathlib.Path(candidate_root, "node_modules", *path_frag)\n self.log.debug("Checking for %s", candidate)\n if candidate.exists():\n found = str(candidate)\n break\n\n if found is None: # pragma: no cover\n self.log.debug(\n "{} not found in node_modules of {}".format(\n pathlib.Path(*path_frag), all_roots\n )\n )\n\n return found\n\n @default("nodejs")\n def _default_nodejs(self):\n return (\n shutil.which("node") or shutil.which("nodejs") or shutil.which("nodejs.exe")\n )\n\n @lru_cache(maxsize=1)\n def _npm_prefix(self, npm: Text):\n try:\n return (\n subprocess.run([npm, "prefix", "-g"], check=True, capture_output=True)\n .stdout.decode("utf-8")\n .strip()\n )\n except Exception as e: # pragma: no cover\n self.log.warn(f"Could not determine npm prefix: {e}")\n\n @default("node_roots")\n def _default_node_roots(self):\n """get the "usual suspects" for where `node_modules` may be found\n\n - where this was launch (usually the same as NotebookApp.notebook_dir)\n - the JupyterLab staging folder (if available)\n - wherever conda puts it\n - wherever some other conventions put it\n """\n\n # check where the server was started first\n roots = [pathlib.Path.cwd()]\n\n # try jupyterlab staging next\n try:\n from jupyterlab import commands\n\n roots += [pathlib.Path(commands.get_app_dir()) / "staging"]\n except ImportError: # pragma: no cover\n pass\n\n # conda puts stuff in $PREFIX/lib on POSIX systems\n roots += [pathlib.Path(sys.prefix) / "lib"]\n\n # ... but right in %PREFIX% on nt\n roots += [pathlib.Path(sys.prefix)]\n\n # check for custom npm prefix\n npm = shutil.which("npm")\n if npm:\n prefix = self._npm_prefix(npm)\n if prefix:\n roots += [ # pragma: no cover\n pathlib.Path(prefix) / "lib",\n pathlib.Path(prefix),\n ]\n\n return roots\n\n\nSimpleSpecMaker = Callable[[LanguageServerManagerAPI], KeyedLanguageServerSpecs]\n\n# String corresponding to a fragment of a shell command\n# arguments list such as returned by `shlex.split`\nToken = Text\n\n\nclass SpecBase:\n """Base for a spec finder that returns a spec for starting a language server"""\n\n key = ""\n languages: List[Text] = []\n args: List[Token] = []\n spec: LanguageServerSpec = {}\n\n def is_installed(self, mgr: LanguageServerManagerAPI) -> bool: # pragma: no cover\n """Whether the language server is installed or not.\n\n This method may become abstract in the next major release."""\n return True\n\n def __call__(\n self, mgr: LanguageServerManagerAPI\n ) -> KeyedLanguageServerSpecs: # pragma: no cover\n return {}\n\n\n# Gotta be down here so it can by typed... really should have a IL\nSpecMaker = Union[SpecBase, SimpleSpecMaker]\n
.venv\Lib\site-packages\jupyter_lsp\types.py
types.py
Python
9,538
0.95
0.173913
0.031008
python-kit
768
2023-09-01T17:58:14.781813
MIT
false
2a99eb8eb875c27e4220ed2f4b703259
# flake8: noqa: W503\nfrom concurrent.futures import ThreadPoolExecutor\nfrom pathlib import Path\nfrom shutil import rmtree\nfrom typing import List\n\nfrom tornado.concurrent import run_on_executor\nfrom tornado.gen import convert_yielded\n\nfrom .manager import lsp_message_listener\nfrom .paths import file_uri_to_path, is_relative\nfrom .types import LanguageServerManagerAPI\n\n# TODO: make configurable\nMAX_WORKERS = 4\n\n\ndef extract_or_none(obj, path):\n for crumb in path:\n try:\n obj = obj[crumb]\n except (KeyError, TypeError):\n return None\n return obj\n\n\nclass EditableFile:\n executor = ThreadPoolExecutor(max_workers=MAX_WORKERS)\n\n def __init__(self, path):\n # Python 3.5 relict:\n self.path = Path(path) if isinstance(path, str) else path\n\n async def read(self):\n self.lines = await convert_yielded(self.read_lines())\n\n async def write(self):\n return await convert_yielded(self.write_lines())\n\n @run_on_executor\n def read_lines(self):\n # empty string required by the assumptions of the gluing algorithm\n lines = [""]\n try:\n # TODO: what to do about bad encoding reads?\n lines = self.path.read_text(encoding="utf-8").splitlines()\n except FileNotFoundError:\n pass\n return lines\n\n @run_on_executor\n def write_lines(self):\n self.path.parent.mkdir(parents=True, exist_ok=True)\n self.path.write_text("\n".join(self.lines), encoding="utf-8")\n\n @staticmethod\n def trim(lines: list, character: int, side: int):\n needs_glue = False\n if lines:\n trimmed = lines[side][character:]\n if lines[side] != trimmed:\n needs_glue = True\n lines[side] = trimmed\n return needs_glue\n\n @staticmethod\n def join(left, right, glue: bool):\n if not glue:\n return []\n return [(left[-1] if left else "") + (right[0] if right else "")]\n\n def apply_change(self, text: str, start, end):\n before = self.lines[: start["line"]]\n after = self.lines[end["line"] :]\n\n needs_glue_left = self.trim(lines=before, character=start["character"], side=0)\n needs_glue_right = self.trim(lines=after, character=end["character"], side=-1)\n\n inner = text.split("\n")\n\n self.lines = (\n before[: -1 if needs_glue_left else None]\n + self.join(before, inner, needs_glue_left)\n + inner[1 if needs_glue_left else None : -1 if needs_glue_right else None]\n + self.join(inner, after, needs_glue_right)\n + after[1 if needs_glue_right else None :]\n ) or [""]\n\n @property\n def full_range(self):\n start = {"line": 0, "character": 0}\n end = {\n "line": len(self.lines),\n "character": len(self.lines[-1]) if self.lines else 0,\n }\n return {"start": start, "end": end}\n\n\nWRITE_ONE = ["textDocument/didOpen", "textDocument/didChange", "textDocument/didSave"]\n\n\nclass ShadowFilesystemError(ValueError):\n """Error in the shadow file system."""\n\n\ndef setup_shadow_filesystem(virtual_documents_uri: str):\n if not virtual_documents_uri.startswith("file:/"):\n raise ShadowFilesystemError( # pragma: no cover\n 'Virtual documents URI has to start with "file:/", got '\n + virtual_documents_uri\n )\n\n initialized = False\n failures: List[Exception] = []\n\n shadow_filesystem = Path(file_uri_to_path(virtual_documents_uri))\n\n @lsp_message_listener("client")\n async def shadow_virtual_documents(scope, message, language_server, manager):\n """Intercept a message with document contents creating a shadow file for it.\n\n Only create the shadow file if the URI matches the virtual documents URI.\n Returns the path on filesystem where the content was stored.\n """\n nonlocal initialized\n\n # short-circut if language server does not require documents on disk\n server_spec = manager.language_servers[language_server]\n if not server_spec.get("requires_documents_on_disk", True):\n return\n\n if not message.get("method") in WRITE_ONE:\n return\n\n document = extract_or_none(message, ["params", "textDocument"])\n if document is None:\n raise ShadowFilesystemError(\n "Could not get textDocument from: {}".format(message)\n )\n\n uri = extract_or_none(document, ["uri"])\n if not uri:\n raise ShadowFilesystemError("Could not get URI from: {}".format(message))\n\n if not uri.startswith(virtual_documents_uri):\n return\n\n # initialization (/any file system operations) delayed until needed\n if not initialized:\n if len(failures) == 3:\n return\n try:\n # create if does no exist (so that removal does not raise)\n shadow_filesystem.mkdir(parents=True, exist_ok=True)\n # remove with contents\n rmtree(str(shadow_filesystem))\n # create again\n shadow_filesystem.mkdir(parents=True, exist_ok=True)\n except (OSError, PermissionError, FileNotFoundError) as e:\n failures.append(e)\n if len(failures) == 3:\n manager.log.warn(\n "[lsp] initialization of shadow filesystem failed three times"\n " check if the path set by `LanguageServerManager.virtual_documents_dir`"\n " or `JP_LSP_VIRTUAL_DIR` is correct; if this is happening with a server"\n " for which you control (or wish to override) jupyter-lsp specification"\n " you can try switching `requires_documents_on_disk` off. The errors were: %s",\n failures,\n )\n return\n initialized = True\n\n path = file_uri_to_path(uri)\n if not is_relative(shadow_filesystem, path):\n raise ShadowFilesystemError(\n f"Path {path} is not relative to shadow filesystem root"\n )\n\n editable_file = EditableFile(path)\n\n await editable_file.read()\n\n text = extract_or_none(document, ["text"])\n\n if text is not None:\n # didOpen and didSave may provide text within the document\n changes = [{"text": text}]\n else:\n # didChange is the only one which can also provide it in params (as contentChanges)\n if message["method"] != "textDocument/didChange":\n return\n if "contentChanges" not in message["params"]:\n raise ShadowFilesystemError(\n "textDocument/didChange is missing contentChanges"\n )\n changes = message["params"]["contentChanges"]\n\n if len(changes) > 1:\n manager.log.warn( # pragma: no cover\n "LSP warning: up to one change supported for textDocument/didChange"\n )\n\n for change in changes[:1]:\n change_range = change.get("range", editable_file.full_range)\n editable_file.apply_change(change["text"], **change_range)\n\n await editable_file.write()\n\n return path\n\n return shadow_virtual_documents\n
.venv\Lib\site-packages\jupyter_lsp\virtual_documents_shadow.py
virtual_documents_shadow.py
Python
7,359
0.95
0.251185
0.072289
awesome-app
231
2023-08-23T14:10:38.050265
GPL-3.0
false
76ee6195d023458b36dc9ec8c9d89295
""" single source of truth for jupyter_lsp version\n"""\n\n__version__ = "2.2.5"\n
.venv\Lib\site-packages\jupyter_lsp\_version.py
_version.py
Python
78
0.5
0.25
0
vue-tools
668
2024-01-30T07:03:11.386130
Apache-2.0
false
0da008e970f1c65b7f10da9557977236
# flake8: noqa: F401\nfrom ._version import __version__\nfrom .manager import LanguageServerManager, lsp_message_listener\nfrom .serverextension import load_jupyter_server_extension\nfrom .specs.utils import NodeModuleSpec, ShellSpec\nfrom .types import (\n KeyedLanguageServerSpecs,\n LanguageServerManagerAPI,\n LanguageServerSpec,\n)\n\n\ndef _jupyter_server_extension_paths():\n return [{"module": "jupyter_lsp"}]\n\n\n_jupyter_server_extension_points = _jupyter_server_extension_paths\n
.venv\Lib\site-packages\jupyter_lsp\__init__.py
__init__.py
Python
486
0.95
0.058824
0.076923
vue-tools
202
2023-09-29T15:21:40.817785
Apache-2.0
false
a2baeb8c0951f3a5ae510cf65098eac6
{\n "ServerApp": {\n "jpserver_extensions": {\n "jupyter_lsp": true\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\etc\jupyter-lsp-jupyter-server.json
jupyter-lsp-jupyter-server.json
JSON
86
0.5
0
0
react-lib
433
2024-08-06T21:42:29.347115
BSD-3-Clause
false
f4a8bb0c7dbee222892ab906f7f4a51f
{\n "$schema": "http://json-schema.org/draft-07/schema#",\n "definitions": {\n "client-config-schema": {\n "description": "a JSON schema to configure the Language Server or extension behavior from the client",\n "title": "Client Configuration Schema",\n "type": "object"\n },\n "current-version": {\n "description": "which version of the spec this implements",\n "enum": [2],\n "title": "Spec Schema Version",\n "type": "number"\n },\n "env-var": {\n "title": "an environment variable. may contain python `string.Template` evaluated against the existing environment, e.g ${HOME}",\n "type": "string"\n },\n "install-bundle": {\n "additionalProperties": {\n "$ref": "#/definitions/install-help"\n },\n "description": "a list of installation approaches keyed by package manager, e.g. pip, npm, yarn, apt",\n "patternProperties": {\n ".+": {\n "$ref": "#/definitions/install-help"\n }\n },\n "title": "Installation",\n "type": "object"\n },\n "install-help": {\n "description": "the install commands or description for installing the language server",\n "type": "string"\n },\n "language-list": {\n "description": "languages supported by this Language Server",\n "items": {\n "type": "string"\n },\n "minItems": 1,\n "type": "array",\n "uniqueItems": true\n },\n "language-server-extension": {\n "description": "an extension which can extend the functionality of the language server and client",\n "properties": {\n "config_schema": {\n "$ref": "#/definitions/client-config-schema"\n },\n "display_name": {\n "type": "string"\n },\n "install": {\n "$ref": "#/definitions/install-bundle"\n }\n },\n "title": "Language Server Extension",\n "type": "object"\n },\n "language-server-spec": {\n "allOf": [\n {\n "$ref": "#/definitions/partial-language-server-spec"\n },\n {\n "required": ["argv", "languages", "version"]\n }\n ],\n "description": "a description of a language server that could be started",\n "title": "Language Server Spec"\n },\n "nullable-date-time": {\n "description": "a date/time that might not have been recorded",\n "oneOf": [\n {\n "format": "date-time",\n "type": "string"\n },\n {\n "type": "null"\n }\n ]\n },\n "partial-language-server-spec": {\n "description": "all properties that might be required to start and/or describe a Language Server",\n "properties": {\n "argv": {\n "$ref": "#/definitions/shell-args",\n "description": "the arguments to start the language server normally",\n "title": "Launch Arguments"\n },\n "config_schema": {\n "$ref": "#/definitions/client-config-schema",\n "description": "a JSON schema to configure the Language Server behavior from the client",\n "title": "Client Configuration Schema"\n },\n "debug_argv": {\n "$ref": "#/definitions/shell-args",\n "description": "the arguments to start the language server with more verbose output",\n "title": "Debug Arguments"\n },\n "display_name": {\n "description": "name shown in the UI",\n "title": "Display Name",\n "type": "string"\n },\n "env": {\n "additionalProperties": {\n "$ref": "#/definitions/env-var"\n },\n "description": "additional environment variables to set when starting the language server",\n "patternProperties": {\n "[^ ]+": {\n "$ref": "#/definitions/env-var"\n }\n },\n "title": "Environment Variables",\n "type": "object"\n },\n "extend": {\n "description": "known extensions that can contribute to the Language Server's features",\n "items": {\n "$ref": "#/definitions/language-server-extension"\n },\n "title": "Extensions",\n "type": "array"\n },\n "requires_documents_on_disk": {\n "default": true,\n "description": "Whether to write un-saved documents to disk in a transient `.virtual_documents` directory. Well-behaved language servers that work against in-memory files should set this to `false`, which will become the default in the future.",\n "type": "boolean"\n },\n "install": {\n "$ref": "#/definitions/install-bundle",\n "description": "a list of installation approaches keyed by package manager, e.g. pip, npm, yarn, apt",\n "title": "Installation"\n },\n "languages": {\n "$ref": "#/definitions/language-list"\n },\n "mime_types": {\n "$ref": "#/definitions/language-list",\n "description": "list of MIME types supported by the language server",\n "title": "MIME Types"\n },\n "troubleshoot": {\n "type": "string",\n "description": "information on troubleshooting the installation or auto-detection of the language server",\n "title": "Troubleshooting"\n },\n "urls": {\n "additionalProperties": {\n "format": "uri",\n "type": "string"\n },\n "description": "a collection of urls keyed by type, e.g. home, issues",\n "patternProperties": {\n ".+": {\n "format": "uri",\n "type": "string"\n }\n },\n "title": "URLs",\n "type": "object"\n },\n "version": {\n "$ref": "#/definitions/current-version"\n },\n "workspace_configuration": {\n "description": "default values to include in the client `workspace/configuration` reply (also known as `serverSettings`). User may override these defaults. The keys should be fully qualified (dotted) names of settings (nested specification is not supported).",\n "title": "Workspace configuration",\n "type": "object"\n }\n },\n "title": "Server Spec Properties"\n },\n "servers-response": {\n "properties": {\n "sessions": {\n "$ref": "#/definitions/sessions"\n },\n "specs": {\n "$ref": "#/definitions/language-server-specs-implementation-map"\n },\n "version": {\n "$ref": "#/definitions/current-version"\n }\n },\n "required": ["sessions", "version"],\n "type": "object"\n },\n "sessions": {\n "description": "named server sessions that are, could be, or were running",\n "patternProperties": {\n ".*": {\n "$ref": "#/definitions/session"\n }\n },\n "additionalProperties": {\n "$ref": "#/definitions/session"\n },\n "type": "object"\n },\n "session": {\n "additionalProperties": false,\n "description": "a language server session",\n "properties": {\n "handler_count": {\n "description": "the count of currently-connected WebSocket handlers",\n "minValue": 0,\n "title": "handler count",\n "type": "integer"\n },\n "last_handler_message_at": {\n "$ref": "#/definitions/nullable-date-time",\n "description": "date-time of last seen message from a WebSocket handler"\n },\n "last_server_message_at": {\n "$ref": "#/definitions/nullable-date-time",\n "description": "date-time of last seen message from the language server"\n },\n "spec": {\n "$ref": "#/definitions/partial-language-server-spec"\n },\n "status": {\n "description": "a string describing the current state of the server",\n "enum": ["not_started", "starting", "started", "stopping", "stopped"],\n "type": "string"\n }\n },\n "required": [\n "handler_count",\n "status",\n "last_server_message_at",\n "last_handler_message_at",\n "spec"\n ],\n "title": "Language Server Session"\n },\n "shell-args": {\n "description": "a list of tokens for running a command",\n "items": {\n "type": "string"\n },\n "type": "array"\n },\n "language-server-specs-implementation-map": {\n "title": "Language Server Specs Map",\n "description": "a set of language servers keyed by their implementation name",\n "patternProperties": {\n ".*": {\n "$ref": "#/definitions/language-server-spec"\n }\n },\n "additionalProperties": {\n "$ref": "#/definitions/language-server-spec"\n },\n "type": "object"\n }\n },\n "description": "describes the current state of (potentially) running language servers",\n "title": "jupyter_lsp server status response"\n}\n
.venv\Lib\site-packages\jupyter_lsp\schema\schema.json
schema.json
JSON
8,855
0.95
0.007576
0
node-utils
85
2023-11-15T08:20:55.128882
GPL-3.0
false
2e0b390ac63af819f2092d78bde7109a
import json\nimport pathlib\n\nimport jsonschema\n\nHERE = pathlib.Path(__file__).parent\nSCHEMA_FILE = HERE / "schema.json"\nSCHEMA = json.loads(SCHEMA_FILE.read_text(encoding="utf-8"))\nSPEC_VERSION = SCHEMA["definitions"]["current-version"]["enum"][0]\n\n\ndef make_validator(key):\n """make a JSON Schema (Draft 7) validator"""\n schema = {"$ref": "#/definitions/{}".format(key)}\n schema.update(SCHEMA)\n return jsonschema.validators.Draft7Validator(schema)\n\n\nSERVERS_RESPONSE = make_validator("servers-response")\n\nLANGUAGE_SERVER_SPEC = make_validator("language-server-spec")\n\nLANGUAGE_SERVER_SPEC_MAP = make_validator("language-server-specs-implementation-map")\n
.venv\Lib\site-packages\jupyter_lsp\schema\__init__.py
__init__.py
Python
666
0.95
0.043478
0
react-lib
547
2024-07-23T05:23:27.202011
BSD-3-Clause
false
dd5b02e01cf790eac72d3e64749fafba
\n\n
.venv\Lib\site-packages\jupyter_lsp\schema\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
1,310
0.8
0
0
awesome-app
37
2024-02-05T04:00:58.115652
MIT
false
7eebf3c507ea2fb2019e63df67aaab7d
from ..types import LanguageServerManagerAPI\nfrom .config import load_config_schema\nfrom .utils import NodeModuleSpec\n\n\nclass BashLanguageServer(NodeModuleSpec):\n node_module = key = "bash-language-server"\n script = ["out", "cli.js"]\n fallback_script = ["bin", "main.js"]\n args = ["start"]\n languages = ["bash", "sh"]\n spec = dict(\n display_name=key,\n mime_types=["text/x-sh", "application/x-sh"],\n urls=dict(\n home="https://github.com/bash-lsp/{}".format(key),\n issues="https://github.com/bash-lsp/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n config_schema=load_config_schema(key),\n )\n\n def solve(self, mgr: LanguageServerManagerAPI):\n new_path = mgr.find_node_module(self.node_module, *self.script)\n if new_path:\n return new_path\n return mgr.find_node_module(\n self.node_module, *self.fallback_script\n ) # pragma: no cover\n
.venv\Lib\site-packages\jupyter_lsp\specs\bash_language_server.py
bash_language_server.py
Python
1,131
0.95
0.090909
0
python-kit
728
2025-05-16T06:11:17.349605
MIT
false
1568465a70dfb3c5883af076ccffeab7
from .config import load_config_schema\nfrom .utils import NodeModuleSpec\n\n\nclass DockerfileLanguageServerNodeJS(NodeModuleSpec):\n node_module = key = "dockerfile-language-server-nodejs"\n script = ["lib", "server.js"]\n args = ["--stdio"]\n languages = ["dockerfile"]\n spec = dict(\n display_name=key,\n mime_types=["text/x-dockerfile"],\n urls=dict(\n home="https://github.com/rcjsuen/{}".format(key),\n issues="https://github.com/rcjsuen/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n config_schema=load_config_schema(key),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\dockerfile_language_server_nodejs.py
dockerfile_language_server_nodejs.py
Python
768
0.95
0.043478
0
vue-tools
20
2024-08-17T13:49:27.533145
Apache-2.0
false
207f0df988fc8e1c05b2fef4f45c37ec
from .utils import NodeModuleSpec\n\n\nclass JavascriptTypescriptLanguageServer(NodeModuleSpec):\n node_module = key = "javascript-typescript-langserver"\n script = ["lib", "language-server-stdio.js"]\n languages = [\n "javascript",\n "jsx",\n "typescript",\n "typescript-jsx",\n "typescriptreact",\n "javascriptreact",\n ]\n spec = dict(\n display_name=key + " (deprecated)",\n mime_types=[\n "application/typescript",\n "text/typescript-jsx",\n "text/javascript",\n "text/ecmascript",\n "application/javascript",\n "application/x-javascript",\n "application/ecmascript",\n "text/jsx",\n ],\n urls=dict(\n home="https://github.com/sourcegraph/{}".format(key),\n issues="https://github.com/sourcegraph/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\javascript_typescript_langserver.py
javascript_typescript_langserver.py
Python
1,100
0.95
0.027778
0
node-utils
888
2025-02-05T11:07:43.243403
MIT
false
6c792bc84c0174f8fea8e41a6c28aaf8
from .utils import ShellSpec\n\n\nclass JediLanguageServer(ShellSpec):\n key = cmd = "jedi-language-server"\n languages = ["python"]\n spec = dict(\n display_name="jedi-language-server",\n mime_types=["text/python", "text/x-ipython"],\n urls=dict(\n home="https://github.com/pappasam/jedi-language-server",\n issues="https://github.com/pappasam/jedi-language-server/issues",\n ),\n install=dict(\n pip="pip install -U jedi-language-server",\n conda="conda install -c conda-forge jedi-language-server",\n ),\n env=dict(PYTHONUNBUFFERED="1"),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\jedi_language_server.py
jedi_language_server.py
Python
632
0.95
0.052632
0
node-utils
817
2024-03-16T09:12:12.565560
GPL-3.0
false
1b3e3ff9cc8f7ad96ed6e710d0eb114e
from .config import load_config_schema\nfrom .utils import ShellSpec\n\n\nclass JuliaLanguageServer(ShellSpec):\n key = "julia-language-server"\n languages = ["julia"]\n cmd = "julia"\n args = [\n "--project=.",\n "-e",\n "using LanguageServer, LanguageServer.SymbolServer; runserver()",\n ".",\n ]\n is_installed_args = [\n "-e",\n 'print(if (Base.find_package("LanguageServer") === nothing) "" else "yes" end)',\n ]\n spec = dict(\n display_name="LanguageServer.jl",\n mime_types=["text/julia", "text/x-julia", "application/julia"],\n urls=dict(\n home="https://github.com/julia-vscode/LanguageServer.jl",\n issues="https://github.com/julia-vscode/LanguageServer.jl/issues",\n ),\n install=dict(julia='using Pkg; Pkg.add("LanguageServer")'),\n config_schema=load_config_schema(key),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\julia_language_server.py
julia_language_server.py
Python
895
0.95
0.071429
0
awesome-app
136
2024-03-21T20:22:29.518393
BSD-3-Clause
false
95b17122ac8a694b91496fb2ef53d59c
from .config import load_config_schema\nfrom .utils import PythonModuleSpec\n\n\nclass PalantirPythonLanguageServer(PythonModuleSpec):\n python_module = key = "pyls"\n languages = ["python"]\n spec = dict(\n display_name="pyls",\n mime_types=["text/python", "text/x-ipython"],\n urls=dict(\n home="https://github.com/palantir/python-language-server",\n issues="https://github.com/palantir/python-language-server/issues",\n ),\n install=dict(\n pip="pip install 'python-language-server[all]'",\n conda="conda install -c conda-forge python-language-server",\n ),\n extend=[\n dict(\n display_name="pyls-mypy",\n install=dict(\n pip="pip install pyls-mypy", conda="conda install pyls-mypy"\n ),\n ),\n dict(\n display_name="pyls-black",\n install=dict(\n pip="pip install pyls-black", conda="conda install pyls-black"\n ),\n ),\n dict(display_name="pyls-isort", install=dict(pip="pip install pyls-isort")),\n ],\n config_schema=load_config_schema(key),\n env=dict(PYTHONUNBUFFERED="1"),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\pyls.py
pyls.py
Python
1,262
0.95
0.027778
0
react-lib
497
2023-10-23T09:15:31.210481
BSD-3-Clause
false
11d135b9cdca0ed6eac436eb7ea7c377
from .config import load_config_schema\nfrom .utils import NodeModuleSpec\n\n\nclass PyrightLanguageServer(NodeModuleSpec):\n node_module = key = "pyright"\n script = ["langserver.index.js"]\n args = ["--stdio"]\n languages = ["python"]\n spec = dict(\n display_name=key,\n mime_types=["text/python", "text/x-ipython"],\n urls=dict(\n home="https://github.com/microsoft/pyright",\n issues="https://github.com/microsoft/pyright/issues",\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n config_schema=load_config_schema(key),\n requires_documents_on_disk=False,\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\pyright.py
pyright.py
Python
776
0.95
0.041667
0
react-lib
702
2025-02-28T17:18:54.403393
BSD-3-Clause
false
5dbf34d742fea464d35c43efa2cd735e
from .config import load_config_schema\nfrom .utils import PythonModuleSpec\n\n\nclass PythonLSPServer(PythonModuleSpec):\n python_module = key = "pylsp"\n languages = ["python"]\n spec = dict(\n display_name="python-lsp-server (pylsp)",\n mime_types=["text/python", "text/x-ipython"],\n urls=dict(\n home="https://github.com/python-lsp/python-lsp-server",\n issues="https://github.com/python-lsp/python-lsp-server/issues",\n ),\n install=dict(\n pip="pip install 'python-lsp-server[all]'",\n conda="conda install -c conda-forge python-lsp-server",\n ),\n extend=[\n dict(\n display_name="pyls-mypy",\n install=dict(\n pip="pip install pyls-mypy", conda="conda install pyls-mypy"\n ),\n ),\n dict(\n display_name="pyls-black",\n install=dict(\n pip="pip install pyls-black", conda="conda install pyls-black"\n ),\n ),\n dict(\n display_name="pyls-isort",\n install=dict(\n pip="pip install pyls-isort",\n conda="conda install pyls-isort",\n ),\n ),\n dict(\n display_name="pyls-memestra",\n install=dict(\n pip="pip install pyls-memestra",\n conda="conda install pyls-memestra",\n ),\n ),\n ],\n config_schema=load_config_schema(key),\n env=dict(PYTHONUNBUFFERED="1"),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\python_lsp_server.py
python_lsp_server.py
Python
1,633
0.95
0.020408
0
node-utils
890
2025-06-20T03:17:20.341407
Apache-2.0
false
c697f27b39df96391447c127f248117f
from .config import load_config_schema\nfrom .utils import ShellSpec\n\nTROUBLESHOOT = """\\nPlease ensure that RScript executable is in the PATH; \\nthis should happen automatically when using Linux, Mac OS or Conda, \\nbut will require manual configuration when using the default R installer on Windows.\n\nFor more details please consult documentation:\nhttps://cran.r-project.org/bin/windows/base/rw-FAQ.html#Rcmd-is-not-found-in-my-PATH_0021\n\nIf Rscript is already in the PATH, you can check whether \\nthe language server package is properly installed with:\n\n Rscript -e "cat(system.file(package='languageserver'))"\n\nwhich should return the path to the installed package.\n"""\n\n\nclass RLanguageServer(ShellSpec):\n package = "languageserver"\n key = "r-languageserver"\n cmd = "Rscript"\n\n @property\n def args(self):\n return ["--slave", "-e", f"{self.package}::run()"]\n\n @property\n def is_installed_args(self):\n return ["-e", f"cat(system.file(package='{self.package}'))"]\n\n languages = ["r"]\n spec = dict(\n display_name=key,\n mime_types=["text/x-rsrc"],\n urls=dict(\n home="https://github.com/REditorSupport/languageserver",\n issues="https://github.com/REditorSupport/languageserver/issues",\n ),\n install=dict(\n cran=f'install.packages("{package}")',\n conda="conda install -c conda-forge r-languageserver",\n ),\n config_schema=load_config_schema(key),\n troubleshoot=TROUBLESHOOT,\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\r_languageserver.py
r_languageserver.py
Python
1,518
0.95
0.0625
0
awesome-app
145
2023-08-15T05:58:42.431823
Apache-2.0
false
13e2df0b3d6f220abc046e7f026482e2
from .config import load_config_schema\nfrom .utils import NodeModuleSpec\n\n\nclass SQLLanguageServer(NodeModuleSpec):\n """Supports mysql, postgres and sqlite3"""\n\n node_module = key = "sql-language-server"\n script = ["dist", "bin", "cli.js"]\n languages = [\n "sql",\n ]\n args = ["up", "--method", "stdio"]\n spec = dict(\n display_name=key,\n mime_types=[\n "application/sql",\n "text/sql",\n "text/x-sql",\n "text/x-mysql",\n "text/x-mariadb",\n "text/x-pgsql",\n ],\n urls=dict(\n home="https://github.com/joe-re/{}".format(key),\n issues="https://github.com/joe-re/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n config_schema=load_config_schema(key),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\sql_language_server.py
sql_language_server.py
Python
973
0.95
0.029412
0
node-utils
229
2024-02-27T23:49:15.472342
BSD-3-Clause
false
aea7404a209addfa045d1608a6f15def
from .config import load_config_schema\nfrom .utils import ShellSpec\n\nTROUBLESHOOT = """\\nPlease ensure that texlab executable is in the PATH; \\nthis should happen automatically when installing texlab from Conda, \\nbut may require manual configuration of PATH environment variable \\nif you compiled texlab from source.\n\nYou can ensure check if texlab is in the PATH, by running:\n\n which texlab\n\nwhich should return the path to the executable (if found).\n"""\n\n\nclass Texlab(ShellSpec):\n cmd = key = "texlab"\n languages = ["tex", "latex"]\n spec = dict(\n display_name="texlab",\n mime_types=["text/x-latex", "text/x-tex"],\n urls=dict(\n home="https://texlab.netlify.app",\n issues="https://github.com/latex-lsp/texlab/issues",\n ),\n install=dict(conda="conda install -c conda-forge texlab chktex"),\n config_schema=load_config_schema(key),\n env=dict(RUST_BACKTRACE="1"),\n troubleshoot=TROUBLESHOOT,\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\texlab.py
texlab.py
Python
984
0.95
0.125
0
python-kit
213
2023-12-25T16:27:04.570887
GPL-3.0
false
dae5009b440abef201fd0314b86f26eb
from .config import load_config_schema\nfrom .utils import NodeModuleSpec\n\n\nclass TypescriptLanguageServer(NodeModuleSpec):\n node_module = key = "typescript-language-server"\n script = ["lib", "cli.mjs"]\n args = ["--stdio"]\n languages = [\n "javascript",\n "jsx",\n "typescript",\n "typescript-jsx",\n "typescriptreact",\n "javascriptreact",\n ]\n spec = dict(\n display_name=key,\n mime_types=[\n "application/typescript",\n "text/typescript-jsx",\n "text/javascript",\n "text/ecmascript",\n "application/javascript",\n "application/x-javascript",\n "application/ecmascript",\n "text/jsx",\n ],\n urls=dict(\n home="https://github.com/typescript-language-server/{}".format(key),\n issues="https://github.com/typescript-language-server/{}/issues".format(\n key\n ),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n config_schema=load_config_schema(key),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\typescript_language_server.py
typescript_language_server.py
Python
1,218
0.95
0.02439
0
node-utils
84
2024-05-24T14:50:24.321702
GPL-3.0
false
d29767b1a3520e24791fd306a65ed2c2
from .utils import NodeModuleSpec\n\n\nclass UnifiedLanguageServer(NodeModuleSpec):\n node_module = key = "unified-language-server"\n script = ["src", "server.js"]\n args = ["--parser=remark-parse", "--stdio"]\n languages = ["markdown", "ipythongfm", "gfm"]\n spec = dict(\n display_name=key,\n mime_types=["text/x-gfm", "text/x-ipythongfm", "text/x-markdown"],\n urls=dict(\n home="https://github.com/unifiedjs/{}".format(key),\n issues="https://github.com/unifiedjs/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\unified_language_server.py
unified_language_server.py
Python
744
0.95
0.047619
0
python-kit
309
2025-05-25T01:27:18.294087
Apache-2.0
false
6b3db74e739a959fe61c29338e3d8aa4
import os\nimport shutil\nimport sys\nfrom pathlib import Path\nfrom subprocess import check_output\nfrom typing import List, Text, Union\n\nfrom ..schema import SPEC_VERSION\nfrom ..types import (\n KeyedLanguageServerSpecs,\n LanguageServerManagerAPI,\n LanguageServerSpec,\n SpecBase,\n Token,\n)\n\n# helper scripts for known tricky language servers\nHELPERS = Path(__file__).parent / "helpers"\n\n# when building docs, let all specs go through\nBUILDING_DOCS = os.environ.get("JUPYTER_LSP_BUILDING_DOCS") is not None\n\n\nclass ShellSpec(SpecBase): # pragma: no cover\n """Helper for a language server spec for executables on $PATH in the\n notebook server environment.\n """\n\n cmd = ""\n\n # [optional] arguments passed to `cmd` which upon execution should print\n # out a non-empty string if the the required language server package\n # is installed, or nothing if it is missing and user action is required.\n is_installed_args: List[Token] = []\n\n def is_installed(self, mgr: LanguageServerManagerAPI) -> bool:\n cmd = self.solve()\n\n if not cmd:\n return False\n\n if not self.is_installed_args:\n return bool(cmd)\n else:\n check_result = check_output([cmd, *self.is_installed_args]).decode(\n encoding="utf-8"\n )\n return check_result != ""\n\n def solve(self) -> Union[str, None]:\n for ext in ["", ".cmd", ".bat", ".exe"]:\n cmd = shutil.which(self.cmd + ext)\n if cmd:\n break\n return cmd\n\n def __call__(self, mgr: LanguageServerManagerAPI) -> KeyedLanguageServerSpecs:\n cmd = self.solve()\n\n spec = dict(self.spec)\n\n if not cmd:\n troubleshooting = [f"{self.cmd} not found."]\n if "troubleshoot" in spec:\n troubleshooting.append(spec["troubleshoot"])\n spec["troubleshoot"] = "\n\n".join(troubleshooting)\n\n if not cmd and BUILDING_DOCS: # pragma: no cover\n cmd = self.cmd\n\n return {\n self.key: {\n "argv": [cmd, *self.args] if cmd else [self.cmd, *self.args],\n "languages": self.languages,\n "version": SPEC_VERSION,\n **spec,\n }\n }\n\n\nclass PythonModuleSpec(SpecBase):\n """Helper for a python-based language server spec in the notebook server\n environment\n """\n\n python_module = ""\n\n def is_installed(self, mgr: LanguageServerManagerAPI) -> bool:\n spec = self.solve()\n\n if not spec:\n return False\n\n if not spec.origin: # pragma: no cover\n return False\n\n return True\n\n def solve(self):\n return __import__("importlib").util.find_spec(self.python_module)\n\n def __call__(self, mgr: LanguageServerManagerAPI) -> KeyedLanguageServerSpecs:\n is_installed = self.is_installed(mgr)\n\n return {\n self.key: {\n "argv": (\n [sys.executable, "-m", self.python_module, *self.args]\n if is_installed\n else []\n ),\n "languages": self.languages,\n "version": SPEC_VERSION,\n **self.spec,\n }\n }\n\n\nclass NodeModuleSpec(SpecBase):\n """Helper for a nodejs-based language server spec in one of several\n node_modules\n """\n\n node_module = ""\n script: List[Text] = []\n\n def is_installed(self, mgr: LanguageServerManagerAPI) -> bool:\n node_module = self.solve(mgr)\n return bool(node_module)\n\n def solve(self, mgr: LanguageServerManagerAPI):\n return mgr.find_node_module(self.node_module, *self.script)\n\n def __call__(self, mgr: LanguageServerManagerAPI) -> KeyedLanguageServerSpecs:\n node_module = self.solve(mgr)\n\n spec = dict(self.spec)\n\n troubleshooting = ["Node.js is required to install this server."]\n if "troubleshoot" in spec: # pragma: no cover\n troubleshooting.append(spec["troubleshoot"])\n spec["troubleshoot"] = "\n\n".join(troubleshooting)\n\n is_installed = self.is_installed(mgr)\n\n return {\n self.key: {\n "argv": ([mgr.nodejs, node_module, *self.args] if is_installed else []),\n "languages": self.languages,\n "version": SPEC_VERSION,\n **spec,\n }\n }\n\n\n# these are not desirable to publish to the frontend\n# and will be replaced with the simplest schema-compliant values\nSKIP_JSON_SPEC = {"argv": [""], "debug_argv": [""], "env": {}}\n\n\ndef censored_spec(spec: LanguageServerSpec) -> LanguageServerSpec:\n return {k: SKIP_JSON_SPEC.get(k, v) for k, v in spec.items()}\n
.venv\Lib\site-packages\jupyter_lsp\specs\utils.py
utils.py
Python
4,737
0.95
0.209877
0.081967
python-kit
735
2023-08-05T05:18:30.736262
Apache-2.0
false
d270cbbc16c992691b0d33fe46cf7a7d
from .utils import NodeModuleSpec\n\n\nclass VSCodeCSSLanguageServer(NodeModuleSpec):\n node_module = key = "vscode-css-languageserver-bin"\n script = ["cssServerMain.js"]\n args = ["--stdio"]\n languages = ["css", "less", "scss"]\n spec = dict(\n display_name=key,\n mime_types=["text/x-scss", "text/css", "text/x-less"],\n urls=dict(\n home="https://github.com/vscode-langservers/{}".format(key),\n issues="https://github.com/vscode-langservers/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\vscode_css_languageserver.py
vscode_css_languageserver.py
Python
723
0.95
0.047619
0
python-kit
958
2024-06-28T12:12:32.761604
BSD-3-Clause
false
12366d0541408ff5e30bf710e34ca1ec
from .utils import NodeModuleSpec\n\n\nclass VSCodeHTMLLanguageServer(NodeModuleSpec):\n node_module = key = "vscode-html-languageserver-bin"\n script = ["htmlServerMain.js"]\n args = ["--stdio"]\n languages = ["html"]\n spec = dict(\n display_name=key,\n mime_types=["text/html"],\n urls=dict(\n home="https://github.com/vscode-langservers/{}".format(key),\n issues="https://github.com/vscode-langservers/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\vscode_html_languageserver.py
vscode_html_languageserver.py
Python
682
0.95
0.047619
0
react-lib
971
2024-11-15T00:00:51.035101
BSD-3-Clause
false
caf88d9e4c763c88b8463a05bf2c2c9e
from .utils import NodeModuleSpec\n\n\nclass VSCodeJSONLanguageServer(NodeModuleSpec):\n node_module = key = "vscode-json-languageserver-bin"\n script = ["jsonServerMain.js"]\n args = ["--stdio"]\n languages = ["json"]\n spec = dict(\n display_name=key,\n mime_types=["application/json", "application/x-json", "application/ld+json"],\n urls=dict(\n home="https://github.com/vscode-langservers/{}".format(key),\n issues="https://github.com/vscode-langservers/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\vscode_json_languageserver.py
vscode_json_languageserver.py
Python
734
0.95
0.047619
0
node-utils
230
2024-09-07T05:47:15.680914
BSD-3-Clause
false
65e980868dee16a50f7073b88808a5fc
from .config import load_config_schema\nfrom .utils import NodeModuleSpec\n\n\nclass YAMLLanguageServer(NodeModuleSpec):\n node_module = key = "yaml-language-server"\n script = ["bin", key]\n args = ["--stdio"]\n languages = ["yaml"]\n spec = dict(\n display_name=key,\n mime_types=["text/x-yaml", "text/yaml"],\n urls=dict(\n home="https://github.com/redhat-developer/{}".format(key),\n issues="https://github.com/redhat-developer/{}/issues".format(key),\n ),\n install=dict(\n npm="npm install --save-dev {}".format(key),\n yarn="yarn add --dev {}".format(key),\n jlpm="jlpm add --dev {}".format(key),\n ),\n config_schema=load_config_schema(key),\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\yaml_language_server.py
yaml_language_server.py
Python
754
0.95
0.043478
0
node-utils
784
2024-01-11T15:51:00.408542
MIT
false
29ea4ebb0bbec4aa719bf4f26b0ff4a3
""" default specs\n"""\n\n# flake8: noqa: F401\n\nfrom .bash_language_server import BashLanguageServer\nfrom .dockerfile_language_server_nodejs import DockerfileLanguageServerNodeJS\nfrom .javascript_typescript_langserver import JavascriptTypescriptLanguageServer\nfrom .jedi_language_server import JediLanguageServer\nfrom .julia_language_server import JuliaLanguageServer\nfrom .pyls import PalantirPythonLanguageServer\nfrom .pyright import PyrightLanguageServer\nfrom .python_lsp_server import PythonLSPServer\nfrom .r_languageserver import RLanguageServer\nfrom .sql_language_server import SQLLanguageServer\nfrom .texlab import Texlab\nfrom .typescript_language_server import TypescriptLanguageServer\nfrom .unified_language_server import UnifiedLanguageServer\nfrom .vscode_css_languageserver import VSCodeCSSLanguageServer\nfrom .vscode_html_languageserver import VSCodeHTMLLanguageServer\nfrom .vscode_json_languageserver import VSCodeJSONLanguageServer\nfrom .yaml_language_server import YAMLLanguageServer\n\nbash = BashLanguageServer()\ncss = VSCodeCSSLanguageServer()\ndockerfile = DockerfileLanguageServerNodeJS()\nhtml = VSCodeHTMLLanguageServer()\njedi = JediLanguageServer()\njson = VSCodeJSONLanguageServer()\njulia = JuliaLanguageServer()\nmd = UnifiedLanguageServer()\npy_palantir = PalantirPythonLanguageServer()\npy_lsp_server = PythonLSPServer()\npyright = PyrightLanguageServer()\nr = RLanguageServer()\ntex = Texlab()\nts_old = JavascriptTypescriptLanguageServer()\nts = TypescriptLanguageServer()\nsql = SQLLanguageServer()\nyaml = YAMLLanguageServer()\n
.venv\Lib\site-packages\jupyter_lsp\specs\__init__.py
__init__.py
Python
1,540
0.95
0
0.027027
react-lib
759
2024-01-22T01:48:53.884168
MIT
false
9cb2b3f8aa308529404b0d0cbb0c3057
{\n "type": "object",\n "title": "Bash IDE configuration",\n "properties": {\n "bashIde.backgroundAnalysisMaxFiles": {\n "type": "number",\n "default": 500,\n "description": "Maximum number of files to analyze in the background. Set to 0 to disable background analysis.",\n "minimum": 0\n },\n "bashIde.enableSourceErrorDiagnostics": {\n "type": "boolean",\n "default": false,\n "description": "Enable diagnostics for source errors. Ignored if includeAllWorkspaceSymbols is true."\n },\n "bashIde.explainshellEndpoint": {\n "type": "string",\n "default": "",\n "description": "Configure explainshell server endpoint in order to get hover documentation on flags and options."\n },\n "bashIde.globPattern": {\n "type": "string",\n "default": "**/*@(.sh|.inc|.bash|.command)",\n "description": "Glob pattern for finding and parsing shell script files in the workspace. Used by the background analysis features across files."\n },\n "bashIde.includeAllWorkspaceSymbols": {\n "type": "boolean",\n "default": false,\n "description": "Controls how symbols (e.g. variables and functions) are included and used for completion and documentation. If false (default and recommended), then we only include symbols from sourced files (i.e. using non dynamic statements like 'source file.sh' or '. file.sh' or following ShellCheck directives). If true, then all symbols from the workspace are included."\n },\n "bashIde.logLevel": {\n "type": "string",\n "default": "info",\n "enum": ["debug", "info", "warning", "error"],\n "description": "Controls the log level of the language server."\n },\n "bashIde.shellcheckPath": {\n "type": "string",\n "default": "shellcheck",\n "description": "Controls the executable used for ShellCheck linting information. An empty string will disable linting."\n },\n "bashIde.shellcheckArguments": {\n "type": "string",\n "default": "",\n "description": "Additional ShellCheck arguments. Note that we already add the following arguments: --shell, --format, --external-sources."\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\bash-language-server.schema.json
bash-language-server.schema.json
JSON
2,142
0.95
0.104167
0
awesome-app
457
2024-06-04T01:24:48.603050
MIT
false
edff8cb6aef7b46d01c850fa99da926e
{\n "title": "Docker language server confiuguration",\n "type": "object",\n "$comment": "Based on settings of vscode-docker which is distributed under MIT License, Copyright (c) Microsoft Corporation",\n "properties": {\n "docker.defaultRegistryPath": {\n "type": "string",\n "default": "",\n "description": "Default registry and path when tagging an image"\n },\n "docker.explorerRefreshInterval": {\n "type": "number",\n "default": 2000,\n "description": "Explorer refresh interval, default is 2000ms"\n },\n "docker.containers.groupBy": {\n "type": "string",\n "default": "None",\n "description": "The property to use when grouping containers.",\n "enum": [\n "ContainerId",\n "ContainerName",\n "CreatedTime",\n "FullTag",\n "ImageId",\n "Networks",\n "None",\n "Ports",\n "Registry",\n "Repository",\n "RepositoryName",\n "RepositoryNameAndTag",\n "State",\n "Status",\n "Tag"\n ]\n },\n "docker.containers.description": {\n "type": "array",\n "default": ["ContainerName", "Status"],\n "description": "Any secondary properties to display for a container.",\n "items": {\n "type": "string",\n "enum": [\n "ContainerId",\n "ContainerName",\n "CreatedTime",\n "FullTag",\n "ImageId",\n "Networks",\n "Ports",\n "Registry",\n "Repository",\n "RepositoryName",\n "RepositoryNameAndTag",\n "State",\n "Status",\n "Tag"\n ]\n }\n },\n "docker.containers.label": {\n "type": "string",\n "default": "FullTag",\n "description": "The primary property to display for a container.",\n "enum": [\n "ContainerId",\n "ContainerName",\n "CreatedTime",\n "FullTag",\n "ImageId",\n "Networks",\n "Ports",\n "Registry",\n "Repository",\n "RepositoryName",\n "RepositoryNameAndTag",\n "State",\n "Status",\n "Tag"\n ]\n },\n "docker.containers.sortBy": {\n "type": "string",\n "default": "CreatedTime",\n "description": "The property to use when sorting containers.",\n "enum": ["CreatedTime", "Label"]\n },\n "docker.images.groupBy": {\n "type": "string",\n "default": "Repository",\n "description": "The property to use when grouping images.",\n "enum": [\n "CreatedTime",\n "FullTag",\n "ImageId",\n "None",\n "Registry",\n "Repository",\n "RepositoryName",\n "RepositoryNameAndTag",\n "Tag"\n ]\n },\n "docker.images.description": {\n "type": "array",\n "default": ["CreatedTime"],\n "description": "Any secondary properties to display for a image.",\n "items": {\n "type": "string",\n "enum": [\n "CreatedTime",\n "FullTag",\n "ImageId",\n "Registry",\n "Repository",\n "RepositoryName",\n "RepositoryNameAndTag",\n "Tag"\n ]\n }\n },\n "docker.images.label": {\n "type": "string",\n "default": "Tag",\n "description": "The primary property to display for a image.",\n "enum": [\n "CreatedTime",\n "FullTag",\n "ImageId",\n "Registry",\n "Repository",\n "RepositoryName",\n "RepositoryNameAndTag",\n "Tag"\n ]\n },\n "docker.images.sortBy": {\n "type": "string",\n "default": "CreatedTime",\n "description": "The property to use when sorting images.",\n "enum": ["CreatedTime", "Label"]\n },\n "docker.networks.groupBy": {\n "type": "string",\n "default": "None",\n "description": "The property to use when grouping networks.",\n "enum": [\n "CreatedTime",\n "NetworkDriver",\n "NetworkId",\n "NetworkName",\n "None"\n ]\n },\n "docker.networks.description": {\n "type": "array",\n "default": ["NetworkDriver", "CreatedTime"],\n "description": "Any secondary properties to display for a network.",\n "items": {\n "type": "string",\n "enum": ["CreatedTime", "NetworkDriver", "NetworkId", "NetworkName"]\n }\n },\n "docker.networks.label": {\n "type": "string",\n "default": "NetworkName",\n "description": "The primary property to display for a network.",\n "enum": ["CreatedTime", "NetworkDriver", "NetworkId", "NetworkName"]\n },\n "docker.networks.sortBy": {\n "type": "string",\n "default": "CreatedTime",\n "description": "The property to use when sorting networks.",\n "enum": ["CreatedTime", "Label"]\n },\n "docker.volumes.groupBy": {\n "type": "string",\n "default": "None",\n "description": "The property to use when grouping volumes.",\n "enum": ["CreatedTime", "VolumeName", "None"]\n },\n "docker.volumes.description": {\n "type": "array",\n "default": ["CreatedTime"],\n "description": "Any secondary properties to display for a volume.",\n "items": {\n "type": "string",\n "enum": ["CreatedTime", "VolumeName"]\n }\n },\n "docker.volumes.label": {\n "type": "string",\n "default": "VolumeName",\n "description": "The primary property to display for a volume.",\n "enum": ["CreatedTime", "VolumeName"]\n },\n "docker.volumes.sortBy": {\n "type": "string",\n "default": "CreatedTime",\n "description": "The property to use when sorting volumes.",\n "enum": ["CreatedTime", "Label"]\n },\n "docker.imageBuildContextPath": {\n "type": "string",\n "default": "",\n "description": "Build context PATH to pass to Docker build command"\n },\n "docker.truncateLongRegistryPaths": {\n "type": "boolean",\n "default": false,\n "description": "Truncate long Image and Container registry paths in the Explorer"\n },\n "docker.truncateMaxLength": {\n "type": "number",\n "default": 10,\n "description": "Maximum number of characters for long registry paths in the Explorer, including elipsis"\n },\n "docker.host": {\n "type": "string",\n "default": "",\n "description": "Equivalent to setting the DOCKER_HOST environment variable."\n },\n "docker.certPath": {\n "type": "string",\n "default": "",\n "description": "Equivalent to setting the DOCKER_CERT_PATH environment variable."\n },\n "docker.tlsVerify": {\n "type": "string",\n "default": "",\n "description": "Equivalent to setting the DOCKER_TLS_VERIFY environment variable."\n },\n "docker.machineName": {\n "type": "string",\n "default": "",\n "description": "Equivalent to setting the DOCKER_MACHINE_NAME environment variable."\n },\n "docker.languageserver.diagnostics.deprecatedMaintainer": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for the deprecated MAINTAINER instruction"\n },\n "docker.languageserver.diagnostics.emptyContinuationLine": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for flagging empty continuation lines found in instructions that span multiple lines"\n },\n "docker.languageserver.diagnostics.directiveCasing": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for parser directives that are not written in lowercase"\n },\n "docker.languageserver.diagnostics.instructionCasing": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for instructions that are not written in uppercase"\n },\n "docker.languageserver.diagnostics.instructionCmdMultiple": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for flagging a Dockerfile with multiple CMD instructions"\n },\n "docker.languageserver.diagnostics.instructionEntrypointMultiple": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for flagging a Dockerfile with multiple ENTRYPOINT instructions"\n },\n "docker.languageserver.diagnostics.instructionHealthcheckMultiple": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for flagging a Dockerfile with multiple HEALTHCHECK instructions"\n },\n "docker.languageserver.diagnostics.instructionJSONInSingleQuotes": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for JSON instructions that are written incorrectly with single quotes"\n },\n "docker.languageserver.diagnostics.instructionWorkdirRelative": {\n "scope": "resource",\n "type": "string",\n "default": "warning",\n "enum": ["ignore", "warning", "error"],\n "description": "Controls the diagnostic severity for WORKDIR instructions that do not point to an absolute path"\n },\n "docker.attachShellCommand.linuxContainer": {\n "type": "string",\n "default": "/bin/sh -c \"[ -e /bin/bash ] && /bin/bash || /bin/sh\"",\n "description": "Attach command to use for Linux containers"\n },\n "docker.attachShellCommand.windowsContainer": {\n "type": "string",\n "default": "powershell",\n "description": "Attach command to use for Windows containers"\n },\n "docker.dockerComposeBuild": {\n "type": "boolean",\n "default": true,\n "description": "Run docker-compose with the --build argument, defaults to true"\n },\n "docker.dockerComposeDetached": {\n "type": "boolean",\n "default": true,\n "description": "Run docker-compose with the --d (detached) argument, defaults to true"\n },\n "docker.showRemoteWorkspaceWarning": {\n "type": "boolean",\n "default": true,\n "description": "Show a prompt to switch from \"UI\" extension to \"Workspace\" extension if an operation is not supported."\n },\n "docker.dockerPath": {\n "type": "string",\n "default": "docker",\n "description": "Absolute path to Docker client executable ('docker' command). If the path contains whitespace, it needs to be quoted appropriately."\n },\n "docker.enableDockerComposeLanguageService": {\n "type": "boolean",\n "default": true,\n "description": "Whether or not to enable the preview Docker Compose Language Service. Changing requires restart to take effect"\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\dockerfile-language-server-nodejs.schema.json
dockerfile-language-server-nodejs.schema.json
JSON
11,154
0.85
0.065089
0
python-kit
491
2025-05-07T16:58:19.971632
Apache-2.0
false
3e57ca4c3c43bd0a8adf21791b11ff94
{\n "title": "Julia Language Server Configuration",\n "description": "Extracted from https://github.com/julia-vscode/julia-vscode/blob/master/package.json; markdownDescription → description; removed Code-specific options, retained the overlap with https://github.com/julia-vscode/LanguageServer.jl/blob/36d8da744c1cb517cca3ba19180ddd276c1c6bf5/src/requests/workspace.jl#L88-L103; distributed under MIT License Copyright (c) 2012-2019 David Anthoff, Zac Nugent and other contributors (https://github.com/JuliaLang/Julia.tmbundle/contributors, https://github.com/julia-vscode/julia-vscode/contributors)",\n "type": "object",\n "properties": {\n "julia.lint.run": {\n "type": "boolean",\n "default": true,\n "description": "Run the linter on active files."\n },\n "julia.lint.missingrefs": {\n "type": "string",\n "default": "none",\n "enum": ["none", "symbols", "all"],\n "description": "Highlight unknown symbols. The `symbols` option will not mark unknown fields."\n },\n "julia.lint.disabledDirs": {\n "type": "array",\n "items": {\n "type": "string"\n },\n "default": ["docs", "test"],\n "description": "Specifies sub-directories in [a package directory](https://docs.julialang.org/en/v1/manual/code-loading/#Package-directories-1) where only basic linting is. This drastically lowers the chance for false positives."\n },\n "julia.lint.call": {\n "type": "boolean",\n "default": true,\n "description": "This compares call signatures against all known methods for the called function. Calls with too many or too few arguments, or unknown keyword parameters are highlighted."\n },\n "julia.lint.iter": {\n "type": "boolean",\n "default": true,\n "description": "Check iterator syntax of loops. Will identify, for example, attempts to iterate over single values."\n },\n "julia.lint.nothingcomp": {\n "type": "boolean",\n "default": true,\n "description": "Check for use of `==` rather than `===` when comparing against `nothing`. "\n },\n "julia.lint.constif": {\n "type": "boolean",\n "default": true,\n "description": "Check for constant conditionals in if statements that result in branches never being reached.."\n },\n "julia.lint.lazy": {\n "type": "boolean",\n "default": true,\n "description": "Check for deterministic lazy boolean operators."\n },\n "julia.lint.datadecl": {\n "type": "boolean",\n "default": true,\n "description": "Check variables used in type declarations are datatypes."\n },\n "julia.lint.typeparam": {\n "type": "boolean",\n "default": true,\n "description": "Check parameters declared in `where` statements or datatype declarations are used."\n },\n "julia.lint.modname": {\n "type": "boolean",\n "default": true,\n "description": "Check submodule names do not shadow their parent's name."\n },\n "julia.lint.pirates": {\n "type": "boolean",\n "default": true,\n "description": "Check for type piracy - the overloading of external functions with methods specified for external datatypes. 'External' here refers to imported code."\n },\n "julia.lint.useoffuncargs": {\n "type": "boolean",\n "default": true,\n "description": "Check that all declared arguments are used within the function body."\n },\n "julia.completionmode": {\n "type": "string",\n "default": "qualify",\n "description": "Sets the mode for completions.",\n "enum": ["exportedonly", "import", "qualify"],\n "enumDescriptions": [\n "Show completions for the current namespace.",\n "Show completions for the current namespace and unexported variables of `using`ed modules. Selection of an unexported variable will result in the automatic insertion of an explicit `using` statement.",\n "Show completions for the current namespace and unexported variables of `using`ed modules. Selection of an unexported variable will complete to a qualified variable name."\n ],\n "scope": "window"\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\julia-language-server.schema.json
julia-language-server.schema.json
JSON
4,070
0.95
0.170455
0
react-lib
117
2024-11-10T17:46:39.434689
Apache-2.0
false
b6fa83c340cb034ebe000ce3e4d41cee
{\n "title": "Python Language Server Configuration",\n "type": "object",\n "properties": {\n "pyls.executable": {\n "type": "string",\n "default": "pyls",\n "description": "Language server executable"\n },\n "pyls.configurationSources": {\n "type": "array",\n "default": ["pycodestyle"],\n "description": "List of configuration sources to use.",\n "items": {\n "type": "string",\n "enum": ["pycodestyle", "pyflakes"]\n },\n "uniqueItems": true\n },\n "pyls.plugins.jedi_completion.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.jedi_completion.include_params": {\n "type": "boolean",\n "default": true,\n "description": "Auto-completes methods and classes with tabstops for each parameter."\n },\n "pyls.plugins.jedi_definition.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.jedi_definition.follow_imports": {\n "type": "boolean",\n "default": true,\n "description": "The goto call will follow imports."\n },\n "pyls.plugins.jedi_definition.follow_builtin_imports": {\n "type": "boolean",\n "default": true,\n "description": "If follow_imports is True will decide if it follow builtin imports."\n },\n "pyls.plugins.jedi_hover.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.jedi_references.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.jedi_signature_help.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.jedi_symbols.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.jedi_symbols.all_scopes": {\n "type": "boolean",\n "default": true,\n "description": "If True lists the names of all scopes instead of only the module namespace."\n },\n "pyls.plugins.mccabe.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.mccabe.threshold": {\n "type": "number",\n "default": 15,\n "description": "The minimum threshold that triggers warnings about cyclomatic complexity."\n },\n "pyls.plugins.preload.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.preload.modules": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "List of modules to import on startup"\n },\n "pyls.plugins.pycodestyle.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.pycodestyle.exclude": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Exclude files or directories which match these patterns."\n },\n "pyls.plugins.pycodestyle.filename": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "When parsing directories, only check filenames matching these patterns."\n },\n "pyls.plugins.pycodestyle.select": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Select errors and warnings"\n },\n "pyls.plugins.pycodestyle.ignore": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Ignore errors and warnings"\n },\n "pyls.plugins.pycodestyle.hangClosing": {\n "type": "boolean",\n "default": null,\n "description": "Hang closing bracket instead of matching indentation of opening bracket's line."\n },\n "pyls.plugins.pycodestyle.maxLineLength": {\n "type": "number",\n "default": null,\n "description": "Set maximum allowed line length."\n },\n "pyls.plugins.pydocstyle.enabled": {\n "type": "boolean",\n "default": false,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.pydocstyle.convention": {\n "type": "string",\n "default": null,\n "enum": ["pep257", "numpy"],\n "description": "Choose the basic list of checked errors by specifying an existing convention."\n },\n "pyls.plugins.pydocstyle.addIgnore": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Ignore errors and warnings in addition to the specified convention."\n },\n "pyls.plugins.pydocstyle.addSelect": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Select errors and warnings in addition to the specified convention."\n },\n "pyls.plugins.pydocstyle.ignore": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Ignore errors and warnings"\n },\n "pyls.plugins.pydocstyle.select": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Select errors and warnings"\n },\n "pyls.plugins.pydocstyle.match": {\n "type": "string",\n "default": "(?!test_).*\\.py",\n "description": "Check only files that exactly match the given regular expression; default is to match files that don't start with 'test_' but end with '.py'."\n },\n "pyls.plugins.pydocstyle.matchDir": {\n "type": "string",\n "default": "[^\\.].*",\n "description": "Search only dirs that exactly match the given regular expression; default is to match dirs which do not begin with a dot."\n },\n "pyls.plugins.pyflakes.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.pylint.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.pylint.args": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": false,\n "description": "Arguments to pass to pylint."\n },\n "pyls.plugins.rope_completion.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.plugins.yapf.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pyls.rope.extensionModules": {\n "type": "string",\n "default": null,\n "description": "Builtin and c-extension modules that are allowed to be imported and inspected by rope."\n },\n "pyls.rope.ropeFolder": {\n "type": "array",\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "The name of the folder in which rope stores project configurations and data. Pass `null` for not using such a folder at all."\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\pyls.schema.json
pyls.schema.json
JSON
7,581
0.85
0.012195
0
node-utils
279
2025-01-21T22:25:50.853893
BSD-3-Clause
false
e59388a20591e9d43bf87d0eed51c021
{\n "title": "Python Language Server Configuration",\n "type": "object",\n "properties": {\n "pylsp.configurationSources": {\n "type": "array",\n "default": ["pycodestyle"],\n "description": "List of configuration sources to use.",\n "items": {\n "type": "string",\n "enum": ["pycodestyle", "pyflakes"]\n },\n "uniqueItems": true\n },\n "pylsp.plugins.flake8.config": {\n "type": ["string", "null"],\n "default": null,\n "description": "Path to the config file that will be the authoritative config source."\n },\n "pylsp.plugins.flake8.enabled": {\n "type": "boolean",\n "default": false,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.flake8.exclude": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "description": "List of files or directories to exclude."\n },\n "pylsp.plugins.flake8.executable": {\n "type": "string",\n "default": "flake8",\n "description": "Path to the flake8 executable."\n },\n "pylsp.plugins.flake8.filename": {\n "type": ["string", "null"],\n "default": null,\n "description": "Only check for filenames matching the patterns in this list."\n },\n "pylsp.plugins.flake8.hangClosing": {\n "type": ["boolean", "null"],\n "default": null,\n "description": "Hang closing bracket instead of matching indentation of opening bracket's line."\n },\n "pylsp.plugins.flake8.ignore": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "description": "List of errors and warnings to ignore (or skip)."\n },\n "pylsp.plugins.flake8.maxLineLength": {\n "type": ["integer", "null"],\n "default": null,\n "description": "Maximum allowed line length for the entirety of this run."\n },\n "pylsp.plugins.flake8.indentSize": {\n "type": ["integer", "null"],\n "default": null,\n "description": "Set indentation spaces."\n },\n "pylsp.plugins.flake8.perFileIgnores": {\n "type": ["array"],\n "default": [],\n "items": {\n "type": "string"\n },\n "description": "A pairing of filenames and violation codes that defines which violations to ignore in a particular file, for example: `[\"file_path.py:W305,W304\"]`)."\n },\n "pylsp.plugins.flake8.select": {\n "type": ["array", "null"],\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "List of errors and warnings to enable."\n },\n "pylsp.plugins.jedi.extra_paths": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "description": "Define extra paths for jedi.Script."\n },\n "pylsp.plugins.jedi.env_vars": {\n "type": ["object", "null"],\n "default": null,\n "description": "Define environment variables for jedi.Script and Jedi.names."\n },\n "pylsp.plugins.jedi.environment": {\n "type": ["string", "null"],\n "default": null,\n "description": "Define environment for jedi.Script and Jedi.names."\n },\n "pylsp.plugins.jedi_completion.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.jedi_completion.include_params": {\n "type": "boolean",\n "default": true,\n "description": "Auto-completes methods and classes with tabstops for each parameter."\n },\n "pylsp.plugins.jedi_completion.include_class_objects": {\n "type": "boolean",\n "default": true,\n "description": "Adds class objects as a separate completion item."\n },\n "pylsp.plugins.jedi_completion.fuzzy": {\n "type": "boolean",\n "default": false,\n "description": "Enable fuzzy when requesting autocomplete."\n },\n "pylsp.plugins.jedi_completion.eager": {\n "type": "boolean",\n "default": false,\n "description": "Resolve documentation and detail eagerly."\n },\n "pylsp.plugins.jedi_completion.resolve_at_most": {\n "type": "number",\n "default": 25,\n "description": "How many labels and snippets (at most) should be resolved?"\n },\n "pylsp.plugins.jedi_completion.cache_for": {\n "type": "array",\n "items": {\n "type": "string"\n },\n "default": ["pandas", "numpy", "tensorflow", "matplotlib"],\n "description": "Modules for which labels and snippets should be cached."\n },\n "pylsp.plugins.jedi_definition.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.jedi_definition.follow_imports": {\n "type": "boolean",\n "default": true,\n "description": "The goto call will follow imports."\n },\n "pylsp.plugins.jedi_definition.follow_builtin_imports": {\n "type": "boolean",\n "default": true,\n "description": "If follow_imports is True will decide if it follow builtin imports."\n },\n "pylsp.plugins.jedi_hover.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.jedi_references.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.jedi_signature_help.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.jedi_symbols.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.jedi_symbols.all_scopes": {\n "type": "boolean",\n "default": true,\n "description": "If True lists the names of all scopes instead of only the module namespace."\n },\n "pylsp.plugins.jedi_symbols.include_import_symbols": {\n "type": "boolean",\n "default": true,\n "description": "If True includes symbols imported from other libraries."\n },\n "pylsp.plugins.mccabe.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.mccabe.threshold": {\n "type": "number",\n "default": 15,\n "description": "The minimum threshold that triggers warnings about cyclomatic complexity."\n },\n "pylsp.plugins.preload.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.preload.modules": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "List of modules to import on startup"\n },\n "pylsp.plugins.pycodestyle.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.pycodestyle.exclude": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Exclude files or directories which match these patterns."\n },\n "pylsp.plugins.pycodestyle.filename": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "When parsing directories, only check filenames matching these patterns."\n },\n "pylsp.plugins.pycodestyle.select": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Select errors and warnings"\n },\n "pylsp.plugins.pycodestyle.ignore": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Ignore errors and warnings"\n },\n "pylsp.plugins.pycodestyle.hangClosing": {\n "type": ["boolean", "null"],\n "default": null,\n "description": "Hang closing bracket instead of matching indentation of opening bracket's line."\n },\n "pylsp.plugins.pycodestyle.maxLineLength": {\n "type": ["number", "null"],\n "default": null,\n "description": "Set maximum allowed line length."\n },\n "pylsp.plugins.pycodestyle.indentSize": {\n "type": ["integer", "null"],\n "default": null,\n "description": "Set indentation spaces."\n },\n "pylsp.plugins.pydocstyle.enabled": {\n "type": "boolean",\n "default": false,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.pydocstyle.convention": {\n "type": ["string", "null"],\n "default": null,\n "enum": ["pep257", "numpy", null],\n "description": "Choose the basic list of checked errors by specifying an existing convention."\n },\n "pylsp.plugins.pydocstyle.addIgnore": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Ignore errors and warnings in addition to the specified convention."\n },\n "pylsp.plugins.pydocstyle.addSelect": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Select errors and warnings in addition to the specified convention."\n },\n "pylsp.plugins.pydocstyle.ignore": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Ignore errors and warnings"\n },\n "pylsp.plugins.pydocstyle.select": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "Select errors and warnings"\n },\n "pylsp.plugins.pydocstyle.match": {\n "type": "string",\n "default": "(?!test_).*\\.py",\n "description": "Check only files that exactly match the given regular expression; default is to match files that don't start with 'test_' but end with '.py'."\n },\n "pylsp.plugins.pydocstyle.matchDir": {\n "type": "string",\n "default": "[^\\.].*",\n "description": "Search only dirs that exactly match the given regular expression; default is to match dirs which do not begin with a dot."\n },\n "pylsp.plugins.pyflakes.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.pylint.enabled": {\n "type": "boolean",\n "default": false,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.pylint.args": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "uniqueItems": false,\n "description": "Arguments to pass to pylint."\n },\n "pylsp.plugins.pylint.executable": {\n "type": ["string", "null"],\n "default": null,\n "description": "Executable to run pylint with. Enabling this will run pylint on unsaved files via stdin. Can slow down workflow. Only works with python3."\n },\n "pylsp.plugins.rope_completion.enabled": {\n "type": "boolean",\n "default": false,\n "description": "Enable or disable the plugin."\n },\n "pylsp.plugins.rope_completion.eager": {\n "type": "boolean",\n "default": false,\n "description": "Resolve documentation and detail eagerly."\n },\n "pylsp.plugins.yapf.enabled": {\n "type": "boolean",\n "default": true,\n "description": "Enable or disable the plugin."\n },\n "pylsp.rope.extensionModules": {\n "type": ["null", "string"],\n "default": null,\n "description": "Builtin and c-extension modules that are allowed to be imported and inspected by rope."\n },\n "pylsp.rope.ropeFolder": {\n "type": ["null", "array"],\n "default": null,\n "items": {\n "type": "string"\n },\n "uniqueItems": true,\n "description": "The name of the folder in which rope stores project configurations and data. Pass `null` for not using such a folder at all."\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\pylsp.schema.json
pylsp.schema.json
JSON
12,070
0.85
0.029333
0
vue-tools
403
2024-09-14T02:19:23.784482
MIT
false
f371c58fc658f28828985cf4fa51ff35
{\n "$schema": "http://json-schema.org/draft-07/schema#",\n "title": "Pyright Language Server Configuration",\n "description": "Pyright Configuration Schema. Distributed under MIT License, Copyright (c) Microsoft Corporation.",\n "allowComments": true,\n "allowTrailingCommas": true,\n "type": "object",\n "properties": {\n "python.analysis.autoImportCompletions": {\n "type": "boolean",\n "default": true,\n "description": "Offer auto-import completions.",\n "scope": "resource"\n },\n "python.analysis.autoSearchPaths": {\n "type": "boolean",\n "default": true,\n "description": "Automatically add common search paths like 'src'?",\n "scope": "resource"\n },\n "python.analysis.extraPaths": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "description": "Additional import search resolution paths",\n "scope": "resource"\n },\n "python.analysis.stubPath": {\n "type": "string",\n "default": "typings",\n "description": "Path to directory containing custom type stub files.",\n "scope": "resource"\n },\n "python.analysis.diagnosticMode": {\n "type": "string",\n "default": "openFilesOnly",\n "enum": ["openFilesOnly", "workspace"],\n "enumDescriptions": [\n "Analyzes and reports errors on only open files.",\n "Analyzes and reports errors on all files in the workspace."\n ],\n "scope": "resource"\n },\n "python.analysis.diagnosticSeverityOverrides": {\n "type": "object",\n "description": "Allows a user to override the severity levels for individual diagnostics.",\n "scope": "resource",\n "properties": {\n "reportGeneralTypeIssues": {\n "type": "string",\n "description": "Diagnostics for general type inconsistencies, unsupported operations, argument/parameter mismatches, etc. Covers all of the basic type-checking rules not covered by other rules. Does not include syntax errors.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportPropertyTypeMismatch": {\n "type": "string",\n "description": "Diagnostics for property whose setter and getter have mismatched types.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportFunctionMemberAccess": {\n "type": "string",\n "description": "Diagnostics for member accesses on functions.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportMissingImports": {\n "type": "string",\n "description": "Diagnostics for imports that have no corresponding imported python file or type stub file.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportMissingModuleSource": {\n "type": "string",\n "description": "Diagnostics for imports that have no corresponding source file. This happens when a type stub is found, but the module source file was not found, indicating that the code may fail at runtime when using this execution environment. Type checking will be done using the type stub.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportInvalidTypeForm": {\n "type": "string",\n "description": "Diagnostics for type expression that uses an invalid form.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportMissingTypeStubs": {\n "type": "string",\n "description": "Diagnostics for imports that have no corresponding type stub file (either a typeshed file or a custom type stub). The type checker requires type stubs to do its best job at analysis.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportImportCycles": {\n "type": "string",\n "description": "Diagnostics for cyclical import chains. These are not errors in Python, but they do slow down type analysis and often hint at architectural layering issues. Generally, they should be avoided.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedImport": {\n "type": "string",\n "description": "Diagnostics for an imported symbol that is not referenced within that file.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedClass": {\n "type": "string",\n "description": "Diagnostics for a class with a private name (starting with an underscore) that is not accessed.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedFunction": {\n "type": "string",\n "description": "Diagnostics for a function or method with a private name (starting with an underscore) that is not accessed.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedVariable": {\n "type": "string",\n "description": "Diagnostics for a variable that is not accessed.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportDuplicateImport": {\n "type": "string",\n "description": "Diagnostics for an imported symbol or module that is imported more than once.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportWildcardImportFromLibrary": {\n "type": "string",\n "description": "Diagnostics for an wildcard import from an external library.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportAbstractUsage": {\n "type": "string",\n "description": "Diagnostics for an attempt to instantiate an abstract or protocol class or use an abstract method.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportArgumentType": {\n "type": "string",\n "description": "Diagnostics for a type incompatibility for an argument to a call.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportAssertTypeFailure": {\n "type": "string",\n "description": "Diagnostics for a type incompatibility detected by a typing.assert_type call.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportAssignmentType": {\n "type": "string",\n "description": "Diagnostics for type incompatibilities for assignments.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportAttributeAccessIssue": {\n "type": "string",\n "description": "Diagnostics for issues involving attribute accesses.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportCallIssue": {\n "type": "string",\n "description": "Diagnostics for issues involving call expressions and arguments.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportInconsistentOverload": {\n "type": "string",\n "description": "Diagnostics for inconsistencies between function overload signatures and implementation.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportIndexIssue": {\n "type": "string",\n "description": "Diagnostics related to index operations and expressions.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportInvalidTypeArguments": {\n "type": "string",\n "description": "Diagnostics for invalid type argument usage.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportNoOverloadImplementation": {\n "type": "string",\n "description": "Diagnostics for an overloaded function or method with a missing implementation.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOperatorIssue": {\n "type": "string",\n "description": "Diagnostics for related to unary or binary operators.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOptionalSubscript": {\n "type": "string",\n "description": "Diagnostics for an attempt to subscript (index) a variable with an Optional type.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOptionalMemberAccess": {\n "type": "string",\n "description": "Diagnostics for an attempt to access a member of a variable with an Optional type.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOptionalCall": {\n "type": "string",\n "description": "Diagnostics for an attempt to call a variable with an Optional type.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOptionalIterable": {\n "type": "string",\n "description": "Diagnostics for an attempt to use an Optional type as an iterable value (e.g. within a for statement).",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOptionalContextManager": {\n "type": "string",\n "description": "Diagnostics for an attempt to use an Optional type as a context manager (as a parameter to a with statement).",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOptionalOperand": {\n "type": "string",\n "description": "Diagnostics for an attempt to use an Optional type as an operand to a binary or unary operator (like '+', '==', 'or', 'not').",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportRedeclaration": {\n "type": "string",\n "description": "Diagnostics for an attempt to declare the type of a symbol multiple times.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportReturnType": {\n "type": "string",\n "description": "Diagnostics related to function return type compatibility.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportTypedDictNotRequiredAccess": {\n "type": "string",\n "description": "Diagnostics for an attempt to access a non-required key within a TypedDict without a check for its presence.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUntypedFunctionDecorator": {\n "type": "string",\n "description": "Diagnostics for function decorators that have no type annotations. These obscure the function type, defeating many type analysis features.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUntypedClassDecorator": {\n "type": "string",\n "description": "Diagnostics for class decorators that have no type annotations. These obscure the class type, defeating many type analysis features.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUntypedBaseClass": {\n "type": "string",\n "description": "Diagnostics for base classes whose type cannot be determined statically. These obscure the class type, defeating many type analysis features.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUntypedNamedTuple": {\n "type": "string",\n "description": "Diagnostics when “namedtuple” is used rather than “NamedTuple”. The former contains no type information, whereas the latter does.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportPrivateUsage": {\n "type": "string",\n "description": "Diagnostics for incorrect usage of private or protected variables or functions. Protected class members begin with a single underscore _ and can be accessed only by subclasses. Private class members begin with a double underscore but do not end in a double underscore and can be accessed only within the declaring class. Variables and functions declared outside of a class are considered private if their names start with either a single or double underscore, and they cannot be accessed outside of the declaring module.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportTypeCommentUsage": {\n "type": "string",\n "description": "Diagnostics for usage of deprecated type comments.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportPrivateImportUsage": {\n "type": "string",\n "description": "Diagnostics for incorrect usage of symbol imported from a \"py.typed\" module that is not re-exported from that module.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportConstantRedefinition": {\n "type": "string",\n "description": "Diagnostics for attempts to redefine variables whose names are all-caps with underscores and numerals.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportDeprecated": {\n "type": "string",\n "description": "Diagnostics for use of deprecated classes or functions.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportIncompatibleMethodOverride": {\n "type": "string",\n "description": "Diagnostics for methods that override a method of the same name in a base class in an incompatible manner (wrong number of parameters, incompatible parameter types, or incompatible return type).",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportIncompatibleVariableOverride": {\n "type": "string",\n "description": "Diagnostics for overrides in subclasses that redefine a variable in an incompatible way.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportInconsistentConstructor": {\n "type": "string",\n "description": "Diagnostics for __init__ and __new__ methods whose signatures are inconsistent.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportOverlappingOverload": {\n "type": "string",\n "description": "Diagnostics for function overloads that overlap in signature and obscure each other or have incompatible return types.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportPossiblyUnboundVariable": {\n "type": "string",\n "description": "Diagnostics for the use of variables that may be unbound on some code paths.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportMissingSuperCall": {\n "type": "string",\n "description": "Diagnostics for missing call to parent class for inherited `__init__` methods.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUninitializedInstanceVariable": {\n "type": "string",\n "description": "Diagnostics for instance variables that are not declared or initialized within class body or `__init__` method.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportInvalidStringEscapeSequence": {\n "type": "string",\n "description": "Diagnostics for invalid escape sequences used within string literals. The Python specification indicates that such sequences will generate a syntax error in future versions.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnknownParameterType": {\n "type": "string",\n "description": "Diagnostics for input or return parameters for functions or methods that have an unknown type.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnknownArgumentType": {\n "type": "string",\n "description": "Diagnostics for call arguments for functions or methods that have an unknown type.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnknownLambdaType": {\n "type": "string",\n "description": "Diagnostics for input or return parameters for lambdas that have an unknown type.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnknownVariableType": {\n "type": "string",\n "description": "Diagnostics for variables that have an unknown type..",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnknownMemberType": {\n "type": "string",\n "description": "Diagnostics for class or instance variables that have an unknown type.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportMissingParameterType": {\n "type": "string",\n "description": "Diagnostics for parameters that are missing a type annotation.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportMissingTypeArgument": {\n "type": "string",\n "description": "Diagnostics for generic class reference with missing type arguments.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportInvalidTypeVarUse": {\n "type": "string",\n "description": "Diagnostics for improper use of type variables in a function signature.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportCallInDefaultInitializer": {\n "type": "string",\n "description": "Diagnostics for function calls within a default value initialization expression. Such calls can mask expensive operations that are performed at module initialization time.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnnecessaryIsInstance": {\n "type": "string",\n "description": "Diagnostics for 'isinstance' or 'issubclass' calls where the result is statically determined to be always true. Such calls are often indicative of a programming error.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnnecessaryCast": {\n "type": "string",\n "description": "Diagnostics for 'cast' calls that are statically determined to be unnecessary. Such calls are sometimes indicative of a programming error.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnnecessaryComparison": {\n "type": "string",\n "description": "Diagnostics for '==' and '!=' comparisons that are statically determined to be unnecessary. Such calls are sometimes indicative of a programming error.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnnecessaryContains": {\n "type": "string",\n "description": "Diagnostics for 'in' operation that is statically determined to be unnecessary. Such operations are sometimes indicative of a programming error.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportAssertAlwaysTrue": {\n "type": "string",\n "description": "Diagnostics for 'assert' statement that will provably always assert. This can be indicative of a programming error.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportSelfClsParameterName": {\n "type": "string",\n "description": "Diagnostics for a missing or misnamed “self” parameter in instance methods and “cls” parameter in class methods. Instance methods in metaclasses (classes that derive from “type”) are allowed to use “cls” for instance methods.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportImplicitStringConcatenation": {\n "type": "string",\n "description": "Diagnostics for two or more string literals that follow each other, indicating an implicit concatenation. This is considered a bad practice and often masks bugs such as missing commas.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportInvalidStubStatement": {\n "type": "string",\n "description": "Diagnostics for type stub statements that do not conform to PEP 484.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportIncompleteStub": {\n "type": "string",\n "description": "Diagnostics for the use of a module-level “__getattr__” function, indicating that the stub is incomplete.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUndefinedVariable": {\n "type": "string",\n "description": "Diagnostics for undefined variables.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnboundVariable": {\n "type": "string",\n "description": "Diagnostics for unbound and possibly unbound variables.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnsupportedDunderAll": {\n "type": "string",\n "description": "Diagnostics for unsupported operations performed on __all__.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedCallResult": {\n "type": "string",\n "description": "Diagnostics for call expressions whose results are not consumed and are not None.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedCoroutine": {\n "type": "string",\n "description": "Diagnostics for call expressions that return a Coroutine and whose results are not consumed.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedExcept": {\n "type": "string",\n "description": "Diagnostics for unreachable except clause.",\n "default": "error",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnusedExpression": {\n "type": "string",\n "description": "Diagnostics for simple expressions whose value is not used in any way.",\n "default": "warning",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportUnnecessaryTypeIgnoreComment": {\n "type": "string",\n "description": "Diagnostics for '# type: ignore' comments that have no effect.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportMatchNotExhaustive": {\n "type": "string",\n "description": "Diagnostics for 'match' statements that do not exhaustively match all possible values.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportShadowedImports": {\n "type": "string",\n "description": "Diagnostics for files that are overriding a module in the stdlib.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n },\n "reportImplicitOverride": {\n "type": "string",\n "description": "Diagnostics for overridden methods that do not include an `@override` decorator.",\n "default": "none",\n "enum": ["none", "information", "warning", "error"]\n }\n }\n },\n "python.analysis.logLevel": {\n "type": "string",\n "default": "Information",\n "description": "Specifies the level of logging for the Output panel",\n "enum": ["Error", "Warning", "Information", "Trace"]\n },\n "python.analysis.typeCheckingMode": {\n "type": "string",\n "default": "basic",\n "enum": ["off", "basic", "strict"],\n "description": "Defines the default rule set for type checking.",\n "scope": "resource"\n },\n "python.analysis.typeshedPaths": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "description": "Paths to look for typeshed modules.",\n "scope": "resource"\n },\n "python.analysis.useLibraryCodeForTypes": {\n "type": "boolean",\n "default": false,\n "description": "Use library implementations to extract type information when type stub is not present.",\n "scope": "resource"\n },\n "pyright.disableLanguageServices": {\n "type": "boolean",\n "default": false,\n "description": "Disables type completion, definitions, and references.",\n "scope": "resource"\n },\n "pyright.disableTaggedHints": {\n "type": "boolean",\n "default": false,\n "description": "Disable hint diagnostics with special hints for grayed-out or strike-through text.",\n "scope": "resource"\n },\n "pyright.disableOrganizeImports": {\n "type": "boolean",\n "default": false,\n "description": "Disables the “Organize Imports” command.",\n "scope": "resource"\n },\n "python.pythonPath": {\n "type": "string",\n "default": "python",\n "description": "Path to Python, you can use a custom version of Python.",\n "scope": "resource"\n },\n "python.venvPath": {\n "type": "string",\n "default": "",\n "description": "Path to folder with a list of Virtual Environments.",\n "scope": "resource"\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\pyright.schema.json
pyright.schema.json
JSON
27,670
0.95
0.197635
0
python-kit
685
2024-11-19T04:59:45.998760
BSD-3-Clause
false
4778498fc238ec81cdea9ecf933727d3
{\n "title": "R Language Server confiuguration",\n "type": "object",\n "properties": {\n "r.lsp.debug": {\n "type": "boolean",\n "default": true,\n "description": "Increase verbosity for debug purpose."\n },\n "r.lsp.log_file": {\n "type": ["string", "null"],\n "default": null,\n "description": "File to log debug messages, fallback to stderr if empty."\n },\n "r.lsp.diagnostics": {\n "type": "boolean",\n "default": true,\n "description": "Enable file diagnostics via lintr."\n },\n "r.lsp.rich_documentation": {\n "type": "boolean",\n "default": true,\n "description": "Rich documentation with enhanced markdown features."\n },\n "r.lsp.snippet_support": {\n "type": "boolean",\n "default": true,\n "description": "Enable snippets in auto completion."\n },\n "r.lsp.max_completions": {\n "type": "number",\n "default": 200,\n "description": "Maximum number of completion items."\n },\n "r.lsp.lint_cache": {\n "type": "boolean",\n "default": false,\n "description": "Toggle caching of lint results."\n },\n "r.lsp.link_file_size_limit": {\n "type": "number",\n "default": 16384,\n "description": "Maximum file size (in bytes) that supports document links."\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\r-languageserver.schema.json
r-languageserver.schema.json
JSON
1,299
0.7
0.043478
0
node-utils
773
2024-12-03T00:51:53.724399
GPL-3.0
false
5c63af9c9e0a90a3e0bf9f512917a04e
{\n "title": "SQL configuration",\n "type": "object",\n "properties": {\n "personalConfig.connections": {\n "type": "array",\n "default": [\n {\n "name": "default sqlite3 connection",\n "adapter": "sqlite3",\n "filename": ":memory:",\n "projectPaths": ["."]\n }\n ],\n "items": {\n "type": "object",\n "required": ["name", "adapter"],\n "properties": {\n "name": {\n "description": "Connection name (free-form text)",\n "type": "string"\n },\n "adapter": {\n "description": "Database type",\n "type": "string",\n "enum": [\n "json",\n "mysql",\n "postgresql",\n "postgres",\n "sqlite3",\n "bigquery"\n ]\n },\n "host": {\n "description": "Database host",\n "type": "string"\n },\n "port": {\n "description": "Database port",\n "type": "number"\n },\n "user": {\n "description": "Database user",\n "type": "string"\n },\n "database": {\n "description": "Database name",\n "type": "string"\n },\n "password": {\n "description": "Database password",\n "type": "string"\n },\n "filename": {\n "description": "Database filename - only for sqlite3 (required); use ':memory:' for in-memory database",\n "type": "string"\n },\n "projectPaths": {\n "description": "Project path that you want to apply (if you don't set it configuration will not apply automatically when lsp's started up)",\n "type": "array",\n "items": { "type": "string" }\n },\n "ssh": {\n "oneOf": [\n {\n "title": "Disabled",\n "type": "null",\n "additionalProperties": false\n },\n {\n "title": "Enabled",\n "type": "object",\n "properties": {\n "remoteHost": {\n "description": "The host address you want to connect to",\n "type": "string",\n "default": "",\n "title": "Remote host"\n },\n "remotePort": {\n "description": "Port number of the server for ssh",\n "type": "integer",\n "default": 22,\n "title": "Remote port"\n },\n "user": {\n "description": "User name on the server",\n "type": "string",\n "default": "",\n "title": "User"\n },\n "dbHost": {\n "description": "Database host on the server",\n "type": "string",\n "default": "127.0.0.1",\n "title": "Database host"\n },\n "dbPort": {\n "description": "Databse port on the server, default 3306 for mysql and 5432 for postgres",\n "type": "number",\n "title": "Database port"\n },\n "identityFile": {\n "description": "Identity file for ssh",\n "type": "string",\n "default": "~/.ssh/config/id_rsa",\n "title": "Identity file"\n },\n "passphrase": {\n "description": "Passphrase to allow to use identity file",\n "type": "string",\n "title": "Passphrase"\n }\n }\n }\n ],\n "default": null,\n "title": "Settings for port fowarding"\n }\n }\n }\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\sql-language-server.schema.json
sql-language-server.schema.json
JSON
3,992
0.85
0.064
0
vue-tools
821
2024-09-20T12:06:00.096295
BSD-3-Clause
false
4ae870cc677467790eb977de26ab7f42
{\n "title": "LaTeX configuration",\n "type": "object",\n "properties": {\n "rootDirectory": {\n "type": ["string", "null"],\n "default": null,\n "description": "Path to the root directory."\n },\n "build.executable": {\n "type": "string",\n "default": "latexmk",\n "description": "Path to a LaTeX build tool."\n },\n "build.args": {\n "type": "array",\n "default": ["-pdf", "-interaction=nonstopmode", "-synctex=1", "%f"],\n "description": "Additional arguments that are passed to the build tool.",\n "items": {\n "type": "string"\n }\n },\n "build.onSave": {\n "type": "boolean",\n "default": false,\n "description": "Build after saving a file"\n },\n "build.outputDirectory": {\n "type": "string",\n "default": ".",\n "description": "Directory containing the build artifacts."\n },\n "build.forwardSearchAfter": {\n "type": "boolean",\n "default": false,\n "description": "Execute forward search after building"\n },\n "forwardSearch.executable": {\n "type": ["string", "null"],\n "default": null,\n "description": "Path to a PDF previewer that supports SyncTeX."\n },\n "forwardSearch.args": {\n "type": "array",\n "default": [],\n "description": "Additional arguments that are passed to the previewer.",\n "items": {\n "type": "string"\n }\n },\n "chktex.onOpenAndSave": {\n "type": "boolean",\n "default": false,\n "description": "Lint with chktex after opening and saving a file"\n },\n "chktex.onEdit": {\n "type": "boolean",\n "default": false,\n "description": "Lint with chktex afte editing a file"\n },\n "diagnosticsDelay": {\n "type": "integer",\n "default": 300,\n "description": "Delay in milliseconds before reporting diagnostics."\n },\n "formatterLineLength": {\n "type": "integer",\n "default": 80,\n "description": "Defines the maximum amount of characters per line (0 = disable) when formatting BibTeX files."\n },\n "latexFormatter": {\n "type": "string",\n "default": "latexindent",\n "description": "Defines the formatter to use for LaTeX formatting. Possible values are either texlab or latexindent. Note that texlab is not implemented yet."\n },\n "latexindent.local": {\n "type": ["string", "null"],\n "default": null,\n "description": "Defines the path of a file containing the latexindent configuration. This corresponds to the --local=file.yaml flag of latexindent. By default the configuration inside the project root directory is used."\n },\n "latexindent.modifyLineBreaks": {\n "type": "boolean",\n "default": false,\n "description": "Modifies linebreaks before, during, and at the end of code blocks when formatting with latexindent. This corresponds to the --modifylinebreaks flag of latexindent."\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\texlab.schema.json
texlab.schema.json
JSON
2,913
0.7
0.011494
0
node-utils
96
2024-12-21T16:09:33.119018
BSD-3-Clause
false
f3845f6a10ba35043018972c9258a7d4
{\n "title": "TypeScript Language Server Configuration",\n "description": "Based on https://github.com/typescript-language-server/typescript-language-server; TODO: add formatting preferences once formatting is supported.",\n "type": "object",\n "properties": {\n "diagnostics.ignoredCodes": {\n "type": "array",\n "items": {\n "type": "number"\n },\n "default": [],\n "description": "Diagnostics code to be omitted when reporting diagnostics. See https://github.com/microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json for a full list of valid codes."\n },\n "completions.completeFunctionCalls": {\n "type": "boolean",\n "default": false,\n "description": "Complete functions with their parameter signature."\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\typescript-language-server.schema.json
typescript-language-server.schema.json
JSON
782
0.95
0.05
0
node-utils
432
2024-01-19T08:21:44.449705
MIT
false
f71bf6284c7d608f5497e9cdbb5c23ad
{\n "title": "YAML language server configuration",\n "type": "object",\n "properties": {\n "yamlVersion": {\n "type": "string",\n "default": "1.2",\n "description": "Set default YAML spec version (1.2 or 1.1)"\n },\n "yaml.trace.server": {\n "type": "string",\n "enum": ["off", "messages", "verbose"],\n "default": "off",\n "description": "Traces the communication between the client and the YAML language service."\n },\n "yaml.schemas": {\n "type": "object",\n "default": {},\n "description": "Associate schemas to YAML files in the current workspace"\n },\n "yaml.format.enable": {\n "type": "boolean",\n "default": true,\n "description": "Enable/disable default YAML formatter (requires restart)"\n },\n "yaml.format.singleQuote": {\n "type": "boolean",\n "default": false,\n "description": "Use single quotes instead of double quotes"\n },\n "yaml.format.bracketSpacing": {\n "type": "boolean",\n "default": true,\n "description": "Print spaces between brackets in objects"\n },\n "yaml.format.proseWrap": {\n "type": "string",\n "default": "preserve",\n "enum": ["preserve", "never", "always"],\n "description": "Always: wrap prose if it exeeds the print width, Never: never wrap the prose, Preserve: wrap prose as-is"\n },\n "yaml.format.printWidth": {\n "type": "integer",\n "default": 80,\n "description": "Specify the line length that the printer will wrap on"\n },\n "yaml.validate": {\n "type": "boolean",\n "default": true,\n "description": "Enable/disable validation feature"\n },\n "yaml.hover": {\n "type": "boolean",\n "default": true,\n "description": "Enable/disable hover feature"\n },\n "yaml.completion": {\n "type": "boolean",\n "default": true,\n "description": "Enable/disable completion feature"\n },\n "yaml.customTags": {\n "type": "array",\n "default": [],\n "items": {\n "type": "string"\n },\n "description": "Custom tags for the parser to use"\n },\n "yaml.schemaStore.enable": {\n "type": "boolean",\n "default": true,\n "description": "Automatically pull available YAML schemas from JSON Schema Store"\n },\n "yaml.schemaStore.url": {\n "type": "string",\n "default": "",\n "description": "URL of a schema store catalog to use when downloading schemas."\n },\n "yaml.maxItemsComputed": {\n "type": "integer",\n "default": 5000,\n "minimum": 0,\n "description": "The maximum number of outline symbols and folding regions computed (limited for performance reasons)."\n },\n "editor.tabSize": {\n "type": "integer",\n "default": 2,\n "minimum": 0,\n "description": "The number of spaces to use when autocompleting"\n },\n "http.proxy": {\n "type": "string",\n "default": "",\n "description": "The URL of the proxy server that will be used when attempting to download a schema. If it is not set or it is undefined no proxy server will be used."\n },\n "http.proxyStrictSSL": {\n "type": "boolean",\n "default": false,\n "description": "If true the proxy server certificate should be verified against the list of supplied CAs."\n },\n "yaml.disableDefaultProperties": {\n "type": "boolean",\n "default": false,\n "description": "Disable adding not required properties with default values into completion text"\n }\n }\n}\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\yaml-language-server.schema.json
yaml-language-server.schema.json
JSON
3,483
0.85
0.027778
0
react-lib
924
2025-03-07T17:41:39.760938
MIT
false
81971eb71dceba38fb69151fa1187eba
import json\nimport pathlib\n\nCONFIGS = pathlib.Path(__file__).parent\n\n\ndef load_config_schema(key):\n """load a keyed filename"""\n return json.loads(\n (CONFIGS / "{}.schema.json".format(key)).read_text(encoding="utf-8")\n )\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\__init__.py
__init__.py
Python
237
0.85
0.090909
0
node-utils
135
2025-03-25T05:44:05.331968
Apache-2.0
false
fd9fabb7485e9afacca4a8c0d704294f
\n\n
.venv\Lib\site-packages\jupyter_lsp\specs\config\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
713
0.8
0
0
node-utils
778
2023-08-18T12:00:17.071358
BSD-3-Clause
false
39f0f8b5c8a0337939ebb0bc132f8a2c