niitools 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.
- niitools-0.0.1/LICENSE +21 -0
- niitools-0.0.1/PKG-INFO +41 -0
- niitools-0.0.1/README.md +2 -0
- niitools-0.0.1/niitools/__init__.py +3 -0
- niitools-0.0.1/niitools/converter.py +32 -0
- niitools-0.0.1/niitools.egg-info/PKG-INFO +41 -0
- niitools-0.0.1/niitools.egg-info/SOURCES.txt +11 -0
- niitools-0.0.1/niitools.egg-info/dependency_links.txt +1 -0
- niitools-0.0.1/niitools.egg-info/top_level.txt +3 -0
- niitools-0.0.1/pyproject.toml +34 -0
- niitools-0.0.1/setup.cfg +4 -0
- niitools-0.0.1/tests/__init__.py +0 -0
- niitools-0.0.1/tests/test_converter.py +46 -0
niitools-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Diogo Shiraishi
|
|
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.
|
niitools-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: niitools
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: My humble package for NeuroImaging Informatics tools
|
|
5
|
+
Author: diogohs
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Diogo Shiraishi
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/diogohs/niitools
|
|
29
|
+
Project-URL: Repository, https://github.com/diogohs/niitools
|
|
30
|
+
Project-URL: Issues, https://github.com/diogohs/niitools/issues
|
|
31
|
+
Project-URL: Bug Tracker, https://github.com/diogohs/niitools/issues
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Requires-Python: >=3.8
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
License-File: LICENSE
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# niitools
|
|
41
|
+
My humble package for NeuroImaging Informatics tools
|
niitools-0.0.1/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
def decimal_to_binary(number: int) -> str:
|
|
2
|
+
"""
|
|
3
|
+
Convert a decimal number to binary.
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
number (int): The decimal number to convert.
|
|
7
|
+
|
|
8
|
+
Returns:
|
|
9
|
+
str: The binary representation of the decimal number.
|
|
10
|
+
"""
|
|
11
|
+
if not isinstance(number, int):
|
|
12
|
+
raise TypeError("Input must be an integer")
|
|
13
|
+
if number < 0:
|
|
14
|
+
raise ValueError("Number must be non-negative")
|
|
15
|
+
return bin(number)[2:] # Remove the '0b' prefix
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def binary_to_decimal(binary: str) -> int:
|
|
19
|
+
"""
|
|
20
|
+
Convert a binary number (as a string) to decimal.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
binary (str): The binary number to convert.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
int: The decimal representation of the binary number.
|
|
27
|
+
"""
|
|
28
|
+
if not isinstance(binary, str):
|
|
29
|
+
raise TypeError("Input must be a string of binary digits")
|
|
30
|
+
if not all(bit in "01" for bit in binary):
|
|
31
|
+
raise ValueError("Invalid binary number")
|
|
32
|
+
return int(binary, 2)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: niitools
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: My humble package for NeuroImaging Informatics tools
|
|
5
|
+
Author: diogohs
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Diogo Shiraishi
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/diogohs/niitools
|
|
29
|
+
Project-URL: Repository, https://github.com/diogohs/niitools
|
|
30
|
+
Project-URL: Issues, https://github.com/diogohs/niitools/issues
|
|
31
|
+
Project-URL: Bug Tracker, https://github.com/diogohs/niitools/issues
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Requires-Python: >=3.8
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
License-File: LICENSE
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# niitools
|
|
41
|
+
My humble package for NeuroImaging Informatics tools
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
niitools/__init__.py
|
|
5
|
+
niitools/converter.py
|
|
6
|
+
niitools.egg-info/PKG-INFO
|
|
7
|
+
niitools.egg-info/SOURCES.txt
|
|
8
|
+
niitools.egg-info/dependency_links.txt
|
|
9
|
+
niitools.egg-info/top_level.txt
|
|
10
|
+
tests/__init__.py
|
|
11
|
+
tests/test_converter.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "niitools"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="diogohs" },
|
|
10
|
+
]
|
|
11
|
+
description = "My humble package for NeuroImaging Informatics tools"
|
|
12
|
+
license = { file = "LICENSE" }
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
# Liste aqui as bibliotecas que seu pacote precisa para funcionar.
|
|
22
|
+
# Exemplo:
|
|
23
|
+
# "requests>=2.31.0",
|
|
24
|
+
# "pandas>=2.0.0"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
"Homepage" = "https://github.com/diogohs/niitools"
|
|
29
|
+
"Repository" = "https://github.com/diogohs/niitools"
|
|
30
|
+
"Issues" = "https://github.com/diogohs/niitools/issues"
|
|
31
|
+
"Bug Tracker" = "https://github.com/diogohs/niitools/issues"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["."]
|
niitools-0.0.1/setup.cfg
ADDED
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from niitools.converter import decimal_to_binary, binary_to_decimal
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# ---------- Tests for decimal_to_binary ----------
|
|
6
|
+
|
|
7
|
+
def test_decimal_to_binary_basic():
|
|
8
|
+
assert decimal_to_binary(0) == "0"
|
|
9
|
+
assert decimal_to_binary(1) == "1"
|
|
10
|
+
assert decimal_to_binary(2) == "10"
|
|
11
|
+
assert decimal_to_binary(10) == "1010"
|
|
12
|
+
assert decimal_to_binary(255) == "11111111"
|
|
13
|
+
|
|
14
|
+
def test_decimal_to_binary_type_error():
|
|
15
|
+
with pytest.raises(TypeError):
|
|
16
|
+
decimal_to_binary("10")
|
|
17
|
+
with pytest.raises(TypeError):
|
|
18
|
+
decimal_to_binary(3.14)
|
|
19
|
+
|
|
20
|
+
def test_decimal_to_binary_value_error():
|
|
21
|
+
with pytest.raises(ValueError):
|
|
22
|
+
decimal_to_binary(-1)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# ---------- Tests for binary_to_decimal ----------
|
|
26
|
+
|
|
27
|
+
def test_binary_to_decimal_basic():
|
|
28
|
+
assert binary_to_decimal("0") == 0
|
|
29
|
+
assert binary_to_decimal("1") == 1
|
|
30
|
+
assert binary_to_decimal("10") == 2
|
|
31
|
+
assert binary_to_decimal("1010") == 10
|
|
32
|
+
assert binary_to_decimal("11111111") == 255
|
|
33
|
+
|
|
34
|
+
def test_binary_to_decimal_type_error():
|
|
35
|
+
with pytest.raises(TypeError):
|
|
36
|
+
binary_to_decimal(1010)
|
|
37
|
+
with pytest.raises(TypeError):
|
|
38
|
+
binary_to_decimal(None)
|
|
39
|
+
|
|
40
|
+
def test_binary_to_decimal_value_error():
|
|
41
|
+
with pytest.raises(ValueError):
|
|
42
|
+
binary_to_decimal("102")
|
|
43
|
+
with pytest.raises(ValueError):
|
|
44
|
+
binary_to_decimal("abc")
|
|
45
|
+
with pytest.raises(ValueError):
|
|
46
|
+
binary_to_decimal("10 01") # contains space
|