├── .github
└── workflows
│ ├── release.yml
│ └── test.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .readthedocs.yml
├── CHANGELOG.rst
├── CONTRIBUTING.rst
├── LICENSE
├── README.rst
├── data
├── testfile-with-null-values.sql
├── testfile.sql
└── testfile.sql.gz
├── docs
├── Makefile
├── conf.py
├── contributing.rst
├── examples.rst
├── index.rst
├── make.bat
├── module-reference.rst
└── readme.rst
├── mwsql
├── __init__.py
├── dump.py
├── parser.py
└── utils.py
├── poetry.lock
├── pyproject.toml
├── tests
├── __init__.py
├── helpers.py
├── test_dump.py
├── test_parser.py
└── test_utils.py
└── tox.ini
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Publish Python 🐍 distributions 📦 to PyPI
2 | on:
3 | push:
4 | tags:
5 | - "v*.*.*"
6 | jobs:
7 | build:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@v4
11 | - name: Build and publish to pypi
12 | uses: JRubics/poetry-publish@v2.0
13 | with:
14 | python_version: "3.12"
15 | poetry_install_options: "--without dev"
16 | pypi_token: ${{ secrets.PYPI_API_TOKEN }}
17 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 | strategy:
13 | matrix:
14 | python-version: ["3.9", "3.10", "3.11", "3.12"]
15 |
16 | steps:
17 | - uses: actions/checkout@v4
18 | - name: Set up Python ${{ matrix.python-version }}
19 | uses: actions/setup-python@v5
20 | with:
21 | python-version: ${{ matrix.python-version }}
22 | - name: Install Poetry
23 | run: |
24 | curl -sSL https://install.python-poetry.org | python -
25 | - name: Install dependencies
26 | run: |
27 | poetry install
28 | - name: Install tox
29 | run: |
30 | poetry run pip install tox
31 | - name: Test with tox
32 | run: poetry run tox
33 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # VSCode
10 | .vscode/
11 |
12 | # Distribution / packaging
13 | .Python
14 | build/
15 | develop-eggs/
16 | dist/
17 | downloads/
18 | eggs/
19 | .eggs/
20 | lib/
21 | lib64/
22 | parts/
23 | sdist/
24 | var/
25 | wheels/
26 | share/python-wheels/
27 | *.egg-info/
28 | .installed.cfg
29 | *.egg
30 | MANIFEST
31 |
32 | # Unit test / coverage reports
33 | htmlcov/
34 | .tox/
35 | .nox/
36 | .coverage
37 | .coverage.*
38 | .cache
39 | nosetests.xml
40 | coverage.xml
41 | *.cover
42 | *.py,cover
43 | .hypothesis/
44 | .pytest_cache/
45 | cover/
46 |
47 | # Sphinx documentation
48 | docs/_build/
49 |
50 | # Jupyter Notebook
51 | .ipynb_checkpoints
52 |
53 | .python-version
54 |
55 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
56 | __pypackages__/
57 |
58 | # Environments
59 | .env
60 |
61 | .ruff_cache/
62 | .mypy_cache
63 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | ci:
3 | autoupdate_schedule: monthly
4 |
5 | repos:
6 | - repo: https://github.com/astral-sh/ruff-pre-commit
7 | rev: v0.2.1
8 | hooks:
9 | # Run the linter.
10 | - id: ruff
11 | args: [--fix, --exit-non-zero-on-fix]
12 | - id: ruff-format
13 |
14 | - repo: https://github.com/pre-commit/mirrors-mypy
15 | rev: v1.8.0
16 | hooks:
17 | - id: mypy
18 | exclude: ^tests/
19 | args: [--disallow-untyped-defs, --disallow-untyped-calls, --check-untyped-defs]
20 |
21 | - repo: https://github.com/pre-commit/pre-commit-hooks
22 | rev: v4.5.0
23 | hooks:
24 | - id: trailing-whitespace
25 | - id: end-of-file-fixer
26 | - id: check-toml
27 | - id: check-yaml
28 |
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | ---
2 | version: 2
3 | formats: all
4 |
5 | build:
6 | os: ubuntu-20.04
7 | tools:
8 | # Keep version in sync with tox.ini (docs and gh-actions).
9 | python: "3.12"
10 |
11 | python:
12 | install:
13 | - method: pip
14 | path: .
15 | extra_requirements:
16 | - docs
17 |
--------------------------------------------------------------------------------
/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | Changelog
2 | =========
3 |
4 | Versions follow `SemVer `_ .
5 | Given a version number MAJOR.MINOR.PATCH, increment the:
6 |
7 | * MAJOR version when you make incompatible API changes,
8 | * MINOR version when you add functionality in a backwards-compatible manner, and
9 | * PATCH version when you make backwards-compatible bug fixes.
10 |
11 |
12 | 0.1.5 (2022-01-31)
13 | -------------------
14 |
15 | Changes
16 | ^^^^^^^
17 |
18 | - Fix some compatibility issues for Windows users.
19 | - Add support for Python 3.10.
20 | - Drop support for Python 3.6.
21 |
22 |
23 | 0.1.4 (2021-12-19)
24 | -------------------
25 |
26 | Changes
27 | ^^^^^^^
28 |
29 | - Use ``requests`` instead of ``wget`` to download files.
30 | - Use ``tqdm`` to show progress bar.
31 |
--------------------------------------------------------------------------------
/CONTRIBUTING.rst:
--------------------------------------------------------------------------------
1 | How To Contribute
2 | =================
3 |
4 | First of all, thank you for considering contributing to ``mwsql``!
5 | The intent of this document is to help get you started.
6 | Don't be afraid to reach out with questions – no matter how "silly.”
7 | Just open a PR whether you have made any significant changes or not, and we'll try to help. You can also open an issue to discuss any changes you want to make before you start.
8 |
9 |
10 | Basic Guidelines
11 | ----------------
12 |
13 | - Contributions of any size are welcome! Fixed a typo?
14 | Changed a docstring? No contribution is too small.
15 | - Try to limit each pull request to *one* change only.
16 | - *Always* add tests and docs for your code.
17 | - Make sure your proposed changes pass our CI_.
18 | Until it's green, you risk not getting any feedback on it.
19 | - Once you've addressed review feedback, make sure to bump the pull request with a comment so we know you're done.
20 |
21 |
22 | Local Dev Environment
23 | ---------------------
24 |
25 | To start, install `Poetry `_. Poetry will handle the creation of the virtual environment and the installation of the dependencies for you.
26 |
27 | Next, get an up to date checkout of the ``mwsql`` repository via ``SSH``:
28 |
29 | .. code-block:: bash
30 |
31 | $ git clone git@github.com:blancadesal/mwsql.git
32 |
33 | or if you want to use git via ``https``:
34 |
35 | .. code-block:: bash
36 |
37 | $ git clone https://github.com/blancadesal/mwsql.git
38 |
39 | Change into the newly created directory and install the dependencies using Poetry:
40 |
41 | .. code-block:: bash
42 |
43 | $ cd mwsql
44 | $ poetry install
45 |
46 | Poetry will install all the necessary dependencies for you, no need to install from a separate ``requirements.txt`` file.
47 |
48 | Dev dependencies
49 | ----------------
50 |
51 | The only dependency you *really* need to install is tox_.
52 | It will handle everything else for you, including running tests, formatting and linting through pre-commit, and building and serving the latest version of the documentation.
53 | Below are a few examples of how to run tox:
54 |
55 | .. code-block:: bash
56 |
57 | $ tox
58 | # This will run the full pytest suite, as well as pre-commit.
59 | # These are the same tests that are run by the CI
60 |
61 | $ tox -e pre-commit
62 | # This will run the pre-commit linting and formatting checks
63 |
64 | $ tox -e docs
65 | # This will run the documentation build process
66 |
67 | $ tox -e serve-docs
68 | # Live-serve docs with Sphinx autobuild
69 |
70 |
71 | Code style
72 | ----------
73 |
74 | - We use ruff_ for linting and formatting Python code.
75 | Static typing is enforced using mypy_.
76 | Code that does not follow these conventions won't pass our CI.
77 | These tools are configured in either ``tox.ini`` or ``pyproject.toml``.
78 | - Make sure your docstrings are formatted using the `Sphinx-style format`_ like in the example below:
79 |
80 | .. code-block:: python
81 |
82 | def add_one(number: int) -> int:
83 | """
84 | Add one to a number.
85 |
86 | :param number: A very important parameter.
87 | :type number: int
88 | :rtype: int
89 | """
90 |
91 | - As long as you run the tox_ suite before submitting a PR, you should be fine.
92 | Tox runs all the tools above by calling pre-commit_. It also runs the whole pytest_ suite (see Tests below) across all supported Python versions, the same as the CI workflow.
93 |
94 | .. code-block:: bash
95 |
96 | $ tox
97 |
98 | - See the section above how to run pre-commit on its own via tox
99 |
100 |
101 | Tests
102 | -----
103 |
104 | - We use pytest_ for testing. For the sake of consistency, write your asserts as ``actual == expected``:
105 |
106 | .. code-block:: python
107 |
108 | def test_add_one():
109 | assert func(2) == 3
110 | assert func(4) == 5
111 |
112 | - You can run the test suite either through tox or directly with pytest:
113 |
114 | .. code-block:: bash
115 |
116 | $ python -m pytest
117 |
118 |
119 | Docs
120 | ----
121 |
122 | - Use `semantic newlines`_ in ``.rst`` files (reStructuredText_ files):
123 |
124 | .. code-block:: rst
125 |
126 | This is a sentence.
127 | This is another sentence.
128 |
129 | - If you start a new section, add two blank lines before and one blank line after the header, except if two headers follow immediately after each other:
130 |
131 | .. code-block:: rst
132 |
133 | Last line of previous section.
134 |
135 |
136 | Header of New Top Section
137 | -------------------------
138 |
139 | Header of New Section
140 | ^^^^^^^^^^^^^^^^^^^^^
141 |
142 | First line of new section.
143 |
144 | - If you add a new feature, include one or more usage examples in ``examples.rst``.
145 |
146 |
147 | .. _tox: https://tox.readthedocs.io/
148 | .. _reStructuredText: https://www.sphinx-doc.org/en/stable/usage/
149 | .. _`Sphinx-style format`: https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html#the-sphinx-docstring-format
150 | .. _semantic newlines: https://rhodesmill.org/brandon/2012/one-sentence-per-line/restructuredtext/basics.html
151 | .. _CI: https://github.com/blancadesal/mwsql/actions
152 | .. _pre-commit: https://pre-commit.com/
153 | .. _ruff: https://github.com/astral-sh/ruff-pre-commit
154 | .. _mypy: https://mypy.readthedocs.io/en/stable/
155 | .. _pytest: https://docs.pytest.org/en/6.2.x/
156 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | .. image:: https://badge.fury.io/py/mwsql.svg
2 | :target: https://badge.fury.io/py/mwsql
3 |
4 | .. image:: https://github.com/mediawiki-utilities/python-mwsql/actions/workflows/test.yml/badge.svg
5 | :target: https://github.com/mediawiki-utilities/python-mwsql/actions/workflows/test.yml
6 |
7 | .. image:: https://readthedocs.org/projects/ansicolortags/badge/?version=latest
8 | :target: http://ansicolortags.readthedocs.io/?badge=latest
9 |
10 |
11 | Overview
12 | ========
13 |
14 | ``mwsql`` provides utilities for working with Wikimedia SQL dump files.
15 | It supports Python 3.9 and later versions.
16 |
17 | ``mwsql`` abstracts the messiness of working with SQL dump files.
18 | Each Wikimedia SQL dump file contains one database table.
19 | The most common use case for ``mwsql`` is to convert this table into a more user-friendly Python ``Dump class`` instance.
20 | This lets you access the table's metadata (db names, field names, data types, etc.) as attributes, and its content – the table rows – as a generator, which enables processing of larger-than-memory datasets due to the inherent lazy/delayed execution of Python generators.
21 |
22 | ``mwsql`` also provides a method to convert SQL dump files into CSV.
23 | You can find more information on how to use ``mwsql`` in the `usage examples`_.
24 |
25 |
26 | Installation
27 | ------------
28 |
29 | You can install ``mwsql`` with ``pip``:
30 |
31 | .. code-block:: bash
32 |
33 | $ pip install mwsql
34 |
35 |
36 | Basic Usage
37 | -----------
38 |
39 | .. code-block:: pycon
40 |
41 | >>> from mwsql import Dump
42 | >>> dump = Dump.from_file('simplewiki-latest-change_tag_def.sql.gz')
43 | >>> dump.head(5)
44 | ['ctd_id', 'ctd_name', 'ctd_user_defined', 'ctd_count']
45 | ['1', 'mw-replace', '0', '10453']
46 | ['2', 'visualeditor', '0', '309141']
47 | ['3', 'mw-undo', '0', '59767']
48 | ['4', 'mw-rollback', '0', '71585']
49 | ['5', 'mobile edit', '0', '234682']
50 | >>> dump.dtypes
51 | {'ctd_id': int, 'ctd_name': str, 'ctd_user_defined': int, 'ctd_count': int}
52 | >>> rows = dump.rows(convert_dtypes=True)
53 | >>> next(rows)
54 | [1, 'mw-replace', 0, 10453]
55 |
56 |
57 | Known Issues
58 | ------------
59 |
60 |
61 | Encoding errors
62 | ~~~~~~~~~~~~~~~
63 |
64 | Wikimedia SQL dumps use utf-8 encoding.
65 | Unfortunately, some fields can contain non-recognized characters, raising an encoding error when attempting to parse the dump file.
66 | If this happens while reading in the file, it's recommended to try again using a different encoding. ``latin-1`` will sometimes solve the problem; if not, you're encouraged to try with other encodings.
67 | If iterating over the rows throws an encoding error, you can try changing the encoding.
68 | In this case, you don't need to recreate the dump – just pass in a new encoding via the ``dump.encoding`` attribute.
69 |
70 |
71 | Parsing errors
72 | ~~~~~~~~~~~~~~
73 |
74 | Some Wikimedia SQL dumps contain string-type fields that are sometimes not correctly parsed, resulting in fields being split up into several parts.
75 | This is more likely to happen when parsing dumps containing file names from Wikimedia Commons or containing external links with many query parameters.
76 | If you're parsing any of the other dumps, you're unlikely to run into this issue.
77 |
78 | In most cases, this issue affects a relatively very small proportion of the total rows parsed.
79 | For instance, Wikimedia Commons ``page`` dump contains approximately 99 million entries, out of which ~13.000 are incorrectly parsed.
80 | Wikimedia Commons ``page links`` on the other hand, contains ~760M records, and only 20 are wrongly parsed.
81 |
82 | This issue is most commonly caused by the parser mistaking a single quote (or apostrophe, as they're identical) within a string for the single quote that marks the end of said string.
83 | There's currently no known workaround other than manually removing the rows that contain more fields than expected, or if they are relatively few, manually merging the split fields.
84 |
85 | Future versions of ``mwsql`` will improve the parser to correctly identify when single quotes should be treated as string delimiters and when they should be escaped. For now, it's essential to be aware that this problem exists.
86 |
87 |
88 | Project information
89 | -------------------
90 |
91 | ``mwsql`` is released under the `GPLv3`_.
92 | You can find the complete documentation at `Read the Docs`_. If you run into bugs, you can file them in our `issue tracker`_.
93 | Have ideas on how to make ``mwsql`` better?
94 | Contributions are most welcome – we have put together a guide on how to `get started`_.
95 |
96 |
97 | .. _`GPLv3`: https://choosealicense.com/licenses/gpl-3.0/
98 | .. _`Read the Docs`: https://mwsql.readthedocs.io/en/latest/
99 | .. _`usage examples`: https://mwsql.readthedocs.io/en/latest/examples.html
100 | .. _`get started`: https://mwsql.readthedocs.io/en/latest/contributing.html
101 | .. _`issue tracker`: https://github.com/blancadesal/mwsql/issues
102 |
--------------------------------------------------------------------------------
/data/testfile-with-null-values.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)
2 | --
3 | -- Host: 10.64.32.82 Database: simplewiki
4 | -- ------------------------------------------------------
5 | -- Server version 10.4.19-MariaDB-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8mb4 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `change_tag_def`
20 | --
21 |
22 | DROP TABLE IF EXISTS `change_tag_def`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `change_tag_def` (
26 | `ctd_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `ctd_name` varbinary(255) NOT NULL,
28 | `ctd_user_defined` tinyint(1) NOT NULL,
29 | `ctd_count` bigint(20) unsigned NOT NULL DEFAULT 0,
30 | PRIMARY KEY (`ctd_id`),
31 | UNIQUE KEY `ctd_name` (`ctd_name`),
32 | KEY `ctd_count` (`ctd_count`),
33 | KEY `ctd_user_defined` (`ctd_user_defined`)
34 | ) ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=binary;
35 | /*!40101 SET character_set_client = @saved_cs_client */;
36 |
37 | --
38 | -- Dumping data for table `change_tag_def`
39 | --
40 |
41 | /*!40000 ALTER TABLE `change_tag_def` DISABLE KEYS */;
42 | INSERT INTO `change_tag_def` VALUES (NULL,'mw-replace?NULL',0,10200),(2,NULL,0,305860),(3,'mw-undo',NULL,58220),(4,'mw-rollback',0,NULL),(5,'mobile edit',0,230487),(6,'mobile web edit',0,223010),(7,'very short new article',0,28586),(8,'visualeditor-wikitext',0,20113),(9,'mw-new-redirect',0,29681),(10,'visualeditor-switched',0,17717),(11,'mw-removed-redirect',0,4426),(12,'repeating characters',0,6721),(13,'blanking',0,19912),(14,'mw-blank',0,42285),(15,'mw-changed-redirect-target',0,4539),(16,'uppercase- or lowercase-only article',0,24377),(17,'emoji',0,2054),(18,'talk page blanking',0,235),(19,'redirect page with extra text',0,675),(20,'article with links to other-language wikis?',0,3556),(21,'possible vandalism',0,4952),(22,'meta spam id',0,219),(23,'copy/paste from another Wikipedia?',0,1229),(24,'contenttranslation',0,1147),(25,'possible spamming',0,420),(26,'mobile app edit',0,6519),(27,'android app edit',0,2033),(28,'massmessage-delivery',0,3698),(36,'ios app edit',0,1023),(37,'possible libel or vandalism',0,1534),(38,'large unwikified new article',0,4066),(39,'New user creating interrogative pages',0,844),(42,'OAuth CID: 99',0,576),(43,'Possible Vandalism',0,9),(44,'Spambot edit?',0,731),(45,'Text after interwiki or categories',0,133),(46,'Text after interwiki/categories',0,283),(47,'abusefilter-condition-limit',0,127),(48,'adding email address',0,37),(50,'article with links to other-language wikis',0,4),(52,'article with uppercase title',0,520),(57,'end of page text',0,165),(58,'gettingstarted edit',0,202),(59,'goji spam test',0,1),(74,'new LGBT rights article',0,173),(75,'new tehsil article',0,83),(76,'ntsamr (global)',0,1),(77,'one-case only article',0,1481),(78,'one-case-only article',0,1779),(83,'repeated xwiki CoI abuse',0,48),(85,'reverting anti-vandal bot',0,664),(86,'short \'X is a city in Y\' article',0,48),(88,'test edit',0,500),(92,'visualeditor-needcheck',0,24),(93,'Possible Vandalism - LTA',1,65),(96,'mw-contentmodelchange',0,6),(97,'contenttranslation-v2',0,583),(98,'OAuth CID: 1188',0,107),(99,'Likely have problems',0,388),(101,'OAuth CID: 1261',0,160),(102,'references removed',0,4277),(103,'Spam Research',0,5),(104,'OAuth CID: 429',0,3),(105,'OAuth CID: 1352',0,5477),(106,'removal of quick deletion templates',0,1789),(107,'advanced mobile edit',0,12013),(108,'OAuth CID: 651',0,5),(109,'OAuth CID: 1805',0,2833),(110,'added links to social media sites',0,679),(111,'discussiontools',0,2832),(112,'discussiontools-reply',0,2444),(113,'discussiontools-visual',0,368),(114,'discussiontools-source',0,2464),(115,'mw-manual-revert',0,44507),(116,'T144167',0,2),(117,'mw-reverted',0,84006),(118,'Ukraine-Russia-related vandalism',0,5),(119,'new user blanking Wikipedia or WP Talk page',0,158),(120,'OAuth CID: 1804',0,99),(121,'discussiontools-newtopic',0,388),(122,'newcomer task',0,410),(123,'mw-add-media',0,23308),(124,'mw-remove-media',0,11135),(125,'discussiontools-source-enhanced',0,341);
43 | /*!40000 ALTER TABLE `change_tag_def` ENABLE KEYS */;
44 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
45 |
46 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
47 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
48 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
49 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
50 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
51 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
52 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
53 |
54 | -- Dump completed on 2021-07-01 11:48:33
55 |
--------------------------------------------------------------------------------
/data/testfile.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)
2 | --
3 | -- Host: 10.64.32.82 Database: simplewiki
4 | -- ------------------------------------------------------
5 | -- Server version 10.4.19-MariaDB-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8mb4 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `change_tag_def`
20 | --
21 |
22 | DROP TABLE IF EXISTS `change_tag_def`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `change_tag_def` (
26 | `ctd_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `ctd_name` varbinary(255) NOT NULL,
28 | `ctd_user_defined` tinyint(1) NOT NULL,
29 | `ctd_count` bigint(20) unsigned NOT NULL DEFAULT 0,
30 | PRIMARY KEY (`ctd_id`),
31 | UNIQUE KEY `ctd_name` (`ctd_name`),
32 | KEY `ctd_count` (`ctd_count`),
33 | KEY `ctd_user_defined` (`ctd_user_defined`)
34 | ) ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=binary;
35 | /*!40101 SET character_set_client = @saved_cs_client */;
36 |
37 | --
38 | -- Dumping data for table `change_tag_def`
39 | --
40 |
41 | /*!40000 ALTER TABLE `change_tag_def` DISABLE KEYS */;
42 | INSERT INTO `change_tag_def` VALUES (1,'mw-replace',0,10200),(2,'visualeditor',0,305860),(3,'mw-undo',0,58220),(4,'mw-rollback',0,70687),(5,'mobile edit',0,230487),(6,'mobile web edit',0,223010),(7,'very short new article',0,28586),(8,'visualeditor-wikitext',0,20113),(9,'mw-new-redirect',0,29681),(10,'visualeditor-switched',0,17717),(11,'mw-removed-redirect',0,4426),(12,'repeating characters',0,6721),(13,'blanking',0,19912),(14,'mw-blank',0,42285),(15,'mw-changed-redirect-target',0,4539),(16,'uppercase- or lowercase-only article',0,24377),(17,'emoji',0,2054),(18,'talk page blanking',0,235),(19,'redirect page with extra text',0,675),(20,'article with links to other-language wikis?',0,3556),(21,'possible vandalism',0,4952),(22,'meta spam id',0,219),(23,'copy/paste from another Wikipedia?',0,1229),(24,'contenttranslation',0,1147),(25,'possible spamming',0,420),(26,'mobile app edit',0,6519),(27,'android app edit',0,2033),(28,'massmessage-delivery',0,3698),(36,'ios app edit',0,1023),(37,'possible libel or vandalism',0,1534),(38,'large unwikified new article',0,4066),(39,'New user creating interrogative pages',0,844),(42,'OAuth CID: 99',0,576),(43,'Possible Vandalism',0,9),(44,'Spambot edit?',0,731),(45,'Text after interwiki or categories',0,133),(46,'Text after interwiki/categories',0,283),(47,'abusefilter-condition-limit',0,127),(48,'adding email address',0,37),(50,'article with links to other-language wikis',0,4),(52,'article with uppercase title',0,520),(57,'end of page text',0,165),(58,'gettingstarted edit',0,202),(59,'goji spam test',0,1),(74,'new LGBT rights article',0,173),(75,'new tehsil article',0,83),(76,'ntsamr (global)',0,1),(77,'one-case only article',0,1481),(78,'one-case-only article',0,1779),(83,'repeated xwiki CoI abuse',0,48),(85,'reverting anti-vandal bot',0,664),(86,'short \'X is a city in Y\' article',0,48),(88,'test edit',0,500),(92,'visualeditor-needcheck',0,24),(93,'Possible Vandalism - LTA',1,65),(96,'mw-contentmodelchange',0,6),(97,'contenttranslation-v2',0,583),(98,'OAuth CID: 1188',0,107),(99,'Likely have problems',0,388),(101,'OAuth CID: 1261',0,160),(102,'references removed',0,4277),(103,'Spam Research',0,5),(104,'OAuth CID: 429',0,3),(105,'OAuth CID: 1352',0,5477),(106,'removal of quick deletion templates',0,1789),(107,'advanced mobile edit',0,12013),(108,'OAuth CID: 651',0,5),(109,'OAuth CID: 1805',0,2833),(110,'added links to social media sites',0,679),(111,'discussiontools',0,2832),(112,'discussiontools-reply',0,2444),(113,'discussiontools-visual',0,368),(114,'discussiontools-source',0,2464),(115,'mw-manual-revert',0,44507),(116,'T144167',0,2),(117,'mw-reverted',0,84006),(118,'Ukraine-Russia-related vandalism',0,5),(119,'new user blanking Wikipedia or WP Talk page',0,158),(120,'OAuth CID: 1804',0,99),(121,'discussiontools-newtopic',0,388),(122,'newcomer task',0,410),(123,'mw-add-media',0,23308),(124,'mw-remove-media',0,11135),(125,'discussiontools-source-enhanced',0,341);
43 | /*!40000 ALTER TABLE `change_tag_def` ENABLE KEYS */;
44 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
45 |
46 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
47 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
48 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
49 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
50 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
51 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
52 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
53 |
54 | -- Dump completed on 2021-07-01 11:48:33
55 |
--------------------------------------------------------------------------------
/data/testfile.sql.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mediawiki-utilities/python-mwsql/ac0c6d9b7339e95b1ad4533e968c3df4cc58f521/data/testfile.sql.gz
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 |
3 | # -- Path setup --------------------------------------------------------------
4 |
5 | # If extensions (or modules to document with autodoc) are in another directory,
6 | # add these directories to sys.path here. If the directory is relative to the
7 | # documentation root, use os.path.abspath to make it absolute, like shown here.
8 | # type: ignore
9 | import sys
10 | from pathlib import Path
11 |
12 | import toml
13 |
14 | sys.path.insert(0, Path().resolve())
15 |
16 |
17 | # -- Project information -----------------------------------------------------
18 |
19 | # Read the project information from pyproject.toml
20 | pyproject = toml.load(Path(__file__).parent.parent / "pyproject.toml")
21 | project = pyproject["tool"]["poetry"]["name"]
22 | author = pyproject["tool"]["poetry"]["authors"][0].split(" <")[0]
23 | email = pyproject["tool"]["poetry"]["authors"][0].split(" <")[1].replace(">", "")
24 | version = release = pyproject["tool"]["poetry"]["version"]
25 | license = pyproject["tool"]["poetry"]["license"]
26 | summary = pyproject["tool"]["poetry"]["description"]
27 | copyright = f"Copyright 2021 {author}"
28 |
29 |
30 | # -- General configuration ---------------------------------------------------
31 |
32 | # Add any Sphinx extension module names here, as strings. They can be
33 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
34 | # ones.
35 | extensions = ["sphinx.ext.autodoc", "sphinx_copybutton"]
36 |
37 | # Add any paths that contain templates here, relative to this directory.
38 | templates_path = ["_templates"]
39 |
40 | # List of patterns, relative to source directory, that match files and
41 | # directories to ignore when looking for source files.
42 | # This pattern also affects html_static_path and html_extra_path.
43 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
44 |
45 |
46 | # -- Options for HTML output -------------------------------------------------
47 |
48 | # The theme to use for HTML and HTML Help pages. See the documentation for
49 | # a list of builtin themes.
50 | #
51 | html_theme = "sphinx_rtd_theme"
52 |
53 | # Add any paths that contain custom static files (such as style sheets) here,
54 | # relative to this directory. They are copied after the builtin static files,
55 | # so a file named "default.css" will overwrite the builtin "default.css".
56 | html_static_path = []
57 |
58 | copybutton_prompt_text = r">>> |\.\.\. |\$ "
59 | copybutton_prompt_is_regexp = True
60 |
--------------------------------------------------------------------------------
/docs/contributing.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../CONTRIBUTING.rst
2 |
--------------------------------------------------------------------------------
/docs/examples.rst:
--------------------------------------------------------------------------------
1 | Usage examples
2 | ==============
3 |
4 |
5 | Loading a dump file
6 | -------------------
7 |
8 | `Wikimedia SQL dump files`_ are publicly available and can be downloaded from the web.
9 | They can also be directly accessed through Wikimedia environments like PAWS or Toolforge.
10 |
11 | ``mwsql`` includes a load utility for easy (down)loading of dump files – All you need to know is which file you need.
12 | For this example, we want to download the latest ``pages`` dump from the Simple English Wikipedia.
13 | If we go to https://dumps.wikimedia.org/simplewiki/latest/, we see that this file is called ``simplewiki-latest-page.sql.gz``.
14 | Instead of manually downloading it, we can do the following:
15 |
16 | .. code-block:: python
17 |
18 | >>> from mwsql import load
19 | >>> dump_file = load('simplewiki', 'page')
20 |
21 | If you *are not* in a Wikimedia hosted environment, the file will now be downloaded to your current working directory, and you will see a progress bar:
22 |
23 | .. code-block:: python
24 |
25 | >>> dump_file = load('simplewiki', 'page')
26 | Downloading https://dumps.wikimedia.org/simplewiki/latest/simplewiki-latest-page.sql.gz
27 | Progress: 92% [19.0 / 20.7] MB
28 |
29 | If you *are* in a Wikimedia hosted environment, the file is already available to you and does not need downloading. The syntax is the same, however:
30 |
31 | .. code-block:: python
32 |
33 | >>> dump_file = load('simplewiki', 'page')
34 |
35 | In both cases, ``dump_file`` will be a PathObject that points to the file.
36 |
37 |
38 | Loading a dump file from a different date
39 | -----------------------------------------
40 |
41 | The default behavior of the ``load`` function is to load the file from the latest dump. If you want to use a file from an earlier date, you can specify this by passing the date as a string to the ``date`` parameter:
42 |
43 | .. code-block:: python
44 |
45 | >>> dump_file = load('simplewiki', 'page', '20210720')
46 |
47 |
48 | Peeking at a dump file
49 | ----------------------
50 |
51 | Before diving into the data contained in the dump, you may want to look at its raw contents. You can do so by using the ``head`` function:
52 |
53 | .. code-block:: python
54 |
55 | >>> from mwsql import head
56 | >>> head(dump_file)
57 | -- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)
58 | --
59 | -- Host: 10.64.32.82 Database: simplewiki
60 | -- ------------------------------------------------------
61 | -- Server version 10.4.19-MariaDB-log
62 |
63 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
64 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
65 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
66 | /*!40101 SET NAMES utf8mb4 */;
67 |
68 |
69 | By default, the ``head`` function prints the first 10 lines.
70 | This can be changed to anything you want by specifying it in the function call:
71 |
72 | .. code-block:: python
73 |
74 | >>> from mwsql import head
75 | >>> head(dump_file, 5)
76 | -- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)
77 | --
78 | -- Host: 10.64.32.82 Database: simplewiki
79 | -- ------------------------------------------------------
80 | -- Server version 10.4.19-MariaDB-log
81 |
82 |
83 | Creating a dump object from file
84 | --------------------------------
85 |
86 | The main use of the ``mwsql`` library is to parse an SQL dump file and turn it into a Python object that is easier to work with.
87 |
88 | .. code-block:: python
89 |
90 | >>> from mwsql import Dump
91 | >>> dump = Dump.from_file(file_path)
92 |
93 | The file that ``file_path`` refers to can be either a ``.sql`` or a ``.sql.gz`` file. Now that we have instantiated a Dump object, we can access its attributes:
94 |
95 | .. code-block:: python
96 |
97 | >>> dump = Dump.from_file('simplewiki-latest-page.sql.gz')
98 | >>> dump
99 | Dump(database=simplewiki, name=page, size=21654225)
100 | >>> dump.col_names
101 | ['page_id', 'page_namespace', 'page_title', 'page_restrictions', 'page_is_redirect', 'page_is_new', 'page_random', 'page_touched', 'page_links_updated', 'page_latest', 'page_len', 'page_content_model', 'page_lang']
102 | >>> dump.encoding
103 | 'utf-8'
104 |
105 | There are other attributes a well, such as ``dtypes`` or ``primary_key``.
106 | See the `Module Reference`_ for a complete list.
107 |
108 |
109 | Displaying the rows
110 | -------------------
111 |
112 | The most interesting part of an SQL table is arguably its entries (rows.)
113 | We can take a look at them by using the ``head`` method.
114 | Note that this is different than the ``head`` *function* we used to peek at a file *before* we turned it into a Dump object.
115 |
116 | .. code-block:: python
117 |
118 | >>> dump_file = load('simplewiki', 'change_tag_def')
119 | >>> dump = Dump.from_file(dump_file)
120 | >>> dump
121 | Dump(database=simplewiki, name=change_tag_def, size=2133)
122 | >>> dump.head()
123 | ['ctd_id', 'ctd_name', 'ctd_user_defined', 'ctd_count']
124 | ['1', 'mw-replace', '0', '10453']
125 | ['2', 'visualeditor', '0', '309141']
126 | ['3', 'mw-undo', '0', '59767']
127 | ['4', 'mw-rollback', '0', '71585']
128 | ['5', 'mobile edit', '0', '234682']
129 | ['6', 'mobile web edit', '0', '227115']
130 | ['7', 'very short new article', '0', '28794']
131 | ['8', 'visualeditor-wikitext', '0', '20529']
132 | ['9', 'mw-new-redirect', '0', '30423']
133 | ['10', 'visualeditor-switched', '0', '18009']
134 |
135 |
136 | By default, the ``head`` method prints the ``col_names``, followed by the first ten rows. You can change this by passing how many rows you'd like to see as a parameter:
137 |
138 | .. code-block:: python
139 |
140 | >>> dump.head(3)
141 | ['ctd_id', 'ctd_name', 'ctd_user_defined', 'ctd_count']
142 | ['1', 'mw-replace', '0', '10453']
143 | ['2', 'visualeditor', '0', '309141']
144 | ['3', 'mw-undo', '0', '59767']
145 |
146 |
147 | Iterating over rows
148 | -------------------
149 |
150 | If we want to access the rows, all we need to do is create a generator object by using the Dump's ``rows`` method.
151 |
152 | .. code-block:: python
153 |
154 | >>> dump_file = load('simplewiki', 'change_tag_def')
155 | >>> dump = Dump.from_file(dump_file)
156 | >>> dump
157 | Dump(database=simplewiki, name=change_tag_def, size=2133)
158 | >>> rows = dump.rows()
159 | >>> for _ in range(5):
160 | print(next(rows))
161 | ['1', 'mw-replace', '0', '10453']
162 | ['2', 'visualeditor', '0', '309141']
163 | ['3', 'mw-undo', '0', '59767']
164 | ['4', 'mw-rollback', '0', '71585']
165 | ['5', 'mobile edit', '0', '234682']
166 |
167 |
168 | Converting to Python dtypes
169 | ---------------------------
170 |
171 | Note that in the above example, *all* values were printed as strings – even those that seem to be of a different dtype.
172 | We can tell the ``rows`` method that we would like to convert numeric types to int or float by setting the ``convert_dtypes`` parameter to ``true``:
173 |
174 | .. code-block:: python
175 |
176 | >>> rows = dump.rows(convert_dtypes=True)
177 | >>> for _ in range(5):
178 | print(next(rows))
179 | [1, 'mw-replace', 0, 10453]
180 | [2, 'visualeditor', 0, 309141]
181 | [3, 'mw-undo', 0, 59767]
182 | [4, 'mw-rollback', 0, 71585]
183 | [5, 'mobile edit', 0, 234682]
184 |
185 |
186 | Exporting as CSV
187 | ----------------
188 |
189 | You can export the dump as a CSV file by using the ``to_csv`` method and specifying a ``file path`` for the output file:
190 |
191 | .. code-block:: python
192 |
193 | >>> dump_file = Dump.from_file(some_file)
194 | >>> dump.to_csv('some_folder/outfile.csv')
195 |
196 | While this may take some time for larger files, you don't risk running out of memory as neither the input nor the output file is ever loaded into RAM in one big chunk.
197 |
198 |
199 | .. _`Wikimedia SQL dump files`: https://dumps.wikimedia.org/
200 | .. _`Module Reference`: https://mwsql.readthedocs.io/en/latest/module-reference.html
201 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | Welcome to ``mwsql's`` documentation!
2 | =====================================
3 |
4 |
5 | .. toctree::
6 | :maxdepth: 2
7 | :caption: Contents:
8 |
9 | readme
10 | examples
11 | contributing
12 | module-reference
13 |
14 |
15 | Indices and tables
16 | ==================
17 |
18 | * :ref:`genindex`
19 | * :ref:`search`
20 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=.
11 | set BUILDDIR=_build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/module-reference.rst:
--------------------------------------------------------------------------------
1 | Module Reference
2 | ================
3 |
4 |
5 | mwsql.dump
6 | ----------
7 |
8 | .. contents::
9 | :local:
10 | :backlinks: none
11 |
12 | .. automodule:: mwsql.dump
13 | :members:
14 |
15 |
16 | mwsql.utils
17 | -----------
18 |
19 | .. automodule:: mwsql.utils
20 | :members:
21 |
--------------------------------------------------------------------------------
/docs/readme.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../README.rst
2 |
--------------------------------------------------------------------------------
/mwsql/__init__.py:
--------------------------------------------------------------------------------
1 | from .dump import Dump
2 | from .utils import head, load
3 |
4 | __all__ = [
5 | "head",
6 | "load",
7 | "Dump",
8 | ]
9 |
--------------------------------------------------------------------------------
/mwsql/dump.py:
--------------------------------------------------------------------------------
1 | """
2 | A set of utilities for processing MediaWiki SQL dump data.
3 | """
4 |
5 | import csv
6 | import sys
7 | from pathlib import Path
8 | from typing import Any, Dict, Iterator, List, Optional, Type, TypeVar, Union
9 |
10 | from .parser import (
11 | _convert,
12 | _get_sql_attribute,
13 | _has_sql_attribute,
14 | _map_dtypes,
15 | _parse,
16 | )
17 | from .utils import _open_file
18 |
19 | # Allow long field names
20 | csv.field_size_limit(min(sys.maxsize, 2147483647))
21 |
22 | # Custom types
23 | PathObject = Union[str, Path]
24 | T = TypeVar("T", bound="Dump")
25 |
26 |
27 | class Dump:
28 | """
29 | Class for parsing an SQL dump file and processing its contents.
30 | """
31 |
32 | def __init__(
33 | self,
34 | database: Optional[str],
35 | table_name: Optional[str],
36 | col_names: List[str],
37 | col_sql_dtypes: Dict[str, str],
38 | primary_key: Optional[str],
39 | source_file: PathObject,
40 | encoding: str,
41 | ) -> None:
42 | """
43 | Dump class constructor.
44 |
45 | :param database: The wiki database, e.g. 'enwiki' or 'dewikibooks'
46 | :type database: Optional[str]
47 | :param table_name: The SQL table name
48 | :type table_name: Optional[str]
49 | :param col_names: The SQL table column (field) names
50 | :type col_names: List[str]
51 | :param col_sql_dtypes: A mapping from the column names in a SQL table
52 | to their respective SQL data types.
53 | Example: {"ct_id": int(10) unsigned NOT NULL AUTO_INCREMENT}
54 | :type col_sql_dtypes: Dict[str, str]
55 | :param primary_key: The primary key of the SQL table
56 | Can be unique or composite.
57 | :type primary_key: Optional[str]
58 | :param source_file: The path to the SQL dump file
59 | :type source_file: PathObject
60 | :param encoding: Text encoding
61 | :type encoding: str
62 | """
63 |
64 | self.db = database
65 | self.name = table_name
66 | self.col_names = col_names
67 | self.sql_dtypes = col_sql_dtypes
68 | self.primary_key = primary_key
69 | self.size = Path(source_file).stat().st_size
70 | self._dtypes: Optional[Dict[str, type]] = None
71 | self._source_file = source_file
72 | self._encoding = encoding
73 |
74 | def __str__(self) -> str:
75 | return f"Dump(database={self.db}, name={self.name}, size={self.size})"
76 |
77 | def __repr__(self) -> str:
78 | return str(self)
79 |
80 | def __iter__(self) -> Iterator[List[Any]]:
81 | return self.rows()
82 |
83 | @property
84 | def encoding(self) -> str:
85 | """
86 | The encoding used to read the dump file.
87 |
88 | :getter: Returns the current encoding
89 | :setter: Sets the encoding to a new value
90 | :return: Text encoding
91 | :rtype: str
92 | """
93 |
94 | return self._encoding
95 |
96 | @encoding.setter
97 | def encoding(self, new_encoding: str) -> None:
98 | self._encoding = new_encoding
99 |
100 | @property
101 | def dtypes(self) -> Dict[str, type]:
102 | """
103 | Mapping between col_names and native Python dtypes.
104 |
105 | :return: A mapping from the column names in a SQL table
106 | to their respective Python data types. Example: {"ct_id": int}
107 | :rtype: Dict[str, type]
108 | """
109 |
110 | if self._dtypes is None:
111 | self._dtypes = _map_dtypes(self.sql_dtypes)
112 | return self._dtypes
113 |
114 | @classmethod
115 | def from_file(cls: Type[T], file_path: PathObject, encoding: str = "utf-8") -> T:
116 | """
117 | Initialize Dump object from dump file.
118 |
119 | :param cls: A Dump class instance
120 | :type cls: Dump
121 | :param file_path: Path to source SQL dump file. Can be a .gz or an
122 | uncompressed file
123 | :type file_path: PathObject
124 | :param encoding: Text encoding, defaults to "utf-8" If you get
125 | an encoding error when processing the file, try setting this
126 | parameter to 'Latin-1'
127 | :type encoding: str, optional
128 | :return: A Dump class instance
129 | :rtype: Dump
130 | """
131 |
132 | source_file = file_path
133 | database = None
134 | table_name = None
135 | primary_key = None
136 | col_names = []
137 | col_sql_dtypes = {}
138 |
139 | # Extract meta data from dump file
140 | with _open_file(file_path, encoding=encoding) as infile:
141 | for line in infile:
142 | if _has_sql_attribute(line, "database"):
143 | database = _get_sql_attribute(line, "database")
144 |
145 | elif _has_sql_attribute(line, "create"):
146 | table_name = _get_sql_attribute(line, "table_name")
147 |
148 | elif _has_sql_attribute(line, "col_name"):
149 | col_name = _get_sql_attribute(line, "col_name")
150 | dtype = _get_sql_attribute(line, "dtype")
151 | col_names.append(col_name)
152 | col_sql_dtypes[col_name] = dtype
153 |
154 | elif _has_sql_attribute(line, "primary_key"):
155 | primary_key = _get_sql_attribute(line, "primary_key")
156 |
157 | elif _has_sql_attribute(line, "insert"):
158 | break
159 |
160 | return cls(
161 | database,
162 | table_name,
163 | col_names, # type: ignore
164 | col_sql_dtypes, # type: ignore
165 | primary_key,
166 | source_file,
167 | encoding,
168 | )
169 |
170 | def rows(
171 | self,
172 | convert_dtypes: bool = False,
173 | strict_conversion: bool = False,
174 | **fmtparams: Any,
175 | ) -> Iterator[List[Any]]:
176 | """
177 | Create a generator object from the rows.
178 |
179 | :param convert_dtypes: When set to True, numerical types are
180 | converted from str to int or float. Defaults to False.
181 | :type convert_dtypes: bool, optional
182 | :param strict_conversion: When True, raise exception Error on
183 | bad input when converting from SQL dtypes to Python dtypes.
184 | Defaults to False.
185 | :type strict_conversion: bool, optional
186 | :param fmtparams: Any kwargs you want to pass to the csv.reader()
187 | function that does the actual parsing.
188 | :yield: A generator used to iterate over the rows in the SQL table
189 | :rtype: Iterator[List[Any]]
190 | """
191 |
192 | if convert_dtypes:
193 | dtypes = list(self.dtypes.values())
194 |
195 | with _open_file(self._source_file, encoding=self.encoding) as infile:
196 | for line in infile:
197 | if _has_sql_attribute(line, "insert"):
198 | rows = _parse(line, **fmtparams)
199 | for row in rows:
200 | if convert_dtypes:
201 | converted_row = _convert(
202 | row, dtypes, strict=strict_conversion
203 | )
204 | yield converted_row
205 | else:
206 | yield row
207 |
208 | def to_csv(self, file_path: PathObject, **fmtparams: Any) -> None:
209 | """
210 | Write Dump object to CSV file.
211 |
212 | :param file_path: The file to write to. Will be created if it
213 | doesn't already exist. Will be overwritten if it does exist.
214 | :type file_path: PathObject
215 | """
216 |
217 | with open(file_path, "w") as outfile:
218 | writer = csv.writer(outfile, **fmtparams)
219 | writer.writerow(self.col_names)
220 | for row in self:
221 | writer.writerow(row)
222 |
223 | def head(self, n_lines: int = 10, convert_dtypes: bool = False) -> None:
224 | """
225 | Display first n rows.
226 |
227 | :param n_lines: Number of rows to display, defaults to 10
228 | :type n_lines: int, optional
229 | :param convert_dtypes: Optionally, shows numerical types as int
230 | or float instead of all str. Defaults to False.
231 | :type convert_dtypes: bool, optional
232 | """
233 |
234 | rows = self.rows(convert_dtypes=convert_dtypes)
235 | print(self.col_names)
236 |
237 | for _ in range(n_lines):
238 | try:
239 | print(next(rows))
240 | except StopIteration:
241 | return
242 | return
243 |
--------------------------------------------------------------------------------
/mwsql/parser.py:
--------------------------------------------------------------------------------
1 | """
2 | Parser functions used in src/dump.py
3 | """
4 |
5 | import csv
6 | import re
7 | import warnings
8 | from typing import Any, Dict, Iterator, List, Optional
9 |
10 |
11 | def _has_sql_attribute(line: str, attr_type: str) -> bool:
12 | """
13 | Check whether a string contains a specific SQL element
14 | or statement.
15 |
16 | :param line: A line from a SQL dump file.
17 | :type line: str
18 | :param attr_type: Element or statement type, e.g "primary_key"
19 | for a table's primary key or "insert" for INSERT INTO statements.
20 | :type attr_type: str
21 | :return: True or False
22 | :rtype: bool
23 | """
24 |
25 | line_start = {
26 | "database": "--",
27 | "insert": "INSERT INTO",
28 | "create": "CREATE TABLE",
29 | "primary_key": "PRIMARY KEY",
30 | "col_name": "`",
31 | }
32 | contains_element = line.strip().startswith(line_start[attr_type])
33 |
34 | if attr_type == "database":
35 | return contains_element and "Database: " in line
36 |
37 | return contains_element
38 |
39 |
40 | def _get_sql_attribute(line: str, attr_type: str) -> Any:
41 | """
42 | Extract a SQL attribute from a string that contains it.
43 |
44 | :param line: A line from a SQL dump file.
45 | :type line: str
46 | :param attr_type: Element or statement type, e.g "primary_key"
47 | for a table's primary key or "col_name" for a column (field) name.
48 | :type attr_type: str
49 | :return: A SQL attribute such as database(name), table name,
50 | primary_key, etc.
51 | :rtype: Optional[str]
52 | """
53 |
54 | attr_pattern = {
55 | "table_name": r"`([\S]*)`",
56 | "col_name": r"`([\S]*)`",
57 | "dtype": r"` ((.)*),",
58 | "primary_key": r"`([\S]*)`",
59 | }
60 |
61 | attr: Optional[str] = None
62 |
63 | try:
64 | if attr_type == "database":
65 | attr = line.strip().partition("Database: ")[-1]
66 |
67 | elif attr_type in ("table_name", "col_name", "dtype"):
68 | # ignore type - mypy does not understand try... except here
69 | attr = re.search(attr_pattern[attr_type], line).group(1) # type: ignore
70 |
71 | elif attr_type == "primary_key":
72 | attr = (
73 | re.search(attr_pattern[attr_type], line)
74 | .group(1) # type: ignore
75 | .replace("`", "")
76 | .split(",")
77 | )
78 |
79 | except AttributeError:
80 | return None
81 |
82 | return attr
83 |
84 |
85 | def _map_dtypes(sql_dtypes: Dict[str, str]) -> Dict[str, type]:
86 | """
87 | Create mapping from SQL data types to Python data types.
88 |
89 | :param sql_dtypes: A mapping from the column names in a SQL table
90 | to their respective SQL data types.
91 | Example: {"ct_id": int(10) unsigned NOT NULL AUTO_INCREMENT}
92 | :type sql_dtypes: Dict[str, str]
93 | :return: A mapping from the column names in a SQL table
94 | to their respective Python data types. Example: {"ct_id": int}
95 | :rtype: Dict[str, type]
96 | """
97 |
98 | types: Dict[str, type] = {}
99 | for key, val in sql_dtypes.items():
100 | if "int" in val:
101 | types[key] = int
102 | elif any(dtype in val for dtype in ("float", "double", "decimal", "numeric")):
103 | types[key] = float
104 | else:
105 | types[key] = str
106 | return types
107 |
108 |
109 | def _convert(values: List[str], dtypes: List[type], strict: bool = False) -> List[Any]:
110 | """
111 | Cast numerical values in a list of strings to float or int
112 | as specified by the dtypes parameter.
113 |
114 | :param values: A list of strings representing a row in a SQL table
115 | E.g. ['28207', 'April', '4742783', '0.9793'].
116 | :type values: List[str]
117 | :param dtypes: A list of Python data types. E.g. [int, str, int, float]
118 | :type dtypes: List[type]
119 | :param strict: When set to False, if any of the items in the list
120 | cannot be converted, it is returned unchanged, i.e. as a str.
121 | :type strict: bool, optional
122 | :raises ValueError: If `values` is not the same length as `dtypes`,
123 | or if `strict` is set to True and some of the values in the
124 | list couldn't be converted.
125 | :return: A list where the numerical values have been cast as int
126 | or string as defined by `dtypes`. E.g. the example list from
127 | above is returned as [28207, 'April', 4742783, 0.9793]
128 | :rtype: List[Any]
129 | """
130 |
131 | len_values = len(values)
132 | len_dtypes = len(dtypes)
133 |
134 | warn = False
135 |
136 | if len_values != len_dtypes:
137 | if not strict:
138 | return values
139 |
140 | raise ValueError("values and dtypes are not the same length")
141 |
142 | converted = []
143 | for i in range(len_dtypes):
144 | dtype = dtypes[i]
145 | val = values[i]
146 |
147 | try:
148 | conv = dtype(val)
149 | converted.append(conv)
150 |
151 | except ValueError as e:
152 | if values[i] == "":
153 | # why not convert to None?
154 | converted.append(val)
155 | elif not strict:
156 | warn = True
157 | converted.append(val)
158 | else:
159 | print(f"ValueError: {e}")
160 | raise
161 |
162 | if warn:
163 | warnings.warn(
164 | "some values could not be converted to Python dtypes", UserWarning
165 | )
166 |
167 | return converted
168 |
169 |
170 | def _split_tuples(line: str) -> List[str]:
171 | """
172 | Split an INSERT INTO statement into a list of strings each
173 | representing a SQL table row.
174 |
175 | :param line: An INSERT INTO statement, e.g. "INSERT INTO `change_tag_def`
176 | VALUES (1,'mw-replace',0,10200),(2,'visualeditor',0,305860);"
177 | :type line: str
178 | :return: A list with items representing SQL rows,
179 | e.g. ["1,'mw-replace',0,10200", "2,'visualeditor',0,305860"]
180 | :rtype: List[str]
181 | """
182 |
183 | tuples = line.partition(" VALUES ")[-1].strip()
184 | # Sub NULL with the empty string
185 | pattern = r"(?<=[,(])NULL(?=[,)])"
186 | values = re.sub(pattern, "", tuples)
187 | # Remove `;` at the end of the last `INSERT INTO` statement
188 | if values[-1] == ";":
189 | values = values[:-1]
190 | records = re.split(r"\),\(", values[1:-1]) # Strip `(` and `)`
191 |
192 | return records
193 |
194 |
195 | def _parse(
196 | line: str,
197 | delimiter: str = ",",
198 | escape_char: str = "\\",
199 | quote_char: str = "'",
200 | doublequote: bool = False,
201 | strict: bool = True,
202 | ) -> Iterator[List[str]]:
203 | """
204 | Parse an INSERT INTO statement and return a generator that yields from a list of CSV-formatted strings, each representing a SQL table row. This
205 | is essentially a wrapper around a csv.reader object and takes the same
206 | parameters, except it takes a string as input instead of an iterator-type
207 | object.
208 |
209 | :param line: An INSERT INTO statement, e.g. "INSERT INTO `change_tag_def`
210 | VALUES (1,'mw-replace',0,10200),(2,'visualeditor',0,305860);"
211 | :type line: str
212 | :param delimiter: A one-character string used to separate fields,
213 | defaults to ","
214 | :type delimiter: str, optional
215 | :param escape_char: A one-character string used by the reader to remove
216 | any special meaning from the following character, defaults to "\"
217 | :type escape_char: str, optional
218 | :param quote_char: A one-character string used to quote fields
219 | containing special characters, such as the delimiter or quotechar,
220 | or which contain new-line characters, defaults to "'"
221 | :type quote_char: str, optional
222 | :param doublequote: Controls how instances of quotechar appearing inside
223 | a field should themselves be quoted. When True, the character
224 | is doubled. When False, the escapechar is used as a prefix
225 | to the quotechar. Defaults to False.
226 | :type doublequote: bool, optional
227 | :param strict: When True, raise exception Error on bad CSV input.
228 | Defaults to True.
229 | :type strict: bool, optional
230 | :return: A generator that yields from a list of CSV-formatted strings.
231 | :rtype: Iterator[List[str]]
232 | """
233 |
234 | records = _split_tuples(line)
235 | reader = csv.reader(
236 | records,
237 | delimiter=delimiter,
238 | escapechar=escape_char,
239 | quotechar=quote_char,
240 | doublequote=doublequote,
241 | strict=strict,
242 | )
243 | return reader
244 |
--------------------------------------------------------------------------------
/mwsql/utils.py:
--------------------------------------------------------------------------------
1 | """
2 | Utility functions used to download, open and display
3 | the contents of Wikimedia SQL dump files.
4 | """
5 |
6 | import gzip
7 | from contextlib import contextmanager
8 | from pathlib import Path
9 | from typing import Iterator, Optional, TextIO, Union
10 |
11 | import requests # type: ignore
12 | from tqdm import tqdm # type: ignore
13 |
14 | # Custom type
15 | PathObject = Union[str, Path]
16 |
17 |
18 | @contextmanager
19 | def _open_file(
20 | file_path: PathObject, encoding: Optional[str] = None
21 | ) -> Iterator[TextIO]:
22 | """
23 | Custom context manager for opening both .gz and uncompressed files.
24 |
25 | :param file_path: The path to the file
26 | :type file_path: PathObject
27 | :param encoding: Text encoding, defaults to None
28 | :type encoding: Optional[str], optional
29 | :yield: A file handle
30 | :rtype: Iterator[TextIO]
31 | """
32 |
33 | if str(file_path).endswith(".gz"):
34 | infile = gzip.open(file_path, mode="rt", encoding=encoding)
35 | else:
36 | infile = open(file_path, mode="r", encoding=encoding)
37 | try:
38 | yield infile
39 | finally:
40 | infile.close()
41 |
42 |
43 | def head(file_path: PathObject, n_lines: int = 10, encoding: str = "utf-8") -> None:
44 | """
45 | Display first n lines of a file. Works with both
46 | .gz and uncompressed files. Defaults to 10 lines.
47 |
48 | :param file_path: The path to the file
49 | :type file_path: PathObject
50 | :param n_lines: Lines to display, defaults to 10
51 | :type n_lines: int, optional
52 | :param encoding: Text encoding, defaults to "utf-8"
53 | :type encoding: str, optional
54 | """
55 |
56 | with _open_file(file_path, encoding=encoding) as infile:
57 | for line in infile:
58 | if n_lines == 0:
59 | break
60 | try:
61 | print(line.strip())
62 | n_lines -= 1
63 | except StopIteration:
64 | return
65 | return
66 |
67 |
68 | def download_file(url: str, file_name: str) -> Optional[Path]:
69 | """
70 | Download a file from a URL and show a progress indicator. Return the path to the downloaded file.
71 |
72 | :param url: URL to download from
73 | :type url: str
74 | :param file_name: name of the file to download
75 | :type file_name: str
76 | :return: path to the downloaded file
77 | :rtype: Optional[Path]
78 | """
79 |
80 | session = requests.Session()
81 | response = session.get(url, stream=True)
82 | response.raise_for_status()
83 | total_size = int(response.headers.get("content-length", 0))
84 | block_size = 4096
85 | progress_bar = tqdm(total=total_size, unit="iB", unit_scale=True)
86 |
87 | with open(file_name, "wb") as outfile:
88 | for data in response.iter_content(block_size):
89 | progress_bar.update(len(data))
90 | outfile.write(data)
91 | progress_bar.close()
92 |
93 | if total_size != 0 and progress_bar.n != total_size:
94 | raise RuntimeError(
95 | f"Downloaded {progress_bar.n} bytes, expected {total_size} bytes"
96 | )
97 |
98 | return Path(file_name)
99 |
100 |
101 | def load(
102 | database: str, filename: str, date: str = "latest", extension: str = "sql"
103 | ) -> Optional[PathObject]:
104 | """
105 | Load a dump file from a Wikimedia public directory if the
106 | user is in a supported environment (PAWS, Toolforge...). Otherwise, download dump file from the web and save in the current working directory. In both cases,the function returns a path-like object which can be used to access the file. Does not check if the file already exists on the path.
107 |
108 | :param database: The database backup dump to download a file from,
109 | e.g. 'enwiki' (English Wikipedia). See a list of available
110 | databases here: https://dumps.wikimedia.org/backup-index-bydb.html
111 | :type database: str
112 | :param filename: The name of the file to download, e.g. 'page' loads the
113 | file {database}-{date}-page.sql.gz
114 | :type filename: str
115 | :param date: Date the dump was generated, defaults to "latest". If "latest"
116 | is not used, the date format should be "YYYYMMDD"
117 | :type date: str, optional
118 | :param extension: The file extension. Defaults to 'sql'
119 | :type extension: str
120 | :return: Path to dump file
121 | :rtype: Optional[PathObject]
122 | """
123 |
124 | paws_root_dir = Path("/public/dumps/public/")
125 | dumps_url = "https://dumps.wikimedia.org/"
126 | subdir = Path(database, date)
127 | extended_filename = f"{database}-{date}-{filename}.{extension}.gz"
128 | file_path = Path(extended_filename)
129 |
130 | if paws_root_dir.exists():
131 | return Path(paws_root_dir, subdir, file_path)
132 |
133 | else:
134 | subdir_str = str(subdir).replace("\\", "/")
135 | url = f"{dumps_url}{subdir_str}/{str(extended_filename)}"
136 | return download_file(url, extended_filename)
137 |
--------------------------------------------------------------------------------
/poetry.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
2 |
3 | [[package]]
4 | name = "alabaster"
5 | version = "0.7.16"
6 | description = "A light, configurable Sphinx theme"
7 | optional = false
8 | python-versions = ">=3.9"
9 | files = [
10 | {file = "alabaster-0.7.16-py3-none-any.whl", hash = "sha256:b46733c07dce03ae4e150330b975c75737fa60f0a7c591b6c8bf4928a28e2c92"},
11 | {file = "alabaster-0.7.16.tar.gz", hash = "sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65"},
12 | ]
13 |
14 | [[package]]
15 | name = "babel"
16 | version = "2.14.0"
17 | description = "Internationalization utilities"
18 | optional = false
19 | python-versions = ">=3.7"
20 | files = [
21 | {file = "Babel-2.14.0-py3-none-any.whl", hash = "sha256:efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287"},
22 | {file = "Babel-2.14.0.tar.gz", hash = "sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363"},
23 | ]
24 |
25 | [package.extras]
26 | dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"]
27 |
28 | [[package]]
29 | name = "certifi"
30 | version = "2024.2.2"
31 | description = "Python package for providing Mozilla's CA Bundle."
32 | optional = false
33 | python-versions = ">=3.6"
34 | files = [
35 | {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"},
36 | {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"},
37 | ]
38 |
39 | [[package]]
40 | name = "cfgv"
41 | version = "3.4.0"
42 | description = "Validate configuration and produce human readable error messages."
43 | optional = false
44 | python-versions = ">=3.8"
45 | files = [
46 | {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"},
47 | {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"},
48 | ]
49 |
50 | [[package]]
51 | name = "charset-normalizer"
52 | version = "3.3.2"
53 | description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
54 | optional = false
55 | python-versions = ">=3.7.0"
56 | files = [
57 | {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"},
58 | {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"},
59 | {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"},
60 | {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"},
61 | {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"},
62 | {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"},
63 | {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"},
64 | {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"},
65 | {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"},
66 | {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"},
67 | {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12"},
68 | {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f"},
69 | {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269"},
70 | {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519"},
71 | {file = "charset_normalizer-3.3.2-cp310-cp310-win32.whl", hash = "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73"},
72 | {file = "charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09"},
73 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"},
74 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"},
75 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"},
76 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"},
77 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"},
78 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"},
79 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"},
80 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"},
81 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"},
82 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"},
83 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"},
84 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"},
85 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"},
86 | {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"},
87 | {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"},
88 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"},
89 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"},
90 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"},
91 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"},
92 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"},
93 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"},
94 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"},
95 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"},
96 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"},
97 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"},
98 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"},
99 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"},
100 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"},
101 | {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"},
102 | {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"},
103 | {file = "charset_normalizer-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c"},
104 | {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5"},
105 | {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985"},
106 | {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6"},
107 | {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714"},
108 | {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786"},
109 | {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5"},
110 | {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c"},
111 | {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8"},
112 | {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711"},
113 | {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811"},
114 | {file = "charset_normalizer-3.3.2-cp37-cp37m-win32.whl", hash = "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4"},
115 | {file = "charset_normalizer-3.3.2-cp37-cp37m-win_amd64.whl", hash = "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99"},
116 | {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a"},
117 | {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac"},
118 | {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a"},
119 | {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33"},
120 | {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238"},
121 | {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a"},
122 | {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2"},
123 | {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8"},
124 | {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898"},
125 | {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99"},
126 | {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d"},
127 | {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04"},
128 | {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087"},
129 | {file = "charset_normalizer-3.3.2-cp38-cp38-win32.whl", hash = "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25"},
130 | {file = "charset_normalizer-3.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b"},
131 | {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4"},
132 | {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d"},
133 | {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0"},
134 | {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269"},
135 | {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c"},
136 | {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519"},
137 | {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796"},
138 | {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185"},
139 | {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c"},
140 | {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458"},
141 | {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2"},
142 | {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8"},
143 | {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"},
144 | {file = "charset_normalizer-3.3.2-cp39-cp39-win32.whl", hash = "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f"},
145 | {file = "charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d"},
146 | {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"},
147 | ]
148 |
149 | [[package]]
150 | name = "colorama"
151 | version = "0.4.6"
152 | description = "Cross-platform colored terminal text."
153 | optional = false
154 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
155 | files = [
156 | {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
157 | {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
158 | ]
159 |
160 | [[package]]
161 | name = "distlib"
162 | version = "0.3.8"
163 | description = "Distribution utilities"
164 | optional = false
165 | python-versions = "*"
166 | files = [
167 | {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"},
168 | {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"},
169 | ]
170 |
171 | [[package]]
172 | name = "docutils"
173 | version = "0.20.1"
174 | description = "Docutils -- Python Documentation Utilities"
175 | optional = false
176 | python-versions = ">=3.7"
177 | files = [
178 | {file = "docutils-0.20.1-py3-none-any.whl", hash = "sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6"},
179 | {file = "docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b"},
180 | ]
181 |
182 | [[package]]
183 | name = "exceptiongroup"
184 | version = "1.2.0"
185 | description = "Backport of PEP 654 (exception groups)"
186 | optional = false
187 | python-versions = ">=3.7"
188 | files = [
189 | {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"},
190 | {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"},
191 | ]
192 |
193 | [package.extras]
194 | test = ["pytest (>=6)"]
195 |
196 | [[package]]
197 | name = "filelock"
198 | version = "3.13.1"
199 | description = "A platform independent file lock."
200 | optional = false
201 | python-versions = ">=3.8"
202 | files = [
203 | {file = "filelock-3.13.1-py3-none-any.whl", hash = "sha256:57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c"},
204 | {file = "filelock-3.13.1.tar.gz", hash = "sha256:521f5f56c50f8426f5e03ad3b281b490a87ef15bc6c526f168290f0c7148d44e"},
205 | ]
206 |
207 | [package.extras]
208 | docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.24)"]
209 | testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"]
210 | typing = ["typing-extensions (>=4.8)"]
211 |
212 | [[package]]
213 | name = "identify"
214 | version = "2.5.33"
215 | description = "File identification library for Python"
216 | optional = false
217 | python-versions = ">=3.8"
218 | files = [
219 | {file = "identify-2.5.33-py2.py3-none-any.whl", hash = "sha256:d40ce5fcd762817627670da8a7d8d8e65f24342d14539c59488dc603bf662e34"},
220 | {file = "identify-2.5.33.tar.gz", hash = "sha256:161558f9fe4559e1557e1bff323e8631f6a0e4837f7497767c1782832f16b62d"},
221 | ]
222 |
223 | [package.extras]
224 | license = ["ukkonen"]
225 |
226 | [[package]]
227 | name = "idna"
228 | version = "3.6"
229 | description = "Internationalized Domain Names in Applications (IDNA)"
230 | optional = false
231 | python-versions = ">=3.5"
232 | files = [
233 | {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"},
234 | {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"},
235 | ]
236 |
237 | [[package]]
238 | name = "imagesize"
239 | version = "1.4.1"
240 | description = "Getting image size from png/jpeg/jpeg2000/gif file"
241 | optional = false
242 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
243 | files = [
244 | {file = "imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b"},
245 | {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"},
246 | ]
247 |
248 | [[package]]
249 | name = "importlib-metadata"
250 | version = "7.0.1"
251 | description = "Read metadata from Python packages"
252 | optional = false
253 | python-versions = ">=3.8"
254 | files = [
255 | {file = "importlib_metadata-7.0.1-py3-none-any.whl", hash = "sha256:4805911c3a4ec7c3966410053e9ec6a1fecd629117df5adee56dfc9432a1081e"},
256 | {file = "importlib_metadata-7.0.1.tar.gz", hash = "sha256:f238736bb06590ae52ac1fab06a3a9ef1d8dce2b7a35b5ab329371d6c8f5d2cc"},
257 | ]
258 |
259 | [package.dependencies]
260 | zipp = ">=0.5"
261 |
262 | [package.extras]
263 | docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"]
264 | perf = ["ipython"]
265 | testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"]
266 |
267 | [[package]]
268 | name = "iniconfig"
269 | version = "2.0.0"
270 | description = "brain-dead simple config-ini parsing"
271 | optional = false
272 | python-versions = ">=3.7"
273 | files = [
274 | {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
275 | {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
276 | ]
277 |
278 | [[package]]
279 | name = "jinja2"
280 | version = "3.1.3"
281 | description = "A very fast and expressive template engine."
282 | optional = false
283 | python-versions = ">=3.7"
284 | files = [
285 | {file = "Jinja2-3.1.3-py3-none-any.whl", hash = "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa"},
286 | {file = "Jinja2-3.1.3.tar.gz", hash = "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90"},
287 | ]
288 |
289 | [package.dependencies]
290 | MarkupSafe = ">=2.0"
291 |
292 | [package.extras]
293 | i18n = ["Babel (>=2.7)"]
294 |
295 | [[package]]
296 | name = "livereload"
297 | version = "2.6.3"
298 | description = "Python LiveReload is an awesome tool for web developers"
299 | optional = false
300 | python-versions = "*"
301 | files = [
302 | {file = "livereload-2.6.3-py2.py3-none-any.whl", hash = "sha256:ad4ac6f53b2d62bb6ce1a5e6e96f1f00976a32348afedcb4b6d68df2a1d346e4"},
303 | {file = "livereload-2.6.3.tar.gz", hash = "sha256:776f2f865e59fde56490a56bcc6773b6917366bce0c267c60ee8aaf1a0959869"},
304 | ]
305 |
306 | [package.dependencies]
307 | six = "*"
308 | tornado = {version = "*", markers = "python_version > \"2.7\""}
309 |
310 | [[package]]
311 | name = "markupsafe"
312 | version = "2.1.5"
313 | description = "Safely add untrusted strings to HTML/XML markup."
314 | optional = false
315 | python-versions = ">=3.7"
316 | files = [
317 | {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc"},
318 | {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5"},
319 | {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46"},
320 | {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f"},
321 | {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900"},
322 | {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff"},
323 | {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad"},
324 | {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd"},
325 | {file = "MarkupSafe-2.1.5-cp310-cp310-win32.whl", hash = "sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4"},
326 | {file = "MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl", hash = "sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5"},
327 | {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f"},
328 | {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2"},
329 | {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced"},
330 | {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5"},
331 | {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c"},
332 | {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f"},
333 | {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a"},
334 | {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f"},
335 | {file = "MarkupSafe-2.1.5-cp311-cp311-win32.whl", hash = "sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906"},
336 | {file = "MarkupSafe-2.1.5-cp311-cp311-win_amd64.whl", hash = "sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617"},
337 | {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1"},
338 | {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4"},
339 | {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee"},
340 | {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5"},
341 | {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b"},
342 | {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a"},
343 | {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f"},
344 | {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169"},
345 | {file = "MarkupSafe-2.1.5-cp312-cp312-win32.whl", hash = "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad"},
346 | {file = "MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb"},
347 | {file = "MarkupSafe-2.1.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f"},
348 | {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf"},
349 | {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a"},
350 | {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52"},
351 | {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9"},
352 | {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df"},
353 | {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50"},
354 | {file = "MarkupSafe-2.1.5-cp37-cp37m-win32.whl", hash = "sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371"},
355 | {file = "MarkupSafe-2.1.5-cp37-cp37m-win_amd64.whl", hash = "sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2"},
356 | {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a"},
357 | {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46"},
358 | {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532"},
359 | {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab"},
360 | {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68"},
361 | {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0"},
362 | {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4"},
363 | {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3"},
364 | {file = "MarkupSafe-2.1.5-cp38-cp38-win32.whl", hash = "sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff"},
365 | {file = "MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl", hash = "sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029"},
366 | {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf"},
367 | {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2"},
368 | {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8"},
369 | {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3"},
370 | {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465"},
371 | {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e"},
372 | {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea"},
373 | {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6"},
374 | {file = "MarkupSafe-2.1.5-cp39-cp39-win32.whl", hash = "sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf"},
375 | {file = "MarkupSafe-2.1.5-cp39-cp39-win_amd64.whl", hash = "sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5"},
376 | {file = "MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"},
377 | ]
378 |
379 | [[package]]
380 | name = "mypy"
381 | version = "1.8.0"
382 | description = "Optional static typing for Python"
383 | optional = false
384 | python-versions = ">=3.8"
385 | files = [
386 | {file = "mypy-1.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:485a8942f671120f76afffff70f259e1cd0f0cfe08f81c05d8816d958d4577d3"},
387 | {file = "mypy-1.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:df9824ac11deaf007443e7ed2a4a26bebff98d2bc43c6da21b2b64185da011c4"},
388 | {file = "mypy-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2afecd6354bbfb6e0160f4e4ad9ba6e4e003b767dd80d85516e71f2e955ab50d"},
389 | {file = "mypy-1.8.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8963b83d53ee733a6e4196954502b33567ad07dfd74851f32be18eb932fb1cb9"},
390 | {file = "mypy-1.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:e46f44b54ebddbeedbd3d5b289a893219065ef805d95094d16a0af6630f5d410"},
391 | {file = "mypy-1.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:855fe27b80375e5c5878492f0729540db47b186509c98dae341254c8f45f42ae"},
392 | {file = "mypy-1.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4c886c6cce2d070bd7df4ec4a05a13ee20c0aa60cb587e8d1265b6c03cf91da3"},
393 | {file = "mypy-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d19c413b3c07cbecf1f991e2221746b0d2a9410b59cb3f4fb9557f0365a1a817"},
394 | {file = "mypy-1.8.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9261ed810972061388918c83c3f5cd46079d875026ba97380f3e3978a72f503d"},
395 | {file = "mypy-1.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:51720c776d148bad2372ca21ca29256ed483aa9a4cdefefcef49006dff2a6835"},
396 | {file = "mypy-1.8.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:52825b01f5c4c1c4eb0db253ec09c7aa17e1a7304d247c48b6f3599ef40db8bd"},
397 | {file = "mypy-1.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f5ac9a4eeb1ec0f1ccdc6f326bcdb464de5f80eb07fb38b5ddd7b0de6bc61e55"},
398 | {file = "mypy-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afe3fe972c645b4632c563d3f3eff1cdca2fa058f730df2b93a35e3b0c538218"},
399 | {file = "mypy-1.8.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:42c6680d256ab35637ef88891c6bd02514ccb7e1122133ac96055ff458f93fc3"},
400 | {file = "mypy-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:720a5ca70e136b675af3af63db533c1c8c9181314d207568bbe79051f122669e"},
401 | {file = "mypy-1.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:028cf9f2cae89e202d7b6593cd98db6759379f17a319b5faf4f9978d7084cdc6"},
402 | {file = "mypy-1.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4e6d97288757e1ddba10dd9549ac27982e3e74a49d8d0179fc14d4365c7add66"},
403 | {file = "mypy-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f1478736fcebb90f97e40aff11a5f253af890c845ee0c850fe80aa060a267c6"},
404 | {file = "mypy-1.8.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42419861b43e6962a649068a61f4a4839205a3ef525b858377a960b9e2de6e0d"},
405 | {file = "mypy-1.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:2b5b6c721bd4aabaadead3a5e6fa85c11c6c795e0c81a7215776ef8afc66de02"},
406 | {file = "mypy-1.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5c1538c38584029352878a0466f03a8ee7547d7bd9f641f57a0f3017a7c905b8"},
407 | {file = "mypy-1.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ef4be7baf08a203170f29e89d79064463b7fc7a0908b9d0d5114e8009c3a259"},
408 | {file = "mypy-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7178def594014aa6c35a8ff411cf37d682f428b3b5617ca79029d8ae72f5402b"},
409 | {file = "mypy-1.8.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ab3c84fa13c04aeeeabb2a7f67a25ef5d77ac9d6486ff33ded762ef353aa5592"},
410 | {file = "mypy-1.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:99b00bc72855812a60d253420d8a2eae839b0afa4938f09f4d2aa9bb4654263a"},
411 | {file = "mypy-1.8.0-py3-none-any.whl", hash = "sha256:538fd81bb5e430cc1381a443971c0475582ff9f434c16cd46d2c66763ce85d9d"},
412 | {file = "mypy-1.8.0.tar.gz", hash = "sha256:6ff8b244d7085a0b425b56d327b480c3b29cafbd2eff27316a004f9a7391ae07"},
413 | ]
414 |
415 | [package.dependencies]
416 | mypy-extensions = ">=1.0.0"
417 | tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
418 | typing-extensions = ">=4.1.0"
419 |
420 | [package.extras]
421 | dmypy = ["psutil (>=4.0)"]
422 | install-types = ["pip"]
423 | mypyc = ["setuptools (>=50)"]
424 | reports = ["lxml"]
425 |
426 | [[package]]
427 | name = "mypy-extensions"
428 | version = "1.0.0"
429 | description = "Type system extensions for programs checked with the mypy type checker."
430 | optional = false
431 | python-versions = ">=3.5"
432 | files = [
433 | {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"},
434 | {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"},
435 | ]
436 |
437 | [[package]]
438 | name = "nodeenv"
439 | version = "1.8.0"
440 | description = "Node.js virtual environment builder"
441 | optional = false
442 | python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*"
443 | files = [
444 | {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"},
445 | {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"},
446 | ]
447 |
448 | [package.dependencies]
449 | setuptools = "*"
450 |
451 | [[package]]
452 | name = "packaging"
453 | version = "23.2"
454 | description = "Core utilities for Python packages"
455 | optional = false
456 | python-versions = ">=3.7"
457 | files = [
458 | {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"},
459 | {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"},
460 | ]
461 |
462 | [[package]]
463 | name = "platformdirs"
464 | version = "4.2.0"
465 | description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
466 | optional = false
467 | python-versions = ">=3.8"
468 | files = [
469 | {file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"},
470 | {file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"},
471 | ]
472 |
473 | [package.extras]
474 | docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
475 | test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
476 |
477 | [[package]]
478 | name = "pluggy"
479 | version = "1.4.0"
480 | description = "plugin and hook calling mechanisms for python"
481 | optional = false
482 | python-versions = ">=3.8"
483 | files = [
484 | {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"},
485 | {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"},
486 | ]
487 |
488 | [package.extras]
489 | dev = ["pre-commit", "tox"]
490 | testing = ["pytest", "pytest-benchmark"]
491 |
492 | [[package]]
493 | name = "pre-commit"
494 | version = "3.6.0"
495 | description = "A framework for managing and maintaining multi-language pre-commit hooks."
496 | optional = false
497 | python-versions = ">=3.9"
498 | files = [
499 | {file = "pre_commit-3.6.0-py2.py3-none-any.whl", hash = "sha256:c255039ef399049a5544b6ce13d135caba8f2c28c3b4033277a788f434308376"},
500 | {file = "pre_commit-3.6.0.tar.gz", hash = "sha256:d30bad9abf165f7785c15a21a1f46da7d0677cb00ee7ff4c579fd38922efe15d"},
501 | ]
502 |
503 | [package.dependencies]
504 | cfgv = ">=2.0.0"
505 | identify = ">=1.0.0"
506 | nodeenv = ">=0.11.1"
507 | pyyaml = ">=5.1"
508 | virtualenv = ">=20.10.0"
509 |
510 | [[package]]
511 | name = "pygments"
512 | version = "2.17.2"
513 | description = "Pygments is a syntax highlighting package written in Python."
514 | optional = false
515 | python-versions = ">=3.7"
516 | files = [
517 | {file = "pygments-2.17.2-py3-none-any.whl", hash = "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c"},
518 | {file = "pygments-2.17.2.tar.gz", hash = "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"},
519 | ]
520 |
521 | [package.extras]
522 | plugins = ["importlib-metadata"]
523 | windows-terminal = ["colorama (>=0.4.6)"]
524 |
525 | [[package]]
526 | name = "pytest"
527 | version = "8.0.0"
528 | description = "pytest: simple powerful testing with Python"
529 | optional = false
530 | python-versions = ">=3.8"
531 | files = [
532 | {file = "pytest-8.0.0-py3-none-any.whl", hash = "sha256:50fb9cbe836c3f20f0dfa99c565201fb75dc54c8d76373cd1bde06b06657bdb6"},
533 | {file = "pytest-8.0.0.tar.gz", hash = "sha256:249b1b0864530ba251b7438274c4d251c58d868edaaec8762893ad4a0d71c36c"},
534 | ]
535 |
536 | [package.dependencies]
537 | colorama = {version = "*", markers = "sys_platform == \"win32\""}
538 | exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
539 | iniconfig = "*"
540 | packaging = "*"
541 | pluggy = ">=1.3.0,<2.0"
542 | tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
543 |
544 | [package.extras]
545 | testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
546 |
547 | [[package]]
548 | name = "pyyaml"
549 | version = "6.0.1"
550 | description = "YAML parser and emitter for Python"
551 | optional = false
552 | python-versions = ">=3.6"
553 | files = [
554 | {file = "PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a"},
555 | {file = "PyYAML-6.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f"},
556 | {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"},
557 | {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"},
558 | {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"},
559 | {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"},
560 | {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"},
561 | {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"},
562 | {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"},
563 | {file = "PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab"},
564 | {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"},
565 | {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"},
566 | {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"},
567 | {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"},
568 | {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"},
569 | {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
570 | {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
571 | {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
572 | {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
573 | {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
574 | {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
575 | {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"},
576 | {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"},
577 | {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"},
578 | {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"},
579 | {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd"},
580 | {file = "PyYAML-6.0.1-cp36-cp36m-win32.whl", hash = "sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585"},
581 | {file = "PyYAML-6.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa"},
582 | {file = "PyYAML-6.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3"},
583 | {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27"},
584 | {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3"},
585 | {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c"},
586 | {file = "PyYAML-6.0.1-cp37-cp37m-win32.whl", hash = "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba"},
587 | {file = "PyYAML-6.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867"},
588 | {file = "PyYAML-6.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595"},
589 | {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"},
590 | {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"},
591 | {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"},
592 | {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"},
593 | {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"},
594 | {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"},
595 | {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"},
596 | {file = "PyYAML-6.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859"},
597 | {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"},
598 | {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"},
599 | {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"},
600 | {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"},
601 | {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"},
602 | {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"},
603 | {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"},
604 | ]
605 |
606 | [[package]]
607 | name = "requests"
608 | version = "2.31.0"
609 | description = "Python HTTP for Humans."
610 | optional = false
611 | python-versions = ">=3.7"
612 | files = [
613 | {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"},
614 | {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"},
615 | ]
616 |
617 | [package.dependencies]
618 | certifi = ">=2017.4.17"
619 | charset-normalizer = ">=2,<4"
620 | idna = ">=2.5,<4"
621 | urllib3 = ">=1.21.1,<3"
622 |
623 | [package.extras]
624 | socks = ["PySocks (>=1.5.6,!=1.5.7)"]
625 | use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
626 |
627 | [[package]]
628 | name = "setuptools"
629 | version = "69.0.3"
630 | description = "Easily download, build, install, upgrade, and uninstall Python packages"
631 | optional = false
632 | python-versions = ">=3.8"
633 | files = [
634 | {file = "setuptools-69.0.3-py3-none-any.whl", hash = "sha256:385eb4edd9c9d5c17540511303e39a147ce2fc04bc55289c322b9e5904fe2c05"},
635 | {file = "setuptools-69.0.3.tar.gz", hash = "sha256:be1af57fc409f93647f2e8e4573a142ed38724b8cdd389706a867bb4efcf1e78"},
636 | ]
637 |
638 | [package.extras]
639 | docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"]
640 | testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"]
641 | testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"]
642 |
643 | [[package]]
644 | name = "six"
645 | version = "1.16.0"
646 | description = "Python 2 and 3 compatibility utilities"
647 | optional = false
648 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
649 | files = [
650 | {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
651 | {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
652 | ]
653 |
654 | [[package]]
655 | name = "snowballstemmer"
656 | version = "2.2.0"
657 | description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms."
658 | optional = false
659 | python-versions = "*"
660 | files = [
661 | {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"},
662 | {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"},
663 | ]
664 |
665 | [[package]]
666 | name = "sphinx"
667 | version = "7.2.6"
668 | description = "Python documentation generator"
669 | optional = false
670 | python-versions = ">=3.9"
671 | files = [
672 | {file = "sphinx-7.2.6-py3-none-any.whl", hash = "sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560"},
673 | {file = "sphinx-7.2.6.tar.gz", hash = "sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5"},
674 | ]
675 |
676 | [package.dependencies]
677 | alabaster = ">=0.7,<0.8"
678 | babel = ">=2.9"
679 | colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""}
680 | docutils = ">=0.18.1,<0.21"
681 | imagesize = ">=1.3"
682 | importlib-metadata = {version = ">=4.8", markers = "python_version < \"3.10\""}
683 | Jinja2 = ">=3.0"
684 | packaging = ">=21.0"
685 | Pygments = ">=2.14"
686 | requests = ">=2.25.0"
687 | snowballstemmer = ">=2.0"
688 | sphinxcontrib-applehelp = "*"
689 | sphinxcontrib-devhelp = "*"
690 | sphinxcontrib-htmlhelp = ">=2.0.0"
691 | sphinxcontrib-jsmath = "*"
692 | sphinxcontrib-qthelp = "*"
693 | sphinxcontrib-serializinghtml = ">=1.1.9"
694 |
695 | [package.extras]
696 | docs = ["sphinxcontrib-websupport"]
697 | lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"]
698 | test = ["cython (>=3.0)", "filelock", "html5lib", "pytest (>=4.6)", "setuptools (>=67.0)"]
699 |
700 | [[package]]
701 | name = "sphinx-autobuild"
702 | version = "2024.2.4"
703 | description = "Rebuild Sphinx documentation on changes, with live-reload in the browser."
704 | optional = false
705 | python-versions = ">=3.9"
706 | files = [
707 | {file = "sphinx_autobuild-2024.2.4-py3-none-any.whl", hash = "sha256:63fd87ab7505872a89aef468ce6503f65e794a195f4ae62269db3b85b72d4854"},
708 | {file = "sphinx_autobuild-2024.2.4.tar.gz", hash = "sha256:cb9d2121a176d62d45471624872afc5fad7755ad662738abe400ecf4a7954303"},
709 | ]
710 |
711 | [package.dependencies]
712 | colorama = "*"
713 | livereload = "*"
714 | sphinx = "*"
715 |
716 | [package.extras]
717 | test = ["pytest (>=6.0)", "pytest-cov"]
718 |
719 | [[package]]
720 | name = "sphinx-copybutton"
721 | version = "0.5.2"
722 | description = "Add a copy button to each of your code cells."
723 | optional = false
724 | python-versions = ">=3.7"
725 | files = [
726 | {file = "sphinx-copybutton-0.5.2.tar.gz", hash = "sha256:4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd"},
727 | {file = "sphinx_copybutton-0.5.2-py3-none-any.whl", hash = "sha256:fb543fd386d917746c9a2c50360c7905b605726b9355cd26e9974857afeae06e"},
728 | ]
729 |
730 | [package.dependencies]
731 | sphinx = ">=1.8"
732 |
733 | [package.extras]
734 | code-style = ["pre-commit (==2.12.1)"]
735 | rtd = ["ipython", "myst-nb", "sphinx", "sphinx-book-theme", "sphinx-examples"]
736 |
737 | [[package]]
738 | name = "sphinx-rtd-theme"
739 | version = "2.0.0"
740 | description = "Read the Docs theme for Sphinx"
741 | optional = false
742 | python-versions = ">=3.6"
743 | files = [
744 | {file = "sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl", hash = "sha256:ec93d0856dc280cf3aee9a4c9807c60e027c7f7b461b77aeffed682e68f0e586"},
745 | {file = "sphinx_rtd_theme-2.0.0.tar.gz", hash = "sha256:bd5d7b80622406762073a04ef8fadc5f9151261563d47027de09910ce03afe6b"},
746 | ]
747 |
748 | [package.dependencies]
749 | docutils = "<0.21"
750 | sphinx = ">=5,<8"
751 | sphinxcontrib-jquery = ">=4,<5"
752 |
753 | [package.extras]
754 | dev = ["bump2version", "sphinxcontrib-httpdomain", "transifex-client", "wheel"]
755 |
756 | [[package]]
757 | name = "sphinxcontrib-applehelp"
758 | version = "1.0.8"
759 | description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books"
760 | optional = false
761 | python-versions = ">=3.9"
762 | files = [
763 | {file = "sphinxcontrib_applehelp-1.0.8-py3-none-any.whl", hash = "sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4"},
764 | {file = "sphinxcontrib_applehelp-1.0.8.tar.gz", hash = "sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619"},
765 | ]
766 |
767 | [package.extras]
768 | lint = ["docutils-stubs", "flake8", "mypy"]
769 | standalone = ["Sphinx (>=5)"]
770 | test = ["pytest"]
771 |
772 | [[package]]
773 | name = "sphinxcontrib-devhelp"
774 | version = "1.0.6"
775 | description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents"
776 | optional = false
777 | python-versions = ">=3.9"
778 | files = [
779 | {file = "sphinxcontrib_devhelp-1.0.6-py3-none-any.whl", hash = "sha256:6485d09629944511c893fa11355bda18b742b83a2b181f9a009f7e500595c90f"},
780 | {file = "sphinxcontrib_devhelp-1.0.6.tar.gz", hash = "sha256:9893fd3f90506bc4b97bdb977ceb8fbd823989f4316b28c3841ec128544372d3"},
781 | ]
782 |
783 | [package.extras]
784 | lint = ["docutils-stubs", "flake8", "mypy"]
785 | standalone = ["Sphinx (>=5)"]
786 | test = ["pytest"]
787 |
788 | [[package]]
789 | name = "sphinxcontrib-htmlhelp"
790 | version = "2.0.5"
791 | description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"
792 | optional = false
793 | python-versions = ">=3.9"
794 | files = [
795 | {file = "sphinxcontrib_htmlhelp-2.0.5-py3-none-any.whl", hash = "sha256:393f04f112b4d2f53d93448d4bce35842f62b307ccdc549ec1585e950bc35e04"},
796 | {file = "sphinxcontrib_htmlhelp-2.0.5.tar.gz", hash = "sha256:0dc87637d5de53dd5eec3a6a01753b1ccf99494bd756aafecd74b4fa9e729015"},
797 | ]
798 |
799 | [package.extras]
800 | lint = ["docutils-stubs", "flake8", "mypy"]
801 | standalone = ["Sphinx (>=5)"]
802 | test = ["html5lib", "pytest"]
803 |
804 | [[package]]
805 | name = "sphinxcontrib-jquery"
806 | version = "4.1"
807 | description = "Extension to include jQuery on newer Sphinx releases"
808 | optional = false
809 | python-versions = ">=2.7"
810 | files = [
811 | {file = "sphinxcontrib-jquery-4.1.tar.gz", hash = "sha256:1620739f04e36a2c779f1a131a2dfd49b2fd07351bf1968ced074365933abc7a"},
812 | {file = "sphinxcontrib_jquery-4.1-py2.py3-none-any.whl", hash = "sha256:f936030d7d0147dd026a4f2b5a57343d233f1fc7b363f68b3d4f1cb0993878ae"},
813 | ]
814 |
815 | [package.dependencies]
816 | Sphinx = ">=1.8"
817 |
818 | [[package]]
819 | name = "sphinxcontrib-jsmath"
820 | version = "1.0.1"
821 | description = "A sphinx extension which renders display math in HTML via JavaScript"
822 | optional = false
823 | python-versions = ">=3.5"
824 | files = [
825 | {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"},
826 | {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"},
827 | ]
828 |
829 | [package.extras]
830 | test = ["flake8", "mypy", "pytest"]
831 |
832 | [[package]]
833 | name = "sphinxcontrib-qthelp"
834 | version = "1.0.7"
835 | description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents"
836 | optional = false
837 | python-versions = ">=3.9"
838 | files = [
839 | {file = "sphinxcontrib_qthelp-1.0.7-py3-none-any.whl", hash = "sha256:e2ae3b5c492d58fcbd73281fbd27e34b8393ec34a073c792642cd8e529288182"},
840 | {file = "sphinxcontrib_qthelp-1.0.7.tar.gz", hash = "sha256:053dedc38823a80a7209a80860b16b722e9e0209e32fea98c90e4e6624588ed6"},
841 | ]
842 |
843 | [package.extras]
844 | lint = ["docutils-stubs", "flake8", "mypy"]
845 | standalone = ["Sphinx (>=5)"]
846 | test = ["pytest"]
847 |
848 | [[package]]
849 | name = "sphinxcontrib-serializinghtml"
850 | version = "1.1.10"
851 | description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)"
852 | optional = false
853 | python-versions = ">=3.9"
854 | files = [
855 | {file = "sphinxcontrib_serializinghtml-1.1.10-py3-none-any.whl", hash = "sha256:326369b8df80a7d2d8d7f99aa5ac577f51ea51556ed974e7716cfd4fca3f6cb7"},
856 | {file = "sphinxcontrib_serializinghtml-1.1.10.tar.gz", hash = "sha256:93f3f5dc458b91b192fe10c397e324f262cf163d79f3282c158e8436a2c4511f"},
857 | ]
858 |
859 | [package.extras]
860 | lint = ["docutils-stubs", "flake8", "mypy"]
861 | standalone = ["Sphinx (>=5)"]
862 | test = ["pytest"]
863 |
864 | [[package]]
865 | name = "toml"
866 | version = "0.10.2"
867 | description = "Python Library for Tom's Obvious, Minimal Language"
868 | optional = false
869 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
870 | files = [
871 | {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
872 | {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
873 | ]
874 |
875 | [[package]]
876 | name = "tomli"
877 | version = "2.0.1"
878 | description = "A lil' TOML parser"
879 | optional = false
880 | python-versions = ">=3.7"
881 | files = [
882 | {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
883 | {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
884 | ]
885 |
886 | [[package]]
887 | name = "tornado"
888 | version = "6.4"
889 | description = "Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed."
890 | optional = false
891 | python-versions = ">= 3.8"
892 | files = [
893 | {file = "tornado-6.4-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:02ccefc7d8211e5a7f9e8bc3f9e5b0ad6262ba2fbb683a6443ecc804e5224ce0"},
894 | {file = "tornado-6.4-cp38-abi3-macosx_10_9_x86_64.whl", hash = "sha256:27787de946a9cffd63ce5814c33f734c627a87072ec7eed71f7fc4417bb16263"},
895 | {file = "tornado-6.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f7894c581ecdcf91666a0912f18ce5e757213999e183ebfc2c3fdbf4d5bd764e"},
896 | {file = "tornado-6.4-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e43bc2e5370a6a8e413e1e1cd0c91bedc5bd62a74a532371042a18ef19e10579"},
897 | {file = "tornado-6.4-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0251554cdd50b4b44362f73ad5ba7126fc5b2c2895cc62b14a1c2d7ea32f212"},
898 | {file = "tornado-6.4-cp38-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:fd03192e287fbd0899dd8f81c6fb9cbbc69194d2074b38f384cb6fa72b80e9c2"},
899 | {file = "tornado-6.4-cp38-abi3-musllinux_1_1_i686.whl", hash = "sha256:88b84956273fbd73420e6d4b8d5ccbe913c65d31351b4c004ae362eba06e1f78"},
900 | {file = "tornado-6.4-cp38-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:71ddfc23a0e03ef2df1c1397d859868d158c8276a0603b96cf86892bff58149f"},
901 | {file = "tornado-6.4-cp38-abi3-win32.whl", hash = "sha256:6f8a6c77900f5ae93d8b4ae1196472d0ccc2775cc1dfdc9e7727889145c45052"},
902 | {file = "tornado-6.4-cp38-abi3-win_amd64.whl", hash = "sha256:10aeaa8006333433da48dec9fe417877f8bcc21f48dda8d661ae79da357b2a63"},
903 | {file = "tornado-6.4.tar.gz", hash = "sha256:72291fa6e6bc84e626589f1c29d90a5a6d593ef5ae68052ee2ef000dfd273dee"},
904 | ]
905 |
906 | [[package]]
907 | name = "tqdm"
908 | version = "4.66.1"
909 | description = "Fast, Extensible Progress Meter"
910 | optional = false
911 | python-versions = ">=3.7"
912 | files = [
913 | {file = "tqdm-4.66.1-py3-none-any.whl", hash = "sha256:d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386"},
914 | {file = "tqdm-4.66.1.tar.gz", hash = "sha256:d88e651f9db8d8551a62556d3cff9e3034274ca5d66e93197cf2490e2dcb69c7"},
915 | ]
916 |
917 | [package.dependencies]
918 | colorama = {version = "*", markers = "platform_system == \"Windows\""}
919 |
920 | [package.extras]
921 | dev = ["pytest (>=6)", "pytest-cov", "pytest-timeout", "pytest-xdist"]
922 | notebook = ["ipywidgets (>=6)"]
923 | slack = ["slack-sdk"]
924 | telegram = ["requests"]
925 |
926 | [[package]]
927 | name = "typing-extensions"
928 | version = "4.9.0"
929 | description = "Backported and Experimental Type Hints for Python 3.8+"
930 | optional = false
931 | python-versions = ">=3.8"
932 | files = [
933 | {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"},
934 | {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"},
935 | ]
936 |
937 | [[package]]
938 | name = "urllib3"
939 | version = "2.2.0"
940 | description = "HTTP library with thread-safe connection pooling, file post, and more."
941 | optional = false
942 | python-versions = ">=3.8"
943 | files = [
944 | {file = "urllib3-2.2.0-py3-none-any.whl", hash = "sha256:ce3711610ddce217e6d113a2732fafad960a03fd0318c91faa79481e35c11224"},
945 | {file = "urllib3-2.2.0.tar.gz", hash = "sha256:051d961ad0c62a94e50ecf1af379c3aba230c66c710493493560c0c223c49f20"},
946 | ]
947 |
948 | [package.extras]
949 | brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"]
950 | h2 = ["h2 (>=4,<5)"]
951 | socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
952 | zstd = ["zstandard (>=0.18.0)"]
953 |
954 | [[package]]
955 | name = "virtualenv"
956 | version = "20.25.0"
957 | description = "Virtual Python Environment builder"
958 | optional = false
959 | python-versions = ">=3.7"
960 | files = [
961 | {file = "virtualenv-20.25.0-py3-none-any.whl", hash = "sha256:4238949c5ffe6876362d9c0180fc6c3a824a7b12b80604eeb8085f2ed7460de3"},
962 | {file = "virtualenv-20.25.0.tar.gz", hash = "sha256:bf51c0d9c7dd63ea8e44086fa1e4fb1093a31e963b86959257378aef020e1f1b"},
963 | ]
964 |
965 | [package.dependencies]
966 | distlib = ">=0.3.7,<1"
967 | filelock = ">=3.12.2,<4"
968 | platformdirs = ">=3.9.1,<5"
969 |
970 | [package.extras]
971 | docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
972 | test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"]
973 |
974 | [[package]]
975 | name = "zipp"
976 | version = "3.17.0"
977 | description = "Backport of pathlib-compatible object wrapper for zip files"
978 | optional = false
979 | python-versions = ">=3.8"
980 | files = [
981 | {file = "zipp-3.17.0-py3-none-any.whl", hash = "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31"},
982 | {file = "zipp-3.17.0.tar.gz", hash = "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0"},
983 | ]
984 |
985 | [package.extras]
986 | docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"]
987 | testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"]
988 |
989 | [metadata]
990 | lock-version = "2.0"
991 | python-versions = "^3.9"
992 | content-hash = "dfb5f8132bb5593a8ff84e6b49a95fc87687e8061fe163bf1347dfda87c7b212"
993 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.poetry]
2 | name = "mwsql"
3 | version = "1.0.4"
4 | description = "mwsql is a set of utilities for processing MediaWiki SQL dump data"
5 | authors = ["Slavina Stefanova "]
6 | license = "GPL-3.0-or-later"
7 | readme = "README.rst"
8 |
9 | [tool.poetry.dependencies]
10 | python = "^3.9"
11 | requests = "^2.31.0"
12 | tqdm = "^4.66.1"
13 |
14 | [tool.poetry.group.dev.dependencies]
15 | Sphinx = "^7.2.6"
16 | sphinx-copybutton = "^0.5.2"
17 | sphinx-rtd-theme = "^2.0.0"
18 | sphinx-autobuild = "^2024.2.4"
19 | pytest = "^8.0.0"
20 | pre-commit = "^3.6.0"
21 | mypy = "^1.8.0"
22 | toml = "^0.10.2"
23 |
24 | [build-system]
25 | requires = ["poetry-core"]
26 | build-backend = "poetry.core.masonry.api"
27 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mediawiki-utilities/python-mwsql/ac0c6d9b7339e95b1ad4533e968c3df4cc58f521/tests/__init__.py
--------------------------------------------------------------------------------
/tests/helpers.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from io import StringIO
3 |
4 |
5 | # Helper class for capturing stout
6 | class Capturing(list):
7 | def __enter__(self):
8 | self._stdout = sys.stdout
9 | sys.stdout = self._stringio = StringIO()
10 | return self
11 |
12 | def __exit__(self, *args):
13 | self.extend(self._stringio.getvalue().splitlines())
14 | del self._stringio # free up some memory
15 | sys.stdout = self._stdout
16 |
--------------------------------------------------------------------------------
/tests/test_dump.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pathlib import Path
3 |
4 | import pytest
5 |
6 | from mwsql import Dump
7 |
8 | from .helpers import Capturing
9 |
10 | CURRENT_DIR = Path(__file__).parent
11 | DATA_DIR = CURRENT_DIR.parent / "data"
12 | FILEPATH_GZ = DATA_DIR / "testfile.sql.gz"
13 | FILEPATH_UNZIPPED = DATA_DIR / "testfile.sql"
14 | FILEPATH_UNZIPPED_WITH_NULL_VALUES = DATA_DIR / "testfile-with-null-values.sql"
15 |
16 |
17 | @pytest.fixture
18 | def dump_gz():
19 | return Dump.from_file(FILEPATH_GZ)
20 |
21 |
22 | @pytest.fixture
23 | def dump_unzipped():
24 | return Dump.from_file(FILEPATH_UNZIPPED)
25 |
26 |
27 | @pytest.fixture
28 | def dump_unzipped_with_null_values():
29 | return Dump.from_file(FILEPATH_UNZIPPED_WITH_NULL_VALUES)
30 |
31 |
32 | def test_from_file_gz(dump_gz):
33 | assert dump_gz.db == "simplewiki"
34 | assert dump_gz.name == "change_tag_def"
35 | assert dump_gz.col_names == ["ctd_id", "ctd_name", "ctd_user_defined", "ctd_count"]
36 | assert dump_gz.sql_dtypes == {
37 | "ctd_id": "int(10) unsigned NOT NULL AUTO_INCREMENT",
38 | "ctd_name": "varbinary(255) NOT NULL",
39 | "ctd_user_defined": "tinyint(1) NOT NULL",
40 | "ctd_count": "bigint(20) unsigned NOT NULL DEFAULT 0",
41 | }
42 | assert dump_gz.primary_key == ["ctd_id"]
43 | assert dump_gz.size == 2131
44 | assert dump_gz._dtypes is None
45 | assert dump_gz._source_file == FILEPATH_GZ
46 | assert dump_gz._encoding == "utf-8"
47 |
48 |
49 | def test_from_file_unzipped(dump_unzipped):
50 | assert dump_unzipped.db == "simplewiki"
51 | assert dump_unzipped.name == "change_tag_def"
52 | assert dump_unzipped.col_names == [
53 | "ctd_id",
54 | "ctd_name",
55 | "ctd_user_defined",
56 | "ctd_count",
57 | ]
58 | assert dump_unzipped.sql_dtypes == {
59 | "ctd_id": "int(10) unsigned NOT NULL AUTO_INCREMENT",
60 | "ctd_name": "varbinary(255) NOT NULL",
61 | "ctd_user_defined": "tinyint(1) NOT NULL",
62 | "ctd_count": "bigint(20) unsigned NOT NULL DEFAULT 0",
63 | }
64 | assert dump_unzipped.primary_key == ["ctd_id"]
65 | assert dump_unzipped.size == 5082
66 | assert dump_unzipped._dtypes is None
67 | assert dump_unzipped._source_file == FILEPATH_UNZIPPED
68 | assert dump_unzipped._encoding == "utf-8"
69 |
70 |
71 | def test_encoding(dump_gz):
72 | assert dump_gz.encoding == dump_gz._encoding == "utf-8"
73 | dump_gz.encoding = "latin-1"
74 | assert dump_gz.encoding == dump_gz._encoding == "latin-1"
75 |
76 |
77 | def test_dtypes(dump_gz):
78 | assert dump_gz._dtypes is None
79 | assert (
80 | dump_gz.dtypes
81 | == dump_gz._dtypes
82 | == {"ctd_id": int, "ctd_name": str, "ctd_user_defined": int, "ctd_count": int}
83 | )
84 |
85 |
86 | def test_rows_unconverted(dump_gz):
87 | rows = dump_gz.rows(convert_dtypes=False)
88 | first = next(rows)
89 | assert first == ["1", "mw-replace", "0", "10200"]
90 | second = next(rows)
91 | assert second == ["2", "visualeditor", "0", "305860"]
92 |
93 |
94 | def test_rows_converted(dump_gz):
95 | rows = dump_gz.rows(convert_dtypes=True)
96 | first = next(rows)
97 | assert first == [1, "mw-replace", 0, 10200]
98 | second = next(rows)
99 | assert second == [2, "visualeditor", 0, 305860]
100 |
101 |
102 | def test_rows_unconverted_with_null_values(dump_unzipped_with_null_values):
103 | rows = dump_unzipped_with_null_values.rows(convert_dtypes=False)
104 | first = next(rows)
105 | assert first == ["", "mw-replace?NULL", "0", "10200"]
106 | second = next(rows)
107 | assert second == ["2", "", "0", "305860"]
108 | third = next(rows)
109 | assert third == ["3", "mw-undo", "", "58220"]
110 | fourth = next(rows)
111 | assert fourth == ["4", "mw-rollback", "0", ""]
112 |
113 |
114 | def test_rows_converted_with_null_values(dump_unzipped_with_null_values):
115 | rows = dump_unzipped_with_null_values.rows(convert_dtypes=True)
116 | first = next(rows)
117 | assert first == ["", "mw-replace?NULL", 0, 10200]
118 | second = next(rows)
119 | assert second == [2, "", 0, 305860]
120 | third = next(rows)
121 | assert third == [3, "mw-undo", "", 58220]
122 | fourth = next(rows)
123 | assert fourth == [4, "mw-rollback", 0, ""]
124 |
125 |
126 | expected_out_unconverted = [
127 | "['ctd_id', 'ctd_name', 'ctd_user_defined', 'ctd_count']",
128 | "['1', 'mw-replace', '0', '10200']",
129 | "['2', 'visualeditor', '0', '305860']",
130 | "['3', 'mw-undo', '0', '58220']",
131 | "['4', 'mw-rollback', '0', '70687']",
132 | "['5', 'mobile edit', '0', '230487']",
133 | "['6', 'mobile web edit', '0', '223010']",
134 | "['7', 'very short new article', '0', '28586']",
135 | "['8', 'visualeditor-wikitext', '0', '20113']",
136 | "['9', 'mw-new-redirect', '0', '29681']",
137 | "['10', 'visualeditor-switched', '0', '17717']",
138 | ]
139 |
140 | expected_out_converted = [
141 | "['ctd_id', 'ctd_name', 'ctd_user_defined', 'ctd_count']",
142 | "[1, 'mw-replace', 0, 10200]",
143 | "[2, 'visualeditor', 0, 305860]",
144 | "[3, 'mw-undo', 0, 58220]",
145 | "[4, 'mw-rollback', 0, 70687]",
146 | "[5, 'mobile edit', 0, 230487]",
147 | "[6, 'mobile web edit', 0, 223010]",
148 | "[7, 'very short new article', 0, 28586]",
149 | "[8, 'visualeditor-wikitext', 0, 20113]",
150 | "[9, 'mw-new-redirect', 0, 29681]",
151 | "[10, 'visualeditor-switched', 0, 17717]",
152 | ]
153 |
154 |
155 | def test_head_unconverted(dump_gz):
156 | with Capturing() as output:
157 | dump_gz.head(10, convert_dtypes=False)
158 | assert output == expected_out_unconverted
159 |
160 |
161 | def test_head_converted(dump_gz):
162 | with Capturing() as output:
163 | dump_gz.head(10, convert_dtypes=True)
164 | assert output == expected_out_converted
165 |
166 |
167 | def test_head_does_not_raise_exception(dump_gz, dump_unzipped):
168 | try:
169 | dump_gz.head(200)
170 | dump_unzipped.head(200)
171 | except StopIteration:
172 | pytest.fail("Unexpected StopIteration")
173 |
174 |
175 | def test_to_csv(dump_gz):
176 | csv_filepath = CURRENT_DIR / "testfile.csv"
177 | dump_gz.to_csv(csv_filepath)
178 | with open(csv_filepath) as infile:
179 | content = infile.readlines()
180 | assert content[0] == "ctd_id,ctd_name,ctd_user_defined,ctd_count\n"
181 | assert content[1] == "1,mw-replace,0,10200\n"
182 | assert content[20] == "20,article with links to other-language wikis?,0,3556\n"
183 | assert content[50] == "83,repeated xwiki CoI abuse,0,48\n"
184 | assert content[-1] == "125,discussiontools-source-enhanced,0,341\n"
185 | os.remove(csv_filepath)
186 |
--------------------------------------------------------------------------------
/tests/test_parser.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from mwsql.parser import (
4 | _convert,
5 | _get_sql_attribute,
6 | _has_sql_attribute,
7 | _map_dtypes,
8 | _parse,
9 | _split_tuples,
10 | )
11 |
12 | metadata = {
13 | 0: "-- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)",
14 | 1: "--",
15 | 2: "-- Host: 10.64.32.82 Database: simplewiki",
16 | 3: "-- ------------------------------------------------------",
17 | 4: "-- Server version\t10.4.19-MariaDB-log",
18 | 5: "",
19 | 6: "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;",
20 | 7: "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;",
21 | 8: "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;",
22 | 9: "/*!40101 SET NAMES utf8mb4 */;",
23 | 10: "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;",
24 | 11: "/*!40103 SET TIME_ZONE='+00:00' */;",
25 | 12: "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;",
26 | 13: "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;",
27 | 14: "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;",
28 | 15: "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;",
29 | 16: "",
30 | 17: "--",
31 | 18: "-- Table structure for table `change_tag_def`",
32 | 19: "--",
33 | 20: "",
34 | 21: "DROP TABLE IF EXISTS `change_tag_def`;",
35 | 22: "/*!40101 SET @saved_cs_client = @@character_set_client */;",
36 | 23: "/*!40101 SET character_set_client = utf8 */;",
37 | 24: "CREATE TABLE `change_tag_def` (",
38 | 25: "`ctd_id` int(10) unsigned NOT NULL AUTO_INCREMENT,",
39 | 26: "`ctd_name` varbinary(255) NOT NULL,",
40 | 27: "`ctd_user_defined` tinyint(1) NOT NULL,",
41 | 28: "`ctd_count` bigint(20) unsigned NOT NULL DEFAULT 0,",
42 | 29: "PRIMARY KEY (`ctd_id`),",
43 | 30: "UNIQUE KEY `ctd_name` (`ctd_name`),",
44 | 31: "KEY `ctd_count` (`ctd_count`),",
45 | 32: "KEY `ctd_user_defined` (`ctd_user_defined`)",
46 | 33: ") ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=binary;",
47 | 34: "/*!40101 SET character_set_client = @saved_cs_client */;",
48 | 35: "",
49 | 36: "--",
50 | 37: "-- Dumping data for table `change_tag_def`",
51 | 38: "--",
52 | 39: "",
53 | 40: "/*!40000 ALTER TABLE `change_tag_def` DISABLE KEYS */;",
54 | 41: "INSERT INTO `change_tag_def` VALUES (1,'mw-replace',0,10200),(2,'visualeditor',0,305860)",
55 | }
56 |
57 |
58 | @pytest.mark.parametrize(
59 | "line,attr,expected",
60 | [
61 | (metadata[0], "database", False),
62 | (metadata[2], "database", True),
63 | (metadata[18], "create", False),
64 | (metadata[24], "create", True),
65 | (metadata[23], "col_name", False),
66 | (metadata[26], "col_name", True),
67 | (metadata[30], "primary_key", False),
68 | (metadata[29], "primary_key", True),
69 | (metadata[37], "insert", False),
70 | (metadata[41], "insert", True),
71 | ],
72 | )
73 | def test__has_sql_attribute(line, attr, expected):
74 | assert _has_sql_attribute(line, attr) == expected
75 |
76 |
77 | @pytest.mark.parametrize(
78 | "line,attr,expected",
79 | [
80 | (metadata[2], "database", "simplewiki"),
81 | (metadata[24], "table_name", "change_tag_def"),
82 | (metadata[26], "col_name", "ctd_name"),
83 | (metadata[27], "dtype", "tinyint(1) NOT NULL"),
84 | (metadata[29], "primary_key", ["ctd_id"]),
85 | ],
86 | )
87 | def test__get_sql_attribute(line, attr, expected):
88 | assert _get_sql_attribute(line, attr) == expected
89 |
90 |
91 | sql_dtypes = {
92 | "ctd_id": "int(10) unsigned NOT NULL AUTO_INCREMENT",
93 | "ctd_name": "varbinary(255) NOT NULL",
94 | "ctd_user_defined": "tinyint(1) NOT NULL",
95 | "ctd_count": "bigint(20) unsigned NOT NULL DEFAULT 0",
96 | "page_namespace": "int(11) NOT NULL DEFAULT 0",
97 | "page_title": "varbinary(255) NOT NULL DEFAULT ''",
98 | "page_restrictions": "tinyblob DEFAULT NULL",
99 | "page_is_redirect": "tinyint(1) unsigned NOT NULL DEFAULT 0",
100 | "page_is_new": "tinyint(1) unsigned NOT NULL DEFAULT 0",
101 | "page_random": "double unsigned NOT NULL DEFAULT 0",
102 | "page_touched": "varbinary(14) NOT NULL",
103 | "page_links_updated": "varbinary(14) DEFAULT NULL",
104 | "page_latest": "int(8) unsigned NOT NULL DEFAULT 0",
105 | "page_len": "int(8) unsigned NOT NULL DEFAULT 0",
106 | "page_content_model": "varbinary(32) DEFAULT NULL",
107 | "page_lang": "varbinary(35) DEFAULT NULL",
108 | }
109 |
110 | dtypes = {
111 | "ctd_id": int,
112 | "ctd_name": str,
113 | "ctd_user_defined": int,
114 | "ctd_count": int,
115 | "page_namespace": int,
116 | "page_title": str,
117 | "page_restrictions": str,
118 | "page_is_redirect": int,
119 | "page_is_new": int,
120 | "page_random": float,
121 | "page_touched": str,
122 | "page_links_updated": str,
123 | "page_latest": int,
124 | "page_len": int,
125 | "page_content_model": str,
126 | "page_lang": str,
127 | }
128 |
129 |
130 | def test__map_dtypes():
131 | assert _map_dtypes(sql_dtypes) == dtypes
132 |
133 |
134 | convert_testdata = [
135 | [
136 | "8",
137 | "4",
138 | "Project_scope",
139 | "0",
140 | "0.575193598203",
141 | "20210624025721",
142 | "24941",
143 | "wikitext",
144 | "",
145 | ], # Should pass without raising errors or warnings in both strict and non-strict mode
146 | [
147 | "bad value",
148 | "4",
149 | "Project_scope",
150 | "0",
151 | "0.575193598203",
152 | "20210624025721",
153 | "24941",
154 | "wikitext",
155 | "",
156 | ], # First field is of the wrong type, should raise ValueError in strict mode and raise a warning in non-strict mode
157 | [
158 | "8",
159 | "4",
160 | "Project_scope",
161 | "0.575193598203",
162 | "20210624025721",
163 | "24941",
164 | "wikitext",
165 | "",
166 | ], # One field is missing, should raise ValueError in strict mode
167 | ]
168 | expected_output = [
169 | [8, 4, "Project_scope", 0, 0.575193598203, "20210624025721", 24941, "wikitext", ""],
170 | [
171 | "bad value",
172 | 4,
173 | "Project_scope",
174 | 0,
175 | 0.575193598203,
176 | "20210624025721",
177 | 24941,
178 | "wikitext",
179 | "",
180 | ],
181 | [
182 | "8",
183 | "4",
184 | "Project_scope",
185 | "0.575193598203",
186 | "20210624025721",
187 | "24941",
188 | "wikitext",
189 | "",
190 | ],
191 | ]
192 |
193 | conv_dtypes = [int, int, str, int, float, str, int, str, str]
194 |
195 |
196 | @pytest.mark.parametrize(
197 | "input_data,expected",
198 | [
199 | (convert_testdata[0], expected_output[0]),
200 | (convert_testdata[2], expected_output[2]),
201 | ],
202 | )
203 | def test__convert_non_strict(input_data, expected):
204 | assert _convert(input_data, conv_dtypes, strict=False) == expected
205 |
206 |
207 | def test__convert_raise_value_error_wrong_dtype():
208 | with pytest.raises(ValueError):
209 | _convert(convert_testdata[1], conv_dtypes, strict=True)
210 |
211 |
212 | def test__convert_raise_warning_wrong_dtype():
213 | with pytest.warns(UserWarning):
214 | _convert(convert_testdata[1], conv_dtypes, strict=False)
215 |
216 |
217 | def test__convert_raise_value_error_wrong_length():
218 | with pytest.raises(ValueError):
219 | _convert(convert_testdata[2], conv_dtypes, strict=True)
220 |
221 |
222 | tuples_testdata = [
223 | "INSERT INTO `page` VALUES (10,0,'AccessibleComputing','',1,0,0.33167112649574004,'20210607122734','20210606191631',1002250816,111,'wikitext',NULL),(12,0,'Anarchism','',0,0,0.786172332974311,'20210701093040','20210701093138',1030472204,96584,'wikitext',NULL)",
224 | "INSERT INTO `page` VALUES (289,0,'ActresseS','',1,0,0.8987093492399061,'20210607122734','20210606191634',907518426,109,'wikitext',NULL),(290,0,'A','',0,0,0.854180265082214,'20210629155037','20210629155404',1031061699,28174,'wikitext',NULL),(291,0,'AnarchoCapitalism','',1,0,0.574773308424999,'20210621014117','20210606191634',783865104,86,'wikitext',NULL);",
225 | ]
226 |
227 | expected_split = [
228 | [
229 | "10,0,'AccessibleComputing','',1,0,0.33167112649574004,'20210607122734','20210606191631',1002250816,111,'wikitext',",
230 | "12,0,'Anarchism','',0,0,0.786172332974311,'20210701093040','20210701093138',1030472204,96584,'wikitext',",
231 | ],
232 | [
233 | "289,0,'ActresseS','',1,0,0.8987093492399061,'20210607122734','20210606191634',907518426,109,'wikitext',",
234 | "290,0,'A','',0,0,0.854180265082214,'20210629155037','20210629155404',1031061699,28174,'wikitext',",
235 | "291,0,'AnarchoCapitalism','',1,0,0.574773308424999,'20210621014117','20210606191634',783865104,86,'wikitext',",
236 | ],
237 | ]
238 |
239 | expected_parse = [
240 | [
241 | "10",
242 | "0",
243 | "AccessibleComputing",
244 | "",
245 | "1",
246 | "0",
247 | "0.33167112649574004",
248 | "20210607122734",
249 | "20210606191631",
250 | "1002250816",
251 | "111",
252 | "wikitext",
253 | "",
254 | ],
255 | [
256 | "289",
257 | "0",
258 | "ActresseS",
259 | "",
260 | "1",
261 | "0",
262 | "0.8987093492399061",
263 | "20210607122734",
264 | "20210606191634",
265 | "907518426",
266 | "109",
267 | "wikitext",
268 | "",
269 | ],
270 | ]
271 |
272 |
273 | @pytest.mark.parametrize(
274 | "tuples_testdata,expected_split",
275 | [
276 | (tuples_testdata[0], expected_split[0]),
277 | (tuples_testdata[1], expected_split[1]),
278 | ],
279 | )
280 | def test__split_tuples(tuples_testdata, expected_split):
281 | assert _split_tuples(tuples_testdata) == expected_split
282 |
283 |
284 | @pytest.mark.parametrize(
285 | "tuples_testdata,expected_parse",
286 | [
287 | (tuples_testdata[0], expected_parse[0]),
288 | (tuples_testdata[1], expected_parse[1]),
289 | ],
290 | )
291 | def test__parse(tuples_testdata, expected_parse):
292 | assert next(_parse(tuples_testdata)) == expected_parse
293 |
--------------------------------------------------------------------------------
/tests/test_utils.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pathlib import Path, PosixPath
3 |
4 | import pytest
5 | import requests
6 |
7 | from mwsql import head, load
8 | from mwsql.utils import _open_file
9 |
10 | from .helpers import Capturing
11 |
12 | # from urllib.error import HTTPError
13 |
14 |
15 | CURRENT_DIR = Path(__file__).parent
16 | DATA_DIR = CURRENT_DIR.parent / "data"
17 | FILEPATH_GZ = DATA_DIR / "testfile.sql.gz"
18 | FILEPATH_UNZIPPED = DATA_DIR / "testfile.sql"
19 |
20 |
21 | @pytest.mark.parametrize(
22 | "database,filename,date,extension,expected",
23 | [
24 | (
25 | "simplewiki",
26 | "change_tag_def",
27 | "latest",
28 | "sql",
29 | "simplewiki-latest-change_tag_def.sql.gz",
30 | ),
31 | (
32 | "simplewiki",
33 | "change_tag",
34 | "latest",
35 | "sql",
36 | "simplewiki-latest-change_tag.sql.gz",
37 | ),
38 | ("bewiki", "site_stats", "latest", "sql", "bewiki-latest-site_stats.sql.gz"),
39 | ("nlwiktionary", "sites", "latest", "sql", "nlwiktionary-latest-sites.sql.gz"),
40 | ],
41 | )
42 | def test_load(database, filename, date, extension, expected):
43 | f = load(database, filename, date, extension)
44 | assert f == PosixPath(expected)
45 | os.remove(f)
46 |
47 |
48 | def test_load_HTTPError():
49 | with pytest.raises(requests.exceptions.HTTPError):
50 | load("simplewiki", "non-existing-filename", "latest")
51 |
52 |
53 | def test__open_file_gz():
54 | with _open_file(FILEPATH_GZ) as infile:
55 | for line in infile:
56 | assert (
57 | line
58 | == "-- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)\n"
59 | )
60 | break
61 |
62 |
63 | def test__open_file_unzipped():
64 | with _open_file(FILEPATH_UNZIPPED) as infile:
65 | for line in infile:
66 | assert (
67 | line
68 | == "-- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)\n"
69 | )
70 | break
71 |
72 |
73 | expected_out = [
74 | "-- MySQL dump 10.18 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64)",
75 | "--",
76 | "-- Host: 10.64.32.82 Database: simplewiki",
77 | "-- ------------------------------------------------------",
78 | "-- Server version\t10.4.19-MariaDB-log",
79 | "",
80 | "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;",
81 | "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;",
82 | "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;",
83 | "/*!40101 SET NAMES utf8mb4 */;",
84 | ]
85 |
86 |
87 | def test_head_gz():
88 | with Capturing() as output:
89 | head(FILEPATH_GZ, 10)
90 | assert output == expected_out
91 |
92 |
93 | def test_head_unzipped():
94 | with Capturing() as output:
95 | head(FILEPATH_UNZIPPED, 10)
96 | assert output == expected_out
97 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | # tox (https://tox.readthedocs.io/) is a tool for running tests
2 | # in multiple virtualenvs. This configuration file will run the
3 | # test suite on all supported python versions. To use it, "pip install tox"
4 | # and then run "tox" from this directory.
5 |
6 | [tox]
7 | skipdist = True
8 | skip_missing_interpreters = True
9 | isolated_build = True
10 | envlist = py{39,310,311,312}, docs, pre-commit
11 |
12 | # Keep python version for docs in sync with docs testenv:docs and .readthedocs.yml
13 | [gh-actions]
14 | python =
15 | 3.9: py39, docs, pre-commit
16 | 3.10: py310
17 | 3.11: py311
18 | 3.12: py312
19 |
20 | # Use tox defaults when creating the source distribution and installing the
21 | # build system requirements (poetry-core).
22 | [testenv:.package]
23 | install_command =
24 |
25 | [testenv]
26 | description = run unit tests
27 | skip_install = true
28 | allowlist_externals = poetry
29 | commands_pre = poetry install
30 | commands =
31 | poetry run pytest {posargs}
32 |
33 | [testenv:docs]
34 | # Keep basepython in sync with gh-actions and .readthedocs.yml.
35 | description = invoke sphinx-build to build the HTML docs
36 | basepython = python3.12
37 | commands =
38 | poetry run sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" --color -W -bhtml {posargs}
39 | python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'
40 |
41 | [testenv:serve-docs]
42 | # Keep basepython in sync with gh-actions and .readthedocs.yml.
43 | description = live-serve docs with sphinx-autobuild
44 | basepython = python3.12
45 | commands =
46 | poetry run sphinx-autobuild --port=0 --open-browser docs docs/_build/html
47 |
48 | [testenv:pre-commit]
49 | description = run linters and formatters
50 | basepython = python3.12
51 | commands =
52 | poetry run pre-commit run --all-files
53 |
54 | [testenv:typing]
55 | description = run type checks
56 | basepython = python3.12
57 | commands =
58 | poetry run mypy ./src
59 |
--------------------------------------------------------------------------------