From 0cbcdb3dc92ef03295b7a587cc075513582fa3ad Mon Sep 17 00:00:00 2001 From: kairi003 Date: Sun, 2 Nov 2025 22:57:00 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=91=E3=83=83=E3=82=B1=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 217 +++++++++++++++++- README.md | 6 +- pyproject.toml | 22 ++ BucketList.py => sortedset/BucketList.py | 2 +- .../SortedMultiset.py | 2 +- SortedSet.py => sortedset/SortedSet.py | 2 +- sortedset/__init__.py | 0 {codon => sortedset/codon}/BucketList.py | 2 +- {codon => sortedset/codon}/SortedMultiset.py | 2 +- {codon => sortedset/codon}/SortedSet.py | 2 +- sortedset/codon/__init__.py | 0 {test => tests}/test_BucketList.py | 2 +- {test => tests}/test_SortedMultiset.py | 2 +- {test => tests}/test_SortedSet.py | 2 +- 14 files changed, 250 insertions(+), 13 deletions(-) create mode 100644 pyproject.toml rename BucketList.py => sortedset/BucketList.py (98%) rename SortedMultiset.py => sortedset/SortedMultiset.py (98%) rename SortedSet.py => sortedset/SortedSet.py (98%) create mode 100644 sortedset/__init__.py rename {codon => sortedset/codon}/BucketList.py (98%) rename {codon => sortedset/codon}/SortedMultiset.py (98%) rename {codon => sortedset/codon}/SortedSet.py (98%) create mode 100644 sortedset/codon/__init__.py rename {test => tests}/test_BucketList.py (99%) rename {test => tests}/test_SortedMultiset.py (99%) rename {test => tests}/test_SortedSet.py (99%) diff --git a/.gitignore b/.gitignore index 0d20b64..e15106e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,216 @@ -*.pyc +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[codz] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py.cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +# Pipfile.lock + +# UV +# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# uv.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +# poetry.lock +# poetry.toml + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python. +# https://pdm-project.org/en/latest/usage/project/#working-with-version-control +# pdm.lock +# pdm.toml +.pdm-python +.pdm-build/ + +# pixi +# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control. +# pixi.lock +# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one +# in the .venv directory. It is recommended not to include this directory in version control. +.pixi + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# Redis +*.rdb +*.aof +*.pid + +# RabbitMQ +mnesia/ +rabbitmq/ +rabbitmq-data/ + +# ActiveMQ +activemq-data/ + +# SageMath parsed files +*.sage.py + +# Environments +.env +.envrc +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +# .idea/ + +# Abstra +# Abstra is an AI-powered process automation framework. +# Ignore directories containing user credentials, local state, and settings. +# Learn more at https://abstra.io/docs +.abstra/ + +# Visual Studio Code +# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore +# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore +# and can be added to the global gitignore or merged into this file. However, if you prefer, +# you could uncomment the following to ignore the entire vscode folder +# .vscode/ + +# Ruff stuff: +.ruff_cache/ + +# PyPI configuration file +.pypirc + +# Marimo +marimo/_static/ +marimo/_lsp/ +__marimo__/ + +# Streamlit +.streamlit/secrets.toml diff --git a/README.md b/README.md index 89b2731..8cb4b87 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ 平衡 $\Theta(\sqrt N)$ 分木の SortedSet です。PyPy で動きます。平衡二分木系より速いと思います。 -[SortedSet](SortedSet.py) -[SortedMultiset](SortedMultiset.py) -[BucketList](BucketList.py) +[SortedSet](sortedset/SortedSet.py) +[SortedMultiset](sortedset/SortedMultiset.py) +[BucketList](sortedset/BucketList.py) [使用例](example) ## ドキュメント diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8c12116 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "sortedset" +version = "0.1.0" +description = "平衡 Θ(N) 分木の SortedSet です。PyPy で動きます。平衡二分木系より速いと思います。" +authors = [{name = "tatyam"}] +readme = "README.md" +license-files = ["LICENSE"] +requires-python = ">=3.9" + +[project.urls] +Homepage = "https://github.com/tatyam-prime/SortedSet" +Repository = "https://github.com/tatyam-prime/SortedSet.git" + +[dependency-groups] +dev = ["pytest>=8.4.2"] + +[tool.setuptools.packages.find] +include = ["sortedset", "sortedset.codon"] diff --git a/BucketList.py b/sortedset/BucketList.py similarity index 98% rename from BucketList.py rename to sortedset/BucketList.py index f75f24b..9530f04 100644 --- a/BucketList.py +++ b/sortedset/BucketList.py @@ -1,4 +1,4 @@ -# https://github.com/tatyam-prime/SortedSet/blob/main/BucketList.py +# https://github.com/tatyam-prime/SortedSet/blob/main/sortedset/BucketList.py import math from typing import Generic, Iterable, Iterator, TypeVar T = TypeVar('T') diff --git a/SortedMultiset.py b/sortedset/SortedMultiset.py similarity index 98% rename from SortedMultiset.py rename to sortedset/SortedMultiset.py index d0d6c0a..cc4c85e 100644 --- a/SortedMultiset.py +++ b/sortedset/SortedMultiset.py @@ -1,4 +1,4 @@ -# https://github.com/tatyam-prime/SortedSet/blob/main/SortedMultiset.py +# https://github.com/tatyam-prime/SortedSet/blob/main/sortedset/SortedMultiset.py import math from bisect import bisect_left, bisect_right from typing import Generic, Iterable, Iterator, TypeVar diff --git a/SortedSet.py b/sortedset/SortedSet.py similarity index 98% rename from SortedSet.py rename to sortedset/SortedSet.py index d62d610..433e09f 100644 --- a/SortedSet.py +++ b/sortedset/SortedSet.py @@ -1,4 +1,4 @@ -# https://github.com/tatyam-prime/SortedSet/blob/main/SortedSet.py +# https://github.com/tatyam-prime/SortedSet/blob/main/sortedset/SortedSet.py import math from bisect import bisect_left, bisect_right from typing import Generic, Iterable, Iterator, TypeVar diff --git a/sortedset/__init__.py b/sortedset/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/codon/BucketList.py b/sortedset/codon/BucketList.py similarity index 98% rename from codon/BucketList.py rename to sortedset/codon/BucketList.py index 79c09a4..ea9b4f5 100644 --- a/codon/BucketList.py +++ b/sortedset/codon/BucketList.py @@ -1,4 +1,4 @@ -# https://github.com/tatyam-prime/SortedSet/blob/main/codon/BucketList.py +# https://github.com/tatyam-prime/SortedSet/blob/main/sortedset/codon/BucketList.py import math from typing import ClassVar, Generator diff --git a/codon/SortedMultiset.py b/sortedset/codon/SortedMultiset.py similarity index 98% rename from codon/SortedMultiset.py rename to sortedset/codon/SortedMultiset.py index 6853d74..72c09c9 100644 --- a/codon/SortedMultiset.py +++ b/sortedset/codon/SortedMultiset.py @@ -1,4 +1,4 @@ -# https://github.com/tatyam-prime/SortedSet/blob/main/codon/SortedMultiset.py +# https://github.com/tatyam-prime/SortedSet/blob/main/sortedset/codon/SortedMultiset.py import math from bisect import bisect_left, bisect_right from typing import ClassVar, Generator, Optional diff --git a/codon/SortedSet.py b/sortedset/codon/SortedSet.py similarity index 98% rename from codon/SortedSet.py rename to sortedset/codon/SortedSet.py index 1986732..2b54a55 100644 --- a/codon/SortedSet.py +++ b/sortedset/codon/SortedSet.py @@ -1,4 +1,4 @@ -# https://github.com/tatyam-prime/SortedSet/blob/main/codon/SortedSet.py +# https://github.com/tatyam-prime/SortedSet/blob/main/sortedset/codon/SortedSet.py import math from bisect import bisect_left, bisect_right from typing import ClassVar, Generator, Optional diff --git a/sortedset/codon/__init__.py b/sortedset/codon/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_BucketList.py b/tests/test_BucketList.py similarity index 99% rename from test/test_BucketList.py rename to tests/test_BucketList.py index 48d5340..e4c9833 100644 --- a/test/test_BucketList.py +++ b/tests/test_BucketList.py @@ -6,7 +6,7 @@ # Add the parent directory to the path to import BucketList sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -from BucketList import BucketList +from sortedset.BucketList import BucketList def test_init(): bl = BucketList([1, 2, 3, 4, 5]) diff --git a/test/test_SortedMultiset.py b/tests/test_SortedMultiset.py similarity index 99% rename from test/test_SortedMultiset.py rename to tests/test_SortedMultiset.py index 67358df..93441a9 100644 --- a/test/test_SortedMultiset.py +++ b/tests/test_SortedMultiset.py @@ -6,7 +6,7 @@ # Add the parent directory to the path to import SortedMultiset sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -from SortedMultiset import SortedMultiset +from sortedset.SortedMultiset import SortedMultiset def test_init(): s = SortedMultiset([1, 4, 3, 2, 5]) diff --git a/test/test_SortedSet.py b/tests/test_SortedSet.py similarity index 99% rename from test/test_SortedSet.py rename to tests/test_SortedSet.py index 842a0e0..5be9bd9 100644 --- a/test/test_SortedSet.py +++ b/tests/test_SortedSet.py @@ -6,7 +6,7 @@ # Add the parent directory to the path to import SortedSet sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -from SortedSet import SortedSet +from sortedset.SortedSet import SortedSet def test_init(): s = SortedSet([1, 4, 3, 2, 5])