Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roll our own generate_string() because mimesis' has gone away (#13257)
Starting `mimesis=9.0.0`, the `generate_string` function has become private: ```python In [1]: import mimesis In [2]: mimesis.__version__ Out[2]: '9.0.0' In [3]: mimesis.random.random.generate_string --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[3], line 1 ----> 1 mimesis.random.random.generate_string AttributeError: 'Random' object has no attribute 'generate_string' In [4]: mimesis.random.random._generate_string Out[4]: <bound method Random._generate_string of <mimesis.random.Random object at 0x555992f65a20>> ``` This PR replaces all uses of the function with a homespun one. Note that the implementation is about as fast (perhaps identical?) ```python In [6]: %timeit "".join(random.choices(string.printable, k=100)) 9.25 µs ± 98.3 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each) In [7]: %timeit mimesis.random.random._generate_string(string.printable, 100) 9.62 µs ± 103 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each) ``` Authors: - Ashwin Srinath (https://github.com/shwina) Approvers: - Bradley Dice (https://github.com/bdice) URL: #13257
- Loading branch information