northpole 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- northpole-0.0.1/.gitignore +1 -0
- northpole-0.0.1/.pre-commit-config.yaml +19 -0
- northpole-0.0.1/LICENSE.txt +19 -0
- northpole-0.0.1/PKG-INFO +38 -0
- northpole-0.0.1/README.rst +16 -0
- northpole-0.0.1/northpole.code-workspace +13 -0
- northpole-0.0.1/pyproject.toml +157 -0
- northpole-0.0.1/src/northpole/__about__.py +1 -0
- northpole-0.0.1/src/northpole/__init__.py +0 -0
- northpole-0.0.1/src/northpole/parsers.py +14 -0
- northpole-0.0.1/tests/__init__.py +0 -0
- northpole-0.0.1/tests/test_parsers.py +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__pycache__/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pycqa/isort
|
|
3
|
+
rev: 5.12.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: isort
|
|
6
|
+
args: ["--profile", "black", "--filter-files"]
|
|
7
|
+
- repo: https://github.com/psf/black
|
|
8
|
+
rev: 23.7.0
|
|
9
|
+
hooks:
|
|
10
|
+
- id: black
|
|
11
|
+
language_version: python3.10
|
|
12
|
+
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
13
|
+
rev: "v0.0.284"
|
|
14
|
+
hooks:
|
|
15
|
+
- id: ruff
|
|
16
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
17
|
+
rev: 'v1.5.0'
|
|
18
|
+
hooks:
|
|
19
|
+
- id: mypy
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Stephen Lutes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
6
|
+
software and associated documentation files (the "Software"), to deal in the Software
|
|
7
|
+
without restriction, including without limitation the rights to use, copy, modify, merge,
|
|
8
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
9
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or
|
|
12
|
+
substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
15
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
16
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
17
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
|
18
|
+
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
19
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
northpole-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: northpole
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Utilities to help with Advent of Code
|
|
5
|
+
Project-URL: Documentation, https://github.com/stephenlutes/northpole#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/stephenlutes/northpole/issues
|
|
7
|
+
Project-URL: Source, https://github.com/stephenlutes/northpole
|
|
8
|
+
Author: Stephen Lutes
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/x-rst
|
|
22
|
+
|
|
23
|
+
NorthPole
|
|
24
|
+
==========
|
|
25
|
+
|
|
26
|
+
NorthPole is a collection of utilities I develop to help in Advent of Code challenges.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Installation
|
|
30
|
+
------------
|
|
31
|
+
|
|
32
|
+
``pip install northpole``
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
License
|
|
36
|
+
-------
|
|
37
|
+
|
|
38
|
+
Northpole is distributed under the terms of the `MIT license <https://spdx.org/licenses/MIT.html>`_.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
NorthPole
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
NorthPole is a collection of utilities I develop to help in Advent of Code challenges.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Installation
|
|
8
|
+
------------
|
|
9
|
+
|
|
10
|
+
``pip install northpole``
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
License
|
|
14
|
+
-------
|
|
15
|
+
|
|
16
|
+
Northpole is distributed under the terms of the `MIT license <https://spdx.org/licenses/MIT.html>`_.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "northpole"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Utilities to help with Advent of Code"
|
|
9
|
+
readme = "README.rst"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = []
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Stephen Lutes" },
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Programming Language :: Python",
|
|
19
|
+
"Programming Language :: Python :: 3.8",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
25
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
26
|
+
]
|
|
27
|
+
dependencies = []
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Documentation = "https://github.com/stephenlutes/northpole#readme"
|
|
31
|
+
Issues = "https://github.com/stephenlutes/northpole/issues"
|
|
32
|
+
Source = "https://github.com/stephenlutes/northpole"
|
|
33
|
+
|
|
34
|
+
[tool.hatch.version]
|
|
35
|
+
path = "src/northpole/__about__.py"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.envs.default]
|
|
38
|
+
dependencies = [
|
|
39
|
+
"coverage[toml]>=6.5",
|
|
40
|
+
"pytest",
|
|
41
|
+
]
|
|
42
|
+
[tool.hatch.envs.default.scripts]
|
|
43
|
+
test = "pytest {args:tests}"
|
|
44
|
+
test-cov = "coverage run -m pytest {args:tests}"
|
|
45
|
+
cov-report = [
|
|
46
|
+
"- coverage combine",
|
|
47
|
+
"coverage report",
|
|
48
|
+
]
|
|
49
|
+
cov = [
|
|
50
|
+
"test-cov",
|
|
51
|
+
"cov-report",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[[tool.hatch.envs.all.matrix]]
|
|
55
|
+
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
56
|
+
|
|
57
|
+
[tool.hatch.envs.lint]
|
|
58
|
+
detached = true
|
|
59
|
+
dependencies = [
|
|
60
|
+
"black>=23.1.0",
|
|
61
|
+
"mypy>=1.0.0",
|
|
62
|
+
"ruff>=0.0.243",
|
|
63
|
+
]
|
|
64
|
+
[tool.hatch.envs.lint.scripts]
|
|
65
|
+
typing = "mypy --install-types --non-interactive {args:src/northpole tests}"
|
|
66
|
+
style = [
|
|
67
|
+
"ruff {args:.}",
|
|
68
|
+
"black --check --diff {args:.}",
|
|
69
|
+
]
|
|
70
|
+
fmt = [
|
|
71
|
+
"black {args:.}",
|
|
72
|
+
"ruff --fix {args:.}",
|
|
73
|
+
"style",
|
|
74
|
+
]
|
|
75
|
+
all = [
|
|
76
|
+
"style",
|
|
77
|
+
"typing",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[tool.black]
|
|
81
|
+
target-version = ["py37"]
|
|
82
|
+
line-length = 120
|
|
83
|
+
skip-string-normalization = true
|
|
84
|
+
|
|
85
|
+
[tool.ruff]
|
|
86
|
+
target-version = "py37"
|
|
87
|
+
line-length = 120
|
|
88
|
+
select = [
|
|
89
|
+
"A",
|
|
90
|
+
"ARG",
|
|
91
|
+
"B",
|
|
92
|
+
"C",
|
|
93
|
+
"DTZ",
|
|
94
|
+
"E",
|
|
95
|
+
"EM",
|
|
96
|
+
"F",
|
|
97
|
+
"FBT",
|
|
98
|
+
"I",
|
|
99
|
+
"ICN",
|
|
100
|
+
"ISC",
|
|
101
|
+
"N",
|
|
102
|
+
"PLC",
|
|
103
|
+
"PLE",
|
|
104
|
+
"PLR",
|
|
105
|
+
"PLW",
|
|
106
|
+
"Q",
|
|
107
|
+
"RUF",
|
|
108
|
+
"S",
|
|
109
|
+
"T",
|
|
110
|
+
"TID",
|
|
111
|
+
"UP",
|
|
112
|
+
"W",
|
|
113
|
+
"YTT",
|
|
114
|
+
]
|
|
115
|
+
ignore = [
|
|
116
|
+
# Allow non-abstract empty methods in abstract base classes
|
|
117
|
+
"B027",
|
|
118
|
+
# Allow boolean positional values in function calls, like `dict.get(... True)`
|
|
119
|
+
"FBT003",
|
|
120
|
+
# Ignore checks for possible passwords
|
|
121
|
+
"S105", "S106", "S107",
|
|
122
|
+
# Ignore complexity
|
|
123
|
+
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
|
|
124
|
+
]
|
|
125
|
+
unfixable = [
|
|
126
|
+
# Don't touch unused imports
|
|
127
|
+
"F401",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[tool.ruff.isort]
|
|
131
|
+
known-first-party = ["northpole"]
|
|
132
|
+
|
|
133
|
+
[tool.ruff.flake8-tidy-imports]
|
|
134
|
+
ban-relative-imports = "all"
|
|
135
|
+
|
|
136
|
+
[tool.ruff.per-file-ignores]
|
|
137
|
+
# Tests can use magic values, assertions, and relative imports
|
|
138
|
+
"tests/**/*" = ["PLR2004", "S101", "TID252"]
|
|
139
|
+
|
|
140
|
+
[tool.coverage.run]
|
|
141
|
+
source_pkgs = ["northpole", "tests"]
|
|
142
|
+
branch = true
|
|
143
|
+
parallel = true
|
|
144
|
+
omit = [
|
|
145
|
+
"src/northpole/__about__.py",
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
[tool.coverage.paths]
|
|
149
|
+
northpole = ["src/northpole", "*/northpole/src/northpole"]
|
|
150
|
+
tests = ["tests", "*/northpole/tests"]
|
|
151
|
+
|
|
152
|
+
[tool.coverage.report]
|
|
153
|
+
exclude_lines = [
|
|
154
|
+
"no cov",
|
|
155
|
+
"if __name__ == .__main__.:",
|
|
156
|
+
"if TYPE_CHECKING:",
|
|
157
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.1"
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
def parse_string(data: str) -> str:
|
|
2
|
+
"""
|
|
3
|
+
Parse the input (most likely read from a file) into a single string. The input data
|
|
4
|
+
will be split on new line characters, and the first string will be returned. It
|
|
5
|
+
works on the assumption that while there may be a new line character in the input,
|
|
6
|
+
there is nothing after it.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
data (str): The input data to parse.
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
str: The string from before the first new line character.
|
|
13
|
+
"""
|
|
14
|
+
return data.splitlines()[0]
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from northpole.parsers import parse_string
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.mark.parametrize("expected,suffix", [("Santa", "\n"), ("Santa", "\nClause"), ("Santa", "")])
|
|
7
|
+
def test_parse_string(expected: str, suffix: str) -> None:
|
|
8
|
+
data: str = f"{expected}{suffix}"
|
|
9
|
+
|
|
10
|
+
assert parse_string(data) == expected
|