git-fantasy-names 1.0.2__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.
- git_fantasy_names-1.0.2/LICENSE +0 -0
- git_fantasy_names-1.0.2/PKG-INFO +19 -0
- git_fantasy_names-1.0.2/README.md +3 -0
- git_fantasy_names-1.0.2/git_fantasy_names/__init__.py +4 -0
- git_fantasy_names-1.0.2/git_fantasy_names/core.py +72 -0
- git_fantasy_names-1.0.2/git_fantasy_names.egg-info/PKG-INFO +19 -0
- git_fantasy_names-1.0.2/git_fantasy_names.egg-info/SOURCES.txt +11 -0
- git_fantasy_names-1.0.2/git_fantasy_names.egg-info/dependency_links.txt +1 -0
- git_fantasy_names-1.0.2/git_fantasy_names.egg-info/requires.txt +1 -0
- git_fantasy_names-1.0.2/git_fantasy_names.egg-info/top_level.txt +1 -0
- git_fantasy_names-1.0.2/pyproject.toml +16 -0
- git_fantasy_names-1.0.2/setup.cfg +4 -0
- git_fantasy_names-1.0.2/setup.py +27 -0
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-fantasy-names
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: A library for generating fantasy names
|
|
5
|
+
Home-page: https://github.com/jeff-web-sketch/FantasyNameGenerator
|
|
6
|
+
Author: Bob Robertson
|
|
7
|
+
Author-email: Bob Robertson <coderdude123@proton.me>
|
|
8
|
+
Requires-Python: >=3.6
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: requests
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: home-page
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
Dynamic: requires-python
|
|
16
|
+
|
|
17
|
+
A small library that reads data from a githuib repo to generate fantasy names.
|
|
18
|
+
Github repo at: https://github.com/Jeff-web-sketch/FantasyNameGenerator
|
|
19
|
+
Online tool: https://jeff-web-sketch.github.io/FantasyNameGenerator/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import random
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
DEFAULT_DATA_URL = "https://raw.githubusercontent.com/jeff-web-sketch/FantasyNameGenerator/main/data.json"
|
|
6
|
+
|
|
7
|
+
class NameGenerator:
|
|
8
|
+
def __init__(self, data_url=DEFAULT_DATA_URL):
|
|
9
|
+
self.data_url = data_url
|
|
10
|
+
self.data = None
|
|
11
|
+
self._fetch_data()
|
|
12
|
+
|
|
13
|
+
def _fetch_data(self):
|
|
14
|
+
"""Fetches data from GitHub on initialization."""
|
|
15
|
+
try:
|
|
16
|
+
response = requests.get(self.data_url)
|
|
17
|
+
response.raise_for_status()
|
|
18
|
+
self.data = response.json()
|
|
19
|
+
except requests.exceptions.RequestException as e:
|
|
20
|
+
raise RuntimeError(f"Failed to fetch name data: {e}")
|
|
21
|
+
|
|
22
|
+
def get_categories(self):
|
|
23
|
+
"""Returns a list of available categories."""
|
|
24
|
+
return list(self.data.keys()) if self.data else []
|
|
25
|
+
|
|
26
|
+
def generate(self, category, count=10, format_type="compound"):
|
|
27
|
+
"""
|
|
28
|
+
Generates names for a specific category.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
category (str): The type of name (e.g., 'dragon', 'elf').
|
|
32
|
+
count (int): Number of names to generate.
|
|
33
|
+
format_type (str): 'compound' (StartEnd) or 'of' (Start of End).
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
list: A list of generated names.
|
|
37
|
+
"""
|
|
38
|
+
if not self.data or category not in self.data:
|
|
39
|
+
raise ValueError(f"Category '{category}' not found. Available: {self.get_categories()}")
|
|
40
|
+
|
|
41
|
+
starts = self.data[category]['starts']
|
|
42
|
+
ends = self.data[category]['ends']
|
|
43
|
+
names = []
|
|
44
|
+
|
|
45
|
+
for _ in range(count):
|
|
46
|
+
s = random.choice(starts)
|
|
47
|
+
e = random.choice(ends)
|
|
48
|
+
|
|
49
|
+
if format_type == "of":
|
|
50
|
+
name = f"{s} of {e}"
|
|
51
|
+
else:
|
|
52
|
+
name = f"{s}{e}"
|
|
53
|
+
names.append(name)
|
|
54
|
+
|
|
55
|
+
return names
|
|
56
|
+
|
|
57
|
+
def export_to_file(self, saved_collection, filename="saved_names.txt"):
|
|
58
|
+
"""Exports a dictionary of saved names to a text file."""
|
|
59
|
+
from datetime import datetime
|
|
60
|
+
|
|
61
|
+
with open(filename, "w", encoding="utf-8") as f:
|
|
62
|
+
f.write("FANTASY NAME GENERATOR - SAVED COLLECTION\n")
|
|
63
|
+
f.write(f"Generated on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
64
|
+
f.write("==========================================\n\n")
|
|
65
|
+
|
|
66
|
+
for category, names in saved_collection.items():
|
|
67
|
+
title = category.capitalize()
|
|
68
|
+
f.write(f"--- {title} Names ---\n")
|
|
69
|
+
for name in names:
|
|
70
|
+
f.write(f"{name}\n")
|
|
71
|
+
f.write("\n")
|
|
72
|
+
return filename
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-fantasy-names
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: A library for generating fantasy names
|
|
5
|
+
Home-page: https://github.com/jeff-web-sketch/FantasyNameGenerator
|
|
6
|
+
Author: Bob Robertson
|
|
7
|
+
Author-email: Bob Robertson <coderdude123@proton.me>
|
|
8
|
+
Requires-Python: >=3.6
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: requests
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: home-page
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
Dynamic: requires-python
|
|
16
|
+
|
|
17
|
+
A small library that reads data from a githuib repo to generate fantasy names.
|
|
18
|
+
Github repo at: https://github.com/Jeff-web-sketch/FantasyNameGenerator
|
|
19
|
+
Online tool: https://jeff-web-sketch.github.io/FantasyNameGenerator/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
git_fantasy_names/__init__.py
|
|
6
|
+
git_fantasy_names/core.py
|
|
7
|
+
git_fantasy_names.egg-info/PKG-INFO
|
|
8
|
+
git_fantasy_names.egg-info/SOURCES.txt
|
|
9
|
+
git_fantasy_names.egg-info/dependency_links.txt
|
|
10
|
+
git_fantasy_names.egg-info/requires.txt
|
|
11
|
+
git_fantasy_names.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
git_fantasy_names
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
[project]
|
|
5
|
+
name = "git-fantasy-names"
|
|
6
|
+
version = "1.0.2"
|
|
7
|
+
description = "A library for generating fantasy names"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.6"
|
|
10
|
+
license-files = ["LICENSE"]
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Bob Robertson", email = "coderdude123@proton.me" }
|
|
13
|
+
]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"requests"
|
|
16
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
|
|
4
|
+
# Read the README content
|
|
5
|
+
this_directory = Path(__file__).parent
|
|
6
|
+
long_description = (this_directory / "README.md").read_text(encoding="utf-8")
|
|
7
|
+
|
|
8
|
+
setup(
|
|
9
|
+
name="git-fantasy-names", # CHANGE THIS if taken on TestPyPI
|
|
10
|
+
version="1.0.2", # INCREMENT VERSION (1.0.0 might be taken)
|
|
11
|
+
description="A library for generating fantasy names (Dragons, Elves, etc.)",
|
|
12
|
+
long_description=long_description,
|
|
13
|
+
long_description_content_type="text/markdown", # CRITICAL: Tells PyPI it's Markdown
|
|
14
|
+
author="Bob Robertson",
|
|
15
|
+
author_email="coderdude123@proton.me", # FIXED: Was 'email'
|
|
16
|
+
url="https://github.com/jeff-web-sketch/FantasyNameGenerator",
|
|
17
|
+
packages=find_packages(),
|
|
18
|
+
install_requires=[
|
|
19
|
+
"requests",
|
|
20
|
+
],
|
|
21
|
+
entry_points={
|
|
22
|
+
"console_scripts": [
|
|
23
|
+
"fantasy_names=cli:main",
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
python_requires=">=3.6"
|
|
27
|
+
)
|