-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46d5394
commit 994ac95
Showing
14 changed files
with
178 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ TODO.md | |
dist | ||
.pytest_cache/ | ||
/.mypy_cache/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[distutils] | ||
index-servers = | ||
pypi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# DEV.md | ||
|
||
## Useful commands | ||
|
||
### bumpver | ||
|
||
```bash | ||
bumpver show | ||
bumpver show -vv | ||
bumpver update --dry --minor --no-fetch | ||
bumpver update --dry --minor | ||
bumpver update --minor | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# MANIFEST.in | ||
|
||
include README.md LICENSE HISTORY.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[build-system] | ||
requires = ["setuptools==61.0.0", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "randmac" | ||
description = "" | ||
readme = "README.md" | ||
authors = [{ name = "Josh Schmelzle", email = "[email protected]"}] | ||
license = { file = "LICENSE" } | ||
classifiers = [ | ||
"Natural Language :: English", | ||
"Development Status :: 3 - Alpha", | ||
"Programming Language :: Python :: 3.2", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: System Administrators", | ||
"Topic :: Utilities", | ||
] | ||
keywords = ["randmac", "random mac", "random mac address"] | ||
|
||
[project.scripts] | ||
randmac = "randmac=randmac.__main__:main" | ||
|
||
[project.optional-dependencies] | ||
build = ["build", "twine"] | ||
dev = ["black", "bumpver", "isort", "mypy", "pytest"] | ||
|
||
[tool.bumpver] | ||
current_version = "0.1.0" | ||
version_pattern = "MAJOR.MINOR.PATCH" | ||
commit_message = "Bump version {old_version} -> {new_version}" | ||
commit = true | ||
tag = true | ||
push = false | ||
|
||
[tool.bumpver.file_patterns] | ||
"pyproject.toml" = [ | ||
'current_version = "{version}"', | ||
] | ||
"randmac/__version__.py" = [ | ||
'__version__ = "{version}"' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
# /usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# _ _ _ _| _ _ _ _ | ||
# | (_|| |(_|| | |(_|(_ | ||
# | ||
|
||
from randmac.randmac import RandMac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# /usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# _ _ _ _| _ _ _ _ | ||
# | (_|| |(_|| | |(_|(_ | ||
|
@@ -6,8 +8,8 @@ | |
__title__ = "randmac" | ||
__description__ = "a random 12-digit mac address generator" | ||
__url__ = "https://github.com/joshschmelzle/randmac" | ||
__version__ = "0.1" | ||
__version__ = "0.1.0" | ||
__author__ = "Josh Schmelzle" | ||
__author_email__ = "[email protected]" | ||
__license__ = "MIT" | ||
__license__ = "BSD-3-Clause" | ||
__copyright__ = "Copyright Josh Schmelzle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,37 @@ | ||
import pytest | ||
# /usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# _ _ _ _| _ _ _ _ | ||
# | (_|| |(_|| | |(_|(_ | ||
# | ||
|
||
import sys | ||
|
||
sys.path.insert(0, "../randmac/") | ||
from randmac import randmac | ||
from randmac import RandMac | ||
|
||
|
||
class TestRandMac(object): | ||
def testrandomnic(self): | ||
assert len(randmac.nic_portion("00.00.00.00.00.00")) == 17 | ||
assert len(randmac.nic_portion("0000.0000.0000")) == 14 | ||
assert "123456" in randmac.nic_portion("123456AABBCC") | ||
class Test_RandMac(object): | ||
def test_partial(self): | ||
assert len(RandMac("000000000000", generate_partial=True)) == 12 | ||
assert len(RandMac("00.00.00.00.00.00", generate_partial=True)) == 17 | ||
assert len(RandMac("00-00-00-00-00-00", generate_partial=True)) == 17 | ||
assert len(RandMac("00:00:00:00:00:00", generate_partial=True)) == 17 | ||
assert len(RandMac("0000.0000.0000", generate_partial=True)) == 14 | ||
assert "123456" in str(RandMac("123456AABBCC", generate_partial=True)) | ||
assert "12:34:56" in str(RandMac("12:34:56:AA:BB:CC", generate_partial=True)) | ||
|
||
def testmac(self): | ||
assert randmac.twelve_digit_mac("00:00:00:00:00:00")[1].lower() in [ | ||
"2", | ||
"6", | ||
"a", | ||
"e", | ||
] | ||
assert randmac.twelve_digit_mac("00.00.00.00.00.00")[1].lower() in [ | ||
"2", | ||
"6", | ||
"a", | ||
"e", | ||
] | ||
assert randmac.twelve_digit_mac("00-00-00-00-00-00")[1].lower() in [ | ||
"2", | ||
"6", | ||
"a", | ||
"e", | ||
] | ||
assert randmac.twelve_digit_mac("0000.0000.0000")[1].lower() in [ | ||
"2", | ||
"6", | ||
"a", | ||
"e", | ||
] | ||
assert randmac.twelve_digit_mac("000000000000")[1].lower() in [ | ||
def test_mac(self): | ||
laa_hex = [ | ||
"2", | ||
"6", | ||
"a", | ||
"e", | ||
] | ||
assert "123456" not in RandMac("123456AABBCC") | ||
assert "12:34:56" not in RandMac("12:34:56:AA:BB:CC") | ||
assert RandMac("00:00:00:00:00:00")[1].lower() in laa_hex | ||
assert RandMac("00.00.00.00.00.00")[1].lower() in laa_hex | ||
assert RandMac("00-00-00-00-00-00")[1].lower() in laa_hex | ||
assert RandMac("0000.0000.0000")[1].lower() in laa_hex | ||
assert RandMac("000000000000")[1].lower() in laa_hex |