Skip to content

Commit ad405fa

Browse files
committed
feat: nigerian license plate number generator [Issue #3]
1 parent 4708a24 commit ad405fa

File tree

19 files changed

+3487
-794
lines changed

19 files changed

+3487
-794
lines changed

docs/source/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
3838

3939
**Added:**
4040

41-
- Fakernaija data for: ``course``, ``degree``, ``email``, ``faculty``, ``marital_status``, ``name``, ``phonenumber``, ``religion``, ``school``, ``state``.
41+
- Fakernaija data for: ``course``, ``degree``, ``email``, ``faculty``, ``license_plate``, ``marital_status``, ``name``, ``phonenumber``, ``religion``, ``school``, ``state``.
4242
- Added everything else.

docs/source/commands.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Each category command is documented with practical examples. You can find a guid
8888
commands/degree
8989
commands/email
9090
commands/faculty
91+
commands/license_plate
9192
commands/marital_status
9293
commands/name
9394
commands/phonenumber
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
license_plate
2+
=============
3+
4+
.. autofunction:: fakernaija.commands.license_plate

docs/source/index.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Welcome to Fakernaija's Documentation!
44
Overview
55
--------
66

7-
**Fakernaija** is a Python library that helps developers generate Nigerian-specific data like names, emails, addresses, phone numbers, bank details, school names, states, license plate numbers, and much more. Whether you're working on testing, development, or educational projects, **Fakernaija** helps you generate realistic data, including a CLI for easy exports.
7+
**Fakernaija** is a Python library that can help developers generate Nigerian-specific data like names, emails, addresses, phone numbers, bank details, school names, states, license plate numbers, and much more. Whether you're working on testing, development, or educational projects, **Fakernaija** can help you to generate realistic data with Nigerian contexts, and it also comes with a CLI for easy data exports to various file formats.
88

99
The source code is available on `GitHub <https://github.com/Pythonian/fakernaija>`_.
1010

@@ -27,7 +27,7 @@ Features
2727
Installation
2828
------------
2929

30-
**Fakernaija** requires **Python 3.10** or higher. Installation is easy-peasy with `pip`, ensuring you always get the latest stable release of the library.
30+
**Fakernaija** requires **Python 3.10** or higher, and installing it is easy-peasy with ``pip``.
3131

3232
.. code-block:: console
3333
@@ -47,16 +47,19 @@ The primary interface you will interact with is the :doc:`naija`. The ``Naija``
4747
Ugochi Maduike
4848
4949
>>> print(naija.state_capital())
50-
Owerri
50+
Damaturu
5151
52-
>>> print(naija.course_name())
53-
Introduction to Computer Science
52+
>>> print(naija.school_name())
53+
University of Nigeria, Nsukka
54+
55+
>>> print(naija.phone_number())
56+
09039294684
5457
55-
>>> print(naija.degree_name())
56-
Bachelor of Pharmacy
58+
>>> print(naija.email())
59+
ololadelawal@hotmail.com
5760
58-
>>> print(naija.faculty_name())
59-
Pharmaceutical Sciences
61+
>>> print(naija.license_plate())
62+
YLA-435EH
6063
6164
**Fakernaija** tries to ensure that each method call returns different results within the same session until all possible outcomes are exhausted:
6265

docs/source/naija.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Each method of the ``Naija`` class has its own documentation, complete with usag
5757
naija/degree
5858
naija/email
5959
naija/faculty
60+
naija/license_plate
6061
naija/marital_status
6162
naija/name
6263
naija/phonenumber
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
LicensePlate
2+
============
3+
4+
.. autofunction:: fakernaija.Naija.license_plate

fakernaija/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This package provides utilities to generate random data with a Nigerian context.
44
"""
55

6-
__version__ = "1.0.4"
6+
__version__ = "1.0.5"
77

88
from .naija import Naija
99

fakernaija/commands/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
faculty,
99
faculty_name,
1010
)
11+
from .license_plate import license_plate
1112
from .marital_status import marital_status
1213
from .name import first_name, full_name, last_name, prefix
1314
from .phonenumber import phone_number
@@ -36,6 +37,8 @@
3637
"faculty",
3738
"faculty_name",
3839
"department_name",
40+
# License plate command
41+
"license_plate",
3942
# Marital status command
4043
"marital_status",
4144
# Name commands
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
"""License plate command to return random license plates data."""
2+
3+
import click
4+
5+
from fakernaija import Naija
6+
from fakernaija.utils import generate_command_data, handle_command_output
7+
8+
naija = Naija()
9+
10+
11+
@click.command()
12+
@click.option(
13+
"--repeat",
14+
"-r",
15+
default=1,
16+
help="Number of random license plates to return. Defaults to 1.",
17+
type=int,
18+
)
19+
@click.option(
20+
"--state",
21+
"-s",
22+
default=None,
23+
help="Generate plate numbers from any state LGA in Nigeria.",
24+
type=str,
25+
)
26+
@click.option(
27+
"--output",
28+
"-o",
29+
default=None,
30+
help="The format of the output file.",
31+
type=click.Choice(["json", "csv", "text"], case_sensitive=False),
32+
)
33+
def license_plate(repeat: int, state: str, output: str) -> None:
34+
"""Generate and returns random license plates.
35+
36+
Args:
37+
repeat (int): The number of random license plates to return.
38+
Must be a positive integer. Defaults to 1.
39+
state (str): Generate license plate number by state.
40+
output (str): The format of the output file if provided.
41+
42+
Note:
43+
- Output options: csv, json, text
44+
- State options: 36 states in Nigeria + FCT
45+
46+
Examples:
47+
To generate a single random license plate:
48+
49+
.. code-block:: bash
50+
51+
$ naija license_plate
52+
FST-452UB
53+
54+
To generate 3 random license plates:
55+
56+
.. code-block:: bash
57+
58+
$ naija license_plate --repeat 3
59+
LND-718GQ
60+
BWR-486US
61+
AAA-182DD
62+
63+
To generate a random license plate from a specific state in Nigeria:
64+
65+
.. code-block:: console
66+
67+
$ naija license_plate --state "akwa ibom"
68+
NGD-631CK
69+
70+
To generate 30 random license plate numbers and save them to a specified format:
71+
72+
.. code-block:: bash
73+
74+
$ naija license_plate --repeat 30 --output text
75+
Generated data saved to /path/to/directory/filename.ext
76+
"""
77+
data = generate_command_data(repeat, naija.license_plate, state=state)
78+
if data:
79+
handle_command_output(data, output, "license_plate", "license plates")

0 commit comments

Comments
 (0)