Skip to content

Commit

Permalink
Fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
lk-geimfari committed Jan 11, 2024
1 parent 3914358 commit 0894bb1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
10 changes: 5 additions & 5 deletions mimesis/providers/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,28 @@ def state(self, abbr: bool = False) -> str:
def region(self, *args: t.Any, **kwargs: t.Any) -> str:
"""Generates a random region.
An alias for :meth:`~Address.state()`.
An alias for :meth:`~.state()`.
"""
return self.state(*args, **kwargs)

def province(self, *args: t.Any, **kwargs: t.Any) -> str:
"""Generates a random province.
An alias for :meth:`~Address.state()`.
An alias for :meth:`~.state()`.
"""
return self.state(*args, **kwargs)

def federal_subject(self, *args: t.Any, **kwargs: t.Any) -> str:
"""Generates a random federal_subject (Russia).
An alias for :meth:`~Address.state()`.
An alias for :meth:`~.state()`.
"""
return self.state(*args, **kwargs)

def prefecture(self, *args: t.Any, **kwargs: t.Any) -> str:
"""Generates a random prefecture.
An alias for :meth:`~Address.state()`.
An alias for :meth:`~.state()`.
"""
return self.state(*args, **kwargs)

Expand All @@ -154,7 +154,7 @@ def postal_code(self) -> str:
def zip_code(self) -> str:
"""Generates a zip code.
An alias for :meth:`~Address.postal_code()`.
An alias for :meth:`~.postal_code()`.
:return: Zip code.
"""
Expand Down
6 changes: 2 additions & 4 deletions mimesis/providers/binaryfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Binary data provider."""

import typing as t
from pathlib import Path

from mimesis.constants import DATADIR
from mimesis.enums import (
AudioFile,
CompressedFile,
Expand All @@ -25,8 +25,6 @@ def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
:param seed: Seed.
"""
super().__init__(*args, **kwargs)
self._data_dir = Path(__file__).parent.parent.joinpath("data", "bin")
self._sample_name: t.Final[str] = "sample"

class Meta:
name = "binaryfile"
Expand All @@ -37,7 +35,7 @@ def _read_file(
file_type: AudioFile | CompressedFile | DocumentFile | ImageFile | VideoFile,
) -> bytes:
file_type = self.validate_enum(file_type, file_type.__class__)
file_path = self._data_dir.joinpath(f"{self._sample_name}.{file_type}")
file_path = DATADIR / "bin" / f"sample.{file_type}"

with open(file_path, "rb") as file:
return file.read()
Expand Down
8 changes: 4 additions & 4 deletions mimesis/providers/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def bulk_create_datetimes(
) -> list[DateTime]:
"""Bulk create datetime objects.
This method creates list of datetime objects from
This method creates a list of datetime objects from
``date_start`` to ``date_end``.
You can use the following keyword arguments:
Expand Down Expand Up @@ -150,7 +150,7 @@ def formatted_date(self, fmt: str = "", **kwargs: t.Any) -> str:
:param fmt: The format of date, if None then use standard
accepted in the current locale.
:param kwargs: Keyword arguments for :meth:`~Datetime.date()`
:param kwargs: Keyword arguments for :meth:`~.date()`
:return: Formatted date.
"""
date_obj = self.date(**kwargs)
Expand Down Expand Up @@ -240,7 +240,7 @@ def formatted_datetime(self, fmt: str = "", **kwargs: t.Any) -> str:
"""Generates datetime string in human-readable format.
:param fmt: Custom format (default is format for current locale)
:param kwargs: Keyword arguments for :meth:`~Datetime.datetime()`
:param kwargs: Keyword arguments for :meth:`~.datetime()`
:return: Formatted datetime string.
"""
dt_obj = self.datetime(**kwargs)
Expand Down Expand Up @@ -276,7 +276,7 @@ def timestamp(
'2009-05-30T21:45:57.328600'
:param fmt: Format of timestamp (Default is TimestampFormat.POSIX).
:param kwargs: Kwargs for :meth:`~Datetime.datetime()`.
:param kwargs: Kwargs for :meth:`~.datetime()`.
:return: Timestamp.
"""
self.validate_enum(fmt, TimestampFormat)
Expand Down
6 changes: 3 additions & 3 deletions mimesis/providers/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def emoji(self, category: EmojyCategory | None = EmojyCategory.DEFAULT) -> str:
category = self.validate_enum(category, EmojyCategory)
symbol = self.random.choice(self._emojis[category])

base = 16
# Some emoji consist of multiple Unicode characters.
if isinstance(symbol, list):
return "".join([chr(int(s, 16)) for s in symbol])

return chr(int(symbol, 16))
return "".join([chr(int(s, base)) for s in symbol])
return chr(int(symbol, base))

0 comments on commit 0894bb1

Please sign in to comment.