convbase 0.0.dev3__tar.gz → 0.2.0__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.
- convbase-0.2.0/PKG-INFO +93 -0
- convbase-0.2.0/README.md +67 -0
- {convbase-0.0.dev3 → convbase-0.2.0}/pyproject.toml +23 -32
- convbase-0.2.0/src/convbase/__init__.py +3 -0
- convbase-0.2.0/src/convbase/cli.py +31 -0
- convbase-0.2.0/src/convbase/lib.py +14 -0
- convbase-0.0.dev3/LICENSE +0 -21
- convbase-0.0.dev3/PKG-INFO +0 -41
- convbase-0.0.dev3/README.md +0 -11
- convbase-0.0.dev3/setup.cfg +0 -4
- convbase-0.0.dev3/src/convbase/__init__.py +0 -1
- convbase-0.0.dev3/src/convbase/__main__.py +0 -3
- convbase-0.0.dev3/src/convbase/convbase.py +0 -13
- convbase-0.0.dev3/src/convbase.egg-info/PKG-INFO +0 -41
- convbase-0.0.dev3/src/convbase.egg-info/SOURCES.txt +0 -13
- convbase-0.0.dev3/src/convbase.egg-info/dependency_links.txt +0 -1
- convbase-0.0.dev3/src/convbase.egg-info/entry_points.txt +0 -2
- convbase-0.0.dev3/src/convbase.egg-info/requires.txt +0 -11
- convbase-0.0.dev3/src/convbase.egg-info/top_level.txt +0 -1
- convbase-0.0.dev3/test/test_convbase.py +0 -9
convbase-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: convbase
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Base conversion command line utility.
|
|
5
|
+
Keywords:
|
|
6
|
+
Author: Kyle O'Malley
|
|
7
|
+
Author-email: Kyle O'Malley <j.kyle.omalley@gmail.com>
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Dist: click
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Project-URL: Documentation, https://github.com/jkomalley/convbase#readme
|
|
23
|
+
Project-URL: Issues, https://github.com/jkomalley/convbase/issues
|
|
24
|
+
Project-URL: Source, https://github.com/jkomalley/convbase
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# convbase
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+

|
|
31
|
+

|
|
32
|
+

|
|
33
|
+
[](https://github.com/jkomalley/convbase/actions)
|
|
34
|
+
|
|
35
|
+
Base conversion command line utility.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
You can install `convbase` using `uv` or `pip`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv pip install convbase
|
|
43
|
+
# or
|
|
44
|
+
pip install convbase
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
`convbase` provides four command-line tools for quick base conversions:
|
|
50
|
+
|
|
51
|
+
### `bin` - Convert to Binary
|
|
52
|
+
|
|
53
|
+
Converts a decimal, octal (prefix `0o`), or hexadecimal (prefix `0x`) value to binary.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
$ bin 10
|
|
57
|
+
0b1010
|
|
58
|
+
$ bin 0xFF
|
|
59
|
+
0b11111111
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `oct` - Convert to Octal
|
|
63
|
+
|
|
64
|
+
Converts a value to octal.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
$ oct 10
|
|
68
|
+
0o12
|
|
69
|
+
$ oct 0b1010
|
|
70
|
+
0o12
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### `dec` - Convert to Decimal
|
|
74
|
+
|
|
75
|
+
Converts a value to decimal.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
$ dec 0b1010
|
|
79
|
+
10
|
|
80
|
+
$ dec 0xFF
|
|
81
|
+
255
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### `hex` - Convert to Hexadecimal
|
|
85
|
+
|
|
86
|
+
Converts a value to hexadecimal.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
$ hex 10
|
|
90
|
+
0xa
|
|
91
|
+
$ hex 0b1111
|
|
92
|
+
0xf
|
|
93
|
+
```
|
convbase-0.2.0/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# convbase
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
[](https://github.com/jkomalley/convbase/actions)
|
|
8
|
+
|
|
9
|
+
Base conversion command line utility.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
You can install `convbase` using `uv` or `pip`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv pip install convbase
|
|
17
|
+
# or
|
|
18
|
+
pip install convbase
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
`convbase` provides four command-line tools for quick base conversions:
|
|
24
|
+
|
|
25
|
+
### `bin` - Convert to Binary
|
|
26
|
+
|
|
27
|
+
Converts a decimal, octal (prefix `0o`), or hexadecimal (prefix `0x`) value to binary.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
$ bin 10
|
|
31
|
+
0b1010
|
|
32
|
+
$ bin 0xFF
|
|
33
|
+
0b11111111
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### `oct` - Convert to Octal
|
|
37
|
+
|
|
38
|
+
Converts a value to octal.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
$ oct 10
|
|
42
|
+
0o12
|
|
43
|
+
$ oct 0b1010
|
|
44
|
+
0o12
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `dec` - Convert to Decimal
|
|
48
|
+
|
|
49
|
+
Converts a value to decimal.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
$ dec 0b1010
|
|
53
|
+
10
|
|
54
|
+
$ dec 0xFF
|
|
55
|
+
255
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `hex` - Convert to Hexadecimal
|
|
59
|
+
|
|
60
|
+
Converts a value to hexadecimal.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
$ hex 10
|
|
64
|
+
0xa
|
|
65
|
+
$ hex 0b1111
|
|
66
|
+
0xf
|
|
67
|
+
```
|
|
@@ -1,54 +1,38 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools >= 61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
1
|
[project]
|
|
6
2
|
name = "convbase"
|
|
7
|
-
|
|
3
|
+
version = "0.2.0"
|
|
8
4
|
description = 'Base conversion command line utility.'
|
|
9
5
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
6
|
+
requires-python = ">=3.10"
|
|
11
7
|
keywords = []
|
|
12
|
-
authors = [
|
|
13
|
-
{ name = "Kyle O'Malley", email = "j.kyle.omalley@gmail.com" },
|
|
14
|
-
]
|
|
8
|
+
authors = [{ name = "Kyle O'Malley", email = "j.kyle.omalley@gmail.com" }]
|
|
15
9
|
classifiers = [
|
|
16
|
-
"Development Status ::
|
|
10
|
+
"Development Status :: 4 - Beta",
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Operating System :: OS Independent",
|
|
17
13
|
"License :: OSI Approved :: MIT License",
|
|
18
14
|
"Programming Language :: Python",
|
|
19
|
-
"Programming Language :: Python :: 3.8",
|
|
20
|
-
"Programming Language :: Python :: 3.9",
|
|
21
15
|
"Programming Language :: Python :: 3.10",
|
|
22
16
|
"Programming Language :: Python :: 3.11",
|
|
23
17
|
"Programming Language :: Python :: 3.12",
|
|
24
|
-
"Programming Language :: Python ::
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Topic :: Utilities",
|
|
28
22
|
]
|
|
23
|
+
dependencies = ["click"]
|
|
29
24
|
|
|
30
25
|
[project.urls]
|
|
31
26
|
Documentation = "https://github.com/jkomalley/convbase#readme"
|
|
32
27
|
Issues = "https://github.com/jkomalley/convbase/issues"
|
|
33
28
|
Source = "https://github.com/jkomalley/convbase"
|
|
34
29
|
|
|
35
|
-
[project.optional-dependencies]
|
|
36
|
-
dev = [
|
|
37
|
-
"pytest",
|
|
38
|
-
"ruff",
|
|
39
|
-
"mypy",
|
|
40
|
-
"pre-commit",
|
|
41
|
-
]
|
|
42
|
-
publish = [
|
|
43
|
-
"twine",
|
|
44
|
-
"build"
|
|
45
|
-
]
|
|
46
|
-
|
|
47
30
|
[project.scripts]
|
|
48
|
-
|
|
31
|
+
bin = "convbase.cli:bin"
|
|
32
|
+
oct = "convbase.cli:oct"
|
|
33
|
+
dec = "convbase.cli:dec"
|
|
34
|
+
hex = "convbase.cli:hex"
|
|
49
35
|
|
|
50
|
-
[tool.setuptools.dynamic]
|
|
51
|
-
version = {attr = "convbase.__version__"}
|
|
52
36
|
|
|
53
37
|
[tool.ruff]
|
|
54
38
|
fix = true
|
|
@@ -58,6 +42,13 @@ line-ending = "lf"
|
|
|
58
42
|
skip-magic-trailing-comma = true
|
|
59
43
|
|
|
60
44
|
[tool.mypy]
|
|
61
|
-
python_version = "3.
|
|
45
|
+
python_version = "3.10"
|
|
62
46
|
warn_return_any = true
|
|
63
47
|
warn_unused_configs = true
|
|
48
|
+
|
|
49
|
+
[build-system]
|
|
50
|
+
requires = ["uv_build>=0.9.25,<0.10.0"]
|
|
51
|
+
build-backend = "uv_build"
|
|
52
|
+
|
|
53
|
+
[dependency-groups]
|
|
54
|
+
dev = ["pytest>=9.0.2", "pytest-cov>=5.0.0", "ruff>=0.5.5", "ty>=0.0.11"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from . import lib
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@click.command()
|
|
7
|
+
@click.argument("value")
|
|
8
|
+
def bin(value):
|
|
9
|
+
"""Converts a value to binary."""
|
|
10
|
+
click.echo(lib.to_binary(value))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click.command()
|
|
14
|
+
@click.argument("value")
|
|
15
|
+
def oct(value):
|
|
16
|
+
"""Converts a value to octal."""
|
|
17
|
+
click.echo(lib.to_octal(value))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@click.command()
|
|
21
|
+
@click.argument("value")
|
|
22
|
+
def dec(value):
|
|
23
|
+
"""Converts a value to decimal."""
|
|
24
|
+
click.echo(lib.to_decimal(value))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@click.command()
|
|
28
|
+
@click.argument("value")
|
|
29
|
+
def hex(value):
|
|
30
|
+
"""Converts a value to hexadecimal."""
|
|
31
|
+
click.echo(lib.to_hexadecimal(value))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
def to_binary(value: str) -> str:
|
|
2
|
+
return bin(int(value, 0))
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def to_octal(value: str) -> str:
|
|
6
|
+
return oct(int(value, 0))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def to_decimal(value: str) -> str:
|
|
10
|
+
return str(int(value, 0))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def to_hexadecimal(value: str) -> str:
|
|
14
|
+
return hex(int(value, 0))
|
convbase-0.0.dev3/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Kyle
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
convbase-0.0.dev3/PKG-INFO
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: convbase
|
|
3
|
-
Version: 0.0.dev3
|
|
4
|
-
Summary: Base conversion command line utility.
|
|
5
|
-
Author-email: Kyle O'Malley <j.kyle.omalley@gmail.com>
|
|
6
|
-
Project-URL: Documentation, https://github.com/jkomalley/convbase#readme
|
|
7
|
-
Project-URL: Issues, https://github.com/jkomalley/convbase/issues
|
|
8
|
-
Project-URL: Source, https://github.com/jkomalley/convbase
|
|
9
|
-
Classifier: Development Status :: 1 - Planning
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
-
Requires-Python: >=3.8
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: click
|
|
22
|
-
Provides-Extra: dev
|
|
23
|
-
Requires-Dist: pytest; extra == "dev"
|
|
24
|
-
Requires-Dist: ruff; extra == "dev"
|
|
25
|
-
Requires-Dist: mypy; extra == "dev"
|
|
26
|
-
Requires-Dist: pre-commit; extra == "dev"
|
|
27
|
-
Provides-Extra: publish
|
|
28
|
-
Requires-Dist: twine; extra == "publish"
|
|
29
|
-
Requires-Dist: build; extra == "publish"
|
|
30
|
-
|
|
31
|
-
# convbase
|
|
32
|
-
|
|
33
|
-

|
|
34
|
-
[](https://pypi.python.org/pypi/convbase)
|
|
35
|
-
[](https://opensource.org/licenses/MIT)
|
|
36
|
-
[](https://pypi.python.org/pypi/convbase)
|
|
37
|
-
[](https://github.com/jkomalley/convbase/actions)
|
|
38
|
-
[](https://github.com/astral-sh/ruff)
|
|
39
|
-
[](https://github.com/pre-commit/pre-commit)
|
|
40
|
-
|
|
41
|
-
Base conversion command line utility.
|
convbase-0.0.dev3/README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# convbase
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
[](https://pypi.python.org/pypi/convbase)
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://pypi.python.org/pypi/convbase)
|
|
7
|
-
[](https://github.com/jkomalley/convbase/actions)
|
|
8
|
-
[](https://github.com/astral-sh/ruff)
|
|
9
|
-
[](https://github.com/pre-commit/pre-commit)
|
|
10
|
-
|
|
11
|
-
Base conversion command line utility.
|
convbase-0.0.dev3/setup.cfg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.dev3"
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: convbase
|
|
3
|
-
Version: 0.0.dev3
|
|
4
|
-
Summary: Base conversion command line utility.
|
|
5
|
-
Author-email: Kyle O'Malley <j.kyle.omalley@gmail.com>
|
|
6
|
-
Project-URL: Documentation, https://github.com/jkomalley/convbase#readme
|
|
7
|
-
Project-URL: Issues, https://github.com/jkomalley/convbase/issues
|
|
8
|
-
Project-URL: Source, https://github.com/jkomalley/convbase
|
|
9
|
-
Classifier: Development Status :: 1 - Planning
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
-
Requires-Python: >=3.8
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: click
|
|
22
|
-
Provides-Extra: dev
|
|
23
|
-
Requires-Dist: pytest; extra == "dev"
|
|
24
|
-
Requires-Dist: ruff; extra == "dev"
|
|
25
|
-
Requires-Dist: mypy; extra == "dev"
|
|
26
|
-
Requires-Dist: pre-commit; extra == "dev"
|
|
27
|
-
Provides-Extra: publish
|
|
28
|
-
Requires-Dist: twine; extra == "publish"
|
|
29
|
-
Requires-Dist: build; extra == "publish"
|
|
30
|
-
|
|
31
|
-
# convbase
|
|
32
|
-
|
|
33
|
-

|
|
34
|
-
[](https://pypi.python.org/pypi/convbase)
|
|
35
|
-
[](https://opensource.org/licenses/MIT)
|
|
36
|
-
[](https://pypi.python.org/pypi/convbase)
|
|
37
|
-
[](https://github.com/jkomalley/convbase/actions)
|
|
38
|
-
[](https://github.com/astral-sh/ruff)
|
|
39
|
-
[](https://github.com/pre-commit/pre-commit)
|
|
40
|
-
|
|
41
|
-
Base conversion command line utility.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
src/convbase/__init__.py
|
|
5
|
-
src/convbase/__main__.py
|
|
6
|
-
src/convbase/convbase.py
|
|
7
|
-
src/convbase.egg-info/PKG-INFO
|
|
8
|
-
src/convbase.egg-info/SOURCES.txt
|
|
9
|
-
src/convbase.egg-info/dependency_links.txt
|
|
10
|
-
src/convbase.egg-info/entry_points.txt
|
|
11
|
-
src/convbase.egg-info/requires.txt
|
|
12
|
-
src/convbase.egg-info/top_level.txt
|
|
13
|
-
test/test_convbase.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
convbase
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from click.testing import CliRunner
|
|
2
|
-
from convbase import convbase, __version__
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def test_cli_version():
|
|
6
|
-
runner = CliRunner()
|
|
7
|
-
result = runner.invoke(convbase.run, ["--version"])
|
|
8
|
-
assert result.exit_code == 0
|
|
9
|
-
assert result.output == f"{convbase.__package__} {__version__}\n"
|