{ "info": { "author": "Ross Patterson", "author_email": "me@rpatterson.net", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Framework :: Zope2", "Framework :: Zope3", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "==============\nz3c.gibberish\n==============\n\nGenerate CSV files containing random words from a dictionary\n\nGet the script from the buildout::\n\n >>> import os\n >>> gibberish = os.path.join(\n ... reduce(lambda path, _: os.path.dirname(path),\n ... range(3), __file__), 'bin', 'gibberish')\n\nPrint the help::\n\n >>> from zc.buildout.testing import system\n >>> print system(gibberish+' --help'),\n usage: gibberish [options] LINES COLUMN [COLUMN ...]\n \n Generate lines of CSV consisting of random words from a\n dictionary. The number of lines of CSV must be specified either\n as a single integer to specify a fixed number of lines or two\n integers separated by a dash to specify that a random number of\n lines between the two integers should be used. The columns are\n specified in the same manner where the numbers represent the\n number of words in that column for a given line.\n \n options:\n -h, --help show this help message and exit\n -w WORDS, --words=WORDS\n File containing the words to be chosen\n from [default: /usr/share/dict/words]\n\nMake a simple file with one line and one column containing one word::\n\n >>> import cStringIO, csv\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' 1 1'))))\n >>> len(result)\n 1\n >>> len(result[0])\n 1\n >>> len(result[0][0].split())\n 1\n\nMake sure that the newline is stripped::\n\n >>> result[0][0][-1] != '\\n'\n True\n\nWith two words in the column::\n\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' 1 2'))))\n >>> len(result)\n 1\n >>> len(result[0])\n 1\n >>> len(result[0][0].split())\n 2\n\nWith a random number of words in the column::\n\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' 1 1-10'))))\n >>> len(result)\n 1\n >>> len(result[0])\n 1\n >>> 1 <= len(result[0][0].split()) <= 10\n True\n\nWith 10 lines::\n\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' 10 2'))))\n >>> len(result)\n 10\n >>> len(result[0])\n 1\n >>> len(result[0][0].split())\n 2\n\nWith a random number of lines::\n\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' 1-10 2'))))\n >>> 1 <= len(result) <= 10\n True\n >>> len(result[0])\n 1\n >>> len(result[0][0].split())\n 2\n\nWith two columns::\n\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' 1 2 3'))))\n >>> len(result)\n 1\n >>> len(result[0])\n 2\n >>> len(result[0][0].split())\n 2\n >>> len(result[0][1].split())\n 3\n\nWith a random number of words including zero in the column::\n\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' 1 0-1'))))\n >>> len(result)\n 1\n >>> len(result[0])\n 1\n >>> len(result[0][0].split()) in (0, 1)\n True\n\nWith a small dictionary to test exhausting the dictionary::\n\n >>> import tempfile\n >>> _, tmp_path = tempfile.mkstemp()\n >>> tmp = file(tmp_path, 'w')\n >>> tmp.write('foo')\n >>> tmp.close()\n >>> result = tuple(csv.reader(cStringIO.StringIO(\n ... system(gibberish+' -w %s 1 1' % tmp_path))))\n >>> result\n (['foo'],)\n >>> os.remove(tmp_path)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://cheeseshop.python.org/pypi/z3c.gibberish", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "z3c.gibberish", "package_url": "https://pypi.org/project/z3c.gibberish/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/z3c.gibberish/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://cheeseshop.python.org/pypi/z3c.gibberish" }, "release_url": "https://pypi.org/project/z3c.gibberish/0.1/", "requires_dist": null, "requires_python": null, "summary": "Generate CSV files containing random words from a dictionary", "version": "0.1" }, "last_serial": 802026, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "26f10765d8f61a4a1103083060009e38", "sha256": "cd8b7213792bf9d25a417948b8897a9acd421f18fb3fa2a10e118084ca73d63f" }, "downloads": -1, "filename": "z3c.gibberish-0.1.tar.gz", "has_sig": false, "md5_digest": "26f10765d8f61a4a1103083060009e38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4889, "upload_time": "2007-12-18T06:27:07", "url": "https://files.pythonhosted.org/packages/00/ac/ad8dbbd711ea015afafee9fd1aa2e17339bbb6c3a7ea8b90a16b6799923c/z3c.gibberish-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "26f10765d8f61a4a1103083060009e38", "sha256": "cd8b7213792bf9d25a417948b8897a9acd421f18fb3fa2a10e118084ca73d63f" }, "downloads": -1, "filename": "z3c.gibberish-0.1.tar.gz", "has_sig": false, "md5_digest": "26f10765d8f61a4a1103083060009e38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4889, "upload_time": "2007-12-18T06:27:07", "url": "https://files.pythonhosted.org/packages/00/ac/ad8dbbd711ea015afafee9fd1aa2e17339bbb6c3a7ea8b90a16b6799923c/z3c.gibberish-0.1.tar.gz" } ] }