Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .cache/pip/http-v2/3/2/2/c/b/322cb2d2fa9c18feda7312c66e98b038ca0bb7446362e84c4a580aa3 +0 -0
- .cache/pip/http-v2/3/3/9/7/4/33974f84394d9a943f68359da08431dab4af9f86c33962982ea21b5f +0 -0
- .cache/pip/http-v2/5/1/f/2/8/51f28abf47f08a699c067b6b49e9b61d7ffb241813480943666c7bcf +0 -0
- .cache/pip/http-v2/5/1/f/2/8/51f28abf47f08a699c067b6b49e9b61d7ffb241813480943666c7bcf.body +87 -0
- .cache/pip/http-v2/5/2/4/e/a/524eaa378c5eeff9b07f34d936ce7bc411da078278be84566970502d +0 -0
- .cache/pip/http-v2/5/4/c/b/6/54cb669eb9a885793334a25ee9e0fbe07bec87103a57cea1aaa59e27 +0 -0
- .cache/pip/http-v2/5/6/f/9/d/56f9d9bd534016b34d1660bb01a66bb1704ef80e0f133b683da4f133 +0 -0
- .cache/pip/http-v2/5/a/2/6/c/5a26cc45879e115d5aabd5f6ef627d6747bf3160bca5548379570c58.body +113 -0
- .cache/pip/http-v2/6/5/0/7/2/65072c35290c429df2e84cb69eba045284d50944561efa156675456a +0 -0
- .cache/pip/http-v2/6/6/6/2/c/6662c3d76e9c2f7783002d2625d92517b2c4b994197bd6d5da887f1e.body +0 -0
- .cache/pip/http-v2/8/5/e/f/e/85efe0b09056afaed0a9932320bb2a590a03afe4bc35e3fffc1e85cd +0 -0
- .cache/pip/http-v2/8/8/b/8/b/88b8bfb8f1d620e081b2b226e7936019ed96f3fadbfbd878f24e6be7 +0 -0
- .cache/pip/http-v2/8/9/2/3/0/89230ee5375192cd78aff8dee73d946e2bcfcfb4c3ec4374132fe597.body +122 -0
- .cache/pip/http-v2/8/9/8/0/7/8980772ed68d7fbcfe2ef2b3f1911b9bd45462ad1becf93269532743 +0 -0
- .cache/pip/http-v2/8/a/c/4/d/8ac4d14dc45e27d21da49fb515570b6f875b78707de9b08ce1088d1b +0 -0
- .cache/pip/http-v2/8/a/c/4/d/8ac4d14dc45e27d21da49fb515570b6f875b78707de9b08ce1088d1b.body +0 -0
- .cache/pip/http-v2/8/c/3/e/c/8c3ecf585c815a73af16247323d407e99afb8fdc40cee3542187ad49 +0 -0
- .cache/pip/http-v2/8/c/3/e/c/8c3ecf585c815a73af16247323d407e99afb8fdc40cee3542187ad49.body +103 -0
- .cache/pip/http-v2/9/7/2/2/f/9722fb20e3ea9cc35611a7af210f3a3c5763e70a73b0619f2dce743f.body +0 -0
- .cache/pip/http-v2/9/d/b/4/b/9db4b6605ca6d6ec2ca5f1968d04b28e2b33e27564d483e330c086bf.body +0 -0
- .cache/pip/http-v2/e/0/5/f/0/e05f0d91f8df88c9349b141f38a86eaea4bf18c9e6190a296b1ada3b +0 -0
- .cache/pip/http-v2/e/9/9/d/2/e99d273763b5a9911259ba7015a44152ddf05aec2016679f6c849a2a +0 -0
- .cache/pip/http-v2/e/a/c/6/1/eac61126daf80149d2a016f12a54eab5e3b5c1dbc77410ff1a97edc4.body +0 -0
- .cache/pip/http-v2/f/4/3/c/e/f43ce2cb74a8c7ad77da70314e043a539a7f01416550c3167312132b.body +131 -0
- .cache/pip/http-v2/f/5/2/7/6/f52769e4b4d00542e1e056baf2db3e5ad8f277bff67f2636cace711d +0 -0
- .cache/pip/http-v2/f/b/c/e/7/fbce770ef113d7303a71734c8a71c6ac1b2cbc4e832a8e70832c37ca.body +0 -0
- .cache/pip/http-v2/f/b/e/3/a/fbe3a5eb3735a745707ab3bf39e17d76ea29c7cd1eaa7763f11e1766.body +128 -0
- .cache/pip/http-v2/f/c/a/5/b/fca5b18fd877930924e4c3ed44a7de4862861d131c1248697b107213 +0 -0
- .cache/pip/wheels/7e/e3/c3/89c7a2f3c4adc07cd1c675f8bb7b9ad4d18f64a72bccdfe826/origin.json +1 -0
- .cache/wandb/logs/core-debug-20240926_180107.log +9 -0
- .jupyter/migrated +1 -0
- .jupyter/nbconfig/notebook.json +7 -0
- .jupyter/nbconfig/tree.json +6 -0
- .local/share/jupyter/nbextensions/addbefore/icon.png +0 -0
- .local/share/jupyter/nbextensions/addbefore/readme.md +12 -0
- .local/share/jupyter/nbextensions/autosavetime/README.md +20 -0
- .local/share/jupyter/nbextensions/autosavetime/autosavetime.yaml +22 -0
- .local/share/jupyter/nbextensions/cell_filter/cell_filter.yml +7 -0
- .local/share/jupyter/nbextensions/code_prettify/README.md +302 -0
- .local/share/jupyter/nbextensions/code_prettify/demo-py.gif +0 -0
- .local/share/jupyter/nbextensions/codefolding/codefolding_firstline_folded.png +0 -0
- .local/share/jupyter/nbextensions/codefolding/codefolding_indent_folded_1.png +0 -0
- .local/share/jupyter/nbextensions/codefolding/codefolding_indent_unfolded.png +0 -0
- .local/share/jupyter/nbextensions/codefolding/foldgutter.css +5 -0
- .local/share/jupyter/nbextensions/codefolding/magic-folded.png +0 -0
- .local/share/jupyter/nbextensions/codefolding/main.js +282 -0
- .local/share/jupyter/nbextensions/codefolding/readme.md +105 -0
- .local/share/jupyter/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml +7 -0
- .local/share/jupyter/nbextensions/collapsible_headings/collapsible_headings.yaml +129 -0
- .local/share/jupyter/nbextensions/collapsible_headings/icon.png +0 -0
.cache/pip/http-v2/3/2/2/c/b/322cb2d2fa9c18feda7312c66e98b038ca0bb7446362e84c4a580aa3
ADDED
Binary file (1.17 kB). View file
|
|
.cache/pip/http-v2/3/3/9/7/4/33974f84394d9a943f68359da08431dab4af9f86c33962982ea21b5f
ADDED
Binary file (1.81 kB). View file
|
|
.cache/pip/http-v2/5/1/f/2/8/51f28abf47f08a699c067b6b49e9b61d7ffb241813480943666c7bcf
ADDED
Binary file (1.19 kB). View file
|
|
.cache/pip/http-v2/5/1/f/2/8/51f28abf47f08a699c067b6b49e9b61d7ffb241813480943666c7bcf.body
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: pyarrow
|
3 |
+
Version: 17.0.0
|
4 |
+
Summary: Python library for Apache Arrow
|
5 |
+
Maintainer-email: Apache Arrow Developers <[email protected]>
|
6 |
+
License: Apache Software License
|
7 |
+
Project-URL: Homepage, https://arrow.apache.org/
|
8 |
+
Project-URL: Documentation, https://arrow.apache.org/docs/python
|
9 |
+
Project-URL: Repository, https://github.com/apache/arrow
|
10 |
+
Project-URL: Issues, https://github.com/apache/arrow/issues
|
11 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
12 |
+
Classifier: Programming Language :: Python :: 3.8
|
13 |
+
Classifier: Programming Language :: Python :: 3.9
|
14 |
+
Classifier: Programming Language :: Python :: 3.10
|
15 |
+
Classifier: Programming Language :: Python :: 3.11
|
16 |
+
Classifier: Programming Language :: Python :: 3.12
|
17 |
+
Requires-Python: >=3.8
|
18 |
+
Description-Content-Type: text/markdown
|
19 |
+
License-File: ../LICENSE.txt
|
20 |
+
License-File: ../NOTICE.txt
|
21 |
+
Requires-Dist: numpy >=1.16.6
|
22 |
+
Provides-Extra: test
|
23 |
+
Requires-Dist: pytest ; extra == 'test'
|
24 |
+
Requires-Dist: hypothesis ; extra == 'test'
|
25 |
+
Requires-Dist: cffi ; extra == 'test'
|
26 |
+
Requires-Dist: pytz ; extra == 'test'
|
27 |
+
Requires-Dist: pandas ; extra == 'test'
|
28 |
+
|
29 |
+
<!---
|
30 |
+
Licensed to the Apache Software Foundation (ASF) under one
|
31 |
+
or more contributor license agreements. See the NOTICE file
|
32 |
+
distributed with this work for additional information
|
33 |
+
regarding copyright ownership. The ASF licenses this file
|
34 |
+
to you under the Apache License, Version 2.0 (the
|
35 |
+
"License"); you may not use this file except in compliance
|
36 |
+
with the License. You may obtain a copy of the License at
|
37 |
+
|
38 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
39 |
+
|
40 |
+
Unless required by applicable law or agreed to in writing,
|
41 |
+
software distributed under the License is distributed on an
|
42 |
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
43 |
+
KIND, either express or implied. See the License for the
|
44 |
+
specific language governing permissions and limitations
|
45 |
+
under the License.
|
46 |
+
-->
|
47 |
+
|
48 |
+
## Python library for Apache Arrow
|
49 |
+
|
50 |
+
[![pypi](https://img.shields.io/pypi/v/pyarrow.svg)](https://pypi.org/project/pyarrow/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/pyarrow.svg)](https://anaconda.org/conda-forge/pyarrow)
|
51 |
+
|
52 |
+
This library provides a Python API for functionality provided by the Arrow C++
|
53 |
+
libraries, along with tools for Arrow integration and interoperability with
|
54 |
+
pandas, NumPy, and other software in the Python ecosystem.
|
55 |
+
|
56 |
+
## Installing
|
57 |
+
|
58 |
+
Across platforms, you can install a recent version of pyarrow with the conda
|
59 |
+
package manager:
|
60 |
+
|
61 |
+
```shell
|
62 |
+
conda install pyarrow -c conda-forge
|
63 |
+
```
|
64 |
+
|
65 |
+
On Linux, macOS, and Windows, you can also install binary wheels from PyPI with
|
66 |
+
pip:
|
67 |
+
|
68 |
+
```shell
|
69 |
+
pip install pyarrow
|
70 |
+
```
|
71 |
+
|
72 |
+
If you encounter any issues importing the pip wheels on Windows, you may need
|
73 |
+
to install the [Visual C++ Redistributable for Visual Studio 2015][6].
|
74 |
+
|
75 |
+
## Development
|
76 |
+
|
77 |
+
See [Python Development][2] in the documentation subproject.
|
78 |
+
|
79 |
+
### Building the documentation
|
80 |
+
|
81 |
+
See [documentation build instructions][1] in the documentation subproject.
|
82 |
+
|
83 |
+
[1]: https://github.com/apache/arrow/blob/main/docs/source/developers/documentation.rst
|
84 |
+
[2]: https://github.com/apache/arrow/blob/main/docs/source/developers/python.rst
|
85 |
+
[3]: https://github.com/pandas-dev/pandas
|
86 |
+
[5]: https://arrow.apache.org/docs/latest/python/benchmarks.html
|
87 |
+
[6]: https://www.microsoft.com/en-us/download/details.aspx?id=48145
|
.cache/pip/http-v2/5/2/4/e/a/524eaa378c5eeff9b07f34d936ce7bc411da078278be84566970502d
ADDED
Binary file (1.19 kB). View file
|
|
.cache/pip/http-v2/5/4/c/b/6/54cb669eb9a885793334a25ee9e0fbe07bec87103a57cea1aaa59e27
ADDED
Binary file (1.19 kB). View file
|
|
.cache/pip/http-v2/5/6/f/9/d/56f9d9bd534016b34d1660bb01a66bb1704ef80e0f133b683da4f133
ADDED
Binary file (1.19 kB). View file
|
|
.cache/pip/http-v2/5/a/2/6/c/5a26cc45879e115d5aabd5f6ef627d6747bf3160bca5548379570c58.body
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: smmap
|
3 |
+
Version: 5.0.1
|
4 |
+
Summary: A pure Python implementation of a sliding window memory map manager
|
5 |
+
Home-page: https://github.com/gitpython-developers/smmap
|
6 |
+
Author: Sebastian Thiel
|
7 |
+
Author-email: [email protected]
|
8 |
+
License: BSD
|
9 |
+
Platform: any
|
10 |
+
Classifier: Development Status :: 5 - Production/Stable
|
11 |
+
Classifier: Environment :: Console
|
12 |
+
Classifier: Intended Audience :: Developers
|
13 |
+
Classifier: License :: OSI Approved :: BSD License
|
14 |
+
Classifier: Operating System :: OS Independent
|
15 |
+
Classifier: Operating System :: POSIX
|
16 |
+
Classifier: Operating System :: Microsoft :: Windows
|
17 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
18 |
+
Classifier: Programming Language :: Python
|
19 |
+
Classifier: Programming Language :: Python :: 3
|
20 |
+
Classifier: Programming Language :: Python :: 3.7
|
21 |
+
Classifier: Programming Language :: Python :: 3.8
|
22 |
+
Classifier: Programming Language :: Python :: 3.9
|
23 |
+
Classifier: Programming Language :: Python :: 3.10
|
24 |
+
Classifier: Programming Language :: Python :: 3.11
|
25 |
+
Classifier: Programming Language :: Python :: 3.12
|
26 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
27 |
+
Requires-Python: >=3.7
|
28 |
+
Description-Content-Type: text/markdown
|
29 |
+
License-File: LICENSE
|
30 |
+
|
31 |
+
## Motivation
|
32 |
+
|
33 |
+
When reading from many possibly large files in a fashion similar to random access, it is usually the fastest and most efficient to use memory maps.
|
34 |
+
|
35 |
+
Although memory maps have many advantages, they represent a very limited system resource as every map uses one file descriptor, whose amount is limited per process. On 32 bit systems, the amount of memory you can have mapped at a time is naturally limited to theoretical 4GB of memory, which may not be enough for some applications.
|
36 |
+
|
37 |
+
|
38 |
+
## Limitations
|
39 |
+
|
40 |
+
* **System resources (file-handles) are likely to be leaked!** This is due to the library authors reliance on a deterministic `__del__()` destructor.
|
41 |
+
* The memory access is read-only by design.
|
42 |
+
|
43 |
+
|
44 |
+
## Overview
|
45 |
+
|
46 |
+
![Python package](https://github.com/gitpython-developers/smmap/workflows/Python%20package/badge.svg)
|
47 |
+
|
48 |
+
Smmap wraps an interface around mmap and tracks the mapped files as well as the amount of clients who use it. If the system runs out of resources, or if a memory limit is reached, it will automatically unload unused maps to allow continued operation.
|
49 |
+
|
50 |
+
To allow processing large files even on 32 bit systems, it allows only portions of the file to be mapped. Once the user reads beyond the mapped region, smmap will automatically map the next required region, unloading unused regions using a LRU algorithm.
|
51 |
+
|
52 |
+
Although the library can be used most efficiently with its native interface, a Buffer implementation is provided to hide these details behind a simple string-like interface.
|
53 |
+
|
54 |
+
For performance critical 64 bit applications, a simplified version of memory mapping is provided which always maps the whole file, but still provides the benefit of unloading unused mappings on demand.
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
## Prerequisites
|
59 |
+
|
60 |
+
* Python 3.7+
|
61 |
+
* OSX, Windows or Linux
|
62 |
+
|
63 |
+
The package was tested on all of the previously mentioned configurations.
|
64 |
+
|
65 |
+
## Installing smmap
|
66 |
+
|
67 |
+
[![Documentation Status](https://readthedocs.org/projects/smmap/badge/?version=latest)](https://readthedocs.org/projects/smmap/?badge=latest)
|
68 |
+
|
69 |
+
Its easiest to install smmap using the [pip](http://www.pip-installer.org/en/latest) program:
|
70 |
+
|
71 |
+
```bash
|
72 |
+
$ pip install smmap
|
73 |
+
```
|
74 |
+
|
75 |
+
As the command will install smmap in your respective python distribution, you will most likely need root permissions to authorize the required changes.
|
76 |
+
|
77 |
+
If you have downloaded the source archive, the package can be installed by running the `setup.py` script:
|
78 |
+
|
79 |
+
```bash
|
80 |
+
$ python setup.py install
|
81 |
+
```
|
82 |
+
|
83 |
+
It is advised to have a look at the **Usage Guide** for a brief introduction on the different database implementations.
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
## Homepage and Links
|
88 |
+
|
89 |
+
The project is home on github at https://github.com/gitpython-developers/smmap .
|
90 |
+
|
91 |
+
The latest source can be cloned from github as well:
|
92 |
+
|
93 |
+
* git://github.com/gitpython-developers/smmap.git
|
94 |
+
|
95 |
+
|
96 |
+
For support, please use the git-python mailing list:
|
97 |
+
|
98 |
+
* http://groups.google.com/group/git-python
|
99 |
+
|
100 |
+
|
101 |
+
Issues can be filed on github:
|
102 |
+
|
103 |
+
* https://github.com/gitpython-developers/smmap/issues
|
104 |
+
|
105 |
+
A link to the pypi page related to this repository:
|
106 |
+
|
107 |
+
* https://pypi.org/project/smmap/
|
108 |
+
|
109 |
+
|
110 |
+
## License Information
|
111 |
+
|
112 |
+
*smmap* is licensed under the New BSD License.
|
113 |
+
|
.cache/pip/http-v2/6/5/0/7/2/65072c35290c429df2e84cb69eba045284d50944561efa156675456a
ADDED
Binary file (1.2 kB). View file
|
|
.cache/pip/http-v2/6/6/6/2/c/6662c3d76e9c2f7783002d2625d92517b2c4b994197bd6d5da887f1e.body
ADDED
Binary file (43.2 kB). View file
|
|
.cache/pip/http-v2/8/5/e/f/e/85efe0b09056afaed0a9932320bb2a590a03afe4bc35e3fffc1e85cd
ADDED
Binary file (1.15 kB). View file
|
|
.cache/pip/http-v2/8/8/b/8/b/88b8bfb8f1d620e081b2b226e7936019ed96f3fadbfbd878f24e6be7
ADDED
Binary file (1.2 kB). View file
|
|
.cache/pip/http-v2/8/9/2/3/0/89230ee5375192cd78aff8dee73d946e2bcfcfb4c3ec4374132fe597.body
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: aiohappyeyeballs
|
3 |
+
Version: 2.4.0
|
4 |
+
Summary: Happy Eyeballs for asyncio
|
5 |
+
Home-page: https://github.com/aio-libs/aiohappyeyeballs
|
6 |
+
License: Python-2.0.1
|
7 |
+
Author: J. Nick Koston
|
8 |
+
Author-email: [email protected]
|
9 |
+
Requires-Python: >=3.8
|
10 |
+
Classifier: Development Status :: 5 - Production/Stable
|
11 |
+
Classifier: Intended Audience :: Developers
|
12 |
+
Classifier: License :: OSI Approved :: Python Software Foundation License
|
13 |
+
Classifier: License :: Other/Proprietary License
|
14 |
+
Classifier: Natural Language :: English
|
15 |
+
Classifier: Operating System :: OS Independent
|
16 |
+
Classifier: Programming Language :: Python :: 3
|
17 |
+
Classifier: Programming Language :: Python :: 3.8
|
18 |
+
Classifier: Programming Language :: Python :: 3.9
|
19 |
+
Classifier: Programming Language :: Python :: 3.10
|
20 |
+
Classifier: Programming Language :: Python :: 3.11
|
21 |
+
Classifier: Programming Language :: Python :: 3.12
|
22 |
+
Classifier: Programming Language :: Python :: 3.13
|
23 |
+
Classifier: Topic :: Software Development :: Libraries
|
24 |
+
Project-URL: Bug Tracker, https://github.com/aio-libs/aiohappyeyeballs/issues
|
25 |
+
Project-URL: Changelog, https://github.com/aio-libs/aiohappyeyeballs/blob/main/CHANGELOG.md
|
26 |
+
Project-URL: Documentation, https://aiohappyeyeballs.readthedocs.io
|
27 |
+
Project-URL: Repository, https://github.com/aio-libs/aiohappyeyeballs
|
28 |
+
Description-Content-Type: text/markdown
|
29 |
+
|
30 |
+
# aiohappyeyeballs
|
31 |
+
|
32 |
+
<p align="center">
|
33 |
+
<a href="https://github.com/aio-libs/aiohappyeyeballs/actions/workflows/ci.yml?query=branch%3Amain">
|
34 |
+
<img src="https://img.shields.io/github/actions/workflow/status/aio-libs/aiohappyeyeballs/ci-cd.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
|
35 |
+
</a>
|
36 |
+
<a href="https://aiohappyeyeballs.readthedocs.io">
|
37 |
+
<img src="https://img.shields.io/readthedocs/aiohappyeyeballs.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">
|
38 |
+
</a>
|
39 |
+
<a href="https://codecov.io/gh/aio-libs/aiohappyeyeballs">
|
40 |
+
<img src="https://img.shields.io/codecov/c/github/aio-libs/aiohappyeyeballs.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
|
41 |
+
</a>
|
42 |
+
</p>
|
43 |
+
<p align="center">
|
44 |
+
<a href="https://python-poetry.org/">
|
45 |
+
<img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
|
46 |
+
</a>
|
47 |
+
<a href="https://github.com/ambv/black">
|
48 |
+
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square" alt="black">
|
49 |
+
</a>
|
50 |
+
<a href="https://github.com/pre-commit/pre-commit">
|
51 |
+
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
|
52 |
+
</a>
|
53 |
+
</p>
|
54 |
+
<p align="center">
|
55 |
+
<a href="https://pypi.org/project/aiohappyeyeballs/">
|
56 |
+
<img src="https://img.shields.io/pypi/v/aiohappyeyeballs.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
|
57 |
+
</a>
|
58 |
+
<img src="https://img.shields.io/pypi/pyversions/aiohappyeyeballs.svg?style=flat-square&logo=python&logoColor=fff" alt="Supported Python versions">
|
59 |
+
<img src="https://img.shields.io/pypi/l/aiohappyeyeballs.svg?style=flat-square" alt="License">
|
60 |
+
</p>
|
61 |
+
|
62 |
+
---
|
63 |
+
|
64 |
+
**Documentation**: <a href="https://aiohappyeyeballs.readthedocs.io" target="_blank">https://aiohappyeyeballs.readthedocs.io </a>
|
65 |
+
|
66 |
+
**Source Code**: <a href="https://github.com/aio-libs/aiohappyeyeballs" target="_blank">https://github.com/aio-libs/aiohappyeyeballs </a>
|
67 |
+
|
68 |
+
---
|
69 |
+
|
70 |
+
[Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs)
|
71 |
+
([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html))
|
72 |
+
|
73 |
+
## Use case
|
74 |
+
|
75 |
+
This library exists to allow connecting with
|
76 |
+
[Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs)
|
77 |
+
([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html))
|
78 |
+
when you
|
79 |
+
already have a list of addrinfo and not a DNS name.
|
80 |
+
|
81 |
+
The stdlib version of `loop.create_connection()`
|
82 |
+
will only work when you pass in an unresolved name which
|
83 |
+
is not a good fit when using DNS caching or resolving
|
84 |
+
names via another method such as `zeroconf`.
|
85 |
+
|
86 |
+
## Installation
|
87 |
+
|
88 |
+
Install this via pip (or your favourite package manager):
|
89 |
+
|
90 |
+
`pip install aiohappyeyeballs`
|
91 |
+
|
92 |
+
## Example usage
|
93 |
+
|
94 |
+
```python
|
95 |
+
|
96 |
+
addr_infos = await loop.getaddrinfo("example.org", 80)
|
97 |
+
|
98 |
+
socket = await start_connection(addr_infos)
|
99 |
+
socket = await start_connection(addr_infos, local_addr_infos=local_addr_infos, happy_eyeballs_delay=0.2)
|
100 |
+
|
101 |
+
transport, protocol = await loop.create_connection(
|
102 |
+
MyProtocol, sock=socket, ...)
|
103 |
+
|
104 |
+
# Remove the first address for each family from addr_info
|
105 |
+
pop_addr_infos_interleave(addr_info, 1)
|
106 |
+
|
107 |
+
# Remove all matching address from addr_info
|
108 |
+
remove_addr_infos(addr_info, "dead::beef::")
|
109 |
+
|
110 |
+
# Convert a local_addr to local_addr_infos
|
111 |
+
local_addr_infos = addr_to_addr_infos(("127.0.0.1",0))
|
112 |
+
```
|
113 |
+
|
114 |
+
## Credits
|
115 |
+
|
116 |
+
This package contains code from cpython and is licensed under the same terms as cpython itself.
|
117 |
+
|
118 |
+
This package was created with
|
119 |
+
[Copier](https://copier.readthedocs.io/) and the
|
120 |
+
[browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
|
121 |
+
project template.
|
122 |
+
|
.cache/pip/http-v2/8/9/8/0/7/8980772ed68d7fbcfe2ef2b3f1911b9bd45462ad1becf93269532743
ADDED
Binary file (1.11 kB). View file
|
|
.cache/pip/http-v2/8/a/c/4/d/8ac4d14dc45e27d21da49fb515570b6f875b78707de9b08ce1088d1b
ADDED
Binary file (1.82 kB). View file
|
|
.cache/pip/http-v2/8/a/c/4/d/8ac4d14dc45e27d21da49fb515570b6f875b78707de9b08ce1088d1b.body
ADDED
Binary file (14.1 kB). View file
|
|
.cache/pip/http-v2/8/c/3/e/c/8c3ecf585c815a73af16247323d407e99afb8fdc40cee3542187ad49
ADDED
Binary file (1.15 kB). View file
|
|
.cache/pip/http-v2/8/c/3/e/c/8c3ecf585c815a73af16247323d407e99afb8fdc40cee3542187ad49.body
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: click
|
3 |
+
Version: 8.1.7
|
4 |
+
Summary: Composable command line interface toolkit
|
5 |
+
Home-page: https://palletsprojects.com/p/click/
|
6 |
+
Maintainer: Pallets
|
7 |
+
Maintainer-email: [email protected]
|
8 |
+
License: BSD-3-Clause
|
9 |
+
Project-URL: Donate, https://palletsprojects.com/donate
|
10 |
+
Project-URL: Documentation, https://click.palletsprojects.com/
|
11 |
+
Project-URL: Changes, https://click.palletsprojects.com/changes/
|
12 |
+
Project-URL: Source Code, https://github.com/pallets/click/
|
13 |
+
Project-URL: Issue Tracker, https://github.com/pallets/click/issues/
|
14 |
+
Project-URL: Chat, https://discord.gg/pallets
|
15 |
+
Classifier: Development Status :: 5 - Production/Stable
|
16 |
+
Classifier: Intended Audience :: Developers
|
17 |
+
Classifier: License :: OSI Approved :: BSD License
|
18 |
+
Classifier: Operating System :: OS Independent
|
19 |
+
Classifier: Programming Language :: Python
|
20 |
+
Requires-Python: >=3.7
|
21 |
+
Description-Content-Type: text/x-rst
|
22 |
+
License-File: LICENSE.rst
|
23 |
+
Requires-Dist: colorama ; platform_system == "Windows"
|
24 |
+
Requires-Dist: importlib-metadata ; python_version < "3.8"
|
25 |
+
|
26 |
+
\$ click\_
|
27 |
+
==========
|
28 |
+
|
29 |
+
Click is a Python package for creating beautiful command line interfaces
|
30 |
+
in a composable way with as little code as necessary. It's the "Command
|
31 |
+
Line Interface Creation Kit". It's highly configurable but comes with
|
32 |
+
sensible defaults out of the box.
|
33 |
+
|
34 |
+
It aims to make the process of writing command line tools quick and fun
|
35 |
+
while also preventing any frustration caused by the inability to
|
36 |
+
implement an intended CLI API.
|
37 |
+
|
38 |
+
Click in three points:
|
39 |
+
|
40 |
+
- Arbitrary nesting of commands
|
41 |
+
- Automatic help page generation
|
42 |
+
- Supports lazy loading of subcommands at runtime
|
43 |
+
|
44 |
+
|
45 |
+
Installing
|
46 |
+
----------
|
47 |
+
|
48 |
+
Install and update using `pip`_:
|
49 |
+
|
50 |
+
.. code-block:: text
|
51 |
+
|
52 |
+
$ pip install -U click
|
53 |
+
|
54 |
+
.. _pip: https://pip.pypa.io/en/stable/getting-started/
|
55 |
+
|
56 |
+
|
57 |
+
A Simple Example
|
58 |
+
----------------
|
59 |
+
|
60 |
+
.. code-block:: python
|
61 |
+
|
62 |
+
import click
|
63 |
+
|
64 |
+
@click.command()
|
65 |
+
@click.option("--count", default=1, help="Number of greetings.")
|
66 |
+
@click.option("--name", prompt="Your name", help="The person to greet.")
|
67 |
+
def hello(count, name):
|
68 |
+
"""Simple program that greets NAME for a total of COUNT times."""
|
69 |
+
for _ in range(count):
|
70 |
+
click.echo(f"Hello, {name}!")
|
71 |
+
|
72 |
+
if __name__ == '__main__':
|
73 |
+
hello()
|
74 |
+
|
75 |
+
.. code-block:: text
|
76 |
+
|
77 |
+
$ python hello.py --count=3
|
78 |
+
Your name: Click
|
79 |
+
Hello, Click!
|
80 |
+
Hello, Click!
|
81 |
+
Hello, Click!
|
82 |
+
|
83 |
+
|
84 |
+
Donate
|
85 |
+
------
|
86 |
+
|
87 |
+
The Pallets organization develops and supports Click and other popular
|
88 |
+
packages. In order to grow the community of contributors and users, and
|
89 |
+
allow the maintainers to devote more time to the projects, `please
|
90 |
+
donate today`_.
|
91 |
+
|
92 |
+
.. _please donate today: https://palletsprojects.com/donate
|
93 |
+
|
94 |
+
|
95 |
+
Links
|
96 |
+
-----
|
97 |
+
|
98 |
+
- Documentation: https://click.palletsprojects.com/
|
99 |
+
- Changes: https://click.palletsprojects.com/changes/
|
100 |
+
- PyPI Releases: https://pypi.org/project/click/
|
101 |
+
- Source Code: https://github.com/pallets/click
|
102 |
+
- Issue Tracker: https://github.com/pallets/click/issues
|
103 |
+
- Chat: https://discord.gg/pallets
|
.cache/pip/http-v2/9/7/2/2/f/9722fb20e3ea9cc35611a7af210f3a3c5763e70a73b0619f2dce743f.body
ADDED
Binary file (7.62 kB). View file
|
|
.cache/pip/http-v2/9/d/b/4/b/9db4b6605ca6d6ec2ca5f1968d04b28e2b33e27564d483e330c086bf.body
ADDED
Binary file (30.8 kB). View file
|
|
.cache/pip/http-v2/e/0/5/f/0/e05f0d91f8df88c9349b141f38a86eaea4bf18c9e6190a296b1ada3b
ADDED
Binary file (1.84 kB). View file
|
|
.cache/pip/http-v2/e/9/9/d/2/e99d273763b5a9911259ba7015a44152ddf05aec2016679f6c849a2a
ADDED
Binary file (1.17 kB). View file
|
|
.cache/pip/http-v2/e/a/c/6/1/eac61126daf80149d2a016f12a54eab5e3b5c1dbc77410ff1a97edc4.body
ADDED
Binary file (29.1 kB). View file
|
|
.cache/pip/http-v2/f/4/3/c/e/f43ce2cb74a8c7ad77da70314e043a539a7f01416550c3167312132b.body
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: async-timeout
|
3 |
+
Version: 4.0.3
|
4 |
+
Summary: Timeout context manager for asyncio programs
|
5 |
+
Home-page: https://github.com/aio-libs/async-timeout
|
6 |
+
Author: Andrew Svetlov <[email protected]>
|
7 |
+
Author-email: [email protected]
|
8 |
+
License: Apache 2
|
9 |
+
Project-URL: Chat: Gitter, https://gitter.im/aio-libs/Lobby
|
10 |
+
Project-URL: CI: GitHub Actions, https://github.com/aio-libs/async-timeout/actions
|
11 |
+
Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/async-timeout
|
12 |
+
Project-URL: GitHub: issues, https://github.com/aio-libs/async-timeout/issues
|
13 |
+
Project-URL: GitHub: repo, https://github.com/aio-libs/async-timeout
|
14 |
+
Classifier: Development Status :: 5 - Production/Stable
|
15 |
+
Classifier: Topic :: Software Development :: Libraries
|
16 |
+
Classifier: Framework :: AsyncIO
|
17 |
+
Classifier: Intended Audience :: Developers
|
18 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
19 |
+
Classifier: Programming Language :: Python
|
20 |
+
Classifier: Programming Language :: Python :: 3
|
21 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
22 |
+
Classifier: Programming Language :: Python :: 3.7
|
23 |
+
Classifier: Programming Language :: Python :: 3.8
|
24 |
+
Classifier: Programming Language :: Python :: 3.9
|
25 |
+
Classifier: Programming Language :: Python :: 3.10
|
26 |
+
Classifier: Programming Language :: Python :: 3.11
|
27 |
+
Requires-Python: >=3.7
|
28 |
+
Description-Content-Type: text/x-rst
|
29 |
+
License-File: LICENSE
|
30 |
+
Requires-Dist: typing-extensions >=3.6.5 ; python_version < "3.8"
|
31 |
+
|
32 |
+
async-timeout
|
33 |
+
=============
|
34 |
+
.. image:: https://travis-ci.com/aio-libs/async-timeout.svg?branch=master
|
35 |
+
:target: https://travis-ci.com/aio-libs/async-timeout
|
36 |
+
.. image:: https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
|
37 |
+
:target: https://codecov.io/gh/aio-libs/async-timeout
|
38 |
+
.. image:: https://img.shields.io/pypi/v/async-timeout.svg
|
39 |
+
:target: https://pypi.python.org/pypi/async-timeout
|
40 |
+
.. image:: https://badges.gitter.im/Join%20Chat.svg
|
41 |
+
:target: https://gitter.im/aio-libs/Lobby
|
42 |
+
:alt: Chat on Gitter
|
43 |
+
|
44 |
+
asyncio-compatible timeout context manager.
|
45 |
+
|
46 |
+
|
47 |
+
Usage example
|
48 |
+
-------------
|
49 |
+
|
50 |
+
|
51 |
+
The context manager is useful in cases when you want to apply timeout
|
52 |
+
logic around block of code or in cases when ``asyncio.wait_for()`` is
|
53 |
+
not suitable. Also it's much faster than ``asyncio.wait_for()``
|
54 |
+
because ``timeout`` doesn't create a new task.
|
55 |
+
|
56 |
+
The ``timeout(delay, *, loop=None)`` call returns a context manager
|
57 |
+
that cancels a block on *timeout* expiring::
|
58 |
+
|
59 |
+
from async_timeout import timeout
|
60 |
+
async with timeout(1.5):
|
61 |
+
await inner()
|
62 |
+
|
63 |
+
1. If ``inner()`` is executed faster than in ``1.5`` seconds nothing
|
64 |
+
happens.
|
65 |
+
2. Otherwise ``inner()`` is cancelled internally by sending
|
66 |
+
``asyncio.CancelledError`` into but ``asyncio.TimeoutError`` is
|
67 |
+
raised outside of context manager scope.
|
68 |
+
|
69 |
+
*timeout* parameter could be ``None`` for skipping timeout functionality.
|
70 |
+
|
71 |
+
|
72 |
+
Alternatively, ``timeout_at(when)`` can be used for scheduling
|
73 |
+
at the absolute time::
|
74 |
+
|
75 |
+
loop = asyncio.get_event_loop()
|
76 |
+
now = loop.time()
|
77 |
+
|
78 |
+
async with timeout_at(now + 1.5):
|
79 |
+
await inner()
|
80 |
+
|
81 |
+
|
82 |
+
Please note: it is not POSIX time but a time with
|
83 |
+
undefined starting base, e.g. the time of the system power on.
|
84 |
+
|
85 |
+
|
86 |
+
Context manager has ``.expired`` property for check if timeout happens
|
87 |
+
exactly in context manager::
|
88 |
+
|
89 |
+
async with timeout(1.5) as cm:
|
90 |
+
await inner()
|
91 |
+
print(cm.expired)
|
92 |
+
|
93 |
+
The property is ``True`` if ``inner()`` execution is cancelled by
|
94 |
+
timeout context manager.
|
95 |
+
|
96 |
+
If ``inner()`` call explicitly raises ``TimeoutError`` ``cm.expired``
|
97 |
+
is ``False``.
|
98 |
+
|
99 |
+
The scheduled deadline time is available as ``.deadline`` property::
|
100 |
+
|
101 |
+
async with timeout(1.5) as cm:
|
102 |
+
cm.deadline
|
103 |
+
|
104 |
+
Not finished yet timeout can be rescheduled by ``shift_by()``
|
105 |
+
or ``shift_to()`` methods::
|
106 |
+
|
107 |
+
async with timeout(1.5) as cm:
|
108 |
+
cm.shift(1) # add another second on waiting
|
109 |
+
cm.update(loop.time() + 5) # reschedule to now+5 seconds
|
110 |
+
|
111 |
+
Rescheduling is forbidden if the timeout is expired or after exit from ``async with``
|
112 |
+
code block.
|
113 |
+
|
114 |
+
|
115 |
+
Installation
|
116 |
+
------------
|
117 |
+
|
118 |
+
::
|
119 |
+
|
120 |
+
$ pip install async-timeout
|
121 |
+
|
122 |
+
The library is Python 3 only!
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
Authors and License
|
127 |
+
-------------------
|
128 |
+
|
129 |
+
The module is written by Andrew Svetlov.
|
130 |
+
|
131 |
+
It's *Apache 2* licensed and freely available.
|
.cache/pip/http-v2/f/5/2/7/6/f52769e4b4d00542e1e056baf2db3e5ad8f277bff67f2636cace711d
ADDED
Binary file (1.15 kB). View file
|
|
.cache/pip/http-v2/f/b/c/e/7/fbce770ef113d7303a71734c8a71c6ac1b2cbc4e832a8e70832c37ca.body
ADDED
Binary file (78.4 kB). View file
|
|
.cache/pip/http-v2/f/b/e/3/a/fbe3a5eb3735a745707ab3bf39e17d76ea29c7cd1eaa7763f11e1766.body
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: aiosignal
|
3 |
+
Version: 1.3.1
|
4 |
+
Summary: aiosignal: a list of registered asynchronous callbacks
|
5 |
+
Home-page: https://github.com/aio-libs/aiosignal
|
6 |
+
Maintainer: aiohttp team <[email protected]>
|
7 |
+
Maintainer-email: [email protected]
|
8 |
+
License: Apache 2.0
|
9 |
+
Project-URL: Chat: Gitter, https://gitter.im/aio-libs/Lobby
|
10 |
+
Project-URL: CI: GitHub Actions, https://github.com/aio-libs/aiosignal/actions
|
11 |
+
Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/aiosignal
|
12 |
+
Project-URL: Docs: RTD, https://docs.aiosignal.org
|
13 |
+
Project-URL: GitHub: issues, https://github.com/aio-libs/aiosignal/issues
|
14 |
+
Project-URL: GitHub: repo, https://github.com/aio-libs/aiosignal
|
15 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
16 |
+
Classifier: Intended Audience :: Developers
|
17 |
+
Classifier: Programming Language :: Python
|
18 |
+
Classifier: Programming Language :: Python :: 3
|
19 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
20 |
+
Classifier: Programming Language :: Python :: 3.7
|
21 |
+
Classifier: Programming Language :: Python :: 3.8
|
22 |
+
Classifier: Programming Language :: Python :: 3.9
|
23 |
+
Classifier: Programming Language :: Python :: 3.10
|
24 |
+
Classifier: Programming Language :: Python :: 3.11
|
25 |
+
Classifier: Development Status :: 5 - Production/Stable
|
26 |
+
Classifier: Operating System :: POSIX
|
27 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
28 |
+
Classifier: Operating System :: Microsoft :: Windows
|
29 |
+
Classifier: Framework :: AsyncIO
|
30 |
+
Requires-Python: >=3.7
|
31 |
+
Description-Content-Type: text/x-rst
|
32 |
+
License-File: LICENSE
|
33 |
+
Requires-Dist: frozenlist (>=1.1.0)
|
34 |
+
|
35 |
+
=========
|
36 |
+
aiosignal
|
37 |
+
=========
|
38 |
+
|
39 |
+
.. image:: https://github.com/aio-libs/aiosignal/workflows/CI/badge.svg
|
40 |
+
:target: https://github.com/aio-libs/aiosignal/actions?query=workflow%3ACI
|
41 |
+
:alt: GitHub status for master branch
|
42 |
+
|
43 |
+
.. image:: https://codecov.io/gh/aio-libs/aiosignal/branch/master/graph/badge.svg
|
44 |
+
:target: https://codecov.io/gh/aio-libs/aiosignal
|
45 |
+
:alt: codecov.io status for master branch
|
46 |
+
|
47 |
+
.. image:: https://badge.fury.io/py/aiosignal.svg
|
48 |
+
:target: https://pypi.org/project/aiosignal
|
49 |
+
:alt: Latest PyPI package version
|
50 |
+
|
51 |
+
.. image:: https://readthedocs.org/projects/aiosignal/badge/?version=latest
|
52 |
+
:target: https://aiosignal.readthedocs.io/
|
53 |
+
:alt: Latest Read The Docs
|
54 |
+
|
55 |
+
.. image:: https://img.shields.io/discourse/topics?server=https%3A%2F%2Faio-libs.discourse.group%2F
|
56 |
+
:target: https://aio-libs.discourse.group/
|
57 |
+
:alt: Discourse group for io-libs
|
58 |
+
|
59 |
+
.. image:: https://badges.gitter.im/Join%20Chat.svg
|
60 |
+
:target: https://gitter.im/aio-libs/Lobby
|
61 |
+
:alt: Chat on Gitter
|
62 |
+
|
63 |
+
Introduction
|
64 |
+
============
|
65 |
+
|
66 |
+
A project to manage callbacks in `asyncio` projects.
|
67 |
+
|
68 |
+
``Signal`` is a list of registered asynchronous callbacks.
|
69 |
+
|
70 |
+
The signal's life-cycle has two stages: after creation its content
|
71 |
+
could be filled by using standard list operations: ``sig.append()``
|
72 |
+
etc.
|
73 |
+
|
74 |
+
After you call ``sig.freeze()`` the signal is *frozen*: adding, removing
|
75 |
+
and dropping callbacks is forbidden.
|
76 |
+
|
77 |
+
The only available operation is calling the previously registered
|
78 |
+
callbacks by using ``await sig.send(data)``.
|
79 |
+
|
80 |
+
For concrete usage examples see the `Signals
|
81 |
+
<https://docs.aiohttp.org/en/stable/web_advanced.html#aiohttp-web-signals>
|
82 |
+
section of the `Web Server Advanced
|
83 |
+
<https://docs.aiohttp.org/en/stable/web_advanced.html>` chapter of the `aiohttp
|
84 |
+
documentation`_.
|
85 |
+
|
86 |
+
|
87 |
+
Installation
|
88 |
+
------------
|
89 |
+
|
90 |
+
::
|
91 |
+
|
92 |
+
$ pip install aiosignal
|
93 |
+
|
94 |
+
The library requires Python 3.6 or newer.
|
95 |
+
|
96 |
+
|
97 |
+
Documentation
|
98 |
+
=============
|
99 |
+
|
100 |
+
https://aiosignal.readthedocs.io/
|
101 |
+
|
102 |
+
Communication channels
|
103 |
+
======================
|
104 |
+
|
105 |
+
*gitter chat* https://gitter.im/aio-libs/Lobby
|
106 |
+
|
107 |
+
Requirements
|
108 |
+
============
|
109 |
+
|
110 |
+
- Python >= 3.6
|
111 |
+
- frozenlist >= 1.0.0
|
112 |
+
|
113 |
+
License
|
114 |
+
=======
|
115 |
+
|
116 |
+
``aiosignal`` is offered under the Apache 2 license.
|
117 |
+
|
118 |
+
Source code
|
119 |
+
===========
|
120 |
+
|
121 |
+
The project is hosted on GitHub_
|
122 |
+
|
123 |
+
Please file an issue in the `bug tracker
|
124 |
+
<https://github.com/aio-libs/aiosignal/issues>`_ if you have found a bug
|
125 |
+
or have some suggestions to improve the library.
|
126 |
+
|
127 |
+
.. _GitHub: https://github.com/aio-libs/aiosignal
|
128 |
+
.. _aiohttp documentation: https://docs.aiohttp.org/
|
.cache/pip/http-v2/f/c/a/5/b/fca5b18fd877930924e4c3ed44a7de4862861d131c1248697b107213
ADDED
Binary file (1.16 kB). View file
|
|
.cache/pip/wheels/7e/e3/c3/89c7a2f3c4adc07cd1c675f8bb7b9ad4d18f64a72bccdfe826/origin.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"archive_info": {"hash": "sha256=5bfae9500ad8e7d2937ebccb4906f3bc464d1bf66eedd0e4adabd520811c7b52", "hashes": {"sha256": "5bfae9500ad8e7d2937ebccb4906f3bc464d1bf66eedd0e4adabd520811c7b52"}}, "url": "https://files.pythonhosted.org/packages/cd/1e/21321670cd3c2f225026d9fd89272cae661529238850e79f48ccf2f9e4e3/flash_attn-2.6.3.tar.gz"}
|
.cache/wandb/logs/core-debug-20240926_180107.log
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"time":"2024-09-26T18:01:07.637065841Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmpn3byfp8o/port-5326.txt","pid":5326,"debug":false,"disable-analytics":false}
|
2 |
+
{"time":"2024-09-26T18:01:07.637109316Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
|
3 |
+
{"time":"2024-09-26T18:01:07.637939058Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":5326}
|
4 |
+
{"time":"2024-09-26T18:01:07.637918908Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":38193,"Zone":""}}
|
5 |
+
{"time":"2024-09-26T18:01:07.833948201Z","level":"INFO","msg":"created new connection","id":"127.0.0.1:53288"}
|
6 |
+
{"time":"2024-09-26T18:01:08.272107166Z","level":"INFO","msg":"connection init received","streamId":"qqp17sde","id":"127.0.0.1:53288"}
|
7 |
+
{"time":"2024-09-26T18:01:08.272615297Z","level":"ERROR","msg":"error creating symlink","error":"symlink /root/.cache/wandb/logs/core-debug-20240926_180107.log /root/wandb/run-20240926_180108-qqp17sde/logs/debug-core.log: file exists"}
|
8 |
+
{"time":"2024-09-26T18:01:08.275500036Z","level":"INFO","msg":"connection init completed","streamId":"qqp17sde","id":"127.0.0.1:53288"}
|
9 |
+
{"time":"2024-09-26T18:06:51.692081081Z","level":"INFO","msg":"Parent process exited, terminating service process."}
|
.jupyter/migrated
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
2024-09-25T18:27:22.795502+00:00
|
.jupyter/nbconfig/notebook.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"load_extensions": {
|
3 |
+
"nbextensions_configurator/config_menu/main": true,
|
4 |
+
"contrib_nbextensions_help_item/main": true,
|
5 |
+
"jupyter-js-widgets/extension": true
|
6 |
+
}
|
7 |
+
}
|
.jupyter/nbconfig/tree.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"load_extensions": {
|
3 |
+
"nbextensions_configurator/tree_tab/main": true,
|
4 |
+
"nbzip/tree": true
|
5 |
+
}
|
6 |
+
}
|
.local/share/jupyter/nbextensions/addbefore/icon.png
ADDED
![]() |
.local/share/jupyter/nbextensions/addbefore/readme.md
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Addbefore
|
2 |
+
=========
|
3 |
+
|
4 |
+
This extension adds a button to add a empty cell before the currently active cell.
|
5 |
+
As was present in IPython 1.0.
|
6 |
+
It is with a circled up arrow.
|
7 |
+
The plus signed "Add Cell After button" is moved to be next to Add Cell Before,
|
8 |
+
and given matching circled down arrow icon.
|
9 |
+
|
10 |
+
The functionality of the buttons are as per in the Insert Menu,
|
11 |
+
for Insert Cell Above, and Insert Cell Below.
|
12 |
+
A empty cell is added, and it takes the cursor focus.
|
.local/share/jupyter/nbextensions/autosavetime/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
autosavetime
|
2 |
+
============
|
3 |
+
|
4 |
+
|
5 |
+
Description
|
6 |
+
-----------
|
7 |
+
|
8 |
+
Optionally set the notebook autosave interval, and/or add a selector to the
|
9 |
+
toolbar to set it.
|
10 |
+
|
11 |
+
|
12 |
+
Parameters
|
13 |
+
----------
|
14 |
+
|
15 |
+
* `autosavetime_set_starting_interval` -
|
16 |
+
Set an autosave interval on notebook load. If false, the default is unchanged.
|
17 |
+
* `autosavetime_starting_interval` -
|
18 |
+
Autosave interval (in minutes) which would be set on notebook load.
|
19 |
+
* `autosavetime_show_selector` -
|
20 |
+
Add a selector to the toolbar to change the autosave interval
|
.local/share/jupyter/nbextensions/autosavetime/autosavetime.yaml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: IPython Notebook Extension
|
2 |
+
Compatibility: 3.x, 4.x, 5.x
|
3 |
+
Name: AutoSaveTime
|
4 |
+
Main: main.js
|
5 |
+
Icon: icon.png
|
6 |
+
Link: README.md
|
7 |
+
Description: Optionally set the notebook autosave interval, and/or add a selector to the toolbar to set it
|
8 |
+
Parameters:
|
9 |
+
- name: autosavetime_set_starting_interval
|
10 |
+
description: Set an autosave interval on notebook load. If false, the default is unchanged.
|
11 |
+
input_type: checkbox
|
12 |
+
default: false
|
13 |
+
- name: autosavetime_starting_interval
|
14 |
+
description: Autosave interval (in minutes) which would be set on notebook load.
|
15 |
+
input_type: number
|
16 |
+
min: 0
|
17 |
+
step: 1
|
18 |
+
default: 2
|
19 |
+
- name: autosavetime_show_selector
|
20 |
+
description: add a selector to the toolbar to change the autosave interval
|
21 |
+
input_type: checkbox
|
22 |
+
default: true
|
.local/share/jupyter/nbextensions/cell_filter/cell_filter.yml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: Jupyter Notebook Extension
|
2 |
+
Compatibility: 4.x, 5.x
|
3 |
+
Name: Cell Filter
|
4 |
+
Main: cell_filter.js
|
5 |
+
Link: README.md
|
6 |
+
Description: |
|
7 |
+
An extension that allows you to filter cells by tags. Keywords entered into the search bar separated by spaces joins them with logical AND.
|
.local/share/jupyter/nbextensions/code_prettify/README.md
ADDED
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
KernelExecOnCells library and nbextensions
|
2 |
+
==========================================
|
3 |
+
|
4 |
+
The KernelExecOnCells library is a shared library for creating Jupyter
|
5 |
+
nbextensions which transform code cell text using calls to the active kernel.
|
6 |
+
|
7 |
+
This scheme has been applied to create several nbextensions which are also
|
8 |
+
included in the repository.
|
9 |
+
For instance, to prettify code, see the [code-prettify] nbextension, or to
|
10 |
+
refactor python 2 code for python 3, see the [2to3] extension.
|
11 |
+
These nbextensions are defined as simple plugins of the main KernelExecOnCells
|
12 |
+
library. Defining such a plugin, [jupyter-autopep8], is described in the last section below.
|
13 |
+
|
14 |
+
|
15 |
+
Compatible Kernels
|
16 |
+
------------------
|
17 |
+
|
18 |
+
The library is kernel-language agnostic, as described in the [internals]
|
19 |
+
section below. Essentially any kernel capable of interpreting and creating
|
20 |
+
json-formatted strings, and sending them to the stream output (where print
|
21 |
+
statements in most languages go) should be easy to integrate.
|
22 |
+
Hopefully, that covers pretty much all languages!
|
23 |
+
|
24 |
+
|
25 |
+
Options
|
26 |
+
-------
|
27 |
+
|
28 |
+
The library uses a series of options, describing the configuration of the
|
29 |
+
plugin. Default values for these options are specified as an object in the
|
30 |
+
plugin source file, and can be overriden by values loaded from config.
|
31 |
+
There are a few nbextension-wide options, configurable using the
|
32 |
+
[jupyter_nbextensions_configurator] or by editing the `notebook` section config
|
33 |
+
file directly.
|
34 |
+
If `mod_name` is the name of the plugin module (e.g. `code_prettify`, `2to3`,
|
35 |
+
...) and `LANG` the lowercased kernel language (eg julia, python, r ...), then
|
36 |
+
the options are as follows:
|
37 |
+
|
38 |
+
- `mod_name.add_toolbar_button`:
|
39 |
+
Whether to add a toolbar button to transform the selected cell(s).
|
40 |
+
Defaults to `true`.
|
41 |
+
|
42 |
+
- `mod_name.button_icon`:
|
43 |
+
A font-awesome class defining the icon used for the toolbar button and
|
44 |
+
actions. See [fontawesome] for available icon classes.
|
45 |
+
Defaults to `fa-legal`.
|
46 |
+
|
47 |
+
- `mod_name.button_label`:
|
48 |
+
Toolbar button label text. Also used in the actions' help text.
|
49 |
+
Defaults to `mod_name`.
|
50 |
+
|
51 |
+
- `mod_name.register_hotkey`:
|
52 |
+
Whether to register hotkeys to transform the selected cell(s)/whole notebook.
|
53 |
+
Defaults to `true`.
|
54 |
+
|
55 |
+
- `mod_name.hotkeys.process_all`:
|
56 |
+
Hotkey to use to transform all the code cells in the notebook.
|
57 |
+
Defaults to `Ctrl-Shift-L`.
|
58 |
+
|
59 |
+
- `mod_name.hotkeys.process_selected`:
|
60 |
+
Hotkey to use to transform the selected cell(s).
|
61 |
+
Defaults to `Ctrl-L`.
|
62 |
+
|
63 |
+
- `mod_name.show_alerts_for_errors`:
|
64 |
+
Whether to show alerts for errors in the kernel calls.
|
65 |
+
Defaults to `true`.
|
66 |
+
|
67 |
+
- `mod_name.kernel_config_map_json`:
|
68 |
+
The value of this key is a string which can be parsed into a json object
|
69 |
+
giving the config for each kernel language.
|
70 |
+
|
71 |
+
The following give the per-kernel options of the parsed json, using the
|
72 |
+
language key `LANG`, to be replaced as appropriate:
|
73 |
+
|
74 |
+
* `mod_name.kernel_config_map_json.LANG.library`:
|
75 |
+
String to execute in the kernel in order to load any necessary kernel
|
76 |
+
libraries.
|
77 |
+
|
78 |
+
* `mod_name.kernel_config_map_json.LANG.replacements_json_to_kernel`:
|
79 |
+
a list of pairs of strings, used as arguments to javascript's
|
80 |
+
`String.replace(from, to)` to translate from a json string into a valid
|
81 |
+
representation of the same string in the kernel language. Since json
|
82 |
+
strings are particularly simple, this can often (as with the python
|
83 |
+
language) be left as the default, an empty list.
|
84 |
+
|
85 |
+
* `mod_name.kernel_config_map_json.LANG.prefix` and
|
86 |
+
`mod_name.kernel_config_map_json.LANG.postfix`:
|
87 |
+
strings added as bookends to the kernel string (translated from the json
|
88 |
+
string using the replacements above) to make up the kernel prettifier call
|
89 |
+
kernel's prettifier libraries.
|
90 |
+
|
91 |
+
* `mod_name.kernel_config_map_json.LANG.trim_formatted_text`:
|
92 |
+
Whether to trim whitespace from the transformed cell text. Since jupyter
|
93 |
+
cells don't usually have leading or trailing whitespace, the default
|
94 |
+
behaviour is to trim the transformed text, in order to prevent the
|
95 |
+
transform adding extra newlines at the end (a common behaviour for source
|
96 |
+
files, where having a trailing newline is often considered good practice).
|
97 |
+
|
98 |
+
|
99 |
+
Internals
|
100 |
+
---------
|
101 |
+
|
102 |
+
The model is essentially:
|
103 |
+
|
104 |
+
1. The cell text is grabbed by client-side javascript, then turned into a json
|
105 |
+
string using javascript `JSON.stringify`. Since json-compatible strings are
|
106 |
+
a particularly simple string format, which is compatible with many other
|
107 |
+
programming languages without much modification (e.g. a valid json string
|
108 |
+
is also a valid string in python 3, and also in python 2 when prefixed with
|
109 |
+
a `u`), and easily converted for use in others (because of its simplicity).
|
110 |
+
|
111 |
+
2. Optional regex replacements are used to translate the json-format string
|
112 |
+
into a valid kernel string. Python, R and javascript don't require this
|
113 |
+
step, but other languages may do, so it's implemented for flexibility
|
114 |
+
using the per-kernel config key `replacements_json_to_kernel`, which is a
|
115 |
+
list of pairs of arguments to javascript `String.replace`.
|
116 |
+
|
117 |
+
3. The kernel-specific prettifier call is then composed from
|
118 |
+
`kernel_config.prefix` + `kernel_text_string` + `kernel_config.postfix` and
|
119 |
+
sent to the kernel for execution. This kernel call is expected to get the
|
120 |
+
formatted cell text _printed_ as a json-compatible string. Since most
|
121 |
+
kernel languages have json packages, this should hopefully be easy to
|
122 |
+
arrange. The reason for the printing text rather than simply displaying it,
|
123 |
+
is that it prevents us having to translate from a kernel string
|
124 |
+
representing a json string.
|
125 |
+
|
126 |
+
4. The callback for the kernel execution in client-side javascript parses the
|
127 |
+
printed json-format string, optionally trims trailing whitespace according
|
128 |
+
to the `trim_formatted_text` key (which defaults to `true`) in the
|
129 |
+
per-kernel config, and then sets the cell text using the result.
|
130 |
+
|
131 |
+
The process is probably best illustrated using an example for the python
|
132 |
+
implementation in `code_prettify`:
|
133 |
+
|
134 |
+
1. **At nbextension load**, the `code_prettify.kernel_config_map_json` config
|
135 |
+
option is parsed to give the json object
|
136 |
+
|
137 |
+
```json
|
138 |
+
{
|
139 |
+
"python": {
|
140 |
+
"library": "import json\nimport yapf.yapflib.yapf_api",
|
141 |
+
"prefix": "print(json.dumps(yapf.yapflib.yapf_api.FormatCode(u",
|
142 |
+
"postfix": ")[0]))"
|
143 |
+
}
|
144 |
+
}
|
145 |
+
```
|
146 |
+
|
147 |
+
(other kernel languages are omitted for clarity).
|
148 |
+
|
149 |
+
2. **On kernel becoming ready**, the nbextension looks up the config for the
|
150 |
+
kernel's language (in our example, this is the `python` key of the kernel
|
151 |
+
config json object above). It then sends the kernel config's `library`
|
152 |
+
string to the kernel for execution. Thus the python implementation above
|
153 |
+
executes
|
154 |
+
|
155 |
+
```python
|
156 |
+
import json
|
157 |
+
import yapf.yapflib.yapf_api
|
158 |
+
```
|
159 |
+
|
160 |
+
3. **On requesting a cell be prettified** which can happen by clicking the
|
161 |
+
toolbar, or with a (configurable) hotkey, the following happens:
|
162 |
+
|
163 |
+
Say the cell to be formatted contains the following ugly python code:
|
164 |
+
|
165 |
+
```python
|
166 |
+
msg= 'hello '+"world"
|
167 |
+
print (
|
168 |
+
msg )
|
169 |
+
```
|
170 |
+
|
171 |
+
Then the result of the `JSON.stringify` call will be a string containing
|
172 |
+
|
173 |
+
```json
|
174 |
+
"msg= 'hello '+\"world\"\nprint (\n msg )"
|
175 |
+
```
|
176 |
+
|
177 |
+
(note the opening and closing quotes). Concatenating this with the prefix &
|
178 |
+
postfix strings from the python kernel config above, gives us the kernel
|
179 |
+
code to execute. The call sent to the python kernel is therefore
|
180 |
+
|
181 |
+
```python
|
182 |
+
print(json.dumps(yapf.yapflib.yapf_api.FormatCode(u"msg= 'hello '+\"world\"\nprint (\n msg )")[0]))
|
183 |
+
```
|
184 |
+
|
185 |
+
4. What gets 'printed' by the kernel (i.e. returned to the javascript stream
|
186 |
+
callback) is the following json-format string:
|
187 |
+
|
188 |
+
```json
|
189 |
+
"msg = 'hello ' + \"world\"\nprint(msg)\n"
|
190 |
+
```
|
191 |
+
|
192 |
+
The default is to trim whitepace from the returned prettified text, which
|
193 |
+
results in the final prettified python code for the cell:
|
194 |
+
|
195 |
+
```python
|
196 |
+
msg = 'hello ' + "world"
|
197 |
+
print(msg)
|
198 |
+
```
|
199 |
+
|
200 |
+
|
201 |
+
Defining a new plugin
|
202 |
+
---------------------
|
203 |
+
|
204 |
+
As an example, we will add a new plugin which reformats code using the
|
205 |
+
[autopep8] module in python, rather than the [yapf] library used by
|
206 |
+
`code_prettify`. Such a plugin, [jupyter-autopep8] was developed by [@kenkoooo]
|
207 |
+
as a fork of an old version of `code_prettify`. Redefining it here has the
|
208 |
+
advantage of using the updated and more-robust architecture, in addition to
|
209 |
+
making it possible to reformat the whole notebook in one go.
|
210 |
+
|
211 |
+
For this new nbextension, we just have to run `import autopep8` as the kernel
|
212 |
+
library code, and then call the `autopep8.fix_code` function on cells' text.
|
213 |
+
Hence what we have to do is:
|
214 |
+
|
215 |
+
- copy `code_prettify.js` to `autopep8.js`
|
216 |
+
|
217 |
+
- update `mod_name`, `hotkeys`, `button_icon` default config values in the new
|
218 |
+
`autopep8.js`. Also update the `cfg.kernel_config_map` value to use the
|
219 |
+
correct kernel code:
|
220 |
+
```javascript
|
221 |
+
cfg.kernel_config_map = { // map of options for supported kernels
|
222 |
+
"python": {
|
223 |
+
"library": "import json\nimport autopep8",
|
224 |
+
"prefix": "print(json.dumps(autopep8.fix_code(u",
|
225 |
+
"postfix": ")))"
|
226 |
+
}
|
227 |
+
};
|
228 |
+
```
|
229 |
+
|
230 |
+
- copy `code_prettify.yaml` to `autopep8.yaml`, and update its values (name,
|
231 |
+
require, readme, plus the new defaults for hotkeys, icon, and
|
232 |
+
kernel_config_map
|
233 |
+
|
234 |
+
- that's all :-)
|
235 |
+
|
236 |
+
Of course, for this simple case, one could equally have just updated the
|
237 |
+
configuration of `code_prettify` using the [jupyter_nbextensions_configurator]
|
238 |
+
to use [autopep8] instead of [yapf] to reformat the python code.
|
239 |
+
But, if you want two alternative prettifiers available for the same kernel
|
240 |
+
language, we need to define separate plugins.
|
241 |
+
|
242 |
+
Custom Yapf Styles
|
243 |
+
------------------
|
244 |
+
|
245 |
+
Using the default `yapf` engine, one may define a custom formatting style according to the [package documentation](https://github.com/google/yapf#formatting-style).
|
246 |
+
|
247 |
+
The `code_prettify` extension is configured to follow the default `yapf` ordering (minus the command line option) and will search for the formatting style in the following manner:
|
248 |
+
|
249 |
+
> 1. In the [style] section of a .style.yapf file in either the current directory or one of its parent directories.
|
250 |
+
> 2. In the [yapf] section of a setup.cfg file in either the current directory or one of its parent directories.
|
251 |
+
> 3. In the ~/.config/yapf/style file in your home directory.
|
252 |
+
>
|
253 |
+
> If none of those files are found, the default style is used (PEP8).
|
254 |
+
|
255 |
+
This means that one can set up a globa custom yapf style using `~/.config/yapf/style` or a project-specific one using the project directory.
|
256 |
+
|
257 |
+
History
|
258 |
+
-------
|
259 |
+
|
260 |
+
- [@jfbercher], august 14, 2016, first version, named `yapf_ext`
|
261 |
+
- [@jfbercher], august 19, 2016, second version `code_prettify`
|
262 |
+
- introduced support for R and javascript.
|
263 |
+
- changed extension name from `yapf_ext` to `code_prettify`
|
264 |
+
- [@jcb91], december 2016
|
265 |
+
- made addition of toolbar button & hotkey configurable
|
266 |
+
- reworked to avoid regex replacements for conversion to/from kernel string
|
267 |
+
formats, in favour of json-string interchange
|
268 |
+
- made kernel-specific prettifier calls configurable, allowing support for
|
269 |
+
different prettifiers & arbitrary kernels
|
270 |
+
- improved documentation
|
271 |
+
- [@jfbercher], december 2016-january 2017
|
272 |
+
- added a configurable shortkey to reflow the whole notebook
|
273 |
+
- extracted most of the code to build a general library of functions,
|
274 |
+
`kernel_exec_on_cell.js`, which can be used for all nbextensions which
|
275 |
+
needs to exec some code (via the current kernel) on the text from cells.
|
276 |
+
- added 2to3 as a plugin to the shared library
|
277 |
+
- [@jcb91], january 2017
|
278 |
+
- library: Use actions to avoid problems with auto-generated actions
|
279 |
+
generated by keyboard_manager, which were overwriting each other.
|
280 |
+
Also fix toolbar button removal.
|
281 |
+
- [@jfbercher], january 2017
|
282 |
+
- updated documentation
|
283 |
+
- added autopep8 nbextension as a plugin using the shared library
|
284 |
+
- [@artificialsoph], Jan 2018
|
285 |
+
- updated documentation
|
286 |
+
- changed default behavior to load custom yapf styles
|
287 |
+
- [@jfbercher], April 2019
|
288 |
+
- corrected an issue in configs merge
|
289 |
+
- added an option for displaying an alert if kernel is not supported and turned it off by default (instead issue a warning in the js console).
|
290 |
+
|
291 |
+
[2to3]: README_2to3.md
|
292 |
+
[@jcb91]: https://github.com/jcb91
|
293 |
+
[@jfbercher]: https://github.com/jfbercher
|
294 |
+
[@kenkoooo]: https://github.com/kenkoooo
|
295 |
+
[autopep8]: https://github.com/hhatto/autopep8
|
296 |
+
[code-prettify]: README_code_prettify.md
|
297 |
+
[jupyter-autopep8]: README_autopep8.md
|
298 |
+
[fontawesome]: https://fontawesome.com/icons
|
299 |
+
[internals]: #Internals
|
300 |
+
[jupyter-autopep8]: https://github.com/kenkoooo/jupyter-autopep8
|
301 |
+
[jupyter_nbextensions_configurator]: https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator
|
302 |
+
[yapf]: https://github.com/google/yapf
|
.local/share/jupyter/nbextensions/code_prettify/demo-py.gif
ADDED
![]() |
.local/share/jupyter/nbextensions/codefolding/codefolding_firstline_folded.png
ADDED
![]() |
.local/share/jupyter/nbextensions/codefolding/codefolding_indent_folded_1.png
ADDED
![]() |
.local/share/jupyter/nbextensions/codefolding/codefolding_indent_unfolded.png
ADDED
![]() |
.local/share/jupyter/nbextensions/codefolding/foldgutter.css
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.CodeMirror-foldgutter {
|
2 |
+
width: .9em;
|
3 |
+
}
|
4 |
+
|
5 |
+
|
.local/share/jupyter/nbextensions/codefolding/magic-folded.png
ADDED
![]() |
.local/share/jupyter/nbextensions/codefolding/main.js
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Allow codefolding in code cells
|
2 |
+
//
|
3 |
+
// This extension enables the CodeMirror feature
|
4 |
+
// It works by adding a gutter area to each code cell.
|
5 |
+
// Fold-able code is marked using small triangles in the gutter.
|
6 |
+
//
|
7 |
+
// The current folding state is saved in the cell metadata as an array
|
8 |
+
// of line numbers.
|
9 |
+
// Format: cell.metadata.code_folding = [ line1, line2, line3, ...]
|
10 |
+
//
|
11 |
+
|
12 |
+
define([
|
13 |
+
'base/js/namespace',
|
14 |
+
'jquery',
|
15 |
+
'require',
|
16 |
+
'base/js/events',
|
17 |
+
'services/config',
|
18 |
+
'notebook/js/codecell',
|
19 |
+
'codemirror/lib/codemirror',
|
20 |
+
'codemirror/addon/fold/foldcode',
|
21 |
+
'codemirror/addon/fold/foldgutter',
|
22 |
+
'codemirror/addon/fold/brace-fold',
|
23 |
+
'codemirror/addon/fold/indent-fold'
|
24 |
+
], function (Jupyter, $, requirejs, events, configmod, codecell, CodeMirror) {
|
25 |
+
"use strict";
|
26 |
+
|
27 |
+
// define default config parameter values
|
28 |
+
var params = {
|
29 |
+
codefolding_hotkey : 'Alt-f',
|
30 |
+
init_delay : 1000
|
31 |
+
};
|
32 |
+
|
33 |
+
// updates default params with any specified in the provided config data
|
34 |
+
var update_params = function (config_data) {
|
35 |
+
for (var key in params) {
|
36 |
+
if (config_data.hasOwnProperty(key)) {
|
37 |
+
params[key] = config_data[key];
|
38 |
+
}
|
39 |
+
}
|
40 |
+
};
|
41 |
+
|
42 |
+
var on_config_loaded = function () {
|
43 |
+
if (Jupyter.notebook !== undefined) {
|
44 |
+
// register actions with ActionHandler instance
|
45 |
+
var prefix = 'auto';
|
46 |
+
var name = 'toggle-codefolding';
|
47 |
+
var action = {
|
48 |
+
icon: 'fa-comment-o',
|
49 |
+
help : 'Toggle codefolding',
|
50 |
+
help_index : 'ec',
|
51 |
+
id : 'toggle_codefolding',
|
52 |
+
handler : toggleFolding
|
53 |
+
};
|
54 |
+
var action_full_name = Jupyter.keyboard_manager.actions.register(action, name, prefix);
|
55 |
+
|
56 |
+
// define keyboard shortcuts
|
57 |
+
var edit_mode_shortcuts = {};
|
58 |
+
edit_mode_shortcuts[params.codefolding_hotkey] = action_full_name;
|
59 |
+
|
60 |
+
// register keyboard shortcuts with keyboard_manager
|
61 |
+
Jupyter.notebook.keyboard_manager.edit_shortcuts.add_shortcuts(edit_mode_shortcuts);
|
62 |
+
Jupyter.notebook.keyboard_manager.command_shortcuts.add_shortcuts(edit_mode_shortcuts);
|
63 |
+
}
|
64 |
+
else {
|
65 |
+
// we're in edit view
|
66 |
+
var extraKeys = Jupyter.editor.codemirror.getOption('extraKeys');
|
67 |
+
extraKeys[params.codefolding_hotkey] = toggleFolding;
|
68 |
+
CodeMirror.normalizeKeyMap(extraKeys);
|
69 |
+
console.log('[codefolding] binding hotkey', params.codefolding_hotkey);
|
70 |
+
Jupyter.editor.codemirror.setOption('extraKeys', extraKeys);
|
71 |
+
}
|
72 |
+
};
|
73 |
+
|
74 |
+
/*
|
75 |
+
* Toggle folding on/off at current line
|
76 |
+
*
|
77 |
+
* @param cm CodeMirror instance
|
78 |
+
*
|
79 |
+
*/
|
80 |
+
function toggleFolding () {
|
81 |
+
var cm;
|
82 |
+
var pos = {line: 0, ch: 0, xRel: 0};
|
83 |
+
if (Jupyter.notebook !== undefined) {
|
84 |
+
cm = Jupyter.notebook.get_selected_cell().code_mirror;
|
85 |
+
if (Jupyter.notebook.mode === 'edit') {
|
86 |
+
pos = cm.getCursor();
|
87 |
+
}
|
88 |
+
}
|
89 |
+
else {
|
90 |
+
cm = Jupyter.editor.codemirror;
|
91 |
+
pos = cm.getCursor();
|
92 |
+
}
|
93 |
+
var opts = cm.state.foldGutter.options;
|
94 |
+
cm.foldCode(pos, opts.rangeFinder);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Update cell metadata with folding info, so folding state can be restored after reloading notebook
|
99 |
+
*
|
100 |
+
* @param cm CodeMirror instance
|
101 |
+
*/
|
102 |
+
function updateMetadata (cm) {
|
103 |
+
var list = cm.getAllMarks();
|
104 |
+
var lines = [];
|
105 |
+
for (var i = 0; i < list.length; i++) {
|
106 |
+
if (list[i].__isFold) {
|
107 |
+
var range = list[i].find();
|
108 |
+
lines.push(range.from.line);
|
109 |
+
}
|
110 |
+
}
|
111 |
+
/* User can click on gutter of unselected cells, so make sure we store metadata in the correct cell */
|
112 |
+
var cell = Jupyter.notebook.get_selected_cell();
|
113 |
+
if (cell.code_mirror !== cm) {
|
114 |
+
var cells = Jupyter.notebook.get_cells();
|
115 |
+
var ncells = Jupyter.notebook.ncells();
|
116 |
+
for (var k = 0; k < ncells; k++) {
|
117 |
+
var _cell = cells[k];
|
118 |
+
if (_cell.code_mirror === cm ) { cell = _cell; break; }
|
119 |
+
}
|
120 |
+
}
|
121 |
+
cell.metadata.code_folding = lines;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Activate codefolding in CodeMirror options, don't overwrite other settings
|
126 |
+
*
|
127 |
+
* @param cm codemirror instance
|
128 |
+
*/
|
129 |
+
function activate_cm_folding (cm) {
|
130 |
+
var gutters = cm.getOption('gutters').slice();
|
131 |
+
if ( $.inArray("CodeMirror-foldgutter", gutters) < 0) {
|
132 |
+
gutters.push('CodeMirror-foldgutter');
|
133 |
+
cm.setOption('gutters', gutters);
|
134 |
+
}
|
135 |
+
|
136 |
+
/* set indent or brace folding */
|
137 |
+
var opts = true;
|
138 |
+
if (Jupyter.notebook) {
|
139 |
+
opts = {
|
140 |
+
rangeFinder: new CodeMirror.fold.combine(
|
141 |
+
CodeMirror.fold.firstline,
|
142 |
+
CodeMirror.fold.magic,
|
143 |
+
CodeMirror.fold.blockcomment,
|
144 |
+
cm.getMode().fold === 'indent' ? CodeMirror.fold.indent : CodeMirror.fold.brace
|
145 |
+
)
|
146 |
+
};
|
147 |
+
}
|
148 |
+
cm.setOption('foldGutter', opts);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Restore folding status from metadata
|
153 |
+
* @param cell
|
154 |
+
*/
|
155 |
+
var restoreFolding = function (cell) {
|
156 |
+
if (cell.metadata.code_folding === undefined || !(cell instanceof codecell.CodeCell)) {
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
// visit in reverse order, as otherwise nested folds un-fold outer ones
|
160 |
+
var lines = cell.metadata.code_folding.slice().sort();
|
161 |
+
for (var idx = lines.length - 1; idx >= 0; idx--) {
|
162 |
+
var line = lines[idx];
|
163 |
+
var opts = cell.code_mirror.state.foldGutter.options;
|
164 |
+
var linetext = cell.code_mirror.getLine(line);
|
165 |
+
if (linetext !== undefined) {
|
166 |
+
cell.code_mirror.foldCode(CodeMirror.Pos(line, 0), opts.rangeFinder);
|
167 |
+
}
|
168 |
+
else {
|
169 |
+
// the line doesn't exist, so we should remove it from metadata
|
170 |
+
cell.metadata.code_folding = lines.slice(0, idx);
|
171 |
+
}
|
172 |
+
cell.code_mirror.refresh();
|
173 |
+
}
|
174 |
+
};
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Add codefolding gutter to a new cell
|
178 |
+
*
|
179 |
+
* @param event
|
180 |
+
* @param nbcell
|
181 |
+
*
|
182 |
+
*/
|
183 |
+
var createCell = function (event, nbcell) {
|
184 |
+
var cell = nbcell.cell;
|
185 |
+
if ((cell instanceof codecell.CodeCell)) {
|
186 |
+
activate_cm_folding(cell.code_mirror);
|
187 |
+
cell.code_mirror.on('fold', updateMetadata);
|
188 |
+
cell.code_mirror.on('unfold', updateMetadata);
|
189 |
+
// queue restoring folding, to run once metadata is set, hopefully.
|
190 |
+
// This can be useful if cells are un-deleted, for example.
|
191 |
+
setTimeout(function () { restoreFolding(cell); }, 500);
|
192 |
+
}
|
193 |
+
};
|
194 |
+
|
195 |
+
/*
|
196 |
+
* Initialize gutter in existing cells
|
197 |
+
*
|
198 |
+
*/
|
199 |
+
var initExistingCells = function () {
|
200 |
+
var cells = Jupyter.notebook.get_cells();
|
201 |
+
var ncells = Jupyter.notebook.ncells();
|
202 |
+
for (var i = 0; i < ncells; i++) {
|
203 |
+
var cell = cells[i];
|
204 |
+
if ((cell instanceof codecell.CodeCell)) {
|
205 |
+
activate_cm_folding(cell.code_mirror);
|
206 |
+
/* restore folding state if previously saved */
|
207 |
+
restoreFolding(cell);
|
208 |
+
cell.code_mirror.on('fold', updateMetadata);
|
209 |
+
cell.code_mirror.on('unfold', updateMetadata);
|
210 |
+
}
|
211 |
+
}
|
212 |
+
events.on('create.Cell', createCell);
|
213 |
+
};
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Load my own CSS file
|
217 |
+
*
|
218 |
+
* @param name off CSS file
|
219 |
+
*
|
220 |
+
*/
|
221 |
+
var load_css = function (name) {
|
222 |
+
var link = document.createElement("link");
|
223 |
+
link.type = "text/css";
|
224 |
+
link.rel = "stylesheet";
|
225 |
+
link.href = requirejs.toUrl(name, 'css');
|
226 |
+
document.getElementsByTagName("head")[0].appendChild(link);
|
227 |
+
};
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Initialize extension
|
231 |
+
*
|
232 |
+
*/
|
233 |
+
var load_extension = function () {
|
234 |
+
// first, check which view we're in, in order to decide whether to load
|
235 |
+
var conf_sect;
|
236 |
+
if (Jupyter.notebook) {
|
237 |
+
// we're in notebook view
|
238 |
+
conf_sect = Jupyter.notebook.config;
|
239 |
+
}
|
240 |
+
else if (Jupyter.editor) {
|
241 |
+
// we're in file-editor view
|
242 |
+
conf_sect = new configmod.ConfigSection('notebook', {base_url: Jupyter.editor.base_url});
|
243 |
+
conf_sect.load();
|
244 |
+
}
|
245 |
+
else {
|
246 |
+
// we're some other view like dashboard, terminal, etc, so bail now
|
247 |
+
return;
|
248 |
+
}
|
249 |
+
|
250 |
+
load_css('codemirror/addon/fold/foldgutter.css');
|
251 |
+
/* change default gutter width */
|
252 |
+
load_css( './foldgutter.css');
|
253 |
+
|
254 |
+
conf_sect.loaded
|
255 |
+
.then(function () { update_params(conf_sect.data); })
|
256 |
+
.then(on_config_loaded);
|
257 |
+
|
258 |
+
if (Jupyter.notebook) {
|
259 |
+
/* require our additional custom codefolding modes before initialising fully */
|
260 |
+
requirejs(['./firstline-fold', './magic-fold', './blockcomment-fold'], function () {
|
261 |
+
if (Jupyter.notebook._fully_loaded) {
|
262 |
+
setTimeout(function () {
|
263 |
+
console.log('Codefolding: Wait for', params.init_delay, 'ms');
|
264 |
+
initExistingCells();
|
265 |
+
}, params.init_delay);
|
266 |
+
}
|
267 |
+
else {
|
268 |
+
events.one('notebook_loaded.Notebook', initExistingCells);
|
269 |
+
}
|
270 |
+
});
|
271 |
+
}
|
272 |
+
else {
|
273 |
+
activate_cm_folding(Jupyter.editor.codemirror);
|
274 |
+
setTimeout(function () {
|
275 |
+
console.log('Codefolding: Wait for', params.init_delay, 'ms');
|
276 |
+
Jupyter.editor.codemirror.refresh();
|
277 |
+
}, params.init_delay);
|
278 |
+
}
|
279 |
+
};
|
280 |
+
|
281 |
+
return {load_ipython_extension : load_extension};
|
282 |
+
});
|
.local/share/jupyter/nbextensions/codefolding/readme.md
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Codefolding
|
2 |
+
===========
|
3 |
+
|
4 |
+
This extension adds codefolding functionality from CodeMirror to a codecell.
|
5 |
+
|
6 |
+
In edit mode, clicking on the triangle in the gutter (left margin of codecell) or typing the codefolding hotkey
|
7 |
+
(default is `Alt+F`), folds the code.
|
8 |
+
In command mode, the folding hotkey relates to the first line of the codecell.
|
9 |
+
|
10 |
+
See the examples below. The folding status is saved in the cell metadata of the notebook, so reloading of a notebook will restore the folding view.
|
11 |
+
|
12 |
+
Supported modes
|
13 |
+
---------------
|
14 |
+
|
15 |
+
Three different folding modes are supported:
|
16 |
+
|
17 |
+
|
18 |
+
### Indent Folding
|
19 |
+
|
20 |
+
In the image below, the Codefolding extension detects unfolded, Python-style indentations:
|
21 |
+
|
22 |
+
![Unfolded](codefolding_indent_unfolded.png)
|
23 |
+
|
24 |
+
The unfolded code above can be folded like this:
|
25 |
+
|
26 |
+
![](codefolding_indent_folded_1.png)
|
27 |
+
|
28 |
+
or this:
|
29 |
+
|
30 |
+
![](codefolding_indent_folded_2.png)
|
31 |
+
|
32 |
+
|
33 |
+
### Bracket Folding
|
34 |
+
|
35 |
+
Other languages like Javascript use brackets to designate code blocks. Codefolding is supported for Javascript in using the `%%javascript` magic in a codecell.
|
36 |
+
|
37 |
+
|
38 |
+
### Firstline Comment Folding
|
39 |
+
|
40 |
+
Allows collapsing of Python code cells to a single comment line. This is useful for long codecells. The algorithm simply looks for a comment in the first line and allows folding in the rest of the cell.
|
41 |
+
|
42 |
+
![](codefolding_firstline_unfolded.png)
|
43 |
+
|
44 |
+
The code above can be folded like this:
|
45 |
+
|
46 |
+
![](codefolding_firstline_folded.png)
|
47 |
+
|
48 |
+
|
49 |
+
### Magics Folding
|
50 |
+
|
51 |
+
If you specify a magic in the first line of a cell, it can be folded, too.
|
52 |
+
|
53 |
+
![](magic-unfolded.png)
|
54 |
+
|
55 |
+
Folded:
|
56 |
+
|
57 |
+
![](magic-folded.png)
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
Installation
|
62 |
+
------------
|
63 |
+
|
64 |
+
Note that there are two extensions: one for the notebook interface (`notebook:codefolding/main`),
|
65 |
+
and one for the editor (`edit:codefolding/edit`) which have slightly different installation syntax:
|
66 |
+
|
67 |
+
```bash
|
68 |
+
jupyter nbextension enable codefolding/main
|
69 |
+
jupyter nbextension enable --section edit codefolding/edit
|
70 |
+
```
|
71 |
+
|
72 |
+
|
73 |
+
Internals
|
74 |
+
---------
|
75 |
+
|
76 |
+
When saving a notebook, the folding information is saved in the metadata of
|
77 |
+
each codecell.
|
78 |
+
The number of the folding start line (beginning with 0) is stored in an array:
|
79 |
+
|
80 |
+
```javascript
|
81 |
+
cell.metadata.code_folding = [ 3, 20, 33 ]
|
82 |
+
```
|
83 |
+
|
84 |
+
When reloading the notebook, the folding status is restored.
|
85 |
+
|
86 |
+
The codefolding hotkey can be customized using the notebook extensions configurator.
|
87 |
+
The settings are stored as `"codefolding_hotkey": "alt-f"` in `the notebook.json` configuration file.
|
88 |
+
|
89 |
+
|
90 |
+
Exporting
|
91 |
+
---------
|
92 |
+
|
93 |
+
To export a notebook containing folded cells, you will need to apply a custom
|
94 |
+
preprocessor for nbconvert.
|
95 |
+
The preprocessor is located in
|
96 |
+
`jupyter_contrib_nbextensions.nbconvert_support.pre_codefolding`.
|
97 |
+
|
98 |
+
The preprocessor is installed when you install the
|
99 |
+
`jupyter_contrib_nbextensions` package.
|
100 |
+
To activate the preprocessor manually,
|
101 |
+
add the following lines to `jupyter_nbconvert_config.py`:
|
102 |
+
|
103 |
+
```python
|
104 |
+
Exporter.preprocessors += ['jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor']
|
105 |
+
```
|
.local/share/jupyter/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: Jupyter Notebook Extension
|
2 |
+
Name: CodeMirror mode extensions
|
3 |
+
Description: |
|
4 |
+
Extends some CodeMirror modes with extra features. Currently just adds
|
5 |
+
support for comment/uncomment and folding for octave/MATLAB mode.
|
6 |
+
Main: main.js
|
7 |
+
Compatibility: 4.x
|
.local/share/jupyter/nbextensions/collapsible_headings/collapsible_headings.yaml
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: Jupyter Notebook Extension
|
2 |
+
Compatibility: 4.x, 5.x
|
3 |
+
Name: Collapsible Headings
|
4 |
+
Main: main.js
|
5 |
+
Description: "Allows notebook to have collapsible sections, separated by headings"
|
6 |
+
Link: readme.md
|
7 |
+
Icon: icon.png
|
8 |
+
Parameters:
|
9 |
+
|
10 |
+
- name: collapsible_headings.add_button
|
11 |
+
description: Add a toolbar button to collapse the closest header cell
|
12 |
+
input_type: checkbox
|
13 |
+
default: false
|
14 |
+
|
15 |
+
- name: collapsible_headings.add_all_cells_button
|
16 |
+
description: Add a toolbar button to collapse/uncollapse all header cells
|
17 |
+
input_type: checkbox
|
18 |
+
default: false
|
19 |
+
|
20 |
+
- name: collapsible_headings.add_insert_header_buttons
|
21 |
+
description: Add toolbar buttons to insert heading cells above/below the selected cell
|
22 |
+
input_type: checkbox
|
23 |
+
default: false
|
24 |
+
|
25 |
+
- name: collapsible_headings.use_toggle_controls
|
26 |
+
description: Add a control in each heading cell's input prompt to collapse/uncollapse it
|
27 |
+
input_type: checkbox
|
28 |
+
default: true
|
29 |
+
|
30 |
+
- name: collapsible_headings.toggle_color
|
31 |
+
description: Color for the toggle control icon
|
32 |
+
input_type: color
|
33 |
+
default: '#aaaaaa'
|
34 |
+
|
35 |
+
- name: collapsible_headings.toggle_closed_icon
|
36 |
+
description: font-awesome class for the toggle control icon on collapsed headings
|
37 |
+
default: fa-caret-right
|
38 |
+
|
39 |
+
- name: collapsible_headings.toggle_open_icon
|
40 |
+
description: font-awesome class for the toggle control icon on uncollapsed (expanded) headings
|
41 |
+
default: fa-caret-down
|
42 |
+
|
43 |
+
- name: collapsible_headings.make_toggle_controls_buttons
|
44 |
+
description: "Make the toggle control into a button (if false, it's just an icon)"
|
45 |
+
input_type: checkbox
|
46 |
+
default: false
|
47 |
+
|
48 |
+
- name: collapsible_headings.size_toggle_controls_by_level
|
49 |
+
description: Adjust the size of the toggle controls to match their heading levels
|
50 |
+
input_type: checkbox
|
51 |
+
default: true
|
52 |
+
|
53 |
+
- name: collapsible_headings.show_section_brackets
|
54 |
+
description: show Mathematica-style brackets around each collapsible section
|
55 |
+
input_type: checkbox
|
56 |
+
default: false
|
57 |
+
|
58 |
+
- name: collapsible_headings.section_bracket_width
|
59 |
+
description: 'Width, in pixels, of the Mathematica-style brackets around sections'
|
60 |
+
input_type: number
|
61 |
+
min: 2
|
62 |
+
max: 100
|
63 |
+
default: 10
|
64 |
+
|
65 |
+
- name: collapsible_headings.show_ellipsis
|
66 |
+
description: show a gray bracketed ellipsis at the end of collapsed heading cells
|
67 |
+
input_type: checkbox
|
68 |
+
default: true
|
69 |
+
|
70 |
+
- name: collapsible_headings.use_shortcuts
|
71 |
+
description: Add command-mode keyboard shortcuts to collapse/uncollapse the selected heading cell
|
72 |
+
input_type: checkbox
|
73 |
+
default: true
|
74 |
+
|
75 |
+
- name: collapsible_headings.shortcuts.collapse
|
76 |
+
description: Command-mode shortcut to collapse the selected heading cell
|
77 |
+
input_type: hotkey
|
78 |
+
default: left
|
79 |
+
|
80 |
+
- name: collapsible_headings.shortcuts.uncollapse
|
81 |
+
description: Command-mode shortcut to uncollapse (expand) the selected heading cell
|
82 |
+
input_type: hotkey
|
83 |
+
default: right
|
84 |
+
|
85 |
+
- name: collapsible_headings.shortcuts.collapse_all
|
86 |
+
description: Command-mode shortcut to collapse all heading cells
|
87 |
+
input_type: hotkey
|
88 |
+
default: ctrl-shift-left
|
89 |
+
|
90 |
+
- name: collapsible_headings.shortcuts.uncollapse_all
|
91 |
+
description: Command-mode shortcut to uncollapse (expand) all heading cells
|
92 |
+
input_type: hotkey
|
93 |
+
default: ctrl-shift-right
|
94 |
+
|
95 |
+
- name: collapsible_headings.shortcuts.select
|
96 |
+
description: Command-mode shortcut to select all cells in the selected heading cell's section
|
97 |
+
input_type: hotkey
|
98 |
+
default: shift-right
|
99 |
+
|
100 |
+
- name: collapsible_headings.shortcuts.insert_above
|
101 |
+
description: Command-mode shortcut to insert a heading cell above the selected cell
|
102 |
+
input_type: hotkey
|
103 |
+
default: shift-a
|
104 |
+
|
105 |
+
- name: collapsible_headings.shortcuts.insert_below
|
106 |
+
description: Command-mode shortcut to insert a heading cell below the selected cell's section
|
107 |
+
input_type: hotkey
|
108 |
+
default: shift-b
|
109 |
+
|
110 |
+
- name: collapsible_headings.select_reveals
|
111 |
+
description: "By default, selecting a whole section also expands the section to reveal its last cell. Set this option to false to disable the expansion."
|
112 |
+
input_type: checkbox
|
113 |
+
default: true
|
114 |
+
|
115 |
+
- name: collapsible_headings.collapse_to_match_toc
|
116 |
+
description: |
|
117 |
+
Collapse/uncollapse notebook sections when the ToC2 nbextension is used to
|
118 |
+
collapse/uncollapse sections in the table of contents. For the inverse
|
119 |
+
behaviour, see ToC2's configuration
|
120 |
+
input_type: checkbox
|
121 |
+
default: false
|
122 |
+
|
123 |
+
- name: collapsible_headings.indent_px
|
124 |
+
description: |
|
125 |
+
Shift the collapsible heading controls left by this many pixels per level,
|
126 |
+
such that more significant headings (lower levels) appear further to the
|
127 |
+
left
|
128 |
+
input_type: number
|
129 |
+
default: 8
|
.local/share/jupyter/nbextensions/collapsible_headings/icon.png
ADDED
![]() |