heroes 0.1.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.
- heroes-0.1.0/LICENSE +21 -0
- heroes-0.1.0/PKG-INFO +103 -0
- heroes-0.1.0/README.md +54 -0
- heroes-0.1.0/pyproject.toml +38 -0
- heroes-0.1.0/setup.cfg +4 -0
- heroes-0.1.0/src/heroes/__init__.py +28 -0
- heroes-0.1.0/src/heroes/_data.py +18 -0
- heroes-0.1.0/src/heroes/heroes.json +224 -0
- heroes-0.1.0/src/heroes.egg-info/PKG-INFO +103 -0
- heroes-0.1.0/src/heroes.egg-info/SOURCES.txt +12 -0
- heroes-0.1.0/src/heroes.egg-info/dependency_links.txt +1 -0
- heroes-0.1.0/src/heroes.egg-info/requires.txt +5 -0
- heroes-0.1.0/src/heroes.egg-info/top_level.txt +1 -0
- heroes-0.1.0/tests/test_heroes.py +55 -0
heroes-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Philipp Muellauer
|
|
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.
|
heroes-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: heroes
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Random superhero names -- a tiny, dependency-free Python package.
|
|
5
|
+
Author: Philipp Muellauer
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Philipp Muellauer
|
|
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/appbrewery/heroes
|
|
29
|
+
Project-URL: Issues, https://github.com/appbrewery/heroes/issues
|
|
30
|
+
Keywords: superhero,heroes,random,names,fixtures
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
41
|
+
Requires-Python: >=3.8
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
46
|
+
Requires-Dist: build; extra == "dev"
|
|
47
|
+
Requires-Dist: twine; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# heroes
|
|
51
|
+
|
|
52
|
+
> Random superhero names -- a tiny, dependency-free Python package.
|
|
53
|
+
|
|
54
|
+
A Python take on the JS [`superheroes`](https://github.com/sindresorhus/superheroes)
|
|
55
|
+
package, with a smaller curated dataset that mixes classic comic names with
|
|
56
|
+
original, slightly silly ones (`Captain Spreadsheet`, `Doctor Latency`,
|
|
57
|
+
`The Linter`, ...).
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
pip install heroes
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import heroes
|
|
69
|
+
|
|
70
|
+
heroes.gen()
|
|
71
|
+
# => 'Hooded'
|
|
72
|
+
|
|
73
|
+
heroes.genarr(3)
|
|
74
|
+
# => ['Askew-Tronics', 'Decepticon', 'Leopardon']
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## API
|
|
78
|
+
|
|
79
|
+
### `heroes.gen() -> str`
|
|
80
|
+
|
|
81
|
+
Returns one random hero name from the bundled dataset.
|
|
82
|
+
|
|
83
|
+
### `heroes.genarr(n: int) -> list[str]`
|
|
84
|
+
|
|
85
|
+
Returns a list of `n` **unique** random hero names (no duplicates).
|
|
86
|
+
|
|
87
|
+
Raises `ValueError` when `n` is negative or larger than the dataset
|
|
88
|
+
(`len(heroes._data.HEROES)`).
|
|
89
|
+
|
|
90
|
+
## Determinism
|
|
91
|
+
|
|
92
|
+
The library uses the module-level `random` module, so you can seed it for
|
|
93
|
+
reproducible output:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import random, heroes
|
|
97
|
+
random.seed(42)
|
|
98
|
+
heroes.gen()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
heroes-0.1.0/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# heroes
|
|
2
|
+
|
|
3
|
+
> Random superhero names -- a tiny, dependency-free Python package.
|
|
4
|
+
|
|
5
|
+
A Python take on the JS [`superheroes`](https://github.com/sindresorhus/superheroes)
|
|
6
|
+
package, with a smaller curated dataset that mixes classic comic names with
|
|
7
|
+
original, slightly silly ones (`Captain Spreadsheet`, `Doctor Latency`,
|
|
8
|
+
`The Linter`, ...).
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pip install heroes
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import heroes
|
|
20
|
+
|
|
21
|
+
heroes.gen()
|
|
22
|
+
# => 'Hooded'
|
|
23
|
+
|
|
24
|
+
heroes.genarr(3)
|
|
25
|
+
# => ['Askew-Tronics', 'Decepticon', 'Leopardon']
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
### `heroes.gen() -> str`
|
|
31
|
+
|
|
32
|
+
Returns one random hero name from the bundled dataset.
|
|
33
|
+
|
|
34
|
+
### `heroes.genarr(n: int) -> list[str]`
|
|
35
|
+
|
|
36
|
+
Returns a list of `n` **unique** random hero names (no duplicates).
|
|
37
|
+
|
|
38
|
+
Raises `ValueError` when `n` is negative or larger than the dataset
|
|
39
|
+
(`len(heroes._data.HEROES)`).
|
|
40
|
+
|
|
41
|
+
## Determinism
|
|
42
|
+
|
|
43
|
+
The library uses the module-level `random` module, so you can seed it for
|
|
44
|
+
reproducible output:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import random, heroes
|
|
48
|
+
random.seed(42)
|
|
49
|
+
heroes.gen()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "heroes"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Random superhero names -- a tiny, dependency-free Python package."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [{ name = "Philipp Muellauer" }]
|
|
13
|
+
keywords = ["superhero", "heroes", "random", "names", "fixtures"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
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
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = ["pytest>=7", "build", "twine"]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/appbrewery/heroes"
|
|
32
|
+
Issues = "https://github.com/appbrewery/heroes/issues"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
where = ["src"]
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.package-data]
|
|
38
|
+
heroes = ["heroes.json"]
|
heroes-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Random superhero names."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import random
|
|
6
|
+
from typing import List
|
|
7
|
+
|
|
8
|
+
from ._data import HEROES
|
|
9
|
+
|
|
10
|
+
__all__ = ["gen", "genarr"]
|
|
11
|
+
__version__ = "0.1.0"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def gen() -> str:
|
|
15
|
+
"""Return one random hero name."""
|
|
16
|
+
return random.choice(HEROES)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def genarr(n: int) -> List[str]:
|
|
20
|
+
"""Return a list of n unique random hero names.
|
|
21
|
+
|
|
22
|
+
Raises ValueError if n is negative or larger than the dataset.
|
|
23
|
+
"""
|
|
24
|
+
if n < 0:
|
|
25
|
+
raise ValueError("n must be >= 0")
|
|
26
|
+
if n > len(HEROES):
|
|
27
|
+
raise ValueError(f"n={n} exceeds dataset size {len(HEROES)}")
|
|
28
|
+
return random.sample(HEROES, n)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Load the bundled heroes.json dataset once at import time."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from importlib.resources import files
|
|
7
|
+
from typing import Tuple
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _load() -> Tuple[str, ...]:
|
|
11
|
+
raw = files(__package__).joinpath("heroes.json").read_text(encoding="utf-8")
|
|
12
|
+
data = json.loads(raw)
|
|
13
|
+
if not isinstance(data, list) or not all(isinstance(x, str) for x in data):
|
|
14
|
+
raise RuntimeError("heroes.json must be a JSON array of strings")
|
|
15
|
+
return tuple(data)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
HEROES: Tuple[str, ...] = _load()
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
[
|
|
2
|
+
"Adam Warlock",
|
|
3
|
+
"Agent Coulson",
|
|
4
|
+
"Agile Avenger",
|
|
5
|
+
"Ant-Man",
|
|
6
|
+
"Anti-Venom",
|
|
7
|
+
"Aquaman",
|
|
8
|
+
"Arsenal",
|
|
9
|
+
"Atom",
|
|
10
|
+
"Banshee",
|
|
11
|
+
"Batgirl",
|
|
12
|
+
"Batman",
|
|
13
|
+
"Batwoman",
|
|
14
|
+
"Beast",
|
|
15
|
+
"Beta Ray Bill",
|
|
16
|
+
"Bishop",
|
|
17
|
+
"Black Canary",
|
|
18
|
+
"Black Cat",
|
|
19
|
+
"Black Knight",
|
|
20
|
+
"Black Lightning",
|
|
21
|
+
"Black Widow",
|
|
22
|
+
"Blade",
|
|
23
|
+
"Blue Beetle",
|
|
24
|
+
"Booster Gold",
|
|
25
|
+
"Bucky Barnes",
|
|
26
|
+
"Bug Crusher",
|
|
27
|
+
"Cable",
|
|
28
|
+
"Captain America",
|
|
29
|
+
"Captain Backlog",
|
|
30
|
+
"Captain Britain",
|
|
31
|
+
"Captain Closure",
|
|
32
|
+
"Captain Cooldown",
|
|
33
|
+
"Captain Marvel",
|
|
34
|
+
"Captain Refactor",
|
|
35
|
+
"Captain Spreadsheet",
|
|
36
|
+
"Captain Sprint",
|
|
37
|
+
"Captain Standup",
|
|
38
|
+
"Cassandra Cain",
|
|
39
|
+
"Catwoman",
|
|
40
|
+
"Code Smith",
|
|
41
|
+
"Colossus",
|
|
42
|
+
"Commander Compile",
|
|
43
|
+
"Commit Crusader",
|
|
44
|
+
"Constantine",
|
|
45
|
+
"Cron Master",
|
|
46
|
+
"Cyborg",
|
|
47
|
+
"Cyclops",
|
|
48
|
+
"Damian Wayne",
|
|
49
|
+
"Daredevil",
|
|
50
|
+
"Dazzler",
|
|
51
|
+
"Deadpool",
|
|
52
|
+
"Debug Diva",
|
|
53
|
+
"Deploy Doctor",
|
|
54
|
+
"Doctor Async",
|
|
55
|
+
"Doctor Cache",
|
|
56
|
+
"Doctor Daemon",
|
|
57
|
+
"Doctor Deadlock",
|
|
58
|
+
"Doctor Diff",
|
|
59
|
+
"Doctor Doom",
|
|
60
|
+
"Doctor Endpoint",
|
|
61
|
+
"Doctor Index",
|
|
62
|
+
"Doctor Latency",
|
|
63
|
+
"Doctor Patch",
|
|
64
|
+
"Doctor Pixel",
|
|
65
|
+
"Doctor Quota",
|
|
66
|
+
"Doctor Schema",
|
|
67
|
+
"Doctor Stacktrace",
|
|
68
|
+
"Doctor Strange",
|
|
69
|
+
"Doctor Syntax",
|
|
70
|
+
"Doctor Webhook",
|
|
71
|
+
"Domino",
|
|
72
|
+
"Drax",
|
|
73
|
+
"Elongated Man",
|
|
74
|
+
"Endpoint Guardian",
|
|
75
|
+
"Excalibur",
|
|
76
|
+
"Falcon",
|
|
77
|
+
"Flash",
|
|
78
|
+
"Forge",
|
|
79
|
+
"Fork Lord",
|
|
80
|
+
"Galactus",
|
|
81
|
+
"Gambit",
|
|
82
|
+
"Gamora",
|
|
83
|
+
"Ghost Rider",
|
|
84
|
+
"Git Goblin",
|
|
85
|
+
"Goliath",
|
|
86
|
+
"Green Arrow",
|
|
87
|
+
"Green Lantern",
|
|
88
|
+
"Groot",
|
|
89
|
+
"Hawkeye",
|
|
90
|
+
"Hawkgirl",
|
|
91
|
+
"Hawkman",
|
|
92
|
+
"Heimdall",
|
|
93
|
+
"Hela",
|
|
94
|
+
"Hellboy",
|
|
95
|
+
"Hellcat",
|
|
96
|
+
"Hellstrom",
|
|
97
|
+
"Hooded",
|
|
98
|
+
"Hotfix Hero",
|
|
99
|
+
"Hulk",
|
|
100
|
+
"Human Torch",
|
|
101
|
+
"Huntress",
|
|
102
|
+
"Hyperion",
|
|
103
|
+
"Iceman",
|
|
104
|
+
"Invisible Woman",
|
|
105
|
+
"Iron Fist",
|
|
106
|
+
"Iron Man",
|
|
107
|
+
"JSON Jester",
|
|
108
|
+
"Jean Grey",
|
|
109
|
+
"Jessica Jones",
|
|
110
|
+
"Joker",
|
|
111
|
+
"Jubilee",
|
|
112
|
+
"Kanban Kid",
|
|
113
|
+
"Kernel Knight",
|
|
114
|
+
"Kitty Pryde",
|
|
115
|
+
"Lambda Lass",
|
|
116
|
+
"Latency Lass",
|
|
117
|
+
"Linter Lord",
|
|
118
|
+
"Loki",
|
|
119
|
+
"Longshot",
|
|
120
|
+
"Luke Cage",
|
|
121
|
+
"Madame Mocha",
|
|
122
|
+
"Magneto",
|
|
123
|
+
"Mantis",
|
|
124
|
+
"Maria Hill",
|
|
125
|
+
"Martian Manhunter",
|
|
126
|
+
"Master Migrator",
|
|
127
|
+
"Miles Morales",
|
|
128
|
+
"Mister Fantastic",
|
|
129
|
+
"Mister Mock",
|
|
130
|
+
"Misty Knight",
|
|
131
|
+
"Mojo",
|
|
132
|
+
"Moon Knight",
|
|
133
|
+
"Morbius",
|
|
134
|
+
"Mystique",
|
|
135
|
+
"Nebula",
|
|
136
|
+
"Nick Fury",
|
|
137
|
+
"Nightcrawler",
|
|
138
|
+
"Nightwing",
|
|
139
|
+
"Nova",
|
|
140
|
+
"Null Pointer",
|
|
141
|
+
"Ops Oracle",
|
|
142
|
+
"PR Phantom",
|
|
143
|
+
"Patch Princess",
|
|
144
|
+
"Penguin",
|
|
145
|
+
"Pepper Potts",
|
|
146
|
+
"Plastic Man",
|
|
147
|
+
"Polaris",
|
|
148
|
+
"Powergirl",
|
|
149
|
+
"Professor X",
|
|
150
|
+
"Psylocke",
|
|
151
|
+
"Punisher",
|
|
152
|
+
"Quasar",
|
|
153
|
+
"Queue Queen",
|
|
154
|
+
"Quicksilver",
|
|
155
|
+
"Rebase Ranger",
|
|
156
|
+
"Red Hood",
|
|
157
|
+
"Red Tornado",
|
|
158
|
+
"Refactor Ronin",
|
|
159
|
+
"Regex Raven",
|
|
160
|
+
"Repo Reaper",
|
|
161
|
+
"Riddler",
|
|
162
|
+
"Robin",
|
|
163
|
+
"Rocket Raccoon",
|
|
164
|
+
"Rogue",
|
|
165
|
+
"Satana",
|
|
166
|
+
"Scarlet Witch",
|
|
167
|
+
"Schema Sage",
|
|
168
|
+
"Sentry",
|
|
169
|
+
"Sergeant Sysadmin",
|
|
170
|
+
"Shadow IT",
|
|
171
|
+
"Shazam",
|
|
172
|
+
"She-Hulk",
|
|
173
|
+
"Sif",
|
|
174
|
+
"Silk",
|
|
175
|
+
"Silver Surfer",
|
|
176
|
+
"Sir Sequel",
|
|
177
|
+
"Spawn",
|
|
178
|
+
"Speedy",
|
|
179
|
+
"Spider-Gwen",
|
|
180
|
+
"Spider-Man",
|
|
181
|
+
"Spiral",
|
|
182
|
+
"Squirrel Girl",
|
|
183
|
+
"Stack Tracer",
|
|
184
|
+
"Star-Lord",
|
|
185
|
+
"Static Shock",
|
|
186
|
+
"Steel",
|
|
187
|
+
"Stephanie Brown",
|
|
188
|
+
"Storm",
|
|
189
|
+
"Sunfire",
|
|
190
|
+
"Supergirl",
|
|
191
|
+
"Superman",
|
|
192
|
+
"Swamp Thing",
|
|
193
|
+
"Syntax Specter",
|
|
194
|
+
"The Bottleneck",
|
|
195
|
+
"The Compiler",
|
|
196
|
+
"The Linter",
|
|
197
|
+
"The Mocker",
|
|
198
|
+
"The Monolith",
|
|
199
|
+
"The Observer",
|
|
200
|
+
"The Rebase",
|
|
201
|
+
"The Sidekick",
|
|
202
|
+
"Thing",
|
|
203
|
+
"Thor",
|
|
204
|
+
"Tigra",
|
|
205
|
+
"Tim Drake",
|
|
206
|
+
"Token Templar",
|
|
207
|
+
"Union Jack",
|
|
208
|
+
"Valkyrie",
|
|
209
|
+
"Venom",
|
|
210
|
+
"Vision",
|
|
211
|
+
"Vixen",
|
|
212
|
+
"War Machine",
|
|
213
|
+
"Wasp",
|
|
214
|
+
"Webhook Wizard",
|
|
215
|
+
"Werewolf By Night",
|
|
216
|
+
"Winter Soldier",
|
|
217
|
+
"Wolverine",
|
|
218
|
+
"Wong",
|
|
219
|
+
"Wonder Woman",
|
|
220
|
+
"YAML Yeti",
|
|
221
|
+
"Yellowjacket",
|
|
222
|
+
"Yondu",
|
|
223
|
+
"Zatanna"
|
|
224
|
+
]
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: heroes
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Random superhero names -- a tiny, dependency-free Python package.
|
|
5
|
+
Author: Philipp Muellauer
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Philipp Muellauer
|
|
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/appbrewery/heroes
|
|
29
|
+
Project-URL: Issues, https://github.com/appbrewery/heroes/issues
|
|
30
|
+
Keywords: superhero,heroes,random,names,fixtures
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
41
|
+
Requires-Python: >=3.8
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
46
|
+
Requires-Dist: build; extra == "dev"
|
|
47
|
+
Requires-Dist: twine; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# heroes
|
|
51
|
+
|
|
52
|
+
> Random superhero names -- a tiny, dependency-free Python package.
|
|
53
|
+
|
|
54
|
+
A Python take on the JS [`superheroes`](https://github.com/sindresorhus/superheroes)
|
|
55
|
+
package, with a smaller curated dataset that mixes classic comic names with
|
|
56
|
+
original, slightly silly ones (`Captain Spreadsheet`, `Doctor Latency`,
|
|
57
|
+
`The Linter`, ...).
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
pip install heroes
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import heroes
|
|
69
|
+
|
|
70
|
+
heroes.gen()
|
|
71
|
+
# => 'Hooded'
|
|
72
|
+
|
|
73
|
+
heroes.genarr(3)
|
|
74
|
+
# => ['Askew-Tronics', 'Decepticon', 'Leopardon']
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## API
|
|
78
|
+
|
|
79
|
+
### `heroes.gen() -> str`
|
|
80
|
+
|
|
81
|
+
Returns one random hero name from the bundled dataset.
|
|
82
|
+
|
|
83
|
+
### `heroes.genarr(n: int) -> list[str]`
|
|
84
|
+
|
|
85
|
+
Returns a list of `n` **unique** random hero names (no duplicates).
|
|
86
|
+
|
|
87
|
+
Raises `ValueError` when `n` is negative or larger than the dataset
|
|
88
|
+
(`len(heroes._data.HEROES)`).
|
|
89
|
+
|
|
90
|
+
## Determinism
|
|
91
|
+
|
|
92
|
+
The library uses the module-level `random` module, so you can seed it for
|
|
93
|
+
reproducible output:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import random, heroes
|
|
97
|
+
random.seed(42)
|
|
98
|
+
heroes.gen()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/heroes/__init__.py
|
|
5
|
+
src/heroes/_data.py
|
|
6
|
+
src/heroes/heroes.json
|
|
7
|
+
src/heroes.egg-info/PKG-INFO
|
|
8
|
+
src/heroes.egg-info/SOURCES.txt
|
|
9
|
+
src/heroes.egg-info/dependency_links.txt
|
|
10
|
+
src/heroes.egg-info/requires.txt
|
|
11
|
+
src/heroes.egg-info/top_level.txt
|
|
12
|
+
tests/test_heroes.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
heroes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import random
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
import heroes
|
|
6
|
+
from heroes._data import HEROES
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_gen_returns_string_from_dataset():
|
|
10
|
+
name = heroes.gen()
|
|
11
|
+
assert isinstance(name, str)
|
|
12
|
+
assert name in HEROES
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_genarr_length_and_membership():
|
|
16
|
+
names = heroes.genarr(5)
|
|
17
|
+
assert isinstance(names, list)
|
|
18
|
+
assert len(names) == 5
|
|
19
|
+
for n in names:
|
|
20
|
+
assert n in HEROES
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_genarr_returns_unique_values():
|
|
24
|
+
names = heroes.genarr(20)
|
|
25
|
+
assert len(set(names)) == len(names)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_genarr_zero_returns_empty_list():
|
|
29
|
+
assert heroes.genarr(0) == []
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_genarr_negative_raises():
|
|
33
|
+
with pytest.raises(ValueError):
|
|
34
|
+
heroes.genarr(-1)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_genarr_too_large_raises():
|
|
38
|
+
with pytest.raises(ValueError):
|
|
39
|
+
heroes.genarr(len(HEROES) + 1)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_gen_is_deterministic_under_seed():
|
|
43
|
+
random.seed(42)
|
|
44
|
+
a = heroes.gen()
|
|
45
|
+
random.seed(42)
|
|
46
|
+
b = heroes.gen()
|
|
47
|
+
assert a == b
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_dataset_has_no_duplicates():
|
|
51
|
+
assert len(HEROES) == len(set(HEROES))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_dataset_is_non_trivial():
|
|
55
|
+
assert len(HEROES) >= 100
|