{ "info": { "author": "Leapfrog Direct Response LLC", "author_email": "oss at leapfrogdevelopment com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Testing" ], "description": "===============================\nrstr = Random Strings in Python\n===============================\n\nrstr is a helper module for easily generating random strings of various types.\nIt could be useful for fuzz testing, generating dummy data, or other\napplications.\n\nIt has no dependencies outside the standard library, and is compatible\nwith Python 3.\n\nA Word of Caution\n-----------------\n\nBy default, rstr uses the Python ``random`` module to generate psuedorandom text. This module is based on the Mersenne Twister and is *not* cryptographically secure.\n\n**If you wish to use rstr for password-generation or other cryptographic\napplications, you must create an instance that uses** SystemRandom_.\n\nFor example:\n\n::\n\n >> from rstr import Rstr\n >> from random import SystemRandom\n >> rs = Rstr(SystemRandom())\n\n\nUse\n---\n\nThe basic method of rstr is ``rstr()``. At a minimum, it requires one argument,\nan alphabet of characters from which to create a string.\n\n::\n\n >>> import rstr\n >>> rstr.rstr('ABC')\n 'AACAACCB'\n\nBy default, it will return a string between 1 and 10 characters in length. You\nmay specify an exact length by including it as a second argument:\n\n::\n\n >>> rstr.rstr('ABC', 4)\n 'ACBC'\n\nYou can also generate a range of lengths by adding two arguments. In the following\ncase, rstr will return a string with a randomly selected length between 5 and 10\ncharacters.\n\n::\n\n >>> rstr.rstr('ABC', 5, 10)\n 'CBCCCABAA'\n\nIt's also possible to include particular characters in your string. This is useful\nwhen testing a validator to make sure that certain characters are rejected.\nCharacters listed in the 'include' argument will *always* be present somewhere\nin the resulting string.\n\n::\n\n >>> rstr.rstr('ABC', include='&')\n 'CA&A'\n\nConversely, you can exclude particular characters from the generated string. This is\nhelpful when starting with a pre-defined population of characters.\n\n::\n\n >>> import string\n >>> rstr.rstr(string.digits, exclude='5')\n '8661442'\n\nNote that any of the arguments that accept strings can also\naccept lists or tuples of strings:\n\n::\n\n >>> rstr.rstr(['A', 'B', 'C'], include = ['@'], exclude=('C',))\n 'BAAABBA@BAA'\n\nOther methods\n-------------\n\nThe other methods provided by rstr, besides ``rstr()`` and ``xeger()``, are convenience\nmethods that can be called without arguments, and provide a pre-defined alphabet.\nThey accept the same arguments as ``rstr()`` for purposes of\nspecifying lengths and including or excluding particular characters.\n\nletters()\n The characters provided by string.letters in the standard library.\n\nuppercase()\n The characters provided by string.uppercase in the standard library.\n\nlowercase()\n The characters provided by string.lowercase in the standard library.\n\nprintable()\n The characters provided by string.printable in the standard library.\n\npunctuation()\n The characters provided by string.punctuation in the standard library.\n\nnonwhitespace()\n The characters provided by string.printable in the standard library, except\n for those representing whitespace: tab, space, etc.\n\ndigits()\n The characters provided by string.digits in the standard library.\n\nnondigits()\n The characters provided by the concatenation of string.letters and\n string.punctuation in the standard library.\n\nnonletters()\n The characters provided by the concatenation of string.digits and\n string.punctuation in the standard library.\n\nnormal()\n Characters commonly accepted in text input, equivalent to string.digits +\n string.letters + ' ' (the space character).\n\npostalsafe()\n Characters that are safe for use in postal addresses in the United States:\n upper- and lower-case letters, digits, spaces, and the punctuation marks period,\n hash (#), hyphen, and forward-slash.\n\nurlsafe()\n Characters safe (unreserved) for use in URLs: letters, digits, hyphen, period, underscore,\n and tilde.\n\ndomainsafe()\n Characters that are allowed for use in hostnames, and consequently, in internet domains: letters,\n digits, and the hyphen.\n\nXeger\n-----\n\nInspired by the Java library of the same name, the ``xeger()`` method allows users to\ncreate a random string from a regular expression.\n\nFor example to generate a postal code that fits the Canadian format:\n\n >>> import rstr\n >>> rstr.xeger(r'[A-Z]\\d[A-Z] \\d[A-Z]\\d')\n u'R6M 1W5'\n\nxeger works fine with most simple regular expressions, but it doesn't support all\nPython regular expression features.\n\nCustom Alphabets\n----------------\n\nIf you have custom alphabets of characters that you would like to use with a method\nshortcut, you can specify them by keyword when instantiating an Rstr object:\n\n >>> from rstr import Rstr\n >>> rs = Rstr(vowels='AEIOU')\n >>> rs.vowels()\n 'AEEUU'\n\nYou can also add an alphabet to an existing instance with the add_alphabet() method:\n\n >>> rs.add_alphabet('odds', '13579')\n >>> rs.odds()\n '339599519'\n\nExamples\n--------\n\nYou can combine rstr with Python's built-in string formatting to produce strings\nthat fit a variety of templates.\n\nAn email address:\n\n::\n\n '{0}@{1}.{2}'.format(rstr.nonwhitespace(exclude='@'),\n rstr.domainsafe()\n rstr.letters(3))\n\nA URL:\n\n::\n\n 'http://{0}.{1}/{2}/?{3}'.format(rstr.domainsafe(),\n rstr.letters(3),\n rstr.urlsafe(),\n rstr.urlsafe())\n\nA postal address:\n\n::\n\n \"\"\"{0} {1}\n {2} {3}\n {4}, {5} {6}\n \"\"\".format(rstr.letters(4, 8).title(),\n rstr.letters(4, 8).title(),\n rstr.digits(3, 5),\n rstr.letters(4, 10).title(),\n rstr.letters(4, 15).title(),\n rstr.uppercase(2),\n rstr.digits(5),\n )\n\n.. _SystemRandom: https://docs.python.org/2/library/random.html#random.SystemRandom", "description_content_type": null, "docs_url": null, "download_url": "https://bitbucket.org/leapfrogdevelopment/rstr/downloads", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/leapfrogdevelopment/rstr/overview", "keywords": "Random strings, reverse regex, reverse regular expression, testing, fuzz testing", "license": "Copyright (c) 2011, Leapfrog Direct Response, LLC\n All rights reserved.\n \n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n * Neither the name of the Leapfrog Direct Response, LLC, including\n its subsidiaries and affiliates nor the names of its\n contributors, may be used to endorse or promote products derived\n from this software without specific prior written permission.\n \n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LEAPFROG DIRECT\n RESPONSE, LLC, INCLUDING ITS SUBSIDIARIES AND AFFILIATES, BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "maintainer": "Brendan.McCollam", "maintainer_email": "brendan at mccoll am", "name": "rstr", "package_url": "https://pypi.org/project/rstr/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rstr/", "project_urls": { "Download": "https://bitbucket.org/leapfrogdevelopment/rstr/downloads", "Homepage": "http://bitbucket.org/leapfrogdevelopment/rstr/overview" }, "release_url": "https://pypi.org/project/rstr/2.2.6/", "requires_dist": null, "requires_python": null, "summary": "Generate random strings in Python", "version": "2.2.6" }, "last_serial": 2600024, "releases": { "2.1.0": [ { "comment_text": "", "digests": { "md5": "c70e2b0ab212cc24b49399b85051f160", "sha256": "de87e2fd956f24fa3a3709da3e48982627388201e7095d56feae0a1331dbab64" }, "downloads": -1, "filename": "rstr-2.1.0.tar.gz", "has_sig": false, "md5_digest": "c70e2b0ab212cc24b49399b85051f160", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4493, "upload_time": "2013-06-06T04:43:00", "url": "https://files.pythonhosted.org/packages/c7/c7/054675403b172626fc837b516f00531bcab6e1a4ac594597910f28a73480/rstr-2.1.0.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "a70670f93501d1107877dea9e9cc6658", "sha256": "63ed2ac4a641cd9f773750f0e9b76f03f7f3618a76dd42f31a15318b625762d3" }, "downloads": -1, "filename": "rstr-2.1.1.tar.gz", "has_sig": false, "md5_digest": "a70670f93501d1107877dea9e9cc6658", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4547, "upload_time": "2013-06-07T16:49:12", "url": "https://files.pythonhosted.org/packages/e5/5d/aab530e4531fdbd8e53b3b5873f6aedee8bdb91cf61403f4c7632d28d4c7/rstr-2.1.1.tar.gz" } ], "2.1.2": [ { "comment_text": "", "digests": { "md5": "ef7bd93c28bc2198b46f3d664c8f5dcf", "sha256": "affa56bee72363f15be89d97f9fd2b9df540227016e7e63fe018c26137b51b2a" }, "downloads": -1, "filename": "rstr-2.1.2.tar.gz", "has_sig": false, "md5_digest": "ef7bd93c28bc2198b46f3d664c8f5dcf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6212, "upload_time": "2014-02-26T13:52:53", "url": "https://files.pythonhosted.org/packages/ee/5f/4f2e8085abf74a5463797bf9700de25b6e52660b78e1eb103e0d49aeac5d/rstr-2.1.2.tar.gz" } ], "2.1.3": [ { "comment_text": "", "digests": { "md5": "7f4348604ceccf90d0399c9409d8adc4", "sha256": "617ec5025671c51715455f27e75ad77fa7ddec0f8adb3d2ef8209af13210223f" }, "downloads": -1, "filename": "rstr-2.1.3.tar.gz", "has_sig": false, "md5_digest": "7f4348604ceccf90d0399c9409d8adc4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6243, "upload_time": "2014-08-02T17:40:18", "url": "https://files.pythonhosted.org/packages/2b/96/170880a64d856676e8815e885eaa0ef717565f4ffedfbe13629dfc4e1f90/rstr-2.1.3.tar.gz" } ], "2.2.0": [ { "comment_text": "", "digests": { "md5": "4eac5fc315fc7a0f71740b878aab8c4b", "sha256": "65141903c3342137cfbef4c8d45feaf95922c5dbb06238939e6b1fc861a8f5fb" }, "downloads": -1, "filename": "rstr-2.2.0.tar.gz", "has_sig": false, "md5_digest": "4eac5fc315fc7a0f71740b878aab8c4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6695, "upload_time": "2015-09-08T05:13:14", "url": "https://files.pythonhosted.org/packages/56/a4/58b47a39098f22f3780bdb151b1c3bf8b7acea8e6f99fd0796b5208b6ef8/rstr-2.2.0.tar.gz" } ], "2.2.2": [ { "comment_text": "", "digests": { "md5": "312a80699d50f2d7293be941c1227dba", "sha256": "051ba164fee6aa45eca815772636680580c4ee872bb97423c0ebcbe02977769b" }, "downloads": -1, "filename": "rstr-2.2.2.tar.gz", "has_sig": false, "md5_digest": "312a80699d50f2d7293be941c1227dba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6917, "upload_time": "2015-09-08T05:29:24", "url": "https://files.pythonhosted.org/packages/f2/5b/59992870ab8caed99771cfe40dc6736265f7a089d5410037217cee2c10af/rstr-2.2.2.tar.gz" } ], "2.2.3": [ { "comment_text": "", "digests": { "md5": "dc43a09953ced7d40fa994da658b373c", "sha256": "10a58eb08a7e3735eddc8f32f3db419797dadb6335b02b94dcd8d741363d79e9" }, "downloads": -1, "filename": "rstr-2.2.3.tar.gz", "has_sig": false, "md5_digest": "dc43a09953ced7d40fa994da658b373c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6916, "upload_time": "2015-09-08T14:44:43", "url": "https://files.pythonhosted.org/packages/f6/c1/3bd8bc9b47ebc63ec08f833dc3a23fed4f3b00d7fd600e4a3bab7983484c/rstr-2.2.3.tar.gz" } ], "2.2.4": [ { "comment_text": "", "digests": { "md5": "26ac863c4df7e5b75d8a9315992d9dc8", "sha256": "64a086a7449a576de7f40327f8cd0a7752efbbb298e65dc68363ee7db0a1c8cf" }, "downloads": -1, "filename": "rstr-2.2.4.tar.gz", "has_sig": false, "md5_digest": "26ac863c4df7e5b75d8a9315992d9dc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6942, "upload_time": "2016-05-26T14:08:26", "url": "https://files.pythonhosted.org/packages/34/73/bf268029482255aa125f015baab1522a22ad201ea5e324038fb542bc3706/rstr-2.2.4.tar.gz" } ], "2.2.5": [ { "comment_text": "", "digests": { "md5": "b6d11725a28be4bf23cde487a4db2a60", "sha256": "0560492461c202478393012fa56263db182205ae03f7a804b1e6f12d57866d7c" }, "downloads": -1, "filename": "rstr-2.2.5.tar.gz", "has_sig": false, "md5_digest": "b6d11725a28be4bf23cde487a4db2a60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8177, "upload_time": "2016-11-17T22:59:44", "url": "https://files.pythonhosted.org/packages/88/38/c37470def328f4badc6ca9ae54140b74ec692e82a7623c274408c1e4c902/rstr-2.2.5.tar.gz" } ], "2.2.6": [ { "comment_text": "", "digests": { "md5": "fcd27163adaad9ca53e46a3ec5d4b22c", "sha256": "3b3ec3bec215a4c7690bc72e1e006ce53a3edad79166dcbdf49bc614caf77f49" }, "downloads": -1, "filename": "rstr-2.2.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fcd27163adaad9ca53e46a3ec5d4b22c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 18186, "upload_time": "2017-01-26T16:34:28", "url": "https://files.pythonhosted.org/packages/b9/30/1e10f00ea45c899ab946f9bde77be49e796a28cb96797ab8b249566490ef/rstr-2.2.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "be2d1a655e3adb5d55db981846fe9761", "sha256": "5dea822326e418e0c9816c9cd14ae9c7be2d4cd4334043c397f202bc2ae2eda4" }, "downloads": -1, "filename": "rstr-2.2.6.tar.gz", "has_sig": false, "md5_digest": "be2d1a655e3adb5d55db981846fe9761", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11197, "upload_time": "2017-01-26T16:34:26", "url": "https://files.pythonhosted.org/packages/be/52/f87d6a9c691329dc71eaa6263f63cc262bd818df89e2dc981720db9dc9c5/rstr-2.2.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fcd27163adaad9ca53e46a3ec5d4b22c", "sha256": "3b3ec3bec215a4c7690bc72e1e006ce53a3edad79166dcbdf49bc614caf77f49" }, "downloads": -1, "filename": "rstr-2.2.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fcd27163adaad9ca53e46a3ec5d4b22c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 18186, "upload_time": "2017-01-26T16:34:28", "url": "https://files.pythonhosted.org/packages/b9/30/1e10f00ea45c899ab946f9bde77be49e796a28cb96797ab8b249566490ef/rstr-2.2.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "be2d1a655e3adb5d55db981846fe9761", "sha256": "5dea822326e418e0c9816c9cd14ae9c7be2d4cd4334043c397f202bc2ae2eda4" }, "downloads": -1, "filename": "rstr-2.2.6.tar.gz", "has_sig": false, "md5_digest": "be2d1a655e3adb5d55db981846fe9761", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11197, "upload_time": "2017-01-26T16:34:26", "url": "https://files.pythonhosted.org/packages/be/52/f87d6a9c691329dc71eaa6263f63cc262bd818df89e2dc981720db9dc9c5/rstr-2.2.6.tar.gz" } ] }