Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Patches and Suggestions
- Zayed Alsaidi `(zayedalsaidi)`_
- Muayyad AlSadi `(muayyadalsadi)`_
- Rodrigo Nogueira `(rodrigobnogueira)`_

- Roman Mikhaylov `(ApusBerliozi)`_

.. _(lk-geimfari): https://github.com/lk-geimfari
.. _(sobolevn): https://github.com/sobolevn
Expand Down Expand Up @@ -176,4 +176,5 @@ Patches and Suggestions
.. _(yah04dev): https://github.com/yah04dev
.. _(muayyadalsadi): https://github.com/muayyad-alsadi
.. _(rodrigobnogueira): https://github.com/rodrigobnogueira
.. _(ApusBerliozi): https://github.com/ApusBerliozi

1 change: 1 addition & 0 deletions mimesis/datasets/int/hardware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides all the data related to the hardware."""

from itertools import product

RESOLUTIONS = [
Expand Down
1 change: 1 addition & 0 deletions mimesis/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

Below, you can see an example of usage enums in methods of data providers.
"""

import typing as t
from enum import Enum, auto

Expand Down
2 changes: 0 additions & 2 deletions mimesis/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
"urlsafe_base64_encode",
"redact",
"join",
"take_first",
"take_last",
"apply_if",
"pipe",
]
Expand Down
1 change: 1 addition & 0 deletions mimesis/providers/choice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides a random choice from items in a sequence."""

import typing as t

from mimesis.providers.base import BaseProvider
Expand Down
3 changes: 1 addition & 2 deletions mimesis/providers/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ class or is not a subclass of BaseProvider.
if inspect.isclass(cls):
if not issubclass(cls, BaseProvider):
raise TypeError(
"The provider must be a "
"subclass of mimesis.providers.BaseProvider"
"The provider must be a subclass of mimesis.providers.BaseProvider"
)
try:
name = cls.Meta.name
Expand Down
1 change: 1 addition & 0 deletions mimesis/providers/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Generic(BaseProvider):

class Meta:
name: t.Final[str]

def __getattr__(self, attrname: str) -> t.Any: ...
def __dir__(self) -> list[str]: ...
def reseed(self, seed: Seed = ...) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions mimesis/providers/text.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides data related to text."""

import typing as t

from mimesis.datasets import SAFE_COLORS
Expand Down
3 changes: 1 addition & 2 deletions mimesis/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def generate_string_by_mask(

if char_code == digit_code:
raise ValueError(
"The same placeholder cannot be "
"used for both numbers and characters."
"The same placeholder cannot be used for both numbers and characters."
)

_mask = mask.encode()
Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ dev = [
"pygments~=2.13",
"pytest-randomly~=3.12",
"pytz~=2023.3",
"black>=22.10,<24.0",
"autoflake~=2.0",
"types-pytz~=2023.3",
"taskipy>=1.10.1,<2",
"validators>=0.20.0,<0.21",
Expand All @@ -81,8 +79,8 @@ dev = [
"sphinx-copybutton>=0.5.0,<0.6",
"sphinx-autodoc-typehints>=1.19.2,<2",
"pytest-factoryboy>=2.6.0,<3",
"isort>=6.0.1",
"twine>=6.1.0",
"ruff>=0.15.9",
]

[tool.hatch.build.targets.sdist]
Expand Down Expand Up @@ -123,9 +121,13 @@ no_implicit_optional = true
warn_return_any = true
strict_equality = true

[tool.isort]
profile = "wemake"

[tool.taskipy.tasks]
minify = "python tasks/minifier.py"

[tool.ruff.lint]

ignore=["F403"]

[tool.ruff.format]

exclude = ["__init__.py"]
18 changes: 6 additions & 12 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@ set -e
: ${CHECK:=''}

if [[ "$CHECK" == '0' ]]; then
CHECK='' # 0 is semantically equivalent to ''
FORMAT='' # 0 is semantically equivalent to ''
LINT=''
fi
if [[ ! -z "$CHECK" ]]; then
CHECK='--check'
FORMAT='--check'
LINT='--diff'
echo 'Running lint check'
fi

uv run isort mimesis tests $CHECK
uv run black mimesis tests $CHECK
uv run autoflake \
--remove-all-unused-imports \
--recursive \
--remove-unused-variables \
--in-place \
--exclude=__init__.py \
--quiet \
mimesis tests $CHECK
uv run ruff check mimesis tests $LINT
uv run ruff format --quiet mimesis tests $FORMAT
3 changes: 1 addition & 2 deletions tests/test_providers/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def three():

class Provider4:
@staticmethod
def empty():
...
def empty(): ...

class Provider5(BaseProvider):
class Meta:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_providers/test_localized/test_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def test_country_emoji_flag(self, _address):

def is_emoji_flag(char):
return (
"\U0001F1E0" <= char <= "\U0001F1FF"
or "\U0001F3F4" <= char <= "\U0001F3FF"
"\U0001f1e0" <= char <= "\U0001f1ff"
or "\U0001f3f4" <= char <= "\U0001f3ff"
)

assert all(is_emoji_flag(char) for char in emoji_flag)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_providers/test_localized/test_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_datetime(self, _datetime, start, end, timezone):
(2019, 2019),
],
)
def test_formatted_datetime(self, _datetime, start, end):
def test_formatted_datetime_with_fmt(self, _datetime, start, end):
dt_str = _datetime.formatted_date(fmt="%Y", start=start, end=end)
assert isinstance(dt_str, str)
assert start <= int(dt_str) <= end
Expand Down
18 changes: 9 additions & 9 deletions tests/test_providers/test_localized/test_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ def test_telephone(self, person):

def test_telephone_e164(self, _person):
result = _person.telephone(e164=True)
assert re.match(
r"^\+\d+$", result
), f"E.164 format should be +digits, got: {result}"
assert re.match(r"^\+\d+$", result), (
f"E.164 format should be +digits, got: {result}"
)
assert len(result) >= 8, "E.164 number should have at least 7 digits plus +"

mask = "+1 (555)-123-4567"
Expand All @@ -219,13 +219,13 @@ def test_telephone_e164(self, _person):

mask_with_separators = "+1-(###)-###-####"
result_e164 = _person.telephone(mask=mask_with_separators, e164=True)
assert re.match(
r"^\+\d+$", result_e164
), f"Should be E.164 format, got: {result_e164}"
assert re.match(r"^\+\d+$", result_e164), (
f"Should be E.164 format, got: {result_e164}"
)
result_default = _person.telephone(mask=mask_with_separators, e164=False)
assert (
"-" in result_default or "(" in result_default
), f"Default should have separators: {result_default}"
assert "-" in result_default or "(" in result_default, (
f"Default should have separators: {result_default}"
)

@pytest.mark.parametrize(
"gender",
Expand Down
Loading
Loading