#!/usr/bin/env python
from setuptools import setup
setup(
  name = 'cs.deco',
  description = 'Assorted decorator functions.',
  author = 'Cameron Simpson',
  author_email = 'cs@cskk.id.au',
  version = '20190307.1',
  url = 'https://bitbucket.org/cameron_simpson/css/commits/all',
  classifiers = ['Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Topic :: Software Development :: Libraries :: Python Modules', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)'],
  include_package_data = True,
  install_requires = ['cs.pfx'],
  keywords = ['python2', 'python3'],
  long_description = 'Assorted decorator functions.\n\n## Function `cached(*da, **dkw)`\n\nDecorator to cache the result of a method and keep a revision\ncounter for changes.\nThe revision supports the `@revised` decorator.\n\nThis decorator may be used in 2 modes.\nDirectly:\n\n    @cached\n    def method(self, ...)\n\nor indirectly:\n\n    @cached(poll_delay=0.25)\n    def method(self, ...)\n\nOptional keyword arguments:\n* `attr_name`: the basis name for the supporting attributes.\n  Default: the name of the method.\n* `poll_delay`: minimum time between polls; after the first\n  access, subsequent accesses before the `poll_delay` has elapsed\n  will return the cached value.\n  Default: `None`, meaning no poll delay.\n* `sig_func`: a signature function, which should be significantly\n  cheaper than the method. If the signature is unchanged, the\n  cached value will be returned. The signature function\n  expected the instance (`self`) as its first parameter.\n  Default: `None`, meaning no signature function;\n  the first computed value will be kept and never updated.\n* `unset_value`: the value to return before the method has been\n  called successfully.\n  Default: `None`.\n\nIf the method raises an exception, this will be logged and\nthe method will return the previously cached value.\n\nAn example use of this decorator might be to keep a "live"\nconfiguration data structure, parsed from a configuration\nfile which might be modified after the program starts. One\nmight provide a signature function which called `os.stat()` on\nthe file to check for changes before invoking a full read and\nparse of the file.\n\n## Function `decorator(deco)`\n\nWrapper for decorator functions to support optional keyword arguments.\n\nExamples:\n\n    @decorator\n    def dec(func, **dkw):\n      ...\n    @dec\n    def func1(...):\n      ...\n    @dec(foo=\'bah\')\n    def func2(...):\n      ...\n\n## Function `strable(*da, **dkw)`\n\nDecorator for functions which may accept a `str`\ninstead of their core type.\n\nParameters:\n* `func`: the function to decorate\n* `open_func`: the "open" factory to produce the core type form\n  the string if a string is provided; the default is the builtin\n  "open" function\n\nThe usual (and default) example is a function to process an\nopen file, designed to be handed a file object but which may\nbe called with a filename. If the first argument is a `str`\nthen that file is opened and the function called with the\nopen file.\n\nExamples:\n\n    @strable\n    def count_lines(f):\n      return len(line for line in f)\n\n    class Recording:\n      "Class representing a video recording."\n      ...\n    @strable\n    def process_video(r, open_func=Recording):\n      ... do stuff with `r` as a Recording instance ...',
  long_description_content_type = 'text/markdown',
  package_dir = {'': 'lib/python'},
  py_modules = ['cs.deco'],
)
