├── .eslintrc.json ├── .gitignore ├── .prettierrc ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── .yarnrc ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── ThirdPartyNotices-Distribution.txt ├── icon.png ├── images └── main.gif ├── package-lock.json ├── package.json ├── python-libs ├── PyYAML-5.4.1.dist-info │ ├── INSTALLER │ ├── LICENSE │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ └── top_level.txt ├── _distutils_hack │ ├── __init__.py │ └── override.py ├── _pyrsistent_version.py ├── _yaml │ └── __init__.py ├── attr │ ├── __init__.py │ ├── __init__.pyi │ ├── _cmp.py │ ├── _cmp.pyi │ ├── _compat.py │ ├── _config.py │ ├── _funcs.py │ ├── _make.py │ ├── _next_gen.py │ ├── _version_info.py │ ├── _version_info.pyi │ ├── converters.py │ ├── converters.pyi │ ├── exceptions.py │ ├── exceptions.pyi │ ├── filters.py │ ├── filters.pyi │ ├── py.typed │ ├── setters.py │ ├── setters.pyi │ ├── validators.py │ └── validators.pyi ├── attrs-21.2.0.dist-info │ ├── AUTHORS.rst │ ├── INSTALLER │ ├── LICENSE │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ └── top_level.txt ├── bin │ ├── jsonschema │ ├── jupyter │ ├── jupyter-migrate │ ├── jupyter-troubleshoot │ ├── jupyter-trust │ ├── jupytext │ └── markdown-it ├── distutils-precedence.pth ├── etc │ └── jupyter │ │ ├── jupyter_notebook_config.d │ │ └── jupytext.json │ │ ├── jupyter_server_config.d │ │ └── jupytext.json │ │ └── nbconfig │ │ └── notebook.d │ │ └── jupytext.json ├── ipython_genutils-0.2.0.dist-info │ ├── DESCRIPTION.rst │ ├── INSTALLER │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ ├── metadata.json │ └── top_level.txt ├── ipython_genutils │ ├── __init__.py │ ├── _version.py │ ├── encoding.py │ ├── importstring.py │ ├── ipstruct.py │ ├── path.py │ ├── py3compat.py │ ├── tempdir.py │ ├── testing │ │ ├── __init__.py │ │ └── decorators.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_importstring.py │ │ ├── test_path.py │ │ ├── test_tempdir.py │ │ └── test_text.py │ └── text.py ├── jsonschema-3.2.0.dist-info │ ├── COPYING │ ├── INSTALLER │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ ├── entry_points.txt │ └── top_level.txt ├── jsonschema │ ├── __init__.py │ ├── __main__.py │ ├── _format.py │ ├── _legacy_validators.py │ ├── _reflect.py │ ├── _types.py │ ├── _utils.py │ ├── _validators.py │ ├── benchmarks │ │ ├── __init__.py │ │ ├── issue232.py │ │ └── json_schema_test_suite.py │ ├── cli.py │ ├── compat.py │ ├── exceptions.py │ ├── schemas │ │ ├── draft3.json │ │ ├── draft4.json │ │ ├── draft6.json │ │ └── draft7.json │ ├── tests │ │ ├── __init__.py │ │ ├── _helpers.py │ │ ├── _suite.py │ │ ├── test_cli.py │ │ ├── test_exceptions.py │ │ ├── test_format.py │ │ ├── test_jsonschema_test_suite.py │ │ ├── test_types.py │ │ └── test_validators.py │ └── validators.py ├── jupyter.py ├── jupyter_core-4.7.1.dist-info │ ├── COPYING.md │ ├── INSTALLER │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ ├── entry_points.txt │ └── top_level.txt ├── jupyter_core │ ├── __init__.py │ ├── __main__.py │ ├── application.py │ ├── command.py │ ├── migrate.py │ ├── paths.py │ ├── tests │ │ ├── __init__.py │ │ ├── dotipython │ │ │ ├── nbextensions │ │ │ │ └── myext.js │ │ │ └── profile_default │ │ │ │ ├── ipython_config.py │ │ │ │ ├── ipython_console_config.py │ │ │ │ ├── ipython_kernel_config.py │ │ │ │ ├── ipython_nbconvert_config.py │ │ │ │ ├── ipython_notebook_config.py │ │ │ │ └── static │ │ │ │ └── custom │ │ │ │ ├── custom.css │ │ │ │ └── custom.js │ │ ├── dotipython_empty │ │ │ └── profile_default │ │ │ │ ├── ipython_config.py │ │ │ │ ├── ipython_console_config.py │ │ │ │ ├── ipython_kernel_config.py │ │ │ │ ├── ipython_nbconvert_config.py │ │ │ │ ├── ipython_notebook_config.py │ │ │ │ └── static │ │ │ │ └── custom │ │ │ │ ├── custom.css │ │ │ │ └── custom.js │ │ ├── mocking.py │ │ ├── test_application.py │ │ ├── test_command.py │ │ ├── test_migrate.py │ │ └── test_paths.py │ ├── troubleshoot.py │ ├── utils │ │ └── __init__.py │ └── version.py ├── jupytext-1.11.2.dist-info │ ├── INSTALLER │ ├── LICENSE │ ├── METADATA │ ├── RECORD │ ├── REQUESTED │ ├── WHEEL │ ├── entry_points.txt │ └── top_level.txt ├── jupytext │ ├── __init__.py │ ├── __main__.py │ ├── cell_metadata.py │ ├── cell_reader.py │ ├── cell_to_text.py │ ├── cli.py │ ├── combine.py │ ├── compare.py │ ├── config.py │ ├── contentsmanager.py │ ├── doxygen.py │ ├── formats.py │ ├── header.py │ ├── jupytext.py │ ├── kernels.py │ ├── languages.py │ ├── magics.py │ ├── metadata_filter.py │ ├── myst.py │ ├── nbextension │ │ ├── README.md │ │ ├── index.js │ │ ├── jupytext.yml │ │ └── jupytext_menu.png │ ├── paired_paths.py │ ├── pairs.py │ ├── pandoc.py │ ├── pep8.py │ ├── reraise.py │ ├── stringparser.py │ └── version.py ├── markdown_it │ ├── __init__.py │ ├── cli │ │ ├── __init__.py │ │ └── parse.py │ ├── common │ │ ├── __init__.py │ │ ├── entities.py │ │ ├── html_blocks.py │ │ ├── html_re.py │ │ ├── normalize_url.py │ │ └── utils.py │ ├── helpers │ │ ├── __init__.py │ │ ├── parse_link_destination.py │ │ ├── parse_link_label.py │ │ └── parse_link_title.py │ ├── main.py │ ├── parser_block.py │ ├── parser_core.py │ ├── parser_inline.py │ ├── port.yaml │ ├── presets │ │ ├── __init__.py │ │ ├── commonmark.py │ │ ├── default.py │ │ └── zero.py │ ├── py.typed │ ├── renderer.py │ ├── ruler.py │ ├── rules_block │ │ ├── __init__.py │ │ ├── blockquote.py │ │ ├── code.py │ │ ├── fence.py │ │ ├── heading.py │ │ ├── hr.py │ │ ├── html_block.py │ │ ├── lheading.py │ │ ├── list.py │ │ ├── paragraph.py │ │ ├── reference.py │ │ ├── state_block.py │ │ └── table.py │ ├── rules_core │ │ ├── __init__.py │ │ ├── block.py │ │ ├── inline.py │ │ ├── linkify.py │ │ ├── normalize.py │ │ ├── replacements.py │ │ ├── smartquotes.py │ │ └── state_core.py │ ├── rules_inline │ │ ├── __init__.py │ │ ├── autolink.py │ │ ├── backticks.py │ │ ├── balance_pairs.py │ │ ├── emphasis.py │ │ ├── entity.py │ │ ├── escape.py │ │ ├── html_inline.py │ │ ├── image.py │ │ ├── link.py │ │ ├── newline.py │ │ ├── state_inline.py │ │ ├── strikethrough.py │ │ ├── text.py │ │ └── text_collapse.py │ ├── token.py │ ├── tree.py │ └── utils.py ├── markdown_it_py-1.1.0.dist-info │ ├── INSTALLER │ ├── LICENSE │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ ├── entry_points.txt │ └── top_level.txt ├── mdit_py_plugins-0.2.8.dist-info │ ├── INSTALLER │ ├── LICENSE │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ ├── top_level.txt │ └── zip-safe ├── mdit_py_plugins │ ├── __init__.py │ ├── amsmath │ │ └── __init__.py │ ├── anchors │ │ ├── __init__.py │ │ └── index.py │ ├── colon_fence.py │ ├── container │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __init__.py │ │ ├── index.py │ │ └── port.yaml │ ├── deflist │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __init__.py │ │ ├── index.py │ │ └── port.yaml │ ├── dollarmath │ │ ├── __init__.py │ │ └── index.py │ ├── footnote │ │ ├── LICENSE │ │ ├── __init__.py │ │ ├── index.py │ │ └── port.yaml │ ├── front_matter │ │ ├── LICENSE │ │ ├── __init__.py │ │ ├── index.py │ │ └── port.yaml │ ├── myst_blocks │ │ ├── __init__.py │ │ └── index.py │ ├── myst_role │ │ ├── __init__.py │ │ └── index.py │ ├── py.typed │ ├── substitution.py │ ├── tasklists │ │ ├── __init__.py │ │ └── port.yaml │ ├── texmath │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __init__.py │ │ ├── index.py │ │ └── port.yaml │ └── wordcount │ │ └── __init__.py ├── nbformat-5.1.3.dist-info │ ├── COPYING.md │ ├── INSTALLER │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ ├── entry_points.txt │ └── top_level.txt ├── nbformat │ ├── __init__.py │ ├── _compat.py │ ├── _version.py │ ├── converter.py │ ├── corpus │ │ ├── __init__.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_words.py │ │ └── words.py │ ├── current.py │ ├── json_compat.py │ ├── notebooknode.py │ ├── reader.py │ ├── sentinel.py │ ├── sign.py │ ├── tests │ │ ├── __init__.py │ │ ├── base.py │ │ ├── invalid.ipynb │ │ ├── invalid_cell_id.ipynb │ │ ├── invalid_unique_cell_id.ipynb │ │ ├── many_tracebacks.ipynb │ │ ├── test2.ipynb │ │ ├── test3.ipynb │ │ ├── test4.ipynb │ │ ├── test4custom.ipynb │ │ ├── test4docinfo.ipynb │ │ ├── test4jupyter_metadata.ipynb │ │ ├── test4jupyter_metadata_timings.ipynb │ │ ├── test4plus.ipynb │ │ ├── test_api.py │ │ ├── test_convert.py │ │ ├── test_nbformat.py │ │ ├── test_reader.py │ │ ├── test_sign.py │ │ └── test_validator.py │ ├── v1 │ │ ├── __init__.py │ │ ├── convert.py │ │ ├── nbbase.py │ │ ├── nbjson.py │ │ ├── rwbase.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── nbexamples.py │ │ │ ├── test_json.py │ │ │ └── test_nbbase.py │ ├── v2 │ │ ├── __init__.py │ │ ├── convert.py │ │ ├── nbbase.py │ │ ├── nbjson.py │ │ ├── nbpy.py │ │ ├── nbxml.py │ │ ├── rwbase.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── nbexamples.py │ │ │ ├── test_json.py │ │ │ ├── test_nbbase.py │ │ │ └── test_nbpy.py │ ├── v3 │ │ ├── __init__.py │ │ ├── convert.py │ │ ├── nbbase.py │ │ ├── nbformat.v3.schema.json │ │ ├── nbjson.py │ │ ├── nbpy.py │ │ ├── rwbase.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── formattest.py │ │ │ ├── nbexamples.py │ │ │ ├── test_json.py │ │ │ ├── test_misc.py │ │ │ ├── test_nbbase.py │ │ │ └── test_nbpy.py │ ├── v4 │ │ ├── __init__.py │ │ ├── convert.py │ │ ├── nbbase.py │ │ ├── nbformat.v4.0.schema.json │ │ ├── nbformat.v4.1.schema.json │ │ ├── nbformat.v4.2.schema.json │ │ ├── nbformat.v4.3.schema.json │ │ ├── nbformat.v4.4.schema.json │ │ ├── nbformat.v4.5.schema.json │ │ ├── nbformat.v4.schema.json │ │ ├── nbjson.py │ │ ├── rwbase.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── formattest.py │ │ │ ├── nbexamples.py │ │ │ ├── test_convert.py │ │ │ ├── test_json.py │ │ │ ├── test_nbbase.py │ │ │ └── test_validate.py │ └── validator.py ├── pkg_resources │ ├── __init__.py │ ├── _vendor │ │ ├── __init__.py │ │ ├── appdirs.py │ │ ├── packaging │ │ │ ├── __about__.py │ │ │ ├── __init__.py │ │ │ ├── _compat.py │ │ │ ├── _structures.py │ │ │ ├── _typing.py │ │ │ ├── markers.py │ │ │ ├── requirements.py │ │ │ ├── specifiers.py │ │ │ ├── tags.py │ │ │ ├── utils.py │ │ │ └── version.py │ │ └── pyparsing.py │ ├── extern │ │ └── __init__.py │ └── tests │ │ └── data │ │ └── my-test-package-source │ │ └── setup.py ├── pyrsistent-0.17.3.dist-info │ ├── INSTALLER │ ├── LICENCE.mit │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ └── top_level.txt ├── pyrsistent │ ├── __init__.py │ ├── __init__.pyi │ ├── _checked_types.py │ ├── _field_common.py │ ├── _helpers.py │ ├── _immutable.py │ ├── _pbag.py │ ├── _pclass.py │ ├── _pdeque.py │ ├── _plist.py │ ├── _pmap.py │ ├── _precord.py │ ├── _pset.py │ ├── _pvector.py │ ├── _toolz.py │ ├── _transformations.py │ ├── py.typed │ ├── typing.py │ └── typing.pyi ├── six-1.16.0.dist-info │ ├── INSTALLER │ ├── LICENSE │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ └── top_level.txt ├── six.py ├── toml-0.10.2.dist-info │ ├── INSTALLER │ ├── LICENSE │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ └── top_level.txt ├── toml │ ├── __init__.py │ ├── decoder.py │ ├── encoder.py │ ├── ordered.py │ └── tz.py ├── traitlets-5.0.5.dist-info │ ├── COPYING.md │ ├── INSTALLER │ ├── METADATA │ ├── RECORD │ ├── WHEEL │ └── top_level.txt ├── traitlets │ ├── __init__.py │ ├── _version.py │ ├── config │ │ ├── __init__.py │ │ ├── application.py │ │ ├── configurable.py │ │ ├── loader.py │ │ ├── manager.py │ │ ├── sphinxdoc.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── test_application.py │ │ │ ├── test_configurable.py │ │ │ └── test_loader.py │ ├── log.py │ ├── tests │ │ ├── __init__.py │ │ ├── _warnings.py │ │ ├── test_traitlets.py │ │ ├── test_traitlets_enum.py │ │ └── utils.py │ ├── traitlets.py │ └── utils │ │ ├── __init__.py │ │ ├── bunch.py │ │ ├── decorators.py │ │ ├── descriptions.py │ │ ├── getargspec.py │ │ ├── importstring.py │ │ ├── sentinel.py │ │ └── tests │ │ ├── __init__.py │ │ ├── test_bunch.py │ │ ├── test_decorators.py │ │ └── test_importstring.py └── yaml │ ├── __init__.py │ ├── composer.py │ ├── constructor.py │ ├── cyaml.py │ ├── dumper.py │ ├── emitter.py │ ├── error.py │ ├── events.py │ ├── loader.py │ ├── nodes.py │ ├── parser.py │ ├── reader.py │ ├── representer.py │ ├── resolver.py │ ├── scanner.py │ ├── serializer.py │ └── tokens.py ├── src ├── commands.ts ├── constants.ts ├── contentProviders.ts ├── conversion.ts ├── extension.ts ├── languages.ts ├── opener.ts ├── python.ts ├── test │ ├── runTest.ts │ └── suite │ │ ├── extension.test.ts │ │ └── index.ts └── utils.ts ├── tsconfig.json ├── vscode.d.ts ├── vscode.proposed.d.ts └── webpack.config.js /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "@typescript-eslint/naming-convention": "warn", 13 | "@typescript-eslint/semi": "warn", 14 | "curly": "warn", 15 | "eqeqeq": "warn", 16 | "no-throw-literal": "warn", 17 | "semi": "off" 18 | }, 19 | "ignorePatterns": [ 20 | "out", 21 | "dist", 22 | "**/*.d.ts" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | out 3 | dist 4 | node_modules 5 | .vscode-test/ 6 | *.vsix 7 | *.pyc 8 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "useTabs": false, 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "eamodio.tsl-problem-matcher" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}", 14 | "--enable-proposed-api" 15 | ], 16 | "outFiles": [ 17 | "${workspaceFolder}/dist/**/*.js" 18 | ], 19 | // "preLaunchTask": "${defaultBuildTask}" 20 | }, 21 | { 22 | "name": "Extension Tests", 23 | "type": "extensionHost", 24 | "request": "launch", 25 | "args": [ 26 | "--extensionDevelopmentPath=${workspaceFolder}", 27 | "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" 28 | ], 29 | "outFiles": [ 30 | "${workspaceFolder}/out/test/**/*.js" 31 | ], 32 | "preLaunchTask": "npm: test-watch" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false, // set this to true to hide the "out" folder with the compiled JS files 5 | "dist": false // set this to true to hide the "dist" folder with the compiled JS files 6 | }, 7 | "search.exclude": { 8 | "out": true, // set this to false to include "out" folder in search results 9 | "dist": true // set this to false to include "dist" folder in search results 10 | }, 11 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 12 | "typescript.tsc.autoDetect": "off" 13 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": [ 10 | "$ts-webpack-watch", 11 | "$tslint-webpack-watch" 12 | ], 13 | "isBackground": true, 14 | "presentation": { 15 | "reveal": "never" 16 | }, 17 | "group": { 18 | "kind": "build", 19 | "isDefault": true 20 | } 21 | }, 22 | { 23 | "type": "npm", 24 | "script": "test-watch", 25 | "problemMatcher": "$tsc-watch", 26 | "isBackground": true, 27 | "presentation": { 28 | "reveal": "never" 29 | }, 30 | "group": "build" 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/** 4 | node_modules/** 5 | src/** 6 | .gitignore 7 | .yarnrc 8 | vsc-extension-quickstart.md 9 | **/tsconfig.json 10 | **/.eslintrc.json 11 | **/*.map 12 | **/*.ts 13 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | --ignore-engines true -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "vscode-notebook-cell-linenumber" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # Licensing terms 2 | 3 | This project is licensed under the terms of the Modified BSD License (also known as New or Revised or 3-Clause BSD), as follows: 4 | 5 | - Copyright 2021 Don Jayamanne 6 | 7 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A [Visual Studio Code](https://code.visualstudio.com/) [extension](https://marketplace.visualstudio.com/items?itemName=donjayamanne.vscode-jupytext) that provides ability to open and execute script files as Jupyter Notebooks. 2 | 3 | ## Like the UI of Jupyter Notebooks, but prefer to use plain text files, this is the extension for you. 4 | 5 | 6 | 7 | 8 | # Features 9 | * Open and execute script files as Jupyter Notebooks 10 | * Editing/Updating notebooks will result in the corresponding source script file getting updated 11 | * Notebook file doesn't exist on disc (hence no need to manage two files and manage syncing the two). 12 | 13 | # Requirements 14 | * Jupyter Extension 15 | * VS Code Insiders (VS Code Stable is not yet supported) 16 | * Python (temporary, see `Roadmap`) 17 | 18 | # Getting Started 19 | * Please install VS Code Insiders (stable is not yet supported) 20 | * Install this extension 21 | * Launch VS Code with the following command line `code-insiders --enable-proposed-api=donjayamanne.vscode-jupytext` 22 | * Right click a file and select `Open as a Jupyter Notebook` 23 | * Start executing code against Jupyter Kernels, save changes to notebook will result in the corresponding script file getting updated. 24 | 25 | 26 | ### Based on the [Jupytext](https://github.com/mwouts/jupytext) 27 | * This extension merely atttempts to provide the same functionality as Jupytext, but in VSCode. 28 | * The Jupytext package is bundled with the extension and used where `Python` is avaialble. 29 | * Opening `Python` and some files such as `rmd` or `markdown` will require `Python` runtime for now 30 | 31 | 32 | ### Roadmap 33 | * Remove dependency on `Python` runtime for script files such as `TypeScript, JavaScript, Rust, C#, F#, etc` 34 | * Seemless editing of both script file and notebook together 35 | * Support metadata in script files (currently metadata might not be saved) 36 | * Configuration of formats (metdata) 37 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/icon.png -------------------------------------------------------------------------------- /images/main.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/images/main.gif -------------------------------------------------------------------------------- /python-libs/PyYAML-5.4.1.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/PyYAML-5.4.1.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2021 Ingy döt Net 2 | Copyright (c) 2006-2016 Kirill Simonov 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /python-libs/PyYAML-5.4.1.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: PyYAML 3 | Version: 5.4.1 4 | Summary: YAML parser and emitter for Python 5 | Home-page: https://pyyaml.org/ 6 | Author: Kirill Simonov 7 | Author-email: xi@resolvent.net 8 | License: MIT 9 | Download-URL: https://pypi.org/project/PyYAML/ 10 | Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues 11 | Project-URL: CI, https://github.com/yaml/pyyaml/actions 12 | Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation 13 | Project-URL: Mailing lists, http://lists.sourceforge.net/lists/listinfo/yaml-core 14 | Project-URL: Source Code, https://github.com/yaml/pyyaml 15 | Platform: Any 16 | Classifier: Development Status :: 5 - Production/Stable 17 | Classifier: Intended Audience :: Developers 18 | Classifier: License :: OSI Approved :: MIT License 19 | Classifier: Operating System :: OS Independent 20 | Classifier: Programming Language :: Cython 21 | Classifier: Programming Language :: Python 22 | Classifier: Programming Language :: Python :: 2 23 | Classifier: Programming Language :: Python :: 2.7 24 | Classifier: Programming Language :: Python :: 3 25 | Classifier: Programming Language :: Python :: 3.6 26 | Classifier: Programming Language :: Python :: 3.7 27 | Classifier: Programming Language :: Python :: 3.8 28 | Classifier: Programming Language :: Python :: 3.9 29 | Classifier: Programming Language :: Python :: Implementation :: CPython 30 | Classifier: Programming Language :: Python :: Implementation :: PyPy 31 | Classifier: Topic :: Software Development :: Libraries :: Python Modules 32 | Classifier: Topic :: Text Processing :: Markup 33 | Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.* 34 | 35 | YAML is a data serialization format designed for human readability 36 | and interaction with scripting languages. PyYAML is a YAML parser 37 | and emitter for Python. 38 | 39 | PyYAML features a complete YAML 1.1 parser, Unicode support, pickle 40 | support, capable extension API, and sensible error messages. PyYAML 41 | supports standard YAML tags and provides Python-specific tags that 42 | allow to represent an arbitrary Python object. 43 | 44 | PyYAML is applicable for a broad range of tasks from complex 45 | configuration files to object serialization and persistence. 46 | 47 | -------------------------------------------------------------------------------- /python-libs/PyYAML-5.4.1.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: false 4 | Tag: cp39-cp39-macosx_11_0_arm64 5 | 6 | -------------------------------------------------------------------------------- /python-libs/PyYAML-5.4.1.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | _yaml 2 | yaml 3 | -------------------------------------------------------------------------------- /python-libs/_distutils_hack/override.py: -------------------------------------------------------------------------------- 1 | __import__('_distutils_hack').do_override() 2 | -------------------------------------------------------------------------------- /python-libs/_pyrsistent_version.py: -------------------------------------------------------------------------------- 1 | __version__ = '0.17.3' 2 | -------------------------------------------------------------------------------- /python-libs/_yaml/__init__.py: -------------------------------------------------------------------------------- 1 | # This is a stub package designed to roughly emulate the _yaml 2 | # extension module, which previously existed as a standalone module 3 | # and has been moved into the `yaml` package namespace. 4 | # It does not perfectly mimic its old counterpart, but should get 5 | # close enough for anyone who's relying on it even when they shouldn't. 6 | import yaml 7 | 8 | # in some circumstances, the yaml module we imoprted may be from a different version, so we need 9 | # to tread carefully when poking at it here (it may not have the attributes we expect) 10 | if not getattr(yaml, '__with_libyaml__', False): 11 | from sys import version_info 12 | 13 | exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError 14 | raise exc("No module named '_yaml'") 15 | else: 16 | from yaml._yaml import * 17 | import warnings 18 | warnings.warn( 19 | 'The _yaml extension module is now located at yaml._yaml' 20 | ' and its location is subject to change. To use the' 21 | ' LibYAML-based parser and emitter, import from `yaml`:' 22 | ' `from yaml import CLoader as Loader, CDumper as Dumper`.', 23 | DeprecationWarning 24 | ) 25 | del warnings 26 | # Don't `del yaml` here because yaml is actually an existing 27 | # namespace member of _yaml. 28 | 29 | __name__ = '_yaml' 30 | # If the module is top-level (i.e. not a part of any specific package) 31 | # then the attribute should be set to ''. 32 | # https://docs.python.org/3.8/library/types.html 33 | __package__ = '' 34 | -------------------------------------------------------------------------------- /python-libs/attr/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import sys 4 | 5 | from functools import partial 6 | 7 | from . import converters, exceptions, filters, setters, validators 8 | from ._cmp import cmp_using 9 | from ._config import get_run_validators, set_run_validators 10 | from ._funcs import asdict, assoc, astuple, evolve, has, resolve_types 11 | from ._make import ( 12 | NOTHING, 13 | Attribute, 14 | Factory, 15 | attrib, 16 | attrs, 17 | fields, 18 | fields_dict, 19 | make_class, 20 | validate, 21 | ) 22 | from ._version_info import VersionInfo 23 | 24 | 25 | __version__ = "21.2.0" 26 | __version_info__ = VersionInfo._from_version_string(__version__) 27 | 28 | __title__ = "attrs" 29 | __description__ = "Classes Without Boilerplate" 30 | __url__ = "https://www.attrs.org/" 31 | __uri__ = __url__ 32 | __doc__ = __description__ + " <" + __uri__ + ">" 33 | 34 | __author__ = "Hynek Schlawack" 35 | __email__ = "hs@ox.cx" 36 | 37 | __license__ = "MIT" 38 | __copyright__ = "Copyright (c) 2015 Hynek Schlawack" 39 | 40 | 41 | s = attributes = attrs 42 | ib = attr = attrib 43 | dataclass = partial(attrs, auto_attribs=True) # happy Easter ;) 44 | 45 | __all__ = [ 46 | "Attribute", 47 | "Factory", 48 | "NOTHING", 49 | "asdict", 50 | "assoc", 51 | "astuple", 52 | "attr", 53 | "attrib", 54 | "attributes", 55 | "attrs", 56 | "cmp_using", 57 | "converters", 58 | "evolve", 59 | "exceptions", 60 | "fields", 61 | "fields_dict", 62 | "filters", 63 | "get_run_validators", 64 | "has", 65 | "ib", 66 | "make_class", 67 | "resolve_types", 68 | "s", 69 | "set_run_validators", 70 | "setters", 71 | "validate", 72 | "validators", 73 | ] 74 | 75 | if sys.version_info[:2] >= (3, 6): 76 | from ._next_gen import define, field, frozen, mutable 77 | 78 | __all__.extend((define, field, frozen, mutable)) 79 | -------------------------------------------------------------------------------- /python-libs/attr/_cmp.pyi: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from . import _CompareWithType 4 | 5 | 6 | def cmp_using( 7 | eq: Optional[_CompareWithType], 8 | lt: Optional[_CompareWithType], 9 | le: Optional[_CompareWithType], 10 | gt: Optional[_CompareWithType], 11 | ge: Optional[_CompareWithType], 12 | require_same_type: bool, 13 | class_name: str, 14 | ) -> Type: ... 15 | -------------------------------------------------------------------------------- /python-libs/attr/_config.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | 4 | __all__ = ["set_run_validators", "get_run_validators"] 5 | 6 | _run_validators = True 7 | 8 | 9 | def set_run_validators(run): 10 | """ 11 | Set whether or not validators are run. By default, they are run. 12 | """ 13 | if not isinstance(run, bool): 14 | raise TypeError("'run' must be bool.") 15 | global _run_validators 16 | _run_validators = run 17 | 18 | 19 | def get_run_validators(): 20 | """ 21 | Return whether or not validators are run. 22 | """ 23 | return _run_validators 24 | -------------------------------------------------------------------------------- /python-libs/attr/_version_info.pyi: -------------------------------------------------------------------------------- 1 | class VersionInfo: 2 | @property 3 | def year(self) -> int: ... 4 | @property 5 | def minor(self) -> int: ... 6 | @property 7 | def micro(self) -> int: ... 8 | @property 9 | def releaselevel(self) -> str: ... 10 | -------------------------------------------------------------------------------- /python-libs/attr/converters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Callable, Optional, TypeVar, overload 2 | 3 | from . import _ConverterType 4 | 5 | 6 | _T = TypeVar("_T") 7 | 8 | def pipe(*validators: _ConverterType) -> _ConverterType: ... 9 | def optional(converter: _ConverterType) -> _ConverterType: ... 10 | @overload 11 | def default_if_none(default: _T) -> _ConverterType: ... 12 | @overload 13 | def default_if_none(*, factory: Callable[[], _T]) -> _ConverterType: ... 14 | -------------------------------------------------------------------------------- /python-libs/attr/exceptions.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | 4 | class FrozenError(AttributeError): 5 | msg: str = ... 6 | 7 | class FrozenInstanceError(FrozenError): ... 8 | class FrozenAttributeError(FrozenError): ... 9 | class AttrsAttributeNotFoundError(ValueError): ... 10 | class NotAnAttrsClassError(ValueError): ... 11 | class DefaultAlreadySetError(RuntimeError): ... 12 | class UnannotatedAttributeError(RuntimeError): ... 13 | class PythonTooOldError(RuntimeError): ... 14 | 15 | class NotCallableError(TypeError): 16 | msg: str = ... 17 | value: Any = ... 18 | def __init__(self, msg: str, value: Any) -> None: ... 19 | -------------------------------------------------------------------------------- /python-libs/attr/filters.py: -------------------------------------------------------------------------------- 1 | """ 2 | Commonly useful filters for `attr.asdict`. 3 | """ 4 | 5 | from __future__ import absolute_import, division, print_function 6 | 7 | from ._compat import isclass 8 | from ._make import Attribute 9 | 10 | 11 | def _split_what(what): 12 | """ 13 | Returns a tuple of `frozenset`s of classes and attributes. 14 | """ 15 | return ( 16 | frozenset(cls for cls in what if isclass(cls)), 17 | frozenset(cls for cls in what if isinstance(cls, Attribute)), 18 | ) 19 | 20 | 21 | def include(*what): 22 | """ 23 | Whitelist *what*. 24 | 25 | :param what: What to whitelist. 26 | :type what: `list` of `type` or `attr.Attribute`\\ s 27 | 28 | :rtype: `callable` 29 | """ 30 | cls, attrs = _split_what(what) 31 | 32 | def include_(attribute, value): 33 | return value.__class__ in cls or attribute in attrs 34 | 35 | return include_ 36 | 37 | 38 | def exclude(*what): 39 | """ 40 | Blacklist *what*. 41 | 42 | :param what: What to blacklist. 43 | :type what: `list` of classes or `attr.Attribute`\\ s. 44 | 45 | :rtype: `callable` 46 | """ 47 | cls, attrs = _split_what(what) 48 | 49 | def exclude_(attribute, value): 50 | return value.__class__ not in cls and attribute not in attrs 51 | 52 | return exclude_ 53 | -------------------------------------------------------------------------------- /python-libs/attr/filters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any, Union 2 | 3 | from . import Attribute, _FilterType 4 | 5 | 6 | def include(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ... 7 | def exclude(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ... 8 | -------------------------------------------------------------------------------- /python-libs/attr/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/attr/py.typed -------------------------------------------------------------------------------- /python-libs/attr/setters.py: -------------------------------------------------------------------------------- 1 | """ 2 | Commonly used hooks for on_setattr. 3 | """ 4 | 5 | from __future__ import absolute_import, division, print_function 6 | 7 | from . import _config 8 | from .exceptions import FrozenAttributeError 9 | 10 | 11 | def pipe(*setters): 12 | """ 13 | Run all *setters* and return the return value of the last one. 14 | 15 | .. versionadded:: 20.1.0 16 | """ 17 | 18 | def wrapped_pipe(instance, attrib, new_value): 19 | rv = new_value 20 | 21 | for setter in setters: 22 | rv = setter(instance, attrib, rv) 23 | 24 | return rv 25 | 26 | return wrapped_pipe 27 | 28 | 29 | def frozen(_, __, ___): 30 | """ 31 | Prevent an attribute to be modified. 32 | 33 | .. versionadded:: 20.1.0 34 | """ 35 | raise FrozenAttributeError() 36 | 37 | 38 | def validate(instance, attrib, new_value): 39 | """ 40 | Run *attrib*'s validator on *new_value* if it has one. 41 | 42 | .. versionadded:: 20.1.0 43 | """ 44 | if _config._run_validators is False: 45 | return new_value 46 | 47 | v = attrib.validator 48 | if not v: 49 | return new_value 50 | 51 | v(instance, attrib, new_value) 52 | 53 | return new_value 54 | 55 | 56 | def convert(instance, attrib, new_value): 57 | """ 58 | Run *attrib*'s converter -- if it has one -- on *new_value* and return the 59 | result. 60 | 61 | .. versionadded:: 20.1.0 62 | """ 63 | c = attrib.converter 64 | if c: 65 | return c(new_value) 66 | 67 | return new_value 68 | 69 | 70 | NO_OP = object() 71 | """ 72 | Sentinel for disabling class-wide *on_setattr* hooks for certain attributes. 73 | 74 | Does not work in `pipe` or within lists. 75 | 76 | .. versionadded:: 20.1.0 77 | """ 78 | -------------------------------------------------------------------------------- /python-libs/attr/setters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any, NewType, NoReturn, TypeVar, cast 2 | 3 | from . import Attribute, _OnSetAttrType 4 | 5 | 6 | _T = TypeVar("_T") 7 | 8 | def frozen( 9 | instance: Any, attribute: Attribute[Any], new_value: Any 10 | ) -> NoReturn: ... 11 | def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ... 12 | def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ... 13 | 14 | # convert is allowed to return Any, because they can be chained using pipe. 15 | def convert( 16 | instance: Any, attribute: Attribute[Any], new_value: Any 17 | ) -> Any: ... 18 | 19 | _NoOpType = NewType("_NoOpType", object) 20 | NO_OP: _NoOpType 21 | -------------------------------------------------------------------------------- /python-libs/attr/validators.pyi: -------------------------------------------------------------------------------- 1 | from typing import ( 2 | Any, 3 | AnyStr, 4 | Callable, 5 | Container, 6 | Iterable, 7 | List, 8 | Mapping, 9 | Match, 10 | Optional, 11 | Tuple, 12 | Type, 13 | TypeVar, 14 | Union, 15 | overload, 16 | ) 17 | 18 | from . import _ValidatorType 19 | 20 | 21 | _T = TypeVar("_T") 22 | _T1 = TypeVar("_T1") 23 | _T2 = TypeVar("_T2") 24 | _T3 = TypeVar("_T3") 25 | _I = TypeVar("_I", bound=Iterable) 26 | _K = TypeVar("_K") 27 | _V = TypeVar("_V") 28 | _M = TypeVar("_M", bound=Mapping) 29 | 30 | # To be more precise on instance_of use some overloads. 31 | # If there are more than 3 items in the tuple then we fall back to Any 32 | @overload 33 | def instance_of(type: Type[_T]) -> _ValidatorType[_T]: ... 34 | @overload 35 | def instance_of(type: Tuple[Type[_T]]) -> _ValidatorType[_T]: ... 36 | @overload 37 | def instance_of( 38 | type: Tuple[Type[_T1], Type[_T2]] 39 | ) -> _ValidatorType[Union[_T1, _T2]]: ... 40 | @overload 41 | def instance_of( 42 | type: Tuple[Type[_T1], Type[_T2], Type[_T3]] 43 | ) -> _ValidatorType[Union[_T1, _T2, _T3]]: ... 44 | @overload 45 | def instance_of(type: Tuple[type, ...]) -> _ValidatorType[Any]: ... 46 | def provides(interface: Any) -> _ValidatorType[Any]: ... 47 | def optional( 48 | validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]] 49 | ) -> _ValidatorType[Optional[_T]]: ... 50 | def in_(options: Container[_T]) -> _ValidatorType[_T]: ... 51 | def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ... 52 | def matches_re( 53 | regex: AnyStr, 54 | flags: int = ..., 55 | func: Optional[ 56 | Callable[[AnyStr, AnyStr, int], Optional[Match[AnyStr]]] 57 | ] = ..., 58 | ) -> _ValidatorType[AnyStr]: ... 59 | def deep_iterable( 60 | member_validator: _ValidatorType[_T], 61 | iterable_validator: Optional[_ValidatorType[_I]] = ..., 62 | ) -> _ValidatorType[_I]: ... 63 | def deep_mapping( 64 | key_validator: _ValidatorType[_K], 65 | value_validator: _ValidatorType[_V], 66 | mapping_validator: Optional[_ValidatorType[_M]] = ..., 67 | ) -> _ValidatorType[_M]: ... 68 | def is_callable() -> _ValidatorType[_T]: ... 69 | -------------------------------------------------------------------------------- /python-libs/attrs-21.2.0.dist-info/AUTHORS.rst: -------------------------------------------------------------------------------- 1 | Credits 2 | ======= 3 | 4 | ``attrs`` is written and maintained by `Hynek Schlawack `_. 5 | 6 | The development is kindly supported by `Variomedia AG `_. 7 | 8 | A full list of contributors can be found in `GitHub's overview `_. 9 | 10 | It’s the spiritual successor of `characteristic `_ and aspires to fix some of it clunkiness and unfortunate decisions. 11 | Both were inspired by Twisted’s `FancyEqMixin `_ but both are implemented using class decorators because `subclassing is bad for you `_, m’kay? 12 | -------------------------------------------------------------------------------- /python-libs/attrs-21.2.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/attrs-21.2.0.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Hynek Schlawack 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /python-libs/attrs-21.2.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: true 4 | Tag: py2-none-any 5 | Tag: py3-none-any 6 | 7 | -------------------------------------------------------------------------------- /python-libs/attrs-21.2.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | attr 2 | -------------------------------------------------------------------------------- /python-libs/bin/jsonschema: -------------------------------------------------------------------------------- 1 | #!/Users/donjayamanne/miniforge3/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from jsonschema.cli import main 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(main()) 9 | -------------------------------------------------------------------------------- /python-libs/bin/jupyter: -------------------------------------------------------------------------------- 1 | #!/Users/donjayamanne/miniforge3/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from jupyter_core.command import main 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(main()) 9 | -------------------------------------------------------------------------------- /python-libs/bin/jupyter-migrate: -------------------------------------------------------------------------------- 1 | #!/Users/donjayamanne/miniforge3/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from jupyter_core.migrate import main 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(main()) 9 | -------------------------------------------------------------------------------- /python-libs/bin/jupyter-troubleshoot: -------------------------------------------------------------------------------- 1 | #!/Users/donjayamanne/miniforge3/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from jupyter_core.troubleshoot import main 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(main()) 9 | -------------------------------------------------------------------------------- /python-libs/bin/jupyter-trust: -------------------------------------------------------------------------------- 1 | #!/Users/donjayamanne/miniforge3/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from nbformat.sign import TrustNotebookApp 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(TrustNotebookApp.launch_instance()) 9 | -------------------------------------------------------------------------------- /python-libs/bin/jupytext: -------------------------------------------------------------------------------- 1 | #!/Users/donjayamanne/miniforge3/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from jupytext.cli import jupytext 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(jupytext()) 9 | -------------------------------------------------------------------------------- /python-libs/bin/markdown-it: -------------------------------------------------------------------------------- 1 | #!/Users/donjayamanne/miniforge3/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from markdown_it.cli.parse import main 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(main()) 9 | -------------------------------------------------------------------------------- /python-libs/distutils-precedence.pth: -------------------------------------------------------------------------------- 1 | import os; var = 'SETUPTOOLS_USE_DISTUTILS'; enabled = os.environ.get(var, 'stdlib') == 'local'; enabled and __import__('_distutils_hack').add_shim(); 2 | -------------------------------------------------------------------------------- /python-libs/etc/jupyter/jupyter_notebook_config.d/jupytext.json: -------------------------------------------------------------------------------- 1 | { 2 | "NotebookApp": { 3 | "nbserver_extensions": { 4 | "jupytext": true 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /python-libs/etc/jupyter/jupyter_server_config.d/jupytext.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerApp": { 3 | "jpserver_extensions": { 4 | "jupytext": true 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /python-libs/etc/jupyter/nbconfig/notebook.d/jupytext.json: -------------------------------------------------------------------------------- 1 | { 2 | "load_extensions": { 3 | "jupytext/index": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils-0.2.0.dist-info/DESCRIPTION.rst: -------------------------------------------------------------------------------- 1 | Pretend this doesn't exist. Nobody should use it. 2 | 3 | 4 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils-0.2.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils-0.2.0.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.0 2 | Name: ipython-genutils 3 | Version: 0.2.0 4 | Summary: Vestigial utilities from IPython 5 | Home-page: http://ipython.org 6 | Author: IPython Development Team 7 | Author-email: ipython-dev@scipy.org 8 | License: BSD 9 | Keywords: Interactive,Interpreter,Shell,Web 10 | Platform: Linux 11 | Platform: Mac OS X 12 | Platform: Windows 13 | Classifier: Intended Audience :: Developers 14 | Classifier: Intended Audience :: System Administrators 15 | Classifier: Intended Audience :: Science/Research 16 | Classifier: License :: OSI Approved :: BSD License 17 | Classifier: Programming Language :: Python 18 | Classifier: Programming Language :: Python :: 2.7 19 | Classifier: Programming Language :: Python :: 3 20 | Classifier: Programming Language :: Python :: 3.3 21 | 22 | Pretend this doesn't exist. Nobody should use it. 23 | 24 | 25 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils-0.2.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.29.0) 3 | Root-Is-Purelib: true 4 | Tag: py2-none-any 5 | Tag: py3-none-any 6 | 7 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils-0.2.0.dist-info/metadata.json: -------------------------------------------------------------------------------- 1 | {"classifiers": ["Intended Audience :: Developers", "Intended Audience :: System Administrators", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3"], "extensions": {"python.details": {"contacts": [{"email": "ipython-dev@scipy.org", "name": "IPython Development Team", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "http://ipython.org"}}}, "generator": "bdist_wheel (0.29.0)", "keywords": ["Interactive", "Interpreter", "Shell", "Web"], "license": "BSD", "metadata_version": "2.0", "name": "ipython-genutils", "platform": "Linux", "summary": "Vestigial utilities from IPython", "version": "0.2.0"} -------------------------------------------------------------------------------- /python-libs/ipython_genutils-0.2.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | ipython_genutils 2 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils/__init__.py: -------------------------------------------------------------------------------- 1 | from ._version import __version__, version_info 2 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils/_version.py: -------------------------------------------------------------------------------- 1 | version_info = (0, 2, 0) 2 | __version__ = '.'.join(map(str, version_info)) 3 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils/importstring.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | A simple utility to import something by its string name. 4 | """ 5 | 6 | # Copyright (c) IPython Development Team. 7 | # Distributed under the terms of the Modified BSD License. 8 | 9 | 10 | def import_item(name): 11 | """Import and return ``bar`` given the string ``foo.bar``. 12 | 13 | Calling ``bar = import_item("foo.bar")`` is the functional equivalent of 14 | executing the code ``from foo import bar``. 15 | 16 | Parameters 17 | ---------- 18 | name : string 19 | The fully qualified name of the module/package being imported. 20 | 21 | Returns 22 | ------- 23 | mod : module object 24 | The module that was imported. 25 | """ 26 | 27 | parts = name.rsplit('.', 1) 28 | if len(parts) == 2: 29 | # called with 'foo.bar....' 30 | package, obj = parts 31 | module = __import__(package, fromlist=[obj]) 32 | try: 33 | pak = getattr(module, obj) 34 | except AttributeError: 35 | raise ImportError('No module named %s' % obj) 36 | return pak 37 | else: 38 | # called with un-dotted string 39 | return __import__(parts[0]) 40 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils/testing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/ipython_genutils/testing/__init__.py -------------------------------------------------------------------------------- /python-libs/ipython_genutils/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/ipython_genutils/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/ipython_genutils/tests/test_importstring.py: -------------------------------------------------------------------------------- 1 | """Tests for IPython.utils.importstring.""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | import nose.tools as nt 7 | 8 | from ..importstring import import_item 9 | 10 | def test_import_plain(): 11 | "Test simple imports" 12 | import os 13 | os2 = import_item('os') 14 | nt.assert_true(os is os2) 15 | 16 | 17 | def test_import_nested(): 18 | "Test nested imports from the stdlib" 19 | from os import path 20 | path2 = import_item('os.path') 21 | nt.assert_true(path is path2) 22 | 23 | 24 | def test_import_raises(): 25 | "Test that failing imports raise the right exception" 26 | nt.assert_raises(ImportError, import_item, 'IPython.foobar') 27 | 28 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils/tests/test_tempdir.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | 4 | from ..tempdir import NamedFileInTemporaryDirectory 5 | from ..tempdir import TemporaryWorkingDirectory 6 | 7 | 8 | def test_named_file_in_temporary_directory(): 9 | with NamedFileInTemporaryDirectory('filename') as file: 10 | name = file.name 11 | assert not file.closed 12 | assert os.path.exists(name) 13 | file.write(b'test') 14 | assert file.closed 15 | assert not os.path.exists(name) 16 | 17 | def test_temporary_working_directory(): 18 | with TemporaryWorkingDirectory() as dir: 19 | assert os.path.exists(dir) 20 | assert os.path.realpath(os.curdir) == os.path.realpath(dir) 21 | assert not os.path.exists(dir) 22 | assert os.path.abspath(os.curdir) != dir 23 | -------------------------------------------------------------------------------- /python-libs/ipython_genutils/tests/test_text.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """Tests for IPython.utils.text""" 3 | from __future__ import print_function 4 | 5 | # Copyright (c) IPython Development Team. 6 | # Distributed under the terms of the Modified BSD License. 7 | 8 | import os 9 | import math 10 | import random 11 | import sys 12 | 13 | import nose.tools as nt 14 | 15 | from .. import text 16 | 17 | 18 | def test_columnize(): 19 | """Basic columnize tests.""" 20 | size = 5 21 | items = [l*size for l in 'abc'] 22 | out = text.columnize(items, displaywidth=80) 23 | nt.assert_equal(out, 'aaaaa bbbbb ccccc\n') 24 | out = text.columnize(items, displaywidth=12) 25 | nt.assert_equal(out, 'aaaaa ccccc\nbbbbb\n') 26 | out = text.columnize(items, displaywidth=10) 27 | nt.assert_equal(out, 'aaaaa\nbbbbb\nccccc\n') 28 | 29 | def test_columnize_random(): 30 | """Test with random input to hopfully catch edge case """ 31 | for nitems in [random.randint(2,70) for i in range(2,20)]: 32 | displaywidth = random.randint(20,200) 33 | rand_len = [random.randint(2,displaywidth) for i in range(nitems)] 34 | items = ['x'*l for l in rand_len] 35 | out = text.columnize(items, displaywidth=displaywidth) 36 | longer_line = max([len(x) for x in out.split('\n')]) 37 | longer_element = max(rand_len) 38 | if longer_line > displaywidth: 39 | print("Columnize displayed something lager than displaywidth : %s " % longer_line) 40 | print("longer element : %s " % longer_element) 41 | print("displaywidth : %s " % displaywidth) 42 | print("number of element : %s " % nitems) 43 | print("size of each element :\n %s" % rand_len) 44 | assert False 45 | 46 | def test_columnize_medium(): 47 | """Test with inputs than shouldn't be wider tahn 80 """ 48 | size = 40 49 | items = [l*size for l in 'abc'] 50 | out = text.columnize(items, displaywidth=80) 51 | nt.assert_equal(out, '\n'.join(items+[''])) 52 | 53 | def test_columnize_long(): 54 | """Test columnize with inputs longer than the display window""" 55 | size = 11 56 | items = [l*size for l in 'abc'] 57 | out = text.columnize(items, displaywidth=size-1) 58 | nt.assert_equal(out, '\n'.join(items+[''])) 59 | 60 | -------------------------------------------------------------------------------- /python-libs/jsonschema-3.2.0.dist-info/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Julian Berman 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /python-libs/jsonschema-3.2.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/jsonschema-3.2.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.33.6) 3 | Root-Is-Purelib: true 4 | Tag: py2-none-any 5 | Tag: py3-none-any 6 | 7 | -------------------------------------------------------------------------------- /python-libs/jsonschema-3.2.0.dist-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | jsonschema = jsonschema.cli:main 3 | 4 | -------------------------------------------------------------------------------- /python-libs/jsonschema-3.2.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | jsonschema 2 | -------------------------------------------------------------------------------- /python-libs/jsonschema/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | An implementation of JSON Schema for Python 3 | 4 | The main functionality is provided by the validator classes for each of the 5 | supported JSON Schema versions. 6 | 7 | Most commonly, `validate` is the quickest way to simply validate a given 8 | instance under a schema, and will create a validator for you. 9 | """ 10 | 11 | from jsonschema.exceptions import ( 12 | ErrorTree, FormatError, RefResolutionError, SchemaError, ValidationError 13 | ) 14 | from jsonschema._format import ( 15 | FormatChecker, 16 | draft3_format_checker, 17 | draft4_format_checker, 18 | draft6_format_checker, 19 | draft7_format_checker, 20 | ) 21 | from jsonschema._types import TypeChecker 22 | from jsonschema.validators import ( 23 | Draft3Validator, 24 | Draft4Validator, 25 | Draft6Validator, 26 | Draft7Validator, 27 | RefResolver, 28 | validate, 29 | ) 30 | try: 31 | from importlib import metadata 32 | except ImportError: # for Python<3.8 33 | import importlib_metadata as metadata 34 | __version__ = metadata.version("jsonschema") 35 | -------------------------------------------------------------------------------- /python-libs/jsonschema/__main__.py: -------------------------------------------------------------------------------- 1 | from jsonschema.cli import main 2 | main() 3 | -------------------------------------------------------------------------------- /python-libs/jsonschema/benchmarks/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Benchmarks for validation. 3 | 4 | This package is *not* public API. 5 | """ 6 | -------------------------------------------------------------------------------- /python-libs/jsonschema/benchmarks/issue232.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | A performance benchmark using the example from issue #232. 4 | 5 | See https://github.com/Julian/jsonschema/pull/232. 6 | """ 7 | from twisted.python.filepath import FilePath 8 | from pyperf import Runner 9 | from pyrsistent import m 10 | 11 | from jsonschema.tests._suite import Version 12 | import jsonschema 13 | 14 | 15 | issue232 = Version( 16 | path=FilePath(__file__).sibling("issue232"), 17 | remotes=m(), 18 | name="issue232", 19 | ) 20 | 21 | 22 | if __name__ == "__main__": 23 | issue232.benchmark( 24 | runner=Runner(), 25 | Validator=jsonschema.Draft4Validator, 26 | ) 27 | -------------------------------------------------------------------------------- /python-libs/jsonschema/benchmarks/json_schema_test_suite.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | A performance benchmark using the official test suite. 4 | 5 | This benchmarks jsonschema using every valid example in the 6 | JSON-Schema-Test-Suite. It will take some time to complete. 7 | """ 8 | from pyperf import Runner 9 | 10 | from jsonschema.tests._suite import Suite 11 | 12 | 13 | if __name__ == "__main__": 14 | Suite().benchmark(runner=Runner()) 15 | -------------------------------------------------------------------------------- /python-libs/jsonschema/compat.py: -------------------------------------------------------------------------------- 1 | """ 2 | Python 2/3 compatibility helpers. 3 | 4 | Note: This module is *not* public API. 5 | """ 6 | import contextlib 7 | import operator 8 | import sys 9 | 10 | 11 | try: 12 | from collections.abc import MutableMapping, Sequence # noqa 13 | except ImportError: 14 | from collections import MutableMapping, Sequence # noqa 15 | 16 | PY3 = sys.version_info[0] >= 3 17 | 18 | if PY3: 19 | zip = zip 20 | from functools import lru_cache 21 | from io import StringIO as NativeIO 22 | from urllib.parse import ( 23 | unquote, urljoin, urlunsplit, SplitResult, urlsplit 24 | ) 25 | from urllib.request import pathname2url, urlopen 26 | str_types = str, 27 | int_types = int, 28 | iteritems = operator.methodcaller("items") 29 | else: 30 | from itertools import izip as zip # noqa 31 | from io import BytesIO as NativeIO 32 | from urlparse import urljoin, urlunsplit, SplitResult, urlsplit 33 | from urllib import pathname2url, unquote # noqa 34 | import urllib2 # noqa 35 | def urlopen(*args, **kwargs): 36 | return contextlib.closing(urllib2.urlopen(*args, **kwargs)) 37 | 38 | str_types = basestring 39 | int_types = int, long 40 | iteritems = operator.methodcaller("iteritems") 41 | 42 | from functools32 import lru_cache 43 | 44 | 45 | def urldefrag(url): 46 | if "#" in url: 47 | s, n, p, q, frag = urlsplit(url) 48 | defrag = urlunsplit((s, n, p, q, "")) 49 | else: 50 | defrag = url 51 | frag = "" 52 | return defrag, frag 53 | 54 | 55 | # flake8: noqa 56 | -------------------------------------------------------------------------------- /python-libs/jsonschema/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/jsonschema/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/jsonschema/tests/_helpers.py: -------------------------------------------------------------------------------- 1 | def bug(issue=None): 2 | message = "A known bug." 3 | if issue is not None: 4 | message += " See issue #{issue}.".format(issue=issue) 5 | return message 6 | -------------------------------------------------------------------------------- /python-libs/jupyter.py: -------------------------------------------------------------------------------- 1 | """Launch the root jupyter command""" 2 | if __name__ == '__main__': 3 | from jupyter_core.command import main 4 | main() 5 | -------------------------------------------------------------------------------- /python-libs/jupyter_core-4.7.1.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/jupyter_core-4.7.1.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: jupyter-core 3 | Version: 4.7.1 4 | Summary: Jupyter core package. A base package on which Jupyter projects rely. 5 | Home-page: https://jupyter.org 6 | Author: Jupyter Development Team 7 | Author-email: jupyter@googlegroups.org 8 | License: BSD 9 | Platform: UNKNOWN 10 | Classifier: Intended Audience :: Developers 11 | Classifier: Intended Audience :: System Administrators 12 | Classifier: Intended Audience :: Science/Research 13 | Classifier: License :: OSI Approved :: BSD License 14 | Classifier: Programming Language :: Python 15 | Classifier: Programming Language :: Python :: 3 16 | Requires-Python: >=3.6 17 | Description-Content-Type: text/plain 18 | Requires-Dist: traitlets 19 | Requires-Dist: pywin32 (>=1.0) ; sys_platform == "win32" 20 | 21 | There is no reason to install this package on its own. 22 | 23 | 24 | -------------------------------------------------------------------------------- /python-libs/jupyter_core-4.7.1.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.35.1) 3 | Root-Is-Purelib: true 4 | Tag: py3-none-any 5 | 6 | -------------------------------------------------------------------------------- /python-libs/jupyter_core-4.7.1.dist-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | jupyter = jupyter_core.command:main 3 | jupyter-migrate = jupyter_core.migrate:main 4 | jupyter-troubleshoot = jupyter_core.troubleshoot:main 5 | 6 | -------------------------------------------------------------------------------- /python-libs/jupyter_core-4.7.1.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | jupyter 2 | jupyter_core 3 | -------------------------------------------------------------------------------- /python-libs/jupyter_core/__init__.py: -------------------------------------------------------------------------------- 1 | from .version import version_info, __version__ 2 | -------------------------------------------------------------------------------- /python-libs/jupyter_core/__main__.py: -------------------------------------------------------------------------------- 1 | """Launch the root jupyter command""" 2 | from .command import main 3 | main() 4 | -------------------------------------------------------------------------------- /python-libs/jupyter_core/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/jupyter_core/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/jupyter_core/tests/dotipython/nbextensions/myext.js: -------------------------------------------------------------------------------- 1 | var hello; 2 | -------------------------------------------------------------------------------- /python-libs/jupyter_core/tests/dotipython/profile_default/ipython_nbconvert_config.py: -------------------------------------------------------------------------------- 1 | c.NbConvertApp.post_processors = [] 2 | -------------------------------------------------------------------------------- /python-libs/jupyter_core/tests/dotipython/profile_default/ipython_notebook_config.py: -------------------------------------------------------------------------------- 1 | c.NotebookApp.open_browser = False 2 | -------------------------------------------------------------------------------- /python-libs/jupyter_core/tests/dotipython/profile_default/static/custom/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | Placeholder for custom user CSS 3 | 4 | mainly to be overridden in profile/static/custom/custom.css 5 | 6 | This will always be an empty file in IPython 7 | */ -------------------------------------------------------------------------------- /python-libs/jupyter_core/tests/dotipython_empty/profile_default/static/custom/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | Placeholder for custom user CSS 3 | 4 | mainly to be overridden in profile/static/custom/custom.css 5 | 6 | This will always be an empty file in IPython 7 | */ -------------------------------------------------------------------------------- /python-libs/jupyter_core/tests/mocking.py: -------------------------------------------------------------------------------- 1 | """General mocking utilities""" 2 | 3 | # Copyright (c) Jupyter Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | import os 7 | import sys 8 | from unittest.mock import patch 9 | 10 | 11 | class MultiPatch(object): 12 | def __init__(self, *patchers): 13 | self.patchers = patchers 14 | 15 | def __enter__(self): 16 | for p in self.patchers: 17 | p.start() 18 | 19 | def __exit__(self, *args): 20 | for p in self.patchers: 21 | p.stop() 22 | 23 | darwin = MultiPatch( 24 | patch.object(os, 'name', 'posix'), 25 | patch.object(sys, 'platform', 'darwin'), 26 | ) 27 | 28 | linux = MultiPatch( 29 | patch.object(os, 'name', 'posix'), 30 | patch.object(sys, 'platform', 'linux2'), 31 | ) 32 | 33 | windows = MultiPatch( 34 | patch.object(os, 'name', 'nt'), 35 | patch.object(sys, 'platform', 'win32'), 36 | ) 37 | -------------------------------------------------------------------------------- /python-libs/jupyter_core/utils/__init__.py: -------------------------------------------------------------------------------- 1 | import errno 2 | import os 3 | 4 | def ensure_dir_exists(path, mode=0o777): 5 | """ensure that a directory exists 6 | If it doesn't exist, try to create it, protecting against a race condition 7 | if another process is doing the same. 8 | The default permissions are determined by the current umask. 9 | """ 10 | try: 11 | os.makedirs(path, mode=mode) 12 | except OSError as e: 13 | if e.errno != errno.EEXIST: 14 | raise 15 | if not os.path.isdir(path): 16 | raise IOError("%r exists but is not a directory" % path) -------------------------------------------------------------------------------- /python-libs/jupyter_core/version.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Jupyter Development Team. 2 | # Distributed under the terms of the Modified BSD License. 3 | 4 | from collections import namedtuple 5 | 6 | VersionInfo = namedtuple('VersionInfo', [ 7 | 'major', 8 | 'minor', 9 | 'micro', 10 | 'releaselevel', 11 | 'serial' 12 | ]) 13 | 14 | version_info = VersionInfo(4, 7, 1, 'final', 0) 15 | 16 | _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': '', 'dev': 'dev'} 17 | 18 | if version_info.releaselevel == 'final': 19 | _suffix_ = '' 20 | elif version_info.releaselevel == 'dev': 21 | _suffix_ = f'.dev{version_info.serial}' 22 | else: 23 | _suffix_ = f'{_specifier_[version_info.releaselevel]}{version_info.serial}' 24 | 25 | __version__ = f'{version_info.major}.{version_info.minor}.{version_info.micro}{_suffix_}' 26 | -------------------------------------------------------------------------------- /python-libs/jupytext-1.11.2.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/jupytext-1.11.2.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Marc Wouts 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /python-libs/jupytext-1.11.2.dist-info/REQUESTED: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/jupytext-1.11.2.dist-info/REQUESTED -------------------------------------------------------------------------------- /python-libs/jupytext-1.11.2.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: true 4 | Tag: py3-none-any 5 | 6 | -------------------------------------------------------------------------------- /python-libs/jupytext-1.11.2.dist-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | jupytext = jupytext.cli:jupytext 3 | 4 | -------------------------------------------------------------------------------- /python-libs/jupytext-1.11.2.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | jupytext 2 | -------------------------------------------------------------------------------- /python-libs/jupytext/__main__.py: -------------------------------------------------------------------------------- 1 | """ Main for Jupytext 2 | 3 | Call with (e.g.):: 4 | 5 | python -m jupytext my_notebook.ipynb --to Rmd 6 | """ 7 | 8 | import sys 9 | 10 | from .cli import jupytext 11 | 12 | if __name__ == "__main__": 13 | sys.exit(jupytext()) 14 | -------------------------------------------------------------------------------- /python-libs/jupytext/doxygen.py: -------------------------------------------------------------------------------- 1 | """Convert Markdown equations to doxygen equations and back 2 | See https://github.com/mwouts/jupytext/issues/517""" 3 | 4 | import re 5 | 6 | 7 | def markdown_to_doxygen(string): 8 | """Markdown to Doxygen equations""" 9 | long_equations = re.sub( 10 | r"(?\\f]", string, flags=re.DOTALL 11 | ) 12 | inline_equations = re.sub(r"(?$$", string, flags=re.DOTALL) 19 | inline_equations = re.sub(r"\\f\$", "$", long_equations) 20 | return inline_equations 21 | -------------------------------------------------------------------------------- /python-libs/jupytext/nbextension/README.md: -------------------------------------------------------------------------------- 1 | # A Jupyter notebook extension for Jupytext 2 | 3 | This extension adds a [Jupytext](https://github.com/mwouts/jupytext/blob/master/README.md) menu to Jupyter notebook. Use the menu to select the desired ipynb/text pairing for your notebook. 4 | 5 | ![Jupytext menu screenshot](jupytext_menu.png) 6 | 7 | ## Installation 8 | 9 | The extension requires [Jupytext](https://github.com/mwouts/jupytext/blob/master/README.md). Please make sure that Jupytext is installed on you system, and that its contents manager is active, i.e. that Markdown files and scripts are displayed with a notebook icon. 10 | 11 | Installing Jupytext activates the Jupytext Menu by default. If you want to install and activate it manually, use the following commands: 12 | 13 | ```bash 14 | jupyter nbextension install --py jupytext 15 | jupyter nbextension enable --py jupytext 16 | ``` 17 | 18 | Add `--user` to these commands if you want to activate the extension only for the current user. 19 | 20 | ## How to develop this extension 21 | 22 | If you wish to develop this extension, install the javascript file locally with: 23 | 24 | ```bash 25 | cd jupytext/nbextension 26 | jupyter nbextension install index.js --symlink --user 27 | jupyter nbextension enable index --user 28 | ``` 29 | 30 | Then, make the desired changes to `index.js` and reload the extension by simply refreshing the notebook (Ctrl+R). In case your OS does not allow symlinks, edit the copy of `index.js` that is actually used by Jupyter (refer to the output of `jupyter nbextension install --user index.js`). 31 | -------------------------------------------------------------------------------- /python-libs/jupytext/nbextension/jupytext.yml: -------------------------------------------------------------------------------- 1 | Type: Jupyter Notebook Extension 2 | Name: Jupytext 3 | Section: notebook 4 | Description: Jupytext Menu 5 | tags: 6 | - version control 7 | - markdown 8 | - script 9 | Link: README.md 10 | Icon: jupytext_menu_zoom.png 11 | Main: index.js 12 | Compatibility: 5.x, 6.x 13 | -------------------------------------------------------------------------------- /python-libs/jupytext/nbextension/jupytext_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/jupytext/nbextension/jupytext_menu.png -------------------------------------------------------------------------------- /python-libs/jupytext/reraise.py: -------------------------------------------------------------------------------- 1 | """Raise the given error at evaluation time""" 2 | 3 | 4 | def reraise(error): 5 | """Return a function that raises the given error when evaluated""" 6 | 7 | def local_function(*args, **kwargs): 8 | raise error 9 | 10 | return local_function 11 | -------------------------------------------------------------------------------- /python-libs/jupytext/version.py: -------------------------------------------------------------------------------- 1 | """Jupytext's version number""" 2 | 3 | __version__ = "1.11.2" 4 | -------------------------------------------------------------------------------- /python-libs/markdown_it/__init__.py: -------------------------------------------------------------------------------- 1 | from .main import MarkdownIt # noqa: F401 2 | 3 | 4 | __version__ = "1.1.0" 5 | -------------------------------------------------------------------------------- /python-libs/markdown_it/cli/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/markdown_it/cli/__init__.py -------------------------------------------------------------------------------- /python-libs/markdown_it/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/markdown_it/common/__init__.py -------------------------------------------------------------------------------- /python-libs/markdown_it/common/entities.py: -------------------------------------------------------------------------------- 1 | """HTML5 entities map: { name -> characters }.""" 2 | import html.entities 3 | 4 | from markdown_it.utils import AttrDict 5 | 6 | 7 | DATA = {name.rstrip(";"): chars for name, chars in html.entities.html5.items()} 8 | 9 | entities = AttrDict(DATA) 10 | -------------------------------------------------------------------------------- /python-libs/markdown_it/common/html_blocks.py: -------------------------------------------------------------------------------- 1 | """List of valid html blocks names, accorting to commonmark spec 2 | http://jgm.github.io/CommonMark/spec.html#html-blocks 3 | """ 4 | 5 | block_names = [ 6 | "address", 7 | "article", 8 | "aside", 9 | "base", 10 | "basefont", 11 | "blockquote", 12 | "body", 13 | "caption", 14 | "center", 15 | "col", 16 | "colgroup", 17 | "dd", 18 | "details", 19 | "dialog", 20 | "dir", 21 | "div", 22 | "dl", 23 | "dt", 24 | "fieldset", 25 | "figcaption", 26 | "figure", 27 | "footer", 28 | "form", 29 | "frame", 30 | "frameset", 31 | "h1", 32 | "h2", 33 | "h3", 34 | "h4", 35 | "h5", 36 | "h6", 37 | "head", 38 | "header", 39 | "hr", 40 | "html", 41 | "iframe", 42 | "legend", 43 | "li", 44 | "link", 45 | "main", 46 | "menu", 47 | "menuitem", 48 | "nav", 49 | "noframes", 50 | "ol", 51 | "optgroup", 52 | "option", 53 | "p", 54 | "param", 55 | "section", 56 | "source", 57 | "summary", 58 | "table", 59 | "tbody", 60 | "td", 61 | "tfoot", 62 | "th", 63 | "thead", 64 | "title", 65 | "tr", 66 | "track", 67 | "ul", 68 | ] 69 | -------------------------------------------------------------------------------- /python-libs/markdown_it/common/html_re.py: -------------------------------------------------------------------------------- 1 | """Regexps to match html elements 2 | """ 3 | 4 | import re 5 | 6 | attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*" 7 | 8 | unquoted = "[^\"'=<>`\\x00-\\x20]+" 9 | single_quoted = "'[^']*'" 10 | double_quoted = '"[^"]*"' 11 | 12 | attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")" 13 | 14 | attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)" 15 | 16 | open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>" 17 | 18 | close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>" 19 | comment = "|" 20 | processing = "<[?][\\s\\S]*?[?]>" 21 | declaration = "]*>" 22 | cdata = "" 23 | 24 | HTML_TAG_RE = re.compile( 25 | "^(?:" 26 | + open_tag 27 | + "|" 28 | + close_tag 29 | + "|" 30 | + comment 31 | + "|" 32 | + processing 33 | + "|" 34 | + declaration 35 | + "|" 36 | + cdata 37 | + ")" 38 | ) 39 | HTML_OPEN_CLOSE_TAG_STR = "^(?:" + open_tag + "|" + close_tag + ")" 40 | HTML_OPEN_CLOSE_TAG_RE = re.compile(HTML_OPEN_CLOSE_TAG_STR) 41 | -------------------------------------------------------------------------------- /python-libs/markdown_it/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | """Functions for parsing Links 2 | """ 3 | from .parse_link_label import parseLinkLabel # noqa: F401 4 | from .parse_link_destination import parseLinkDestination # noqa: F401 5 | from .parse_link_title import parseLinkTitle # noqa: F401 6 | -------------------------------------------------------------------------------- /python-libs/markdown_it/helpers/parse_link_label.py: -------------------------------------------------------------------------------- 1 | """ 2 | Parse link label 3 | 4 | this function assumes that first character ("[") already matches 5 | returns the end of the label 6 | 7 | """ 8 | from markdown_it.rules_inline import StateInline 9 | 10 | 11 | def parseLinkLabel(state: StateInline, start: int, disableNested: bool = False) -> int: 12 | 13 | labelEnd = -1 14 | oldPos = state.pos 15 | found = False 16 | 17 | state.pos = start + 1 18 | level = 1 19 | 20 | while state.pos < state.posMax: 21 | marker = state.srcCharCode[state.pos] 22 | if marker == 0x5D: # /* ] */) 23 | level -= 1 24 | if level == 0: 25 | found = True 26 | break 27 | 28 | prevPos = state.pos 29 | state.md.inline.skipToken(state) 30 | if marker == 0x5B: # /* [ */) 31 | if prevPos == state.pos - 1: 32 | # increase level if we find text `[`, 33 | # which is not a part of any token 34 | level += 1 35 | elif disableNested: 36 | state.pos = oldPos 37 | return -1 38 | if found: 39 | labelEnd = state.pos 40 | 41 | # restore old state 42 | state.pos = oldPos 43 | 44 | return labelEnd 45 | -------------------------------------------------------------------------------- /python-libs/markdown_it/helpers/parse_link_title.py: -------------------------------------------------------------------------------- 1 | """Parse link title 2 | """ 3 | from ..common.utils import unescapeAll, charCodeAt, stripEscape 4 | 5 | 6 | class _Result: 7 | __slots__ = ("ok", "pos", "lines", "str") 8 | 9 | def __init__(self): 10 | self.ok = False 11 | self.pos = 0 12 | self.lines = 0 13 | self.str = "" 14 | 15 | def __str__(self): 16 | return self.str 17 | 18 | 19 | def parseLinkTitle(string: str, pos: int, maximum: int) -> _Result: 20 | lines = 0 21 | start = pos 22 | result = _Result() 23 | 24 | if pos >= maximum: 25 | return result 26 | 27 | marker = charCodeAt(string, pos) 28 | 29 | # /* " */ /* ' */ /* ( */ 30 | if marker != 0x22 and marker != 0x27 and marker != 0x28: 31 | return result 32 | 33 | pos += 1 34 | 35 | # if opening marker is "(", switch it to closing marker ")" 36 | if marker == 0x28: 37 | marker = 0x29 38 | 39 | while pos < maximum: 40 | code = charCodeAt(string, pos) 41 | if code == marker: 42 | title = string[start + 1 : pos] 43 | title = unescapeAll(stripEscape(title)) 44 | result.pos = pos + 1 45 | result.lines = lines 46 | result.str = title 47 | result.ok = True 48 | return result 49 | elif code == 0x28 and marker == 0x29: # /* ( */ /* ) */ 50 | return result 51 | elif code == 0x0A: 52 | lines += 1 53 | elif code == 0x5C and pos + 1 < maximum: # /* \ */ 54 | pos += 1 55 | if charCodeAt(string, pos) == 0x0A: 56 | lines += 1 57 | 58 | pos += 1 59 | 60 | return result 61 | -------------------------------------------------------------------------------- /python-libs/markdown_it/parser_core.py: -------------------------------------------------------------------------------- 1 | """ 2 | * class Core 3 | * 4 | * Top-level rules executor. Glues block/inline parsers and does intermediate 5 | * transformations. 6 | """ 7 | from typing import List, Tuple 8 | 9 | from .ruler import Ruler, RuleFunc 10 | from .rules_core.state_core import StateCore 11 | from .rules_core import normalize, block, inline, replace, smartquotes, linkify 12 | 13 | 14 | _rules: List[Tuple[str, RuleFunc]] = [ 15 | ("normalize", normalize), 16 | ("block", block), 17 | ("inline", inline), 18 | ("linkify", linkify), 19 | ("replacements", replace), 20 | ("smartquotes", smartquotes), 21 | ] 22 | 23 | 24 | class ParserCore: 25 | def __init__(self): 26 | self.ruler = Ruler() 27 | for name, rule in _rules: 28 | self.ruler.push(name, rule) 29 | 30 | def process(self, state: StateCore) -> None: 31 | """Executes core chain rules.""" 32 | for rule in self.ruler.getRules(""): 33 | rule(state) 34 | -------------------------------------------------------------------------------- /python-libs/markdown_it/presets/__init__.py: -------------------------------------------------------------------------------- 1 | from . import commonmark, default, zero # noqa: F401 2 | 3 | js_default = default 4 | 5 | 6 | class gfm_like: 7 | """GitHub Flavoured Markdown (GFM) like. 8 | 9 | This adds the linkify, table and strikethrough components to CommmonMark. 10 | 11 | Note, it lacks task-list items and raw HTML filtering, 12 | to meet the the full GFM specification 13 | (see https://github.github.com/gfm/#autolinks-extension-). 14 | """ 15 | 16 | @staticmethod 17 | def make(): 18 | config = commonmark.make() 19 | config["components"]["core"]["rules"].append("linkify") 20 | config["components"]["block"]["rules"].append("table") 21 | config["components"]["inline"]["rules"].append("strikethrough") 22 | config["components"]["inline"]["rules2"].append("strikethrough") 23 | config["options"]["linkify"] = True 24 | config["options"]["html"] = True 25 | return config 26 | -------------------------------------------------------------------------------- /python-libs/markdown_it/presets/default.py: -------------------------------------------------------------------------------- 1 | """markdown-it default options.""" 2 | 3 | 4 | def make(): 5 | return { 6 | "options": { 7 | "maxNesting": 100, # Internal protection, recursion limit 8 | "html": False, # Enable HTML tags in source 9 | # this is just a shorthand for .disable(["html_inline", "html_block"]) 10 | # used by the linkify rule: 11 | "linkify": False, # autoconvert URL-like texts to links 12 | # used by the replacements and smartquotes rules: 13 | # Enable some language-neutral replacements + quotes beautification 14 | "typographer": False, 15 | # used by the smartquotes rule: 16 | # Double + single quotes replacement pairs, when typographer enabled, 17 | # and smartquotes on. Could be either a String or an Array. 18 | # For example, you can use '«»„“' for Russian, '„“‚‘' for German, 19 | # and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). 20 | "quotes": "\u201c\u201d\u2018\u2019", # /* “”‘’ */ 21 | # Renderer specific; these options are used directly in the HTML renderer 22 | "xhtmlOut": False, # Use '/' to close single tags (
) 23 | "breaks": False, # Convert '\n' in paragraphs into
24 | "langPrefix": "language-", # CSS language prefix for fenced blocks 25 | # Highlighter function. Should return escaped HTML, 26 | # or '' if the source string is not changed and should be escaped externaly. 27 | # If result starts with ) 26 | "breaks": False, # Convert '\n' in paragraphs into
27 | "langPrefix": "language-", # CSS language prefix for fenced blocks 28 | # Highlighter function. Should return escaped HTML, 29 | # or '' if the source string is not changed and should be escaped externaly. 30 | # If result starts with = 4: 23 | nextLine += 1 24 | last = nextLine 25 | continue 26 | 27 | break 28 | 29 | state.line = last 30 | 31 | token = state.push("code_block", "code", 0) 32 | token.content = state.getLines(startLine, last, 4 + state.blkIndent, True) 33 | token.map = [startLine, state.line] 34 | 35 | return True 36 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_block/heading.py: -------------------------------------------------------------------------------- 1 | """ Atex heading (#, ##, ...) """ 2 | import logging 3 | from typing import Optional 4 | 5 | from .state_block import StateBlock 6 | from ..common.utils import isSpace 7 | 8 | LOGGER = logging.getLogger(__name__) 9 | 10 | 11 | def heading(state: StateBlock, startLine: int, endLine: int, silent: bool): 12 | 13 | LOGGER.debug("entering heading: %s, %s, %s, %s", state, startLine, endLine, silent) 14 | 15 | pos = state.bMarks[startLine] + state.tShift[startLine] 16 | maximum = state.eMarks[startLine] 17 | 18 | # if it's indented more than 3 spaces, it should be a code block 19 | if state.sCount[startLine] - state.blkIndent >= 4: 20 | return False 21 | 22 | ch: Optional[int] = state.srcCharCode[pos] 23 | 24 | # /* # */ 25 | if ch != 0x23 or pos >= maximum: 26 | return False 27 | 28 | # count heading level 29 | level = 1 30 | pos += 1 31 | try: 32 | ch = state.srcCharCode[pos] 33 | except IndexError: 34 | ch = None 35 | # /* # */ 36 | while ch == 0x23 and pos < maximum and level <= 6: 37 | level += 1 38 | pos += 1 39 | try: 40 | ch = state.srcCharCode[pos] 41 | except IndexError: 42 | ch = None 43 | 44 | if level > 6 or (pos < maximum and not isSpace(ch)): 45 | return False 46 | 47 | if silent: 48 | return True 49 | 50 | # Let's cut tails like ' ### ' from the end of string 51 | 52 | maximum = state.skipSpacesBack(maximum, pos) 53 | tmp = state.skipCharsBack(maximum, 0x23, pos) # # 54 | if tmp > pos and isSpace(state.srcCharCode[tmp - 1]): 55 | maximum = tmp 56 | 57 | state.line = startLine + 1 58 | 59 | token = state.push("heading_open", "h" + str(level), 1) 60 | token.markup = "########"[:level] 61 | token.map = [startLine, state.line] 62 | 63 | token = state.push("inline", "", 0) 64 | token.content = state.src[pos:maximum].strip() 65 | token.map = [startLine, state.line] 66 | token.children = [] 67 | 68 | token = state.push("heading_close", "h" + str(level), -1) 69 | token.markup = "########"[:level] 70 | 71 | return True 72 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_block/hr.py: -------------------------------------------------------------------------------- 1 | """Horizontal rule 2 | 3 | At least 3 of these characters on a line * - _ 4 | """ 5 | import logging 6 | 7 | from ..common.utils import isSpace 8 | from .state_block import StateBlock 9 | 10 | 11 | LOGGER = logging.getLogger(__name__) 12 | 13 | 14 | def hr(state: StateBlock, startLine: int, endLine: int, silent: bool): 15 | 16 | LOGGER.debug("entering hr: %s, %s, %s, %s", state, startLine, endLine, silent) 17 | 18 | pos = state.bMarks[startLine] + state.tShift[startLine] 19 | maximum = state.eMarks[startLine] 20 | 21 | # if it's indented more than 3 spaces, it should be a code block 22 | if state.sCount[startLine] - state.blkIndent >= 4: 23 | return False 24 | 25 | marker = state.srcCharCode[pos] 26 | pos += 1 27 | 28 | # Check hr marker: /* * */ /* - */ /* _ */ 29 | if marker != 0x2A and marker != 0x2D and marker != 0x5F: 30 | return False 31 | 32 | # markers can be mixed with spaces, but there should be at least 3 of them 33 | 34 | cnt = 1 35 | while pos < maximum: 36 | ch = state.srcCharCode[pos] 37 | pos += 1 38 | if ch != marker and not isSpace(ch): 39 | return False 40 | if ch == marker: 41 | cnt += 1 42 | 43 | if cnt < 3: 44 | return False 45 | 46 | if silent: 47 | return True 48 | 49 | state.line = startLine + 1 50 | 51 | token = state.push("hr", "hr", 0) 52 | token.map = [startLine, state.line] 53 | token.markup = chr(marker) * (cnt + 1) 54 | 55 | return True 56 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_block/paragraph.py: -------------------------------------------------------------------------------- 1 | """Paragraph.""" 2 | import logging 3 | 4 | from ..ruler import Ruler 5 | from .state_block import StateBlock 6 | 7 | LOGGER = logging.getLogger(__name__) 8 | 9 | 10 | def paragraph(state: StateBlock, startLine: int, endLine: int, silent: bool = False): 11 | 12 | LOGGER.debug( 13 | "entering paragraph: %s, %s, %s, %s", state, startLine, endLine, silent 14 | ) 15 | 16 | nextLine = startLine + 1 17 | ruler: Ruler = state.md.block.ruler 18 | terminatorRules = ruler.getRules("paragraph") 19 | endLine = state.lineMax 20 | 21 | oldParentType = state.parentType 22 | state.parentType = "paragraph" 23 | 24 | # jump line-by-line until empty one or EOF 25 | while nextLine < endLine: 26 | if state.isEmpty(nextLine): 27 | break 28 | # this would be a code block normally, but after paragraph 29 | # it's considered a lazy continuation regardless of what's there 30 | if state.sCount[nextLine] - state.blkIndent > 3: 31 | nextLine += 1 32 | continue 33 | 34 | # quirk for blockquotes, this line should already be checked by that rule 35 | if state.sCount[nextLine] < 0: 36 | nextLine += 1 37 | continue 38 | 39 | # Some tags can terminate paragraph without empty line. 40 | terminate = False 41 | for terminatorRule in terminatorRules: 42 | if terminatorRule(state, nextLine, endLine, True): 43 | terminate = True 44 | break 45 | 46 | if terminate: 47 | break 48 | 49 | nextLine += 1 50 | 51 | content = state.getLines(startLine, nextLine, state.blkIndent, False).strip() 52 | 53 | state.line = nextLine 54 | 55 | token = state.push("paragraph_open", "p", 1) 56 | token.map = [startLine, state.line] 57 | 58 | token = state.push("inline", "", 0) 59 | token.content = content 60 | token.map = [startLine, state.line] 61 | token.children = [] 62 | 63 | token = state.push("paragraph_close", "p", -1) 64 | 65 | state.parentType = oldParentType 66 | 67 | return True 68 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_core/__init__.py: -------------------------------------------------------------------------------- 1 | from .state_core import StateCore # noqa: F401 2 | from .normalize import normalize # noqa: F401 3 | from .block import block # noqa: F401 4 | from .inline import inline # noqa: F401 5 | from .replacements import replace # noqa: F401 6 | from .smartquotes import smartquotes # noqa: F401 7 | from .linkify import linkify # noqa: F401 8 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_core/block.py: -------------------------------------------------------------------------------- 1 | from ..token import Token 2 | from .state_core import StateCore 3 | 4 | 5 | def block(state: StateCore) -> None: 6 | 7 | if state.inlineMode: 8 | token = Token("inline", "", 0) 9 | token.content = state.src 10 | token.map = [0, 1] 11 | token.children = [] 12 | state.tokens.append(token) 13 | else: 14 | state.md.block.parse( 15 | state.src, state.md, state.env, state.tokens, state.srcCharCode 16 | ) 17 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_core/inline.py: -------------------------------------------------------------------------------- 1 | from .state_core import StateCore 2 | 3 | 4 | def inline(state: StateCore) -> None: 5 | """Parse inlines""" 6 | for token in state.tokens: 7 | if token.type == "inline": 8 | if token.children is None: 9 | token.children = [] 10 | state.md.inline.parse(token.content, state.md, state.env, token.children) 11 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_core/normalize.py: -------------------------------------------------------------------------------- 1 | """Normalize input string.""" 2 | import re 3 | 4 | from .state_core import StateCore 5 | 6 | 7 | # https://spec.commonmark.org/0.29/#line-ending 8 | NEWLINES_RE = re.compile(r"\r\n?|\n") 9 | NULL_RE = re.compile(r"\0") 10 | 11 | 12 | def normalize(state: StateCore) -> None: 13 | 14 | # Normalize newlines 15 | string = NEWLINES_RE.sub("\n", state.src) 16 | 17 | # Replace NULL characters 18 | string = NULL_RE.sub("\uFFFD", string) 19 | 20 | state.src = string 21 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_core/state_core.py: -------------------------------------------------------------------------------- 1 | from typing import List, MutableMapping, Optional, TYPE_CHECKING 2 | 3 | from ..token import Token 4 | from ..ruler import StateBase 5 | 6 | if TYPE_CHECKING: 7 | from markdown_it import MarkdownIt 8 | 9 | 10 | class StateCore(StateBase): 11 | def __init__( 12 | self, 13 | src: str, 14 | md: "MarkdownIt", 15 | env: MutableMapping, 16 | tokens: Optional[List[Token]] = None, 17 | ): 18 | self.src = src 19 | self.md = md # link to parser instance 20 | self.env = env 21 | self.tokens: List[Token] = tokens or [] 22 | self.inlineMode = False 23 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_inline/__init__.py: -------------------------------------------------------------------------------- 1 | from .state_inline import StateInline # noqa: F401 2 | from .text import text # noqa: F401 3 | from .text_collapse import text_collapse # noqa: F401 4 | from .balance_pairs import link_pairs # noqa: F401 5 | from .escape import escape # noqa: F401 6 | from .newline import newline # noqa: F401 7 | from .backticks import backtick # noqa: F401 8 | from . import emphasis # noqa: F401 9 | from .image import image # noqa: F401 10 | from .link import link # noqa: F401 11 | from .autolink import autolink # noqa: F401 12 | from .entity import entity # noqa: F401 13 | from .html_inline import html_inline # noqa: F401 14 | from . import strikethrough # noqa: F401 15 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_inline/entity.py: -------------------------------------------------------------------------------- 1 | # Process html entity - {, ¯, ", ... 2 | import re 3 | 4 | from ..common.entities import entities 5 | from ..common.utils import has, isValidEntityCode, fromCodePoint 6 | from .state_inline import StateInline 7 | 8 | DIGITAL_RE = re.compile(r"^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));", re.IGNORECASE) 9 | NAMED_RE = re.compile(r"^&([a-z][a-z0-9]{1,31});", re.IGNORECASE) 10 | 11 | 12 | def entity(state: StateInline, silent: bool): 13 | 14 | pos = state.pos 15 | maximum = state.posMax 16 | 17 | if state.srcCharCode[pos] != 0x26: # /* & */ 18 | return False 19 | 20 | if (pos + 1) < maximum: 21 | ch = state.srcCharCode[pos + 1] 22 | 23 | if ch == 0x23: # /* # */ 24 | match = DIGITAL_RE.search(state.src[pos:]) 25 | if match: 26 | if not silent: 27 | match1 = match.group(1) 28 | code = ( 29 | int(match1[1:], 16) 30 | if match1[0].lower() == "x" 31 | else int(match1, 10) 32 | ) 33 | state.pending += ( 34 | fromCodePoint(code) 35 | if isValidEntityCode(code) 36 | else fromCodePoint(0xFFFD) 37 | ) 38 | 39 | state.pos += len(match.group(0)) 40 | return True 41 | 42 | else: 43 | match = NAMED_RE.search(state.src[pos:]) 44 | if match: 45 | if has(entities, match.group(1)): 46 | if not silent: 47 | state.pending += entities[match.group(1)] 48 | state.pos += len(match.group(0)) 49 | return True 50 | 51 | if not silent: 52 | state.pending += "&" 53 | state.pos += 1 54 | return True 55 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_inline/escape.py: -------------------------------------------------------------------------------- 1 | """ 2 | Process escaped chars and hardbreaks 3 | """ 4 | from .state_inline import StateInline 5 | from ..common.utils import isSpace 6 | 7 | 8 | ESCAPED = [0 for _ in range(256)] 9 | for ch in "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-": 10 | ESCAPED[ord(ch)] = 1 11 | 12 | 13 | def escape(state: StateInline, silent: bool): 14 | pos = state.pos 15 | maximum = state.posMax 16 | 17 | # /* \ */ 18 | if state.srcCharCode[pos] != 0x5C: 19 | return False 20 | 21 | pos += 1 22 | 23 | if pos < maximum: 24 | ch = state.srcCharCode[pos] 25 | 26 | if ch < 256 and ESCAPED[ch] != 0: 27 | if not silent: 28 | state.pending += state.src[pos] 29 | state.pos += 2 30 | return True 31 | 32 | if ch == 0x0A: 33 | if not silent: 34 | state.push("hardbreak", "br", 0) 35 | 36 | pos += 1 37 | # skip leading whitespaces from next line 38 | while pos < maximum: 39 | ch = state.srcCharCode[pos] 40 | if not isSpace(ch): 41 | break 42 | pos += 1 43 | 44 | state.pos = pos 45 | return True 46 | 47 | if not silent: 48 | state.pending += "\\" 49 | state.pos += 1 50 | return True 51 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_inline/html_inline.py: -------------------------------------------------------------------------------- 1 | # Process html tags 2 | from .state_inline import StateInline 3 | from ..common.html_re import HTML_TAG_RE 4 | 5 | 6 | def isLetter(ch: int): 7 | lc = ch | 0x20 # to lower case 8 | # /* a */ and /* z */ 9 | return (lc >= 0x61) and (lc <= 0x7A) 10 | 11 | 12 | def html_inline(state: StateInline, silent: bool): 13 | 14 | pos = state.pos 15 | 16 | if not state.md.options.get("html", None): 17 | return False 18 | 19 | # Check start 20 | maximum = state.posMax 21 | if state.srcCharCode[pos] != 0x3C or pos + 2 >= maximum: # /* < */ 22 | return False 23 | 24 | # Quick fail on second char 25 | ch = state.srcCharCode[pos + 1] 26 | if ( 27 | ch != 0x21 28 | and ch != 0x3F # /* ! */ 29 | and ch != 0x2F # /* ? */ 30 | and not isLetter(ch) # /* / */ 31 | ): 32 | return False 33 | 34 | match = HTML_TAG_RE.search(state.src[pos:]) 35 | if not match: 36 | return False 37 | 38 | if not silent: 39 | token = state.push("html_inline", "", 0) 40 | token.content = state.src[pos : pos + len(match.group(0))] 41 | 42 | state.pos += len(match.group(0)) 43 | return True 44 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_inline/newline.py: -------------------------------------------------------------------------------- 1 | # Proceess '\n' 2 | import re 3 | 4 | from .state_inline import StateInline 5 | from ..common.utils import charCodeAt, isSpace 6 | 7 | endSpace = re.compile(r" +$") 8 | 9 | 10 | def newline(state: StateInline, silent: bool): 11 | pos = state.pos 12 | 13 | # /* \n */ 14 | if state.srcCharCode[pos] != 0x0A: 15 | return False 16 | 17 | pmax = len(state.pending) - 1 18 | maximum = state.posMax 19 | 20 | # ' \n' -> hardbreak 21 | # Lookup in pending chars is bad practice! Don't copy to other rules! 22 | # Pending string is stored in concat mode, indexed lookups will cause 23 | # conversion to flat mode. 24 | if not silent: 25 | if pmax >= 0 and charCodeAt(state.pending, pmax) == 0x20: 26 | if pmax >= 1 and charCodeAt(state.pending, pmax - 1) == 0x20: 27 | state.pending = endSpace.sub("", state.pending) 28 | state.push("hardbreak", "br", 0) 29 | else: 30 | state.pending = state.pending[:-1] 31 | state.push("softbreak", "br", 0) 32 | 33 | else: 34 | state.push("softbreak", "br", 0) 35 | 36 | pos += 1 37 | 38 | # skip heading spaces for next line 39 | while pos < maximum and isSpace(state.srcCharCode[pos]): 40 | pos += 1 41 | 42 | state.pos = pos 43 | return True 44 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_inline/text.py: -------------------------------------------------------------------------------- 1 | # Skip text characters for text token, place those to pending buffer 2 | # and increment current pos 3 | 4 | from .state_inline import StateInline 5 | 6 | 7 | # Rule to skip pure text 8 | # '{}$%@~+=:' reserved for extentions 9 | 10 | # !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~ 11 | 12 | # !!!! Don't confuse with "Markdown ASCII Punctuation" chars 13 | # http://spec.commonmark.org/0.15/#ascii-punctuation-character 14 | def isTerminatorChar(ch): 15 | return ch in { 16 | 0x0A, # /* \n */: 17 | 0x21, # /* ! */: 18 | 0x23, # /* # */: 19 | 0x24, # /* $ */: 20 | 0x25, # /* % */: 21 | 0x26, # /* & */: 22 | 0x2A, # /* * */: 23 | 0x2B, # /* + */: 24 | 0x2D, # /* - */: 25 | 0x3A, # /* : */: 26 | 0x3C, # /* < */: 27 | 0x3D, # /* = */: 28 | 0x3E, # /* > */: 29 | 0x40, # /* @ */: 30 | 0x5B, # /* [ */: 31 | 0x5C, # /* \ */: 32 | 0x5D, # /* ] */: 33 | 0x5E, # /* ^ */: 34 | 0x5F, # /* _ */: 35 | 0x60, # /* ` */: 36 | 0x7B, # /* { */: 37 | 0x7D, # /* } */: 38 | 0x7E, # /* ~ */: 39 | } 40 | 41 | 42 | def text(state: StateInline, silent: bool, **args): 43 | pos = state.pos 44 | posMax = state.posMax 45 | while (pos < posMax) and not isTerminatorChar(state.srcCharCode[pos]): 46 | pos += 1 47 | 48 | if pos == state.pos: 49 | return False 50 | 51 | if not silent: 52 | state.pending += state.src[state.pos : pos] 53 | 54 | state.pos = pos 55 | 56 | return True 57 | -------------------------------------------------------------------------------- /python-libs/markdown_it/rules_inline/text_collapse.py: -------------------------------------------------------------------------------- 1 | from .state_inline import StateInline 2 | 3 | 4 | def text_collapse(state: StateInline, *args): 5 | """ 6 | Clean up tokens after emphasis and strikethrough postprocessing: 7 | merge adjacent text nodes into one and re-calculate all token levels 8 | 9 | This is necessary because initially emphasis delimiter markers (``*, _, ~``) 10 | are treated as their own separate text tokens. Then emphasis rule either 11 | leaves them as text (needed to merge with adjacent text) or turns them 12 | into opening/closing tags (which messes up levels inside). 13 | """ 14 | level = 0 15 | maximum = len(state.tokens) 16 | 17 | curr = last = 0 18 | while curr < maximum: 19 | # re-calculate levels after emphasis/strikethrough turns some text nodes 20 | # into opening/closing tags 21 | if state.tokens[curr].nesting < 0: 22 | level -= 1 # closing tag 23 | state.tokens[curr].level = level 24 | if state.tokens[curr].nesting > 0: 25 | level += 1 # opening tag 26 | 27 | if ( 28 | state.tokens[curr].type == "text" 29 | and curr + 1 < maximum 30 | and state.tokens[curr + 1].type == "text" 31 | ): 32 | # collapse two adjacent text nodes 33 | state.tokens[curr + 1].content = ( 34 | state.tokens[curr].content + state.tokens[curr + 1].content 35 | ) 36 | else: 37 | if curr != last: 38 | state.tokens[last] = state.tokens[curr] 39 | last += 1 40 | curr += 1 41 | 42 | if curr != last: 43 | del state.tokens[last:] 44 | -------------------------------------------------------------------------------- /python-libs/markdown_it_py-1.1.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/markdown_it_py-1.1.0.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 ExecutableBookProject 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /python-libs/markdown_it_py-1.1.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: true 4 | Tag: py3-none-any 5 | 6 | -------------------------------------------------------------------------------- /python-libs/markdown_it_py-1.1.0.dist-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | markdown-it = markdown_it.cli.parse:main 3 | 4 | -------------------------------------------------------------------------------- /python-libs/markdown_it_py-1.1.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | markdown_it 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins-0.2.8.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins-0.2.8.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 ExecutableBookProject 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins-0.2.8.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: true 4 | Tag: py3-none-any 5 | 6 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins-0.2.8.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | mdit_py_plugins 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins-0.2.8.dist-info/zip-safe: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "0.2.8" 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/anchors/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import anchors_plugin # noqa F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/container/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Vitaly Puzrin, Alex Kocharin. 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/container/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import container_plugin # noqa F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/container/port.yaml: -------------------------------------------------------------------------------- 1 | - package: markdown-it-container 2 | commit: adb3defde3a1c56015895b47ce4c6591b8b1e3a2 3 | date: Jun 2, 2020 4 | version: 3.0.0 5 | changes: 6 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/deflist/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2015 Vitaly Puzrin, Alex Kocharin. 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/deflist/README.md: -------------------------------------------------------------------------------- 1 | # markdown-it-deflist 2 | 3 | [![Build Status](https://img.shields.io/travis/markdown-it/markdown-it-deflist/master.svg?style=flat)](https://travis-ci.org/markdown-it/markdown-it-deflist) 4 | [![NPM version](https://img.shields.io/npm/v/markdown-it-deflist.svg?style=flat)](https://www.npmjs.org/package/markdown-it-deflist) 5 | [![Coverage Status](https://img.shields.io/coveralls/markdown-it/markdown-it-deflist/master.svg?style=flat)](https://coveralls.io/r/markdown-it/markdown-it-deflist?branch=master) 6 | 7 | > Definition list (`
`) tag plugin for [markdown-it](https://github.com/markdown-it/markdown-it) markdown parser. 8 | 9 | __v2.+ requires `markdown-it` v5.+, see changelog.__ 10 | 11 | Syntax is based on [pandoc definition lists](http://johnmacfarlane.net/pandoc/README.html#definition-lists). 12 | 13 | 14 | ## Install 15 | 16 | node.js, browser: 17 | 18 | ```bash 19 | npm install markdown-it-deflist --save 20 | bower install markdown-it-deflist --save 21 | ``` 22 | 23 | ## Use 24 | 25 | ```js 26 | var md = require('markdown-it')() 27 | .use(require('markdown-it-deflist')); 28 | 29 | md.render(/*...*/); 30 | ``` 31 | 32 | _Differences in browser._ If you load script directly into the page, without 33 | package system, module will add itself globally as `window.markdownitDeflist`. 34 | 35 | 36 | ## License 37 | 38 | [MIT](https://github.com/markdown-it/markdown-it-deflist/blob/master/LICENSE) 39 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/deflist/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import deflist_plugin # noqa F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/deflist/port.yaml: -------------------------------------------------------------------------------- 1 | - package: markdown-it-deflist 2 | commit: 20db400948520308291da029a23b0751cb30f3a0 3 | date: July 12, 2017 4 | version: 2.0.3 5 | changes: 6 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/dollarmath/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import dollarmath_plugin # noqa F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/footnote/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2015 Vitaly Puzrin, Alex Kocharin. 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/footnote/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import footnote_plugin # noqa: F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/footnote/port.yaml: -------------------------------------------------------------------------------- 1 | - package: markdown-it-footnote 2 | commit: cab6665ba39c6eb517cbbae3baeb549004bf740c 3 | date: Jul 9, 2019 4 | version: 3.0.2 5 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/front_matter/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2020 ParkSB. 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/front_matter/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import front_matter_plugin # noqa: F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/front_matter/port.yaml: -------------------------------------------------------------------------------- 1 | - package: markdown-it-front-matter 2 | commit: b404f5d8fd536e7e9ddb276267ae0b6f76e9cf9d 3 | date: Feb 7, 2020 4 | version: 0.2.1 5 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/myst_blocks/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import myst_block_plugin # noqa: F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/myst_role/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import myst_role_plugin # noqa: F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/myst_role/index.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from markdown_it import MarkdownIt 4 | from markdown_it.common.utils import escapeHtml 5 | from markdown_it.rules_inline import StateInline 6 | 7 | PATTERN = re.compile(r"^\{([a-zA-Z0-9\_\-\+\:]{1,36})\}(`+)(?!`)(.+?)(?' 42 | f"{{{name}}}[{escapeHtml(token.content)}]" 43 | "" 44 | ) 45 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/tasklists/port.yaml: -------------------------------------------------------------------------------- 1 | - package: markdown-it-task-lists 2 | commit: 8233e000559fae5a6306009e55332a54a9d3f606 3 | date: 6 Mar 2018 4 | version: 2.1.1 5 | changes: 6 | - Replaced number generator from original plugin with uuid 7 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/texmath/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-17 Stefan Goessner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/texmath/__init__.py: -------------------------------------------------------------------------------- 1 | from .index import texmath_plugin # noqa F401 2 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/texmath/port.yaml: -------------------------------------------------------------------------------- 1 | - package: markdown-it-texmath 2 | commit: 78c548829ce2ef85c73dc71e680d01e5ae41ffbf 3 | date: Oct 4, 2019 4 | version: 0.6 5 | changes: | 6 | both dollars/math_inline and brackets/math_inline regexes have been changed, 7 | to allow (single) line breaks 8 | -------------------------------------------------------------------------------- /python-libs/mdit_py_plugins/wordcount/__init__.py: -------------------------------------------------------------------------------- 1 | import string 2 | from typing import Callable, List 3 | 4 | from markdown_it import MarkdownIt 5 | from markdown_it.rules_core import StateCore 6 | 7 | 8 | def basic_count(text: str) -> int: 9 | """Split the string and ignore punctuation only elements.""" 10 | return sum([el.strip(string.punctuation).isalpha() for el in text.split()]) 11 | 12 | 13 | def wordcount_plugin( 14 | md: MarkdownIt, 15 | *, 16 | per_minute: int = 200, 17 | count_func: Callable[[str], int] = basic_count, 18 | store_text: bool = False 19 | ): 20 | """Plugin for computing and storing the word count. 21 | 22 | Stores in the ``env`` e.g.:: 23 | 24 | env["wordcount"] = { 25 | "words": 200 26 | "minutes": 1, 27 | } 28 | 29 | If "wordcount" is already in the env, it will update it. 30 | 31 | :param per_minute: Words per minute reading speed 32 | :param store_text: store all text under a "text" key, as a list of strings 33 | """ 34 | 35 | def _word_count_rule(state: StateCore) -> None: 36 | text: List[str] = [] 37 | words = 0 38 | for token in state.tokens: 39 | if token.type == "text": 40 | words += count_func(token.content) 41 | if store_text: 42 | text.append(token.content) 43 | elif token.type == "inline": 44 | for child in token.children or (): 45 | if child.type == "text": 46 | words += count_func(child.content) 47 | if store_text: 48 | text.append(child.content) 49 | 50 | data = state.env.setdefault("wordcount", {}) 51 | if store_text: 52 | data.setdefault("text", []) 53 | data["text"] += text 54 | data.setdefault("words", 0) 55 | data["words"] += words 56 | data["minutes"] = int(round(data["words"] / per_minute)) 57 | 58 | md.core.ruler.push("wordcount", _word_count_rule) 59 | -------------------------------------------------------------------------------- /python-libs/nbformat-5.1.3.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/nbformat-5.1.3.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: nbformat 3 | Version: 5.1.3 4 | Summary: The Jupyter Notebook format 5 | Home-page: http://jupyter.org 6 | Author: Jupyter Development Team 7 | Author-email: jupyter@googlegroups.com 8 | License: BSD 9 | Keywords: Interactive,Interpreter,Shell,Web 10 | Platform: Linux 11 | Platform: Mac OS X 12 | Platform: Windows 13 | Classifier: Intended Audience :: Developers 14 | Classifier: Intended Audience :: System Administrators 15 | Classifier: Intended Audience :: Science/Research 16 | Classifier: License :: OSI Approved :: BSD License 17 | Classifier: Programming Language :: Python 18 | Classifier: Programming Language :: Python :: 3 19 | Classifier: Programming Language :: Python :: 3.5 20 | Classifier: Programming Language :: Python :: 3.6 21 | Classifier: Programming Language :: Python :: 3.7 22 | Classifier: Programming Language :: Python :: 3.8 23 | Requires-Python: >=3.5 24 | Requires-Dist: ipython-genutils 25 | Requires-Dist: traitlets (>=4.1) 26 | Requires-Dist: jsonschema (!=2.5.0,>=2.4) 27 | Requires-Dist: jupyter-core 28 | Provides-Extra: fast 29 | Requires-Dist: fastjsonschema ; extra == 'fast' 30 | Provides-Extra: test 31 | Requires-Dist: check-manifest ; extra == 'test' 32 | Requires-Dist: fastjsonschema ; extra == 'test' 33 | Requires-Dist: testpath ; extra == 'test' 34 | Requires-Dist: pytest ; extra == 'test' 35 | Requires-Dist: pytest-cov ; extra == 'test' 36 | 37 | 38 | This package contains the base implementation of the Jupyter Notebook format, 39 | and Python APIs for working with notebooks. 40 | 41 | 42 | -------------------------------------------------------------------------------- /python-libs/nbformat-5.1.3.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: true 4 | Tag: py3-none-any 5 | 6 | -------------------------------------------------------------------------------- /python-libs/nbformat-5.1.3.dist-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | jupyter-trust = nbformat.sign:TrustNotebookApp.launch_instance 3 | 4 | -------------------------------------------------------------------------------- /python-libs/nbformat-5.1.3.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | nbformat 2 | -------------------------------------------------------------------------------- /python-libs/nbformat/_compat.py: -------------------------------------------------------------------------------- 1 | """Code for supporting compatibility across python versions.""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | try: 7 | from base64 import decodebytes, encodebytes 8 | except ImportError: 9 | from base64 import encodestring as encodebytes 10 | from base64 import decodestring as decodebytes 11 | -------------------------------------------------------------------------------- /python-libs/nbformat/_version.py: -------------------------------------------------------------------------------- 1 | # Make sure to update package.json, too! 2 | version_info = (5, 1, 3) 3 | __version__ = '.'.join(map(str, version_info)) 4 | -------------------------------------------------------------------------------- /python-libs/nbformat/converter.py: -------------------------------------------------------------------------------- 1 | """API for converting notebooks between versions.""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | from . import versions 7 | from .reader import get_version 8 | 9 | 10 | def convert(nb, to_version): 11 | """Convert a notebook node object to a specific version. Assumes that 12 | all the versions starting from 1 to the latest major X are implemented. 13 | In other words, there should never be a case where v1 v2 v3 v5 exist without 14 | a v4. Also assumes that all conversions can be made in one step increments 15 | between major versions and ignores minor revisions. 16 | 17 | Parameters 18 | ---------- 19 | nb : NotebookNode 20 | to_version : int 21 | Major revision to convert the notebook to. Can either be an upgrade or 22 | a downgrade. 23 | """ 24 | 25 | # Get input notebook version. 26 | (version, version_minor) = get_version(nb) 27 | 28 | # Check if destination is target version, if so return contents 29 | if version == to_version: 30 | return nb 31 | 32 | # If the version exist, try to convert to it one step at a time. 33 | elif to_version in versions: 34 | 35 | # Get the the version that this recursion will convert to as a step 36 | # closer to the final revision. Make sure the newer of the conversion 37 | # functions is used to perform the conversion. 38 | if to_version > version: 39 | step_version = version + 1 40 | convert_function = versions[step_version].upgrade 41 | else: 42 | step_version = version - 1 43 | convert_function = versions[version].downgrade 44 | 45 | # Convert and make sure version changed during conversion. 46 | converted = convert_function(nb) 47 | if converted.get('nbformat', 1) == version: 48 | raise ValueError("Failed to convert notebook from v%d to v%d." % (version, step_version)) 49 | 50 | # Recursively convert until target version is reached. 51 | return convert(converted, to_version) 52 | else: 53 | raise ValueError("Cannot convert notebook to v%d because that " \ 54 | "version doesn't exist" % (to_version)) 55 | -------------------------------------------------------------------------------- /python-libs/nbformat/corpus/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/nbformat/corpus/__init__.py -------------------------------------------------------------------------------- /python-libs/nbformat/corpus/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/nbformat/corpus/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/nbformat/corpus/tests/test_words.py: -------------------------------------------------------------------------------- 1 | """Tests for nbformat corpus""" 2 | 3 | # Copyright (c) Jupyter Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | import pytest 7 | import random 8 | 9 | from .. import words 10 | 11 | 12 | def test_generate_corpus_id(): 13 | with pytest.warns(None) as record: 14 | assert len(words.generate_corpus_id()) > 7 15 | # 1 in 4294967296 (2^32) times this will fail 16 | assert words.generate_corpus_id() != words.generate_corpus_id() 17 | assert len(record) == 0 18 | -------------------------------------------------------------------------------- /python-libs/nbformat/corpus/words.py: -------------------------------------------------------------------------------- 1 | import os 2 | import uuid 3 | 4 | 5 | def generate_corpus_id(): 6 | return uuid.uuid4().hex[:8] 7 | -------------------------------------------------------------------------------- /python-libs/nbformat/notebooknode.py: -------------------------------------------------------------------------------- 1 | """NotebookNode - adding attribute access to dicts""" 2 | 3 | from ipython_genutils.ipstruct import Struct 4 | try: 5 | from collections.abc import Mapping 6 | except ImportError: 7 | from collections import Mapping 8 | 9 | 10 | class NotebookNode(Struct): 11 | """A dict-like node with attribute-access""" 12 | 13 | def __setitem__(self, key, value): 14 | if isinstance(value, Mapping) and not isinstance(value, NotebookNode): 15 | value = from_dict(value) 16 | super(NotebookNode, self).__setitem__(key, value) 17 | 18 | def update(self, *args, **kwargs): 19 | """ 20 | A dict-like update method based on CPython's MutableMapping `update` 21 | method. 22 | """ 23 | if len(args) > 1: 24 | raise TypeError('update expected at most 1 arguments, got %d' % 25 | len(args)) 26 | if args: 27 | other = args[0] 28 | if isinstance(other, Mapping): 29 | for key in other: 30 | self[key] = other[key] 31 | elif hasattr(other, "keys"): 32 | for key in other.keys(): 33 | self[key] = other[key] 34 | else: 35 | for key, value in other: 36 | self[key] = value 37 | for key, value in kwargs.items(): 38 | self[key] = value 39 | 40 | 41 | def from_dict(d): 42 | """Convert dict to dict-like NotebookNode 43 | 44 | Recursively converts any dict in the container to a NotebookNode. 45 | This does not check that the contents of the dictionary make a valid 46 | notebook or part of a notebook. 47 | """ 48 | if isinstance(d, dict): 49 | return NotebookNode({k: from_dict(v) for k, v in d.items()}) 50 | elif isinstance(d, (tuple, list)): 51 | return [from_dict(i) for i in d] 52 | else: 53 | return d 54 | -------------------------------------------------------------------------------- /python-libs/nbformat/sentinel.py: -------------------------------------------------------------------------------- 1 | """Sentinel class for constants with useful reprs""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | class Sentinel(object): 7 | 8 | def __init__(self, name, module, docstring=None): 9 | self.name = name 10 | self.module = module 11 | if docstring: 12 | self.__doc__ = docstring 13 | 14 | 15 | def __repr__(self): 16 | return str(self.module)+'.'+self.name 17 | 18 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/nbformat/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/nbformat/tests/base.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains base test class for nbformat 3 | """ 4 | 5 | # Copyright (c) IPython Development Team. 6 | # Distributed under the terms of the Modified BSD License. 7 | 8 | import os 9 | import unittest 10 | import io 11 | 12 | class TestsBase(unittest.TestCase): 13 | """Base tests class.""" 14 | 15 | @classmethod 16 | def fopen(cls, f, mode=u'r',encoding='utf-8'): 17 | return io.open(os.path.join(cls._get_files_path(), f), mode, encoding=encoding) 18 | 19 | @classmethod 20 | def _get_files_path(cls): 21 | return os.path.dirname(__file__) 22 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/invalid_cell_id.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "id": "$illegal_chars", 5 | "cell_type": "code", 6 | "execution_count": 1, 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "data": { 11 | "text/plain": [ 12 | "'bar'" 13 | ] 14 | }, 15 | "execution_count": 1, 16 | "metadata": {}, 17 | "output_type": "execute_result" 18 | } 19 | ], 20 | "source": [ 21 | "\"bar\"" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 3", 28 | "language": "python", 29 | "name": "python3" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 3 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython3", 41 | "version": "3.8.2" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 5 46 | } 47 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/invalid_unique_cell_id.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "id": "dup", 5 | "cell_type": "code", 6 | "execution_count": null, 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "\"foo\"" 11 | ] 12 | }, 13 | { 14 | "id": "dup", 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "\"foo2\"" 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.8.2" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 5 45 | } 46 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/many_tracebacks.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "ename": "NameError", 10 | "evalue": "name 'iAmNotDefined' is not defined", 11 | "output_type": "error", 12 | "traceback": [ 13 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 14 | "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", 15 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0miAmNotDefined\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 16 | "\u001b[0;31mNameError\u001b[0m: name 'iAmNotDefined' is not defined" 17 | ] 18 | } 19 | ], 20 | "source": [ 21 | "# Imagine this cell called a function which runs things on a cluster and you have an error" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 3", 28 | "language": "python", 29 | "name": "python3" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 3 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython3", 41 | "version": "3.8.5" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 4 46 | } 47 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/test4custom.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": { 7 | "collapsed": false 8 | }, 9 | "outputs": [ 10 | { 11 | "data": { 12 | "application/vnd.raw.v1+json": { 13 | "apples": [ 14 | "🍎", 15 | "🍏" 16 | ], 17 | "bananas": 2, 18 | "oranges": "apples" 19 | } 20 | }, 21 | "metadata": {}, 22 | "output_type": "display_data" 23 | } 24 | ], 25 | "source": [ 26 | "import IPython\n", 27 | "\n", 28 | "bundle = {}\n", 29 | "bundle['application/vnd.raw.v1+json'] = {\n", 30 | " 'apples': ['🍎', '🍏'],\n", 31 | " 'bananas': 2,\n", 32 | " 'oranges': 'apples'\n", 33 | "}\n", 34 | "\n", 35 | "IPython.display.display(bundle, raw=True)" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": null, 41 | "metadata": { 42 | "collapsed": true 43 | }, 44 | "outputs": [], 45 | "source": [] 46 | } 47 | ], 48 | "metadata": { 49 | }, 50 | "nbformat": 4, 51 | "nbformat_minor": 2 52 | } 53 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/test4jupyter_metadata.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": false, 8 | "jupyter": { 9 | "outputs_hidden": false, 10 | "source_hidden": false 11 | } 12 | }, 13 | "outputs": [ 14 | { 15 | "name": "stdout", 16 | "output_type": "stream", 17 | "text": [ 18 | "hello\n" 19 | ] 20 | } 21 | ], 22 | "source": [ 23 | "print(\"hello\")" 24 | ] 25 | } 26 | ], 27 | "metadata": {}, 28 | "nbformat": 4, 29 | "nbformat_minor": 0 30 | } 31 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/test4jupyter_metadata_timings.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 5, 6 | "metadata": { 7 | "execution": { 8 | "iopub.execute_input": "2019-08-26T17:50:29.604738Z", 9 | "iopub.status.busy": "2019-08-26T17:50:29.603423Z", 10 | "iopub.status.idle": "2019-08-26T17:50:29.628032Z", 11 | "shell.execute_reply": "2019-08-26T17:50:29.623438Z", 12 | "shell.execute_reply.started": "2019-08-26T17:50:29.604616Z" 13 | } 14 | }, 15 | "outputs": [ 16 | { 17 | "data": { 18 | "text/plain": [ 19 | "2" 20 | ] 21 | }, 22 | "execution_count": 5, 23 | "metadata": {}, 24 | "output_type": "execute_result" 25 | } 26 | ], 27 | "source": [ 28 | "1+1" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | } 38 | ], 39 | "metadata": { 40 | "kernelspec": { 41 | "display_name": "Python 2", 42 | "language": "python", 43 | "name": "python2" 44 | }, 45 | "language_info": { 46 | "codemirror_mode": { 47 | "name": "ipython", 48 | "version": 3 49 | }, 50 | "file_extension": ".py", 51 | "mimetype": "text/x-python", 52 | "name": "python", 53 | "nbconvert_exporter": "python", 54 | "pygments_lexer": "ipython3", 55 | "version": "3.6.0" 56 | }, 57 | "record_timing": true 58 | }, 59 | "nbformat": 4, 60 | "nbformat_minor": 4 61 | } 62 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/test_nbformat.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from nbformat import read 4 | 5 | 6 | def test_read_invalid_iowrapper(tmpdir): 7 | ipynb_filepath = tmpdir.join("empty.ipynb") 8 | ipynb_filepath.write("{}") 9 | 10 | with pytest.raises(AttributeError) as excinfo: 11 | with ipynb_filepath.open() as fp: 12 | read(fp, as_version=4) 13 | assert "cells" in str(excinfo.value) 14 | 15 | 16 | def test_read_invalid_filepath(tmpdir): 17 | ipynb_filepath = tmpdir.join("empty.ipynb") 18 | ipynb_filepath.write("{}") 19 | 20 | with pytest.raises(AttributeError) as excinfo: 21 | read(str(ipynb_filepath), as_version=4) 22 | assert "cells" in str(excinfo.value) 23 | 24 | 25 | def test_read_invalid_pathlikeobj(tmpdir): 26 | ipynb_filepath = tmpdir.join("empty.ipynb") 27 | ipynb_filepath.write("{}") 28 | 29 | with pytest.raises(AttributeError) as excinfo: 30 | read(ipynb_filepath, as_version=4) 31 | assert "cells" in str(excinfo.value) 32 | 33 | 34 | def test_read_invalid_str(tmpdir): 35 | with pytest.raises(OSError) as excinfo: 36 | read("not_exist_path", as_version=4) 37 | assert "No such file or directory" in str(excinfo.value) 38 | 39 | 40 | def test_read_invalid_type(tmpdir): 41 | with pytest.raises(OSError) as excinfo: 42 | read(123, as_version=4) 43 | -------------------------------------------------------------------------------- /python-libs/nbformat/tests/test_reader.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains tests class for reader.py 3 | """ 4 | #----------------------------------------------------------------------------- 5 | # Copyright (C) 2013 The IPython Development Team 6 | # 7 | # Distributed under the terms of the BSD License. The full license is in 8 | # the file COPYING, distributed as part of this software. 9 | #----------------------------------------------------------------------------- 10 | 11 | #----------------------------------------------------------------------------- 12 | # Imports 13 | #----------------------------------------------------------------------------- 14 | 15 | from .base import TestsBase 16 | 17 | from ..reader import read, get_version 18 | 19 | #----------------------------------------------------------------------------- 20 | # Classes and functions 21 | #----------------------------------------------------------------------------- 22 | 23 | class TestReader(TestsBase): 24 | 25 | def test_read(self): 26 | """Can older notebooks be opened without modification?""" 27 | 28 | # Open a version 3 notebook. Make sure it is still version 3. 29 | with self.fopen(u'test3.ipynb', u'r') as f: 30 | nb = read(f) 31 | (major, minor) = get_version(nb) 32 | self.assertEqual(major, 3) 33 | 34 | # Open a version 2 notebook. Make sure it is still version 2. 35 | with self.fopen(u'test2.ipynb', u'r') as f: 36 | nb = read(f) 37 | (major, minor) = get_version(nb) 38 | self.assertEqual(major, 2) 39 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/__init__.py: -------------------------------------------------------------------------------- 1 | """The main module for the v1 notebook format.""" 2 | 3 | #----------------------------------------------------------------------------- 4 | # Copyright (C) 2008-2011 The IPython Development Team 5 | # 6 | # Distributed under the terms of the BSD License. The full license is in 7 | # the file COPYING, distributed as part of this software. 8 | #----------------------------------------------------------------------------- 9 | 10 | #----------------------------------------------------------------------------- 11 | # Imports 12 | #----------------------------------------------------------------------------- 13 | 14 | from .nbbase import ( 15 | NotebookNode, 16 | new_code_cell, new_text_cell, new_notebook 17 | ) 18 | 19 | from .nbjson import reads as reads_json, writes as writes_json 20 | from .nbjson import reads as read_json, writes as write_json 21 | from .nbjson import to_notebook as to_notebook_json 22 | 23 | from .convert import upgrade 24 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/convert.py: -------------------------------------------------------------------------------- 1 | """Convert notebook to the v1 format.""" 2 | 3 | #----------------------------------------------------------------------------- 4 | # Copyright (C) 2008-2011 The IPython Development Team 5 | # 6 | # Distributed under the terms of the BSD License. The full license is in 7 | # the file COPYING, distributed as part of this software. 8 | #----------------------------------------------------------------------------- 9 | 10 | #----------------------------------------------------------------------------- 11 | # Code 12 | #----------------------------------------------------------------------------- 13 | 14 | def upgrade(nb, orig_version=None): 15 | raise ValueError('Cannot convert to v1 notebook format') 16 | 17 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/nbbase.py: -------------------------------------------------------------------------------- 1 | """The basic dict based notebook format. 2 | 3 | Authors: 4 | 5 | * Brian Granger 6 | """ 7 | 8 | #----------------------------------------------------------------------------- 9 | # Copyright (C) 2008-2011 The IPython Development Team 10 | # 11 | # Distributed under the terms of the BSD License. The full license is in 12 | # the file COPYING, distributed as part of this software. 13 | #----------------------------------------------------------------------------- 14 | 15 | #----------------------------------------------------------------------------- 16 | # Imports 17 | #----------------------------------------------------------------------------- 18 | 19 | import pprint 20 | import uuid 21 | 22 | from ipython_genutils.ipstruct import Struct 23 | 24 | #----------------------------------------------------------------------------- 25 | # Code 26 | #----------------------------------------------------------------------------- 27 | 28 | class NotebookNode(Struct): 29 | pass 30 | 31 | 32 | def from_dict(d): 33 | if isinstance(d, dict): 34 | newd = NotebookNode() 35 | for k,v in d.items(): 36 | newd[k] = from_dict(v) 37 | return newd 38 | elif isinstance(d, (tuple, list)): 39 | return [from_dict(i) for i in d] 40 | else: 41 | return d 42 | 43 | 44 | def new_code_cell(code=None, prompt_number=None): 45 | """Create a new code cell with input and output""" 46 | cell = NotebookNode() 47 | cell.cell_type = u'code' 48 | if code is not None: 49 | cell.code = str(code) 50 | if prompt_number is not None: 51 | cell.prompt_number = int(prompt_number) 52 | return cell 53 | 54 | 55 | def new_text_cell(text=None): 56 | """Create a new text cell.""" 57 | cell = NotebookNode() 58 | if text is not None: 59 | cell.text = str(text) 60 | cell.cell_type = u'text' 61 | return cell 62 | 63 | 64 | def new_notebook(cells=None): 65 | """Create a notebook by name, id and a list of worksheets.""" 66 | nb = NotebookNode() 67 | if cells is not None: 68 | nb.cells = cells 69 | else: 70 | nb.cells = [] 71 | return nb 72 | 73 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/nbjson.py: -------------------------------------------------------------------------------- 1 | """Read and write notebooks in JSON format. 2 | 3 | Authors: 4 | 5 | * Brian Granger 6 | """ 7 | 8 | #----------------------------------------------------------------------------- 9 | # Copyright (C) 2008-2011 The IPython Development Team 10 | # 11 | # Distributed under the terms of the BSD License. The full license is in 12 | # the file COPYING, distributed as part of this software. 13 | #----------------------------------------------------------------------------- 14 | 15 | #----------------------------------------------------------------------------- 16 | # Imports 17 | #----------------------------------------------------------------------------- 18 | 19 | from .rwbase import NotebookReader, NotebookWriter 20 | from .nbbase import from_dict 21 | import json 22 | 23 | #----------------------------------------------------------------------------- 24 | # Code 25 | #----------------------------------------------------------------------------- 26 | 27 | class JSONReader(NotebookReader): 28 | 29 | def reads(self, s, **kwargs): 30 | nb = json.loads(s, **kwargs) 31 | return self.to_notebook(nb, **kwargs) 32 | 33 | def to_notebook(self, d, **kwargs): 34 | """Convert from a raw JSON dict to a nested NotebookNode structure.""" 35 | return from_dict(d) 36 | 37 | 38 | class JSONWriter(NotebookWriter): 39 | 40 | def writes(self, nb, **kwargs): 41 | kwargs['indent'] = 4 42 | return json.dumps(nb, **kwargs) 43 | 44 | 45 | _reader = JSONReader() 46 | _writer = JSONWriter() 47 | 48 | reads = _reader.reads 49 | read = _reader.read 50 | to_notebook = _reader.to_notebook 51 | write = _writer.write 52 | writes = _writer.writes 53 | 54 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/rwbase.py: -------------------------------------------------------------------------------- 1 | """Base classes and function for readers and writers. 2 | 3 | Authors: 4 | 5 | * Brian Granger 6 | """ 7 | 8 | #----------------------------------------------------------------------------- 9 | # Copyright (C) 2008-2011 The IPython Development Team 10 | # 11 | # Distributed under the terms of the BSD License. The full license is in 12 | # the file COPYING, distributed as part of this software. 13 | #----------------------------------------------------------------------------- 14 | 15 | #----------------------------------------------------------------------------- 16 | # Imports 17 | #----------------------------------------------------------------------------- 18 | 19 | #----------------------------------------------------------------------------- 20 | # Code 21 | #----------------------------------------------------------------------------- 22 | 23 | class NotebookReader(object): 24 | 25 | def reads(self, s, **kwargs): 26 | """Read a notebook from a string.""" 27 | raise NotImplementedError("loads must be implemented in a subclass") 28 | 29 | def read(self, fp, **kwargs): 30 | """Read a notebook from a file like object""" 31 | return self.reads(fp.read(), **kwargs) 32 | 33 | 34 | class NotebookWriter(object): 35 | 36 | def writes(self, nb, **kwargs): 37 | """Write a notebook to a string.""" 38 | raise NotImplementedError("loads must be implemented in a subclass") 39 | 40 | def write(self, nb, fp, **kwargs): 41 | """Write a notebook to a file like object""" 42 | return fp.write(self.writes(nb,**kwargs)) 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/nbformat/v1/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/nbformat/v1/tests/nbexamples.py: -------------------------------------------------------------------------------- 1 | from ..nbbase import ( 2 | NotebookNode, 3 | new_code_cell, new_text_cell, new_notebook 4 | ) 5 | 6 | 7 | 8 | nb0 = new_notebook() 9 | 10 | nb0.cells.append(new_text_cell( 11 | text='Some NumPy Examples' 12 | )) 13 | 14 | 15 | nb0.cells.append(new_code_cell( 16 | code='import numpy', 17 | prompt_number=1 18 | )) 19 | 20 | nb0.cells.append(new_code_cell( 21 | code='a = numpy.random.rand(100)', 22 | prompt_number=2 23 | )) 24 | 25 | nb0.cells.append(new_code_cell( 26 | code='print a', 27 | prompt_number=3 28 | )) 29 | 30 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/tests/test_json.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | from ..nbjson import reads, writes 4 | from .nbexamples import nb0 5 | 6 | 7 | class TestJSON(TestCase): 8 | 9 | def test_roundtrip(self): 10 | s = writes(nb0) 11 | self.assertEqual(reads(s),nb0) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /python-libs/nbformat/v1/tests/test_nbbase.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | from ..nbbase import ( 4 | NotebookNode, 5 | new_code_cell, new_text_cell, new_notebook 6 | ) 7 | 8 | class TestCell(TestCase): 9 | 10 | def test_empty_code_cell(self): 11 | cc = new_code_cell() 12 | self.assertEqual(cc.cell_type,'code') 13 | self.assertEqual('code' not in cc, True) 14 | self.assertEqual('prompt_number' not in cc, True) 15 | 16 | def test_code_cell(self): 17 | cc = new_code_cell(code='a=10', prompt_number=0) 18 | self.assertEqual(cc.code, u'a=10') 19 | self.assertEqual(cc.prompt_number, 0) 20 | 21 | def test_empty_text_cell(self): 22 | tc = new_text_cell() 23 | self.assertEqual(tc.cell_type, 'text') 24 | self.assertEqual('text' not in tc, True) 25 | 26 | def test_text_cell(self): 27 | tc = new_text_cell('hi') 28 | self.assertEqual(tc.text, u'hi') 29 | 30 | 31 | class TestNotebook(TestCase): 32 | 33 | def test_empty_notebook(self): 34 | nb = new_notebook() 35 | self.assertEqual(nb.cells, []) 36 | 37 | def test_notebooke(self): 38 | cells = [new_code_cell(),new_text_cell()] 39 | nb = new_notebook(cells=cells) 40 | self.assertEqual(nb.cells,cells) 41 | 42 | -------------------------------------------------------------------------------- /python-libs/nbformat/v2/convert.py: -------------------------------------------------------------------------------- 1 | """Code for converting notebooks to and from the v2 format. 2 | 3 | Authors: 4 | 5 | * Brian Granger 6 | * Jonathan Frederic 7 | """ 8 | 9 | #----------------------------------------------------------------------------- 10 | # Copyright (C) 2008-2011 The IPython Development Team 11 | # 12 | # Distributed under the terms of the BSD License. The full license is in 13 | # the file COPYING, distributed as part of this software. 14 | #----------------------------------------------------------------------------- 15 | 16 | #----------------------------------------------------------------------------- 17 | # Imports 18 | #----------------------------------------------------------------------------- 19 | 20 | from .nbbase import ( 21 | new_code_cell, new_text_cell, new_worksheet, new_notebook, new_output 22 | ) 23 | 24 | #----------------------------------------------------------------------------- 25 | # Code 26 | #----------------------------------------------------------------------------- 27 | 28 | def upgrade(nb, from_version=1): 29 | """Convert a notebook to the v2 format. 30 | 31 | Parameters 32 | ---------- 33 | nb : NotebookNode 34 | The Python representation of the notebook to convert. 35 | from_version : int 36 | The version of the notebook to convert from. 37 | """ 38 | if from_version == 1: 39 | newnb = new_notebook() 40 | ws = new_worksheet() 41 | for cell in nb.cells: 42 | if cell.cell_type == u'code': 43 | newcell = new_code_cell(input=cell.get('code'),prompt_number=cell.get('prompt_number')) 44 | elif cell.cell_type == u'text': 45 | newcell = new_text_cell(u'markdown',source=cell.get('text')) 46 | ws.cells.append(newcell) 47 | newnb.worksheets.append(ws) 48 | return newnb 49 | else: 50 | raise ValueError('Cannot convert a notebook from v%s to v2' % from_version) 51 | 52 | 53 | def downgrade(nb): 54 | """Convert a v2 notebook to v1. 55 | 56 | Parameters 57 | ---------- 58 | nb : NotebookNode 59 | The Python representation of the notebook to convert. 60 | """ 61 | raise Exception("Downgrade from notebook v2 to v1 is not supported.") 62 | -------------------------------------------------------------------------------- /python-libs/nbformat/v2/nbjson.py: -------------------------------------------------------------------------------- 1 | """Read and write notebooks in JSON format. 2 | 3 | Authors: 4 | 5 | * Brian Granger 6 | """ 7 | 8 | #----------------------------------------------------------------------------- 9 | # Copyright (C) 2008-2011 The IPython Development Team 10 | # 11 | # Distributed under the terms of the BSD License. The full license is in 12 | # the file COPYING, distributed as part of this software. 13 | #----------------------------------------------------------------------------- 14 | 15 | #----------------------------------------------------------------------------- 16 | # Imports 17 | #----------------------------------------------------------------------------- 18 | 19 | import copy 20 | import json 21 | 22 | from .nbbase import from_dict 23 | from .rwbase import ( 24 | NotebookReader, NotebookWriter, restore_bytes, rejoin_lines, split_lines 25 | ) 26 | 27 | #----------------------------------------------------------------------------- 28 | # Code 29 | #----------------------------------------------------------------------------- 30 | 31 | class BytesEncoder(json.JSONEncoder): 32 | """A JSON encoder that accepts b64 (and other *ascii*) bytestrings.""" 33 | def default(self, obj): 34 | if isinstance(obj, bytes): 35 | return obj.decode('ascii') 36 | return json.JSONEncoder.default(self, obj) 37 | 38 | 39 | class JSONReader(NotebookReader): 40 | 41 | def reads(self, s, **kwargs): 42 | nb = json.loads(s, **kwargs) 43 | nb = self.to_notebook(nb, **kwargs) 44 | return nb 45 | 46 | def to_notebook(self, d, **kwargs): 47 | return restore_bytes(rejoin_lines(from_dict(d))) 48 | 49 | 50 | class JSONWriter(NotebookWriter): 51 | 52 | def writes(self, nb, **kwargs): 53 | kwargs['cls'] = BytesEncoder 54 | kwargs['indent'] = 1 55 | kwargs['sort_keys'] = True 56 | if kwargs.pop('split_lines', True): 57 | nb = split_lines(copy.deepcopy(nb)) 58 | return json.dumps(nb, **kwargs) 59 | 60 | 61 | _reader = JSONReader() 62 | _writer = JSONWriter() 63 | 64 | reads = _reader.reads 65 | read = _reader.read 66 | to_notebook = _reader.to_notebook 67 | write = _writer.write 68 | writes = _writer.writes 69 | 70 | -------------------------------------------------------------------------------- /python-libs/nbformat/v2/nbxml.py: -------------------------------------------------------------------------------- 1 | """REMOVED: Read and write notebook files as XML. 2 | """ 3 | 4 | 5 | REMOVED_MSG = """\ 6 | Reading notebooks as XML has been removed to harden security and avoid 7 | possible denial-of-service attacks. 8 | 9 | The XML notebook format was deprecated before the Jupyter (previously IPython) 10 | Notebook was ever released. We are not aware of anyone using it, so we have 11 | removed it. 12 | 13 | If you were using this code, and you need to continue using it, feel free to 14 | fork an earlier version of the nbformat package and maintain it yourself. 15 | The issue which prompted this removal is: 16 | 17 | https://github.com/jupyter/nbformat/issues/132 18 | """ 19 | 20 | def reads(s, **kwargs): 21 | raise Exception(REMOVED_MSG) 22 | 23 | def read(fp, **kwargs): 24 | raise Exception(REMOVED_MSG) 25 | 26 | def to_notebook(root, **kwargs): 27 | raise Exception(REMOVED_MSG) 28 | -------------------------------------------------------------------------------- /python-libs/nbformat/v2/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/nbformat/v2/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/nbformat/v2/tests/test_json.py: -------------------------------------------------------------------------------- 1 | import pprint 2 | from unittest import TestCase 3 | 4 | from ..nbjson import reads, writes 5 | from .nbexamples import nb0 6 | 7 | 8 | class TestJSON(TestCase): 9 | 10 | def test_roundtrip(self): 11 | s = writes(nb0) 12 | # print 13 | # print pprint.pformat(nb0,indent=2) 14 | # print 15 | # print pprint.pformat(reads(s),indent=2) 16 | # print 17 | # print s 18 | self.assertEqual(reads(s),nb0) 19 | 20 | def test_roundtrip_nosplit(self): 21 | """Ensure that multiline blobs are still readable""" 22 | # ensures that notebooks written prior to splitlines change 23 | # are still readable. 24 | s = writes(nb0, split_lines=False) 25 | self.assertEqual(reads(s),nb0) 26 | 27 | def test_roundtrip_split(self): 28 | """Ensure that splitting multiline blocks is safe""" 29 | # This won't differ from test_roundtrip unless the default changes 30 | s = writes(nb0, split_lines=True) 31 | self.assertEqual(reads(s),nb0) 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /python-libs/nbformat/v2/tests/test_nbpy.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | from ..nbbase import ( 4 | NotebookNode, 5 | new_code_cell, new_text_cell, new_worksheet, new_notebook 6 | ) 7 | 8 | from ..nbpy import reads, writes 9 | from .nbexamples import nb0, nb0_py 10 | 11 | 12 | class TestPy(TestCase): 13 | 14 | def test_write(self): 15 | s = writes(nb0) 16 | self.assertEqual(s,nb0_py) 17 | 18 | -------------------------------------------------------------------------------- /python-libs/nbformat/v3/nbjson.py: -------------------------------------------------------------------------------- 1 | """Read and write notebooks in JSON format.""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | import copy 7 | import json 8 | 9 | from .nbbase import from_dict 10 | from .rwbase import ( 11 | NotebookReader, NotebookWriter, restore_bytes, rejoin_lines, split_lines, 12 | strip_transient, 13 | ) 14 | 15 | 16 | class BytesEncoder(json.JSONEncoder): 17 | """A JSON encoder that accepts b64 (and other *ascii*) bytestrings.""" 18 | def default(self, obj): 19 | if isinstance(obj, bytes): 20 | return obj.decode('ascii') 21 | return json.JSONEncoder.default(self, obj) 22 | 23 | 24 | class JSONReader(NotebookReader): 25 | 26 | def reads(self, s, **kwargs): 27 | nb = json.loads(s, **kwargs) 28 | nb = self.to_notebook(nb, **kwargs) 29 | nb = strip_transient(nb) 30 | return nb 31 | 32 | def to_notebook(self, d, **kwargs): 33 | return rejoin_lines(from_dict(d)) 34 | 35 | 36 | class JSONWriter(NotebookWriter): 37 | 38 | def writes(self, nb, **kwargs): 39 | kwargs['cls'] = BytesEncoder 40 | kwargs['indent'] = 1 41 | kwargs['sort_keys'] = True 42 | kwargs['separators'] = (',',': ') 43 | nb = copy.deepcopy(nb) 44 | nb = strip_transient(nb) 45 | if kwargs.pop('split_lines', True): 46 | nb = split_lines(nb) 47 | return json.dumps(nb, **kwargs) 48 | 49 | 50 | _reader = JSONReader() 51 | _writer = JSONWriter() 52 | 53 | reads = _reader.reads 54 | read = _reader.read 55 | to_notebook = _reader.to_notebook 56 | write = _writer.write 57 | writes = _writer.writes 58 | 59 | -------------------------------------------------------------------------------- /python-libs/nbformat/v3/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/nbformat/v3/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/nbformat/v3/tests/formattest.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf8 -*- 2 | import io 3 | import os 4 | import shutil 5 | import tempfile 6 | 7 | pjoin = os.path.join 8 | 9 | from ..nbbase import ( 10 | NotebookNode, 11 | new_code_cell, new_text_cell, new_worksheet, new_notebook 12 | ) 13 | 14 | from ..nbpy import reads, writes, read, write 15 | from .nbexamples import nb0, nb0_py 16 | 17 | 18 | def open_utf8(fname, mode): 19 | return io.open(fname, mode=mode, encoding='utf-8') 20 | 21 | class NBFormatTest: 22 | """Mixin for writing notebook format tests""" 23 | 24 | # override with appropriate values in subclasses 25 | nb0_ref = None 26 | ext = None 27 | mod = None 28 | 29 | def setUp(self): 30 | self.wd = tempfile.mkdtemp() 31 | 32 | def tearDown(self): 33 | shutil.rmtree(self.wd) 34 | 35 | def assertNBEquals(self, nba, nbb): 36 | self.assertEqual(nba, nbb) 37 | 38 | def test_writes(self): 39 | s = self.mod.writes(nb0) 40 | if self.nb0_ref: 41 | self.assertEqual(s, self.nb0_ref) 42 | 43 | def test_reads(self): 44 | s = self.mod.writes(nb0) 45 | nb = self.mod.reads(s) 46 | 47 | def test_roundtrip(self): 48 | s = self.mod.writes(nb0) 49 | self.assertNBEquals(self.mod.reads(s),nb0) 50 | 51 | def test_write_file(self): 52 | with open_utf8(pjoin(self.wd, "nb0.%s" % self.ext), 'w') as f: 53 | self.mod.write(nb0, f) 54 | 55 | def test_read_file(self): 56 | with open_utf8(pjoin(self.wd, "nb0.%s" % self.ext), 'w') as f: 57 | self.mod.write(nb0, f) 58 | 59 | with open_utf8(pjoin(self.wd, "nb0.%s" % self.ext), 'r') as f: 60 | nb = self.mod.read(f) 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /python-libs/nbformat/v3/tests/test_misc.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unittest import TestCase 3 | 4 | from .. import parse_filename 5 | 6 | 7 | class MiscTests(TestCase): 8 | 9 | def check_filename(self, path, exp_fname, exp_bname, exp_format): 10 | fname, bname, format = parse_filename(path) 11 | self.assertEqual(fname, exp_fname) 12 | self.assertEqual(bname, exp_bname) 13 | self.assertEqual(format, exp_format) 14 | 15 | def test_parse_filename(self): 16 | 17 | # check format detection 18 | self.check_filename("test.ipynb", "test.ipynb", "test", "json") 19 | self.check_filename("test.json", "test.json", "test", "json") 20 | self.check_filename("test.py", "test.py", "test", "py") 21 | 22 | # check parsing an unknown format 23 | self.check_filename("test.nb", "test.nb.ipynb", "test.nb", "json") 24 | 25 | # check parsing a full file path 26 | abs_path = os.path.abspath("test.ipynb") 27 | basename, ext = os.path.splitext(abs_path) 28 | self.check_filename(abs_path, abs_path, basename, "json") 29 | 30 | # check parsing a file name containing dots 31 | self.check_filename("test.nb.ipynb", "test.nb.ipynb", "test.nb", 32 | "json") 33 | -------------------------------------------------------------------------------- /python-libs/nbformat/v3/tests/test_nbpy.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf8 -*- 2 | 3 | from unittest import TestCase 4 | 5 | from ipython_genutils.py3compat import string_types, iteritems 6 | 7 | from . import formattest 8 | 9 | from .. import nbpy 10 | from .nbexamples import nb0, nb0_py 11 | 12 | 13 | class TestPy(formattest.NBFormatTest, TestCase): 14 | 15 | nb0_ref = nb0_py 16 | ext = 'py' 17 | mod = nbpy 18 | ignored_keys = ['collapsed', 'outputs', 'prompt_number', 'metadata'] 19 | 20 | def assertSubset(self, da, db): 21 | """assert that da is a subset of db, ignoring self.ignored_keys. 22 | 23 | Called recursively on containers, ultimately comparing individual 24 | elements. 25 | """ 26 | if isinstance(da, dict): 27 | for k,v in iteritems(da): 28 | if k in self.ignored_keys: 29 | continue 30 | self.assertTrue(k in db) 31 | self.assertSubset(v, db[k]) 32 | elif isinstance(da, list): 33 | for a,b in zip(da, db): 34 | self.assertSubset(a,b) 35 | else: 36 | if isinstance(da, string_types) and isinstance(db, string_types): 37 | # pyfile is not sensitive to preserving leading/trailing 38 | # newlines in blocks through roundtrip 39 | da = da.strip('\n') 40 | db = db.strip('\n') 41 | self.assertEqual(da, db) 42 | return True 43 | 44 | def assertNBEquals(self, nba, nbb): 45 | # since roundtrip is lossy, only compare keys that are preserved 46 | # assumes nba is read from my file format 47 | return self.assertSubset(nba, nbb) 48 | 49 | -------------------------------------------------------------------------------- /python-libs/nbformat/v4/__init__.py: -------------------------------------------------------------------------------- 1 | """The main API for the v4 notebook format.""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | __all__ = ['nbformat', 'nbformat_minor', 'nbformat_schema', 'new_code_cell', 7 | 'new_markdown_cell', 'new_notebook', 'new_output', 'output_from_msg', 8 | 'reads', 'writes', 'to_notebook', 'downgrade', 'upgrade'] 9 | 10 | from .nbbase import ( 11 | nbformat, nbformat_minor, nbformat_schema, 12 | new_code_cell, new_markdown_cell, new_raw_cell, new_notebook, 13 | new_output, output_from_msg, 14 | ) 15 | 16 | from .nbjson import reads, writes, to_notebook 17 | reads_json = reads 18 | writes_json = writes 19 | to_notebook_json = to_notebook 20 | 21 | from .convert import downgrade, upgrade 22 | 23 | 24 | -------------------------------------------------------------------------------- /python-libs/nbformat/v4/nbjson.py: -------------------------------------------------------------------------------- 1 | """Read and write notebooks in JSON format.""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | import copy 7 | import json 8 | 9 | from ..notebooknode import from_dict 10 | from .rwbase import ( 11 | NotebookReader, NotebookWriter, rejoin_lines, split_lines, strip_transient 12 | ) 13 | 14 | 15 | class BytesEncoder(json.JSONEncoder): 16 | """A JSON encoder that accepts b64 (and other *ascii*) bytestrings.""" 17 | def default(self, obj): 18 | if isinstance(obj, bytes): 19 | return obj.decode('ascii') 20 | return json.JSONEncoder.default(self, obj) 21 | 22 | 23 | class JSONReader(NotebookReader): 24 | 25 | def reads(self, s, **kwargs): 26 | """Read a JSON string into a Notebook object""" 27 | nb = json.loads(s, **kwargs) 28 | nb = self.to_notebook(nb, **kwargs) 29 | return nb 30 | 31 | def to_notebook(self, d, **kwargs): 32 | """Convert a disk-format notebook dict to in-memory NotebookNode 33 | 34 | handles multi-line values as strings, scrubbing of transient values, etc. 35 | """ 36 | nb = from_dict(d) 37 | nb = rejoin_lines(nb) 38 | nb = strip_transient(nb) 39 | return nb 40 | 41 | 42 | class JSONWriter(NotebookWriter): 43 | 44 | def writes(self, nb, **kwargs): 45 | """Serialize a NotebookNode object as a JSON string""" 46 | kwargs['cls'] = BytesEncoder 47 | kwargs['indent'] = 1 48 | kwargs['sort_keys'] = True 49 | kwargs['separators'] = (',',': ') 50 | kwargs.setdefault('ensure_ascii', False) 51 | # don't modify in-memory dict 52 | nb = copy.deepcopy(nb) 53 | if kwargs.pop('split_lines', True): 54 | nb = split_lines(nb) 55 | nb = strip_transient(nb) 56 | return json.dumps(nb, **kwargs) 57 | 58 | 59 | _reader = JSONReader() 60 | _writer = JSONWriter() 61 | 62 | reads = _reader.reads 63 | read = _reader.read 64 | to_notebook = _reader.to_notebook 65 | write = _writer.write 66 | writes = _writer.writes 67 | -------------------------------------------------------------------------------- /python-libs/nbformat/v4/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/nbformat/v4/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/nbformat/v4/tests/formattest.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf8 -*- 2 | import io 3 | import os 4 | import shutil 5 | import tempfile 6 | 7 | pjoin = os.path.join 8 | 9 | from .nbexamples import nb0 10 | 11 | 12 | def open_utf8(fname, mode): 13 | return io.open(fname, mode=mode, encoding='utf-8') 14 | 15 | class NBFormatTest: 16 | """Mixin for writing notebook format tests""" 17 | 18 | # override with appropriate values in subclasses 19 | nb0_ref = None 20 | ext = None 21 | mod = None 22 | 23 | def setUp(self): 24 | self.wd = tempfile.mkdtemp() 25 | 26 | def tearDown(self): 27 | shutil.rmtree(self.wd) 28 | 29 | def assertNBEquals(self, nba, nbb): 30 | self.assertEqual(nba, nbb) 31 | 32 | def test_writes(self): 33 | s = self.mod.writes(nb0) 34 | if self.nb0_ref: 35 | self.assertEqual(s, self.nb0_ref) 36 | 37 | def test_reads(self): 38 | s = self.mod.writes(nb0) 39 | nb = self.mod.reads(s) 40 | 41 | def test_roundtrip(self): 42 | s = self.mod.writes(nb0) 43 | self.assertNBEquals(self.mod.reads(s),nb0) 44 | 45 | def test_write_file(self): 46 | with open_utf8(pjoin(self.wd, "nb0.%s" % self.ext), 'w') as f: 47 | self.mod.write(nb0, f) 48 | 49 | def test_read_file(self): 50 | with open_utf8(pjoin(self.wd, "nb0.%s" % self.ext), 'w') as f: 51 | self.mod.write(nb0, f) 52 | 53 | with open_utf8(pjoin(self.wd, "nb0.%s" % self.ext), 'r') as f: 54 | nb = self.mod.read(f) 55 | -------------------------------------------------------------------------------- /python-libs/pkg_resources/_vendor/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/pkg_resources/_vendor/__init__.py -------------------------------------------------------------------------------- /python-libs/pkg_resources/_vendor/packaging/__about__.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | from __future__ import absolute_import, division, print_function 5 | 6 | __all__ = [ 7 | "__title__", 8 | "__summary__", 9 | "__uri__", 10 | "__version__", 11 | "__author__", 12 | "__email__", 13 | "__license__", 14 | "__copyright__", 15 | ] 16 | 17 | __title__ = "packaging" 18 | __summary__ = "Core utilities for Python packages" 19 | __uri__ = "https://github.com/pypa/packaging" 20 | 21 | __version__ = "20.4" 22 | 23 | __author__ = "Donald Stufft and individual contributors" 24 | __email__ = "donald@stufft.io" 25 | 26 | __license__ = "BSD-2-Clause or Apache-2.0" 27 | __copyright__ = "Copyright 2014-2019 %s" % __author__ 28 | -------------------------------------------------------------------------------- /python-libs/pkg_resources/_vendor/packaging/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | from __future__ import absolute_import, division, print_function 5 | 6 | from .__about__ import ( 7 | __author__, 8 | __copyright__, 9 | __email__, 10 | __license__, 11 | __summary__, 12 | __title__, 13 | __uri__, 14 | __version__, 15 | ) 16 | 17 | __all__ = [ 18 | "__title__", 19 | "__summary__", 20 | "__uri__", 21 | "__version__", 22 | "__author__", 23 | "__email__", 24 | "__license__", 25 | "__copyright__", 26 | ] 27 | -------------------------------------------------------------------------------- /python-libs/pkg_resources/_vendor/packaging/_compat.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | from __future__ import absolute_import, division, print_function 5 | 6 | import sys 7 | 8 | from ._typing import TYPE_CHECKING 9 | 10 | if TYPE_CHECKING: # pragma: no cover 11 | from typing import Any, Dict, Tuple, Type 12 | 13 | 14 | PY2 = sys.version_info[0] == 2 15 | PY3 = sys.version_info[0] == 3 16 | 17 | # flake8: noqa 18 | 19 | if PY3: 20 | string_types = (str,) 21 | else: 22 | string_types = (basestring,) 23 | 24 | 25 | def with_metaclass(meta, *bases): 26 | # type: (Type[Any], Tuple[Type[Any], ...]) -> Any 27 | """ 28 | Create a base class with a metaclass. 29 | """ 30 | # This requires a bit of explanation: the basic idea is to make a dummy 31 | # metaclass for one level of class instantiation that replaces itself with 32 | # the actual metaclass. 33 | class metaclass(meta): # type: ignore 34 | def __new__(cls, name, this_bases, d): 35 | # type: (Type[Any], str, Tuple[Any], Dict[Any, Any]) -> Any 36 | return meta(name, bases, d) 37 | 38 | return type.__new__(metaclass, "temporary_class", (), {}) 39 | -------------------------------------------------------------------------------- /python-libs/pkg_resources/_vendor/packaging/_typing.py: -------------------------------------------------------------------------------- 1 | """For neatly implementing static typing in packaging. 2 | 3 | `mypy` - the static type analysis tool we use - uses the `typing` module, which 4 | provides core functionality fundamental to mypy's functioning. 5 | 6 | Generally, `typing` would be imported at runtime and used in that fashion - 7 | it acts as a no-op at runtime and does not have any run-time overhead by 8 | design. 9 | 10 | As it turns out, `typing` is not vendorable - it uses separate sources for 11 | Python 2/Python 3. Thus, this codebase can not expect it to be present. 12 | To work around this, mypy allows the typing import to be behind a False-y 13 | optional to prevent it from running at runtime and type-comments can be used 14 | to remove the need for the types to be accessible directly during runtime. 15 | 16 | This module provides the False-y guard in a nicely named fashion so that a 17 | curious maintainer can reach here to read this. 18 | 19 | In packaging, all static-typing related imports should be guarded as follows: 20 | 21 | from packaging._typing import TYPE_CHECKING 22 | 23 | if TYPE_CHECKING: 24 | from typing import ... 25 | 26 | Ref: https://github.com/python/mypy/issues/3216 27 | """ 28 | 29 | __all__ = ["TYPE_CHECKING", "cast"] 30 | 31 | # The TYPE_CHECKING constant defined by the typing module is False at runtime 32 | # but True while type checking. 33 | if False: # pragma: no cover 34 | from typing import TYPE_CHECKING 35 | else: 36 | TYPE_CHECKING = False 37 | 38 | # typing's cast syntax requires calling typing.cast at runtime, but we don't 39 | # want to import typing at runtime. Here, we inform the type checkers that 40 | # we're importing `typing.cast` as `cast` and re-implement typing.cast's 41 | # runtime behavior in a block that is ignored by type checkers. 42 | if TYPE_CHECKING: # pragma: no cover 43 | # not executed at runtime 44 | from typing import cast 45 | else: 46 | # executed at runtime 47 | def cast(type_, value): # noqa 48 | return value 49 | -------------------------------------------------------------------------------- /python-libs/pkg_resources/_vendor/packaging/utils.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | from __future__ import absolute_import, division, print_function 5 | 6 | import re 7 | 8 | from ._typing import TYPE_CHECKING, cast 9 | from .version import InvalidVersion, Version 10 | 11 | if TYPE_CHECKING: # pragma: no cover 12 | from typing import NewType, Union 13 | 14 | NormalizedName = NewType("NormalizedName", str) 15 | 16 | _canonicalize_regex = re.compile(r"[-_.]+") 17 | 18 | 19 | def canonicalize_name(name): 20 | # type: (str) -> NormalizedName 21 | # This is taken from PEP 503. 22 | value = _canonicalize_regex.sub("-", name).lower() 23 | return cast("NormalizedName", value) 24 | 25 | 26 | def canonicalize_version(_version): 27 | # type: (str) -> Union[Version, str] 28 | """ 29 | This is very similar to Version.__str__, but has one subtle difference 30 | with the way it handles the release segment. 31 | """ 32 | 33 | try: 34 | version = Version(_version) 35 | except InvalidVersion: 36 | # Legacy versions cannot be normalized 37 | return _version 38 | 39 | parts = [] 40 | 41 | # Epoch 42 | if version.epoch != 0: 43 | parts.append("{0}!".format(version.epoch)) 44 | 45 | # Release segment 46 | # NB: This strips trailing '.0's to normalize 47 | parts.append(re.sub(r"(\.0)+$", "", ".".join(str(x) for x in version.release))) 48 | 49 | # Pre-release 50 | if version.pre is not None: 51 | parts.append("".join(str(x) for x in version.pre)) 52 | 53 | # Post-release 54 | if version.post is not None: 55 | parts.append(".post{0}".format(version.post)) 56 | 57 | # Development release 58 | if version.dev is not None: 59 | parts.append(".dev{0}".format(version.dev)) 60 | 61 | # Local version segment 62 | if version.local is not None: 63 | parts.append("+{0}".format(version.local)) 64 | 65 | return "".join(parts) 66 | -------------------------------------------------------------------------------- /python-libs/pkg_resources/tests/data/my-test-package-source/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | setuptools.setup( 3 | name="my-test-package", 4 | version="1.0", 5 | zip_safe=True, 6 | ) 7 | -------------------------------------------------------------------------------- /python-libs/pyrsistent-0.17.3.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/pyrsistent-0.17.3.dist-info/LICENCE.mit: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Tobias Gustafsson 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /python-libs/pyrsistent-0.17.3.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: false 4 | Tag: cp39-cp39-macosx_11_0_arm64 5 | 6 | -------------------------------------------------------------------------------- /python-libs/pyrsistent-0.17.3.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | _pyrsistent_version 2 | pvectorc 3 | pyrsistent 4 | -------------------------------------------------------------------------------- /python-libs/pyrsistent/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from pyrsistent._pmap import pmap, m, PMap 4 | 5 | from pyrsistent._pvector import pvector, v, PVector 6 | 7 | from pyrsistent._pset import pset, s, PSet 8 | 9 | from pyrsistent._pbag import pbag, b, PBag 10 | 11 | from pyrsistent._plist import plist, l, PList 12 | 13 | from pyrsistent._pdeque import pdeque, dq, PDeque 14 | 15 | from pyrsistent._checked_types import ( 16 | CheckedPMap, CheckedPVector, CheckedPSet, InvariantException, CheckedKeyTypeError, 17 | CheckedValueTypeError, CheckedType, optional) 18 | 19 | from pyrsistent._field_common import ( 20 | field, PTypeError, pset_field, pmap_field, pvector_field) 21 | 22 | from pyrsistent._precord import PRecord 23 | 24 | from pyrsistent._pclass import PClass, PClassMeta 25 | 26 | from pyrsistent._immutable import immutable 27 | 28 | from pyrsistent._helpers import freeze, thaw, mutant 29 | 30 | from pyrsistent._transformations import inc, discard, rex, ny 31 | 32 | from pyrsistent._toolz import get_in 33 | 34 | 35 | __all__ = ('pmap', 'm', 'PMap', 36 | 'pvector', 'v', 'PVector', 37 | 'pset', 's', 'PSet', 38 | 'pbag', 'b', 'PBag', 39 | 'plist', 'l', 'PList', 40 | 'pdeque', 'dq', 'PDeque', 41 | 'CheckedPMap', 'CheckedPVector', 'CheckedPSet', 'InvariantException', 'CheckedKeyTypeError', 'CheckedValueTypeError', 'CheckedType', 'optional', 42 | 'PRecord', 'field', 'pset_field', 'pmap_field', 'pvector_field', 43 | 'PClass', 'PClassMeta', 44 | 'immutable', 45 | 'freeze', 'thaw', 'mutant', 46 | 'get_in', 47 | 'inc', 'discard', 'rex', 'ny') 48 | -------------------------------------------------------------------------------- /python-libs/pyrsistent/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/pyrsistent/py.typed -------------------------------------------------------------------------------- /python-libs/pyrsistent/typing.py: -------------------------------------------------------------------------------- 1 | """Helpers for use with type annotation. 2 | 3 | Use the empty classes in this module when annotating the types of Pyrsistent 4 | objects, instead of using the actual collection class. 5 | 6 | For example, 7 | 8 | from pyrsistent import pvector 9 | from pyrsistent.typing import PVector 10 | 11 | myvector: PVector[str] = pvector(['a', 'b', 'c']) 12 | 13 | """ 14 | from __future__ import absolute_import 15 | 16 | try: 17 | from typing import Container 18 | from typing import Hashable 19 | from typing import Generic 20 | from typing import Iterable 21 | from typing import Mapping 22 | from typing import Sequence 23 | from typing import Sized 24 | from typing import TypeVar 25 | 26 | __all__ = [ 27 | 'CheckedPMap', 28 | 'CheckedPSet', 29 | 'CheckedPVector', 30 | 'PBag', 31 | 'PDeque', 32 | 'PList', 33 | 'PMap', 34 | 'PSet', 35 | 'PVector', 36 | ] 37 | 38 | T = TypeVar('T') 39 | KT = TypeVar('KT') 40 | VT = TypeVar('VT') 41 | 42 | class CheckedPMap(Mapping[KT, VT], Hashable): 43 | pass 44 | 45 | # PSet.add and PSet.discard have different type signatures than that of Set. 46 | class CheckedPSet(Generic[T], Hashable): 47 | pass 48 | 49 | class CheckedPVector(Sequence[T], Hashable): 50 | pass 51 | 52 | class PBag(Container[T], Iterable[T], Sized, Hashable): 53 | pass 54 | 55 | class PDeque(Sequence[T], Hashable): 56 | pass 57 | 58 | class PList(Sequence[T], Hashable): 59 | pass 60 | 61 | class PMap(Mapping[KT, VT], Hashable): 62 | pass 63 | 64 | # PSet.add and PSet.discard have different type signatures than that of Set. 65 | class PSet(Generic[T], Hashable): 66 | pass 67 | 68 | class PVector(Sequence[T], Hashable): 69 | pass 70 | 71 | class PVectorEvolver(Generic[T]): 72 | pass 73 | 74 | class PMapEvolver(Generic[KT, VT]): 75 | pass 76 | 77 | class PSetEvolver(Generic[T]): 78 | pass 79 | except ImportError: 80 | pass 81 | -------------------------------------------------------------------------------- /python-libs/six-1.16.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/six-1.16.0.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2020 Benjamin Peterson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /python-libs/six-1.16.0.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: six 3 | Version: 1.16.0 4 | Summary: Python 2 and 3 compatibility utilities 5 | Home-page: https://github.com/benjaminp/six 6 | Author: Benjamin Peterson 7 | Author-email: benjamin@python.org 8 | License: MIT 9 | Platform: UNKNOWN 10 | Classifier: Development Status :: 5 - Production/Stable 11 | Classifier: Programming Language :: Python :: 2 12 | Classifier: Programming Language :: Python :: 3 13 | Classifier: Intended Audience :: Developers 14 | Classifier: License :: OSI Approved :: MIT License 15 | Classifier: Topic :: Software Development :: Libraries 16 | Classifier: Topic :: Utilities 17 | Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.* 18 | 19 | .. image:: https://img.shields.io/pypi/v/six.svg 20 | :target: https://pypi.org/project/six/ 21 | :alt: six on PyPI 22 | 23 | .. image:: https://travis-ci.org/benjaminp/six.svg?branch=master 24 | :target: https://travis-ci.org/benjaminp/six 25 | :alt: six on TravisCI 26 | 27 | .. image:: https://readthedocs.org/projects/six/badge/?version=latest 28 | :target: https://six.readthedocs.io/ 29 | :alt: six's documentation on Read the Docs 30 | 31 | .. image:: https://img.shields.io/badge/license-MIT-green.svg 32 | :target: https://github.com/benjaminp/six/blob/master/LICENSE 33 | :alt: MIT License badge 34 | 35 | Six is a Python 2 and 3 compatibility library. It provides utility functions 36 | for smoothing over the differences between the Python versions with the goal of 37 | writing Python code that is compatible on both Python versions. See the 38 | documentation for more information on what is provided. 39 | 40 | Six supports Python 2.7 and 3.3+. It is contained in only one Python 41 | file, so it can be easily copied into your project. (The copyright and license 42 | notice must be retained.) 43 | 44 | Online documentation is at https://six.readthedocs.io/. 45 | 46 | Bugs can be reported to https://github.com/benjaminp/six. The code can also 47 | be found there. 48 | 49 | 50 | -------------------------------------------------------------------------------- /python-libs/six-1.16.0.dist-info/RECORD: -------------------------------------------------------------------------------- 1 | __pycache__/six.cpython-39.pyc,, 2 | six-1.16.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 3 | six-1.16.0.dist-info/LICENSE,sha256=i7hQxWWqOJ_cFvOkaWWtI9gq3_YPI5P8J2K2MYXo5sk,1066 4 | six-1.16.0.dist-info/METADATA,sha256=VQcGIFCAEmfZcl77E5riPCN4v2TIsc_qtacnjxKHJoI,1795 5 | six-1.16.0.dist-info/RECORD,, 6 | six-1.16.0.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110 7 | six-1.16.0.dist-info/top_level.txt,sha256=_iVH_iYEtEXnD8nYGQYpYFUvkUW9sEO1GYbkeKSAais,4 8 | six.py,sha256=TOOfQi7nFGfMrIvtdr6wX4wyHH8M7aknmuLfo2cBBrM,34549 9 | -------------------------------------------------------------------------------- /python-libs/six-1.16.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: true 4 | Tag: py2-none-any 5 | Tag: py3-none-any 6 | 7 | -------------------------------------------------------------------------------- /python-libs/six-1.16.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | six 2 | -------------------------------------------------------------------------------- /python-libs/toml-0.10.2.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/toml-0.10.2.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright 2013-2019 William Pearson 4 | Copyright 2015-2016 Julien Enselme 5 | Copyright 2016 Google Inc. 6 | Copyright 2017 Samuel Vasko 7 | Copyright 2017 Nate Prewitt 8 | Copyright 2017 Jack Evans 9 | Copyright 2019 Filippo Broggini 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. -------------------------------------------------------------------------------- /python-libs/toml-0.10.2.dist-info/RECORD: -------------------------------------------------------------------------------- 1 | toml-0.10.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 2 | toml-0.10.2.dist-info/LICENSE,sha256=LZKUgj32yJNXyL5JJ_znk2HWVh5e51MtWSbmOTmqpTY,1252 3 | toml-0.10.2.dist-info/METADATA,sha256=n_YkspvEihd_QXLIZZ50WVSFz3rZ_k7jQP-OU1WUpWY,7142 4 | toml-0.10.2.dist-info/RECORD,, 5 | toml-0.10.2.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110 6 | toml-0.10.2.dist-info/top_level.txt,sha256=2BO8ZRNnvJWgXyiQv66LBb_v87qBzcoUtEBefA75Ouk,5 7 | toml/__init__.py,sha256=Au3kqCwKD0cjbf4yJGOpUFwpsY0WHsC1ZRGvWgIKmpc,723 8 | toml/__pycache__/__init__.cpython-39.pyc,, 9 | toml/__pycache__/decoder.cpython-39.pyc,, 10 | toml/__pycache__/encoder.cpython-39.pyc,, 11 | toml/__pycache__/ordered.cpython-39.pyc,, 12 | toml/__pycache__/tz.cpython-39.pyc,, 13 | toml/decoder.py,sha256=hSGTLf-2WBDZ_ddoCHWFy6N647XyMSh1o3rN2o4dEFg,38942 14 | toml/encoder.py,sha256=XjBc8ayvvlsLyd_qDA4tMWDNmMFRS4DpwtuDSWBq7zo,9940 15 | toml/ordered.py,sha256=mz03lZmV0bmc9lsYRIUOuj7Dsu5Ptwq-UtGVq5FdVZ4,354 16 | toml/tz.py,sha256=-5vg8wkg_atnVi2TnEveexIVE7T_FxBVr_-2WVfO1oA,701 17 | -------------------------------------------------------------------------------- /python-libs/toml-0.10.2.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.35.1) 3 | Root-Is-Purelib: true 4 | Tag: py2-none-any 5 | Tag: py3-none-any 6 | 7 | -------------------------------------------------------------------------------- /python-libs/toml-0.10.2.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | toml 2 | -------------------------------------------------------------------------------- /python-libs/toml/__init__.py: -------------------------------------------------------------------------------- 1 | """Python module which parses and emits TOML. 2 | 3 | Released under the MIT license. 4 | """ 5 | 6 | from toml import encoder 7 | from toml import decoder 8 | 9 | __version__ = "0.10.2" 10 | _spec_ = "0.5.0" 11 | 12 | load = decoder.load 13 | loads = decoder.loads 14 | TomlDecoder = decoder.TomlDecoder 15 | TomlDecodeError = decoder.TomlDecodeError 16 | TomlPreserveCommentDecoder = decoder.TomlPreserveCommentDecoder 17 | 18 | dump = encoder.dump 19 | dumps = encoder.dumps 20 | TomlEncoder = encoder.TomlEncoder 21 | TomlArraySeparatorEncoder = encoder.TomlArraySeparatorEncoder 22 | TomlPreserveInlineDictEncoder = encoder.TomlPreserveInlineDictEncoder 23 | TomlNumpyEncoder = encoder.TomlNumpyEncoder 24 | TomlPreserveCommentEncoder = encoder.TomlPreserveCommentEncoder 25 | TomlPathlibEncoder = encoder.TomlPathlibEncoder 26 | -------------------------------------------------------------------------------- /python-libs/toml/ordered.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict 2 | from toml import TomlEncoder 3 | from toml import TomlDecoder 4 | 5 | 6 | class TomlOrderedDecoder(TomlDecoder): 7 | 8 | def __init__(self): 9 | super(self.__class__, self).__init__(_dict=OrderedDict) 10 | 11 | 12 | class TomlOrderedEncoder(TomlEncoder): 13 | 14 | def __init__(self): 15 | super(self.__class__, self).__init__(_dict=OrderedDict) 16 | -------------------------------------------------------------------------------- /python-libs/toml/tz.py: -------------------------------------------------------------------------------- 1 | from datetime import tzinfo, timedelta 2 | 3 | 4 | class TomlTz(tzinfo): 5 | def __init__(self, toml_offset): 6 | if toml_offset == "Z": 7 | self._raw_offset = "+00:00" 8 | else: 9 | self._raw_offset = toml_offset 10 | self._sign = -1 if self._raw_offset[0] == '-' else 1 11 | self._hours = int(self._raw_offset[1:3]) 12 | self._minutes = int(self._raw_offset[4:6]) 13 | 14 | def __deepcopy__(self, memo): 15 | return self.__class__(self._raw_offset) 16 | 17 | def tzname(self, dt): 18 | return "UTC" + self._raw_offset 19 | 20 | def utcoffset(self, dt): 21 | return self._sign * timedelta(hours=self._hours, minutes=self._minutes) 22 | 23 | def dst(self, dt): 24 | return timedelta(0) 25 | -------------------------------------------------------------------------------- /python-libs/traitlets-5.0.5.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /python-libs/traitlets-5.0.5.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.35.1) 3 | Root-Is-Purelib: true 4 | Tag: py3-none-any 5 | 6 | -------------------------------------------------------------------------------- /python-libs/traitlets-5.0.5.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | traitlets 2 | -------------------------------------------------------------------------------- /python-libs/traitlets/__init__.py: -------------------------------------------------------------------------------- 1 | from warnings import warn 2 | 3 | from . import traitlets 4 | from .traitlets import * 5 | from .utils.importstring import import_item 6 | from .utils.decorators import signature_has_traits 7 | from .utils.bunch import Bunch 8 | from ._version import version_info, __version__ 9 | 10 | 11 | class Sentinel(traitlets.Sentinel): 12 | def __init__(self, *args, **kwargs): 13 | super(Sentinel, self).__init__(*args, **kwargs) 14 | warn( 15 | """ 16 | Sentinel is not a public part of the traitlets API. 17 | It was published by mistake, and may be removed in the future. 18 | """, 19 | DeprecationWarning, 20 | stacklevel=2, 21 | ) 22 | -------------------------------------------------------------------------------- /python-libs/traitlets/_version.py: -------------------------------------------------------------------------------- 1 | version_info = (5, 0, 5) 2 | 3 | # unlike `.dev`, alpha, beta and rc _must not_ have dots, 4 | # or the wheel and tgz won't look to pip like the same version. 5 | 6 | __version__ = ( 7 | ".".join(map(str, version_info)) 8 | .replace(".b", "b") 9 | .replace(".a", "a") 10 | .replace(".rc", "rc") 11 | ) 12 | assert ".b" not in __version__ 13 | assert ".a" not in __version__ 14 | assert ".rc" not in __version__ 15 | -------------------------------------------------------------------------------- /python-libs/traitlets/config/__init__.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | from .application import * 7 | from .configurable import * 8 | from .loader import Config 9 | -------------------------------------------------------------------------------- /python-libs/traitlets/config/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/traitlets/config/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/traitlets/log.py: -------------------------------------------------------------------------------- 1 | """Grab the global logger instance.""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | import logging 7 | 8 | _logger = None 9 | 10 | def get_logger(): 11 | """Grab the global logger instance. 12 | 13 | If a global Application is instantiated, grab its logger. 14 | Otherwise, grab the root logger. 15 | """ 16 | global _logger 17 | 18 | if _logger is None: 19 | from .config import Application 20 | if Application.initialized(): 21 | _logger = Application.instance().log 22 | else: 23 | _logger = logging.getLogger('traitlets') 24 | # Add a NullHandler to silence warnings about not being 25 | # initialized, per best practice for libraries. 26 | _logger.addHandler(logging.NullHandler()) 27 | return _logger 28 | -------------------------------------------------------------------------------- /python-libs/traitlets/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/traitlets/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/traitlets/tests/utils.py: -------------------------------------------------------------------------------- 1 | from subprocess import Popen, PIPE 2 | import sys 3 | 4 | 5 | def get_output_error_code(cmd): 6 | """Get stdout, stderr, and exit code from running a command""" 7 | p = Popen(cmd, stdout=PIPE, stderr=PIPE) 8 | out, err = p.communicate() 9 | out = out.decode('utf8', 'replace') 10 | err = err.decode('utf8', 'replace') 11 | return out, err, p.returncode 12 | 13 | 14 | def check_help_output(pkg, subcommand=None): 15 | """test that `python -m PKG [subcommand] -h` works""" 16 | cmd = [sys.executable, '-m', pkg] 17 | if subcommand: 18 | cmd.extend(subcommand) 19 | cmd.append('-h') 20 | out, err, rc = get_output_error_code(cmd) 21 | assert rc == 0, err 22 | assert "Traceback" not in err 23 | assert "Options" in out 24 | assert "--help-all" in out 25 | return out, err 26 | 27 | 28 | def check_help_all_output(pkg, subcommand=None): 29 | """test that `python -m PKG --help-all` works""" 30 | cmd = [sys.executable, '-m', pkg] 31 | if subcommand: 32 | cmd.extend(subcommand) 33 | cmd.append('--help-all') 34 | out, err, rc = get_output_error_code(cmd) 35 | assert rc == 0, err 36 | assert "Traceback" not in err 37 | assert "Options" in out 38 | assert "Class options" in out 39 | return out, err 40 | -------------------------------------------------------------------------------- /python-libs/traitlets/utils/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | # vestigal things from IPython_genutils. 3 | def cast_unicode(s, encoding='utf-8'): 4 | if isinstance(s, bytes): 5 | return s.decode(encoding, 'replace') 6 | return s 7 | -------------------------------------------------------------------------------- /python-libs/traitlets/utils/bunch.py: -------------------------------------------------------------------------------- 1 | """Yet another implementation of bunch 2 | 3 | attribute-access of items on a dict. 4 | """ 5 | 6 | # Copyright (c) Jupyter Development Team. 7 | # Distributed under the terms of the Modified BSD License. 8 | 9 | class Bunch(dict): 10 | """A dict with attribute-access""" 11 | def __getattr__(self, key): 12 | try: 13 | return self.__getitem__(key) 14 | except KeyError: 15 | raise AttributeError(key) 16 | 17 | def __setattr__(self, key, value): 18 | self.__setitem__(key, value) 19 | 20 | def __dir__(self): 21 | # py2-compat: can't use super because dict doesn't have __dir__ 22 | names = dir({}) 23 | names.extend(self.keys()) 24 | return names 25 | 26 | -------------------------------------------------------------------------------- /python-libs/traitlets/utils/getargspec.py: -------------------------------------------------------------------------------- 1 | """ 2 | getargspec excerpted from: 3 | 4 | sphinx.util.inspect 5 | ~~~~~~~~~~~~~~~~~~~ 6 | Helpers for inspecting Python modules. 7 | :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | """ 10 | 11 | import inspect 12 | 13 | # Unmodified from sphinx below this line 14 | 15 | from functools import partial 16 | 17 | def getargspec(func): 18 | """Like inspect.getargspec but supports functools.partial as well.""" 19 | if inspect.ismethod(func): 20 | func = func.__func__ 21 | if type(func) is partial: 22 | orig_func = func.func 23 | argspec = getargspec(orig_func) 24 | args = list(argspec[0]) 25 | defaults = list(argspec[3] or ()) 26 | kwoargs = list(argspec[4]) 27 | kwodefs = dict(argspec[5] or {}) 28 | if func.args: 29 | args = args[len(func.args):] 30 | for arg in func.keywords or (): 31 | try: 32 | i = args.index(arg) - len(args) 33 | del args[i] 34 | try: 35 | del defaults[i] 36 | except IndexError: 37 | pass 38 | except ValueError: # must be a kwonly arg 39 | i = kwoargs.index(arg) 40 | del kwoargs[i] 41 | del kwodefs[arg] 42 | return inspect.FullArgSpec(args, argspec[1], argspec[2], 43 | tuple(defaults), kwoargs, 44 | kwodefs, argspec[6]) 45 | while hasattr(func, '__wrapped__'): 46 | func = func.__wrapped__ 47 | if not inspect.isfunction(func): 48 | raise TypeError('%r is not a Python function' % func) 49 | return inspect.getfullargspec(func) 50 | 51 | -------------------------------------------------------------------------------- /python-libs/traitlets/utils/importstring.py: -------------------------------------------------------------------------------- 1 | """ 2 | A simple utility to import something by its string name. 3 | """ 4 | # Copyright (c) IPython Development Team. 5 | # Distributed under the terms of the Modified BSD License. 6 | 7 | 8 | def import_item(name): 9 | """Import and return ``bar`` given the string ``foo.bar``. 10 | 11 | Calling ``bar = import_item("foo.bar")`` is the functional equivalent of 12 | executing the code ``from foo import bar``. 13 | 14 | Parameters 15 | ---------- 16 | name : string 17 | The fully qualified name of the module/package being imported. 18 | 19 | Returns 20 | ------- 21 | mod : module object 22 | The module that was imported. 23 | """ 24 | if not isinstance(name, str): 25 | raise TypeError("import_item accepts strings, not '%s'." % type(name)) 26 | parts = name.rsplit('.', 1) 27 | if len(parts) == 2: 28 | # called with 'foo.bar....' 29 | package, obj = parts 30 | module = __import__(package, fromlist=[obj]) 31 | try: 32 | pak = getattr(module, obj) 33 | except AttributeError: 34 | raise ImportError('No module named %s' % obj) 35 | return pak 36 | else: 37 | # called with un-dotted string 38 | return __import__(parts[0]) 39 | -------------------------------------------------------------------------------- /python-libs/traitlets/utils/sentinel.py: -------------------------------------------------------------------------------- 1 | """Sentinel class for constants with useful reprs""" 2 | 3 | # Copyright (c) IPython Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | 7 | class Sentinel(object): 8 | 9 | def __init__(self, name, module, docstring=None): 10 | self.name = name 11 | self.module = module 12 | if docstring: 13 | self.__doc__ = docstring 14 | 15 | def __repr__(self): 16 | return str(self.module) + '.' + self.name 17 | 18 | def __copy__(self): 19 | return self 20 | 21 | def __deepcopy__(self, memo): 22 | return self 23 | -------------------------------------------------------------------------------- /python-libs/traitlets/utils/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notebookPowerTools/vscode-jupytext/9b2e50cb5360774c0e65e7cb3b833760e539f505/python-libs/traitlets/utils/tests/__init__.py -------------------------------------------------------------------------------- /python-libs/traitlets/utils/tests/test_bunch.py: -------------------------------------------------------------------------------- 1 | from ..bunch import Bunch 2 | 3 | def test_bunch(): 4 | b = Bunch(x=5, y=10) 5 | assert 'y' in b 6 | assert 'x' in b 7 | assert b.x == 5 8 | b['a'] = 'hi' 9 | assert b.a == 'hi' 10 | 11 | def test_bunch_dir(): 12 | b = Bunch(x=5, y=10) 13 | assert 'x' in dir(b) 14 | assert 'keys' in dir(b) 15 | -------------------------------------------------------------------------------- /python-libs/traitlets/utils/tests/test_importstring.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) IPython Development Team. 2 | # Distributed under the terms of the Modified BSD License. 3 | # 4 | # Adapted from enthought.traits, Copyright (c) Enthought, Inc., 5 | # also under the terms of the Modified BSD License. 6 | """Tests for traitlets.utils.importstring.""" 7 | 8 | import os 9 | from unittest import TestCase 10 | 11 | from ..importstring import import_item 12 | 13 | 14 | class TestImportItem(TestCase): 15 | 16 | def test_import_unicode(self): 17 | self.assertIs(os, import_item('os')) 18 | self.assertIs(os.path, import_item('os.path')) 19 | self.assertIs(os.path.join, import_item('os.path.join')) 20 | 21 | def test_bad_input(self): 22 | class NotAString(object): 23 | pass 24 | msg = ( 25 | "import_item accepts strings, " 26 | "not '%s'." % NotAString 27 | ) 28 | with self.assertRaisesRegex(TypeError, msg): 29 | import_item(NotAString()) 30 | -------------------------------------------------------------------------------- /python-libs/yaml/nodes.py: -------------------------------------------------------------------------------- 1 | 2 | class Node(object): 3 | def __init__(self, tag, value, start_mark, end_mark): 4 | self.tag = tag 5 | self.value = value 6 | self.start_mark = start_mark 7 | self.end_mark = end_mark 8 | def __repr__(self): 9 | value = self.value 10 | #if isinstance(value, list): 11 | # if len(value) == 0: 12 | # value = '' 13 | # elif len(value) == 1: 14 | # value = '<1 item>' 15 | # else: 16 | # value = '<%d items>' % len(value) 17 | #else: 18 | # if len(value) > 75: 19 | # value = repr(value[:70]+u' ... ') 20 | # else: 21 | # value = repr(value) 22 | value = repr(value) 23 | return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) 24 | 25 | class ScalarNode(Node): 26 | id = 'scalar' 27 | def __init__(self, tag, value, 28 | start_mark=None, end_mark=None, style=None): 29 | self.tag = tag 30 | self.value = value 31 | self.start_mark = start_mark 32 | self.end_mark = end_mark 33 | self.style = style 34 | 35 | class CollectionNode(Node): 36 | def __init__(self, tag, value, 37 | start_mark=None, end_mark=None, flow_style=None): 38 | self.tag = tag 39 | self.value = value 40 | self.start_mark = start_mark 41 | self.end_mark = end_mark 42 | self.flow_style = flow_style 43 | 44 | class SequenceNode(CollectionNode): 45 | id = 'sequence' 46 | 47 | class MappingNode(CollectionNode): 48 | id = 'mapping' 49 | 50 | -------------------------------------------------------------------------------- /src/commands.ts: -------------------------------------------------------------------------------- 1 | import { commands, Uri, window } from 'vscode'; 2 | import { JupyterNotebookView, jupytextScheme } from './constants'; 3 | import { convertToNotebook } from './conversion'; 4 | 5 | export function initialize() { 6 | commands.registerCommand('jupyter.openAsPairedNotebook', async (uri?: Uri) => { 7 | uri = uri || window.activeTextEditor?.document.uri ; 8 | if (!uri){ 9 | return; 10 | } 11 | const notebookUri = await convertToNotebook(uri); 12 | if (!notebookUri) { 13 | return; 14 | } 15 | await commands.executeCommand( 16 | 'vscode.openWith', 17 | Uri.file(notebookUri.virtualIpynb).with({scheme: jupytextScheme}), 18 | JupyterNotebookView 19 | ); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /src/constants.ts: -------------------------------------------------------------------------------- 1 | import { Disposable, ExtensionContext, Memento, Uri, workspace } from 'vscode'; 2 | 3 | export const noop = () => { 4 | // 5 | }; 6 | 7 | export const jupytextScheme = 'jupytext'; 8 | export function isJupytextScheme(uri:Uri){ 9 | return uri.scheme === jupytextScheme; 10 | } 11 | export const JupyterNotebookView = 'jupyter-notebook'; 12 | 13 | let extensionDir: Uri; 14 | let globalMemento: Memento; 15 | export function getExtensionDir(): Uri { 16 | return extensionDir; 17 | } 18 | export function getGlobalCache(): Memento { 19 | return globalMemento; 20 | } 21 | let disposables:Disposable []; 22 | export function registerDisposable(disposable: Disposable) { 23 | disposables.push(disposable); 24 | } 25 | let globalTempDir:Uri; 26 | export function getGlobalTempDir(): Uri { 27 | return globalTempDir; 28 | } 29 | export async function initialize(context: ExtensionContext) { 30 | extensionDir = context.extensionUri; 31 | globalMemento = context.globalState; 32 | disposables = context.subscriptions; 33 | globalTempDir = context.globalStorageUri; 34 | await workspace.fs.createDirectory(context.globalStorageUri).then(noop, noop); 35 | } 36 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | // The module 'vscode' contains the VS Code extensibility API 2 | // Import the module and reference it with the alias vscode in your code below 3 | import { 4 | ExtensionContext, 5 | } from "vscode"; 6 | import { initialize } from "./constants"; 7 | import { initialize as initializeCommands } from "./commands"; 8 | import { initialize as initializeContentProvider } from "./contentProviders"; 9 | 10 | // this method is called when your extension is activated 11 | // your extension is activated the very first time the command is executed 12 | export async function activate(context: ExtensionContext) { 13 | await initialize(context); 14 | initializeCommands(); 15 | initializeContentProvider(); 16 | // Use the console to output diagnostic information (console.log) and errors (console.error) 17 | // This line of code will only be executed once when your extension is activated 18 | console.log( 19 | 'Congratulations, your extension "vscode-notebook-cell-linenumber" is now active!' 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/languages.ts: -------------------------------------------------------------------------------- 1 | import { Uri } from "vscode" 2 | 3 | export const supportedFileExtensions = { 4 | ".py": {"language": "python", "comment": "#"}, 5 | ".coco": {"language": "coconut", "comment": "#"}, 6 | ".R": {"language": "R", "comment": "#"}, 7 | ".r": {"language": "R", "comment": "#"}, 8 | ".jl": {"language": "julia", "comment": "#"}, 9 | ".cpp": {"language": "c++", "comment": "//"}, 10 | ".ss": {"language": "scheme", "comment": ";;"}, 11 | ".clj": {"language": "clojure", "comment": ";;"}, 12 | ".scm": {"language": "scheme", "comment": ";;"}, 13 | ".sh": {"language": "bash", "comment": "#"}, 14 | ".ps1": {"language": "powershell", "comment": "#"}, 15 | ".q": {"language": "q", "comment": "/"}, 16 | ".m": {"language": "matlab", "comment": "%"}, 17 | ".pro": {"language": "idl", "comment": ";"}, 18 | ".js": {"language": "javascript", "comment": "//"}, 19 | ".ts": {"language": "typescript", "comment": "//"}, 20 | ".scala": {"language": "scala", "comment": "//"}, 21 | ".rs": {"language": "rust", "comment": "//"}, 22 | ".robot": {"language": "robotframework", "comment": "#"}, 23 | ".resource": {"language": "robotframework", "comment": "#"}, 24 | ".cs": {"language": "csharp", "comment": "//"}, 25 | ".fsx": {"language": "fsharp", "comment": "//"}, 26 | ".fs": {"language": "fsharp", "comment": "//"}, 27 | ".sos": {"language": "sos", "comment": "#"}, 28 | ".java": {"language": "java", "comment": "//"}, 29 | ".groovy": {"language": "groovy", "comment": "//"}, 30 | ".sage": {"language": "sage", "comment": "#"}, 31 | } 32 | 33 | export function isConversionSupportedWithoutPython(uri: Uri){ 34 | if (uri.fsPath.toLowerCase().endsWith('.py')){ 35 | return false; 36 | } 37 | return true; 38 | } -------------------------------------------------------------------------------- /src/opener.ts: -------------------------------------------------------------------------------- 1 | import { Uri, window } from "vscode"; 2 | import { isConversionSupportedWithoutPython } from "./languages"; 3 | import { isPythonAvaialble } from "./python"; 4 | 5 | export async function openFileAsPairedNotebook(uri: Uri){ 6 | const isPythonAvailable = await isPythonAvaialble(); 7 | if (!isPythonAvaialble && !isConversionSupportedWithoutPython(uri)){ 8 | window.showErrorMessage('Unable to open file as a paired notebook with Python installed'); 9 | return; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/runTest.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | 3 | import { runTests } from 'vscode-test'; 4 | 5 | async function main() { 6 | try { 7 | // The folder containing the Extension Manifest package.json 8 | // Passed to `--extensionDevelopmentPath` 9 | const extensionDevelopmentPath = path.resolve(__dirname, '../../'); 10 | 11 | // The path to test runner 12 | // Passed to --extensionTestsPath 13 | const extensionTestsPath = path.resolve(__dirname, './suite/index'); 14 | 15 | // Download VS Code, unzip it and run the integration test 16 | await runTests({ extensionDevelopmentPath, extensionTestsPath }); 17 | } catch (err) { 18 | console.error('Failed to run tests'); 19 | process.exit(1); 20 | } 21 | } 22 | 23 | main(); 24 | -------------------------------------------------------------------------------- /src/test/suite/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../../extension'; 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /src/test/suite/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as Mocha from 'mocha'; 3 | import * as glob from 'glob'; 4 | 5 | export function run(): Promise { 6 | // Create the mocha test 7 | const mocha = new Mocha({ 8 | ui: 'tdd', 9 | color: true 10 | }); 11 | 12 | const testsRoot = path.resolve(__dirname, '..'); 13 | 14 | return new Promise((c, e) => { 15 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { 16 | if (err) { 17 | return e(err); 18 | } 19 | 20 | // Add files to the test suite 21 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); 22 | 23 | try { 24 | // Run the mocha test 25 | mocha.run(failures => { 26 | if (failures > 0) { 27 | e(new Error(`${failures} tests failed.`)); 28 | } else { 29 | c(); 30 | } 31 | }); 32 | } catch (err) { 33 | console.error(err); 34 | e(err); 35 | } 36 | }); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | import * as tmp from 'tmp'; 2 | import * as path from 'path'; 3 | 4 | export function tempFile(options: { extension: string, prefix?:string }) { 5 | return new Promise((resolve, reject) => { 6 | tmp.tmpName( 7 | { postfix: path.extname(options.extension), prefix:options.prefix }, 8 | 9 | (err: Error | null, name: string) => { 10 | if (err) { 11 | return reject(err); 12 | } 13 | name = name.endsWith(options.extension) ? name : name + options.extension; 14 | resolve(name); 15 | } 16 | ); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | "strict": true /* enable all strict type-checking options */ 12 | /* Additional Checks */ 13 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 14 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 15 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 16 | }, 17 | "exclude": [ 18 | "node_modules", 19 | ".vscode-test" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | 3 | 'use strict'; 4 | 5 | const path = require('path'); 6 | 7 | /**@type {import('webpack').Configuration}*/ 8 | const config = { 9 | target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ 10 | mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production') 11 | 12 | entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ 13 | output: { 14 | // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ 15 | path: path.resolve(__dirname, 'dist'), 16 | filename: 'extension.js', 17 | libraryTarget: 'commonjs2' 18 | }, 19 | devtool: 'nosources-source-map', 20 | externals: { 21 | vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ 22 | // modules added here also need to be added in the .vsceignore file 23 | }, 24 | resolve: { 25 | // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader 26 | extensions: ['.ts', '.js'] 27 | }, 28 | module: { 29 | rules: [ 30 | { 31 | test: /\.ts$/, 32 | exclude: /node_modules/, 33 | use: [ 34 | { 35 | loader: 'ts-loader' 36 | } 37 | ] 38 | } 39 | ] 40 | } 41 | }; 42 | module.exports = config; --------------------------------------------------------------------------------