{ "info": { "author": "Andrea Corbellini", "author_email": "corbellini.andrea@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Random name generator in Python\n\nfunkybob is a Python library for generating Docker-style random names,\nlike these:\n\n ecstatic_ritchie, kind_beaver, sharp_heisenberg, angry_nightingale, ...\n\nfunkybob supports generating names preceeded by an arbirary number of\nadjectives, in order to increase the number of unique names that can\nbe generated:\n\n Random names with no adjectives:\n swirles, khorana, blackwell, ...\n\n Random names preceeded by an adjective:\n ecstatic_ritchie, kind_beaver, sharp_heisenberg, ...\n\n Random names preceeded by two adjectives:\n admiring_dazzling_noether, thirsty_wonderful_agnesi, silly_wizardly_feynman, ...\n\n Random names preceeded by three adjectives:\n cranky_goofy_hopeful_wright, competent_jolly_suspicious_kare, cocky_competent_gifted_yalow, ...\n\nWhen using more than one adjective, funkybob ensures that two names with the\nsame set of adjectives cannot occur, even if the order is different. So, for\nexample, if the name `inspiring_stupefied_payne` was generated, then you can\nbe sure that the name `stupefied_inspiring_payne` won't be generated later.\nThis makes names much more easier to distinguish and less likely to generate\nconfusion.\n\n\n## Generators\n\nfunkybob ships three different name generators:\n\n* **SimpleNameGenerator**: this provides a deterministic sequence of names --\n no randomness involved. This will return duplicate names once all\n combinations have been yielded. Useful if all you care about is performance.\n\n* **RandomNameGenerator**: returns randomly generated names. It may return\n duplicate names at any point.\n\n* **UniqueRandomNameGenerator**: returns randomly generated names, but unlike\n RandomNameGenerator, no duplicates are returned. Unlike the other two\n generators, this one has a limited size and will stop yielding values once\n all unique names have been returned.\n\nThis table sumarizes the features of all three generators:\n\n| Generator | Infinite | Random | Duplicates |\n|---------------------------|----------|--------|------------|\n| SimpleNameGenerator | Yes | No | Yes |\n| RandomNameGenerator | Yes | Yes | Yes |\n| UniqueRandomNameGenerator | No | Yes | No |\n\n\n## Usage\n\nAll three generators are iterables, which means that you can simply use\n`iter()` and `next()` on them in order to retrieve names:\n\n```python\n>>> import funkybob\n>>> generator = funkybob.RandomNameGenerator()\n>>> it = iter(generator)\n>>> next(it)\n'practical_hoover'\n>>> next(it)\n'stupefied_ramanujan'\n>>> next(it)\n'zealous_aryabhata'\n```\n\nYou can pass the `members` and `separator` parameters to change the number of\nadjectives or the formatting of names:\n\n```python\n>>> # This will generate names with 3 members (2 adjectives + 1 last name),\n>>> # separated by a colon\n>>> generator = funkybob.RandomNameGenerator(members=3, separator=':')\n>>> it = iter(generator)\n>>> next(it)\n'friendly:hopeful:neumann'\n>>> next(it)\n'admiring:trusting:montalcini'\n>>> next(it)\n'practical:suspicious:blackwell'\n```\n\nGenerators have an `unique_count` attribute that you can use to check\nthe number of unique names that can be generated:\n\n```python\n>>> generator.unique_count\n740094\n```\n\n\n### UniqueRandomNameGenerator\n\nIn addition to all of the above, UniqueRandomNameGenerator privides a\n[sequence](https://docs.python.org/3/glossary.html#term-sequence)-like\ninterfance, which means, for example, that you can use indexing or the\n`len()` method (which is the same as accessing the `unique_count`\nattribute):\n\n```python\n>>> generator = funkybob.UniqueRandomNameGenerator()\n>>> generator[0]\n'xenodochial_yalow'\n>>> generator[1]\n'kind_mccarthy'\n>>> generator[2]\n'happy_hawking'\n>>> len(generator)\n16089\n```\n\nYou can increase the number of `members` in order to increase the size,\nat the expense of having longer names.\n\nUniqueRandomNameGenerator also supports an additional parameter: `seed`.\nThis can be used to initialize the pseudo-random generator. If you pass\nalways the same value, the same sequence of names will be generated. This\ncan be useful in tests when you need predictable names.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/andreacorbellini/funkybob", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "funkybob", "package_url": "https://pypi.org/project/funkybob/", "platform": "", "project_url": "https://pypi.org/project/funkybob/", "project_urls": { "Homepage": "https://github.com/andreacorbellini/funkybob" }, "release_url": "https://pypi.org/project/funkybob/2018.5.1/", "requires_dist": null, "requires_python": "", "summary": "", "version": "2018.5.1" }, "last_serial": 3841730, "releases": { "2018.5.1": [ { "comment_text": "", "digests": { "md5": "13f81b8729a35fe9bc44a5c33548f1d3", "sha256": "e61b741c1d6f63a97506c30c48b74a166fb1640f4192515b92fa102e7d252987" }, "downloads": -1, "filename": "funkybob-2018.5.1.tar.gz", "has_sig": false, "md5_digest": "13f81b8729a35fe9bc44a5c33548f1d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6713, "upload_time": "2018-05-07T18:05:53", "url": "https://files.pythonhosted.org/packages/e1/7b/594bef6acaaeb80acd53cf7e3e81cf9dfb6b87515f6d1850623f8dc8440d/funkybob-2018.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "13f81b8729a35fe9bc44a5c33548f1d3", "sha256": "e61b741c1d6f63a97506c30c48b74a166fb1640f4192515b92fa102e7d252987" }, "downloads": -1, "filename": "funkybob-2018.5.1.tar.gz", "has_sig": false, "md5_digest": "13f81b8729a35fe9bc44a5c33548f1d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6713, "upload_time": "2018-05-07T18:05:53", "url": "https://files.pythonhosted.org/packages/e1/7b/594bef6acaaeb80acd53cf7e3e81cf9dfb6b87515f6d1850623f8dc8440d/funkybob-2018.5.1.tar.gz" } ] }