random-user-name-generator 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.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Minji
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: random_user_name_generator
3
+ Version: 0.1.0
4
+ Summary: Generate random name
5
+ Author-email: Minji <minjikwak.cs@gmail.com>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.7
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
File without changes
@@ -0,0 +1,4 @@
1
+ from .core import get_random_name
2
+
3
+ __version__ = '0.1.0'
4
+ __all__ = ['get_random_name']
@@ -0,0 +1,43 @@
1
+ import json
2
+ import os
3
+ import random
4
+ from name_generator.default_type import DefaultType
5
+
6
+
7
+ class NameGenerator:
8
+ def __init__(self):
9
+ self._data = None
10
+ self._load_data()
11
+
12
+ def _load_data(self):
13
+ base_dir = os.path.dirname(__file__)
14
+ json_dir = os.path.join(base_dir, "words.json")
15
+
16
+ try:
17
+ with open(json_dir, "r", encoding="utf-8") as f:
18
+ self._data = json.load(f)
19
+ except FileNotFoundError:
20
+ raise FileNotFoundError(f"File not found:{json_dir}")
21
+
22
+ def generate(self):
23
+ if not self._data:
24
+ self._load_data()
25
+
26
+ adjectives = self._data.get("adjectives", [DefaultType.ADJECTIVE.value])
27
+ nouns = self._data.get("nouns", [DefaultType.NOUN.value])
28
+
29
+ first_name = random.choice(adjectives + nouns)
30
+ last_name = random.choice(nouns)
31
+
32
+ return f"{first_name} {last_name}"
33
+
34
+
35
+ _generator = NameGenerator()
36
+
37
+
38
+ def get_random_name():
39
+ return _generator.generate()
40
+
41
+
42
+ if __name__ == "__main__":
43
+ print(get_random_name())
@@ -0,0 +1,6 @@
1
+ from enum import Enum
2
+
3
+
4
+ class DefaultType(Enum):
5
+ ADJECTIVE = "Amazing"
6
+ NOUN = "Koconut"
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "random_user_name_generator"
7
+ version = "0.1.0"
8
+ description = "Generate random name"
9
+ readme = "README.md"
10
+ requires-python = ">=3.7"
11
+ license = "MIT"
12
+ authors = [
13
+ {name = "Minji", email = "minjikwak.cs@gmail.com"}
14
+ ]
15
+ dependencies = [
16
+ ]
17
+
18
+ [tool.setuptools]
19
+ packages = ["name_generator"]
20
+
21
+ [tool.setuptools.package-data]
22
+ "name_generator.data" = ["*.json"]
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: random_user_name_generator
3
+ Version: 0.1.0
4
+ Summary: Generate random name
5
+ Author-email: Minji <minjikwak.cs@gmail.com>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.7
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ name_generator/__init__.py
5
+ name_generator/core.py
6
+ name_generator/default_type.py
7
+ random_user_name_generator.egg-info/PKG-INFO
8
+ random_user_name_generator.egg-info/SOURCES.txt
9
+ random_user_name_generator.egg-info/dependency_links.txt
10
+ random_user_name_generator.egg-info/top_level.txt
11
+ tests/test_core.py
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes