<commit_before>from setuptools import setup

setup(
    name='tablesnap',
    description='Uses inotify to monitor Cassandra SSTables and upload them to S3',
    long_description='Tablesnap is a script that uses inotify to monitor a directory for IN_MOVED_TO events and reacts to them by spawning a new thread to upload that file to Amazon S3, along with a JSON-formatted list of what other files were in the directory at the time of the copy.',
    version='1.2.0',
    license='BSD',
    author='Jeremy Grosser',
    author_email='jeremy@synack.me',
    url='https://github.com/JeremyGrosser/tablesnap',
    scripts=[
        'tablesnap',
        'tableslurp',
        'tablechop'
    ],
    install_requires=[
        'pyinotify',
        'boto>=2.6.0',
        'argparse',
        'python-dateutil',
    ],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: BSD License',
        'Natural Language :: English',
        'Operating System :: POSIX :: Linux',
        'Programming Language :: Python',
        'Topic :: Database',
        'Topic :: System :: Archiving :: Backup',
        'Topic :: Utilities',
    ]
)
<commit_msg>Release 1.2.1<commit_after>from setuptools import setup

setup(
    name='tablesnap',
    description='Uses inotify to monitor Cassandra SSTables and upload them to S3',
    long_description='Tablesnap is a script that uses inotify to monitor a directory for IN_MOVED_TO events and reacts to them by spawning a new thread to upload that file to Amazon S3, along with a JSON-formatted list of what other files were in the directory at the time of the copy.',
    version='1.2.1',
    license='BSD',
    author='Jeremy Grosser',
    author_email='jeremy@synack.me',
    url='https://github.com/JeremyGrosser/tablesnap',
    scripts=[
        'tablesnap',
        'tableslurp',
        'tablechop'
    ],
    install_requires=[
        'pyinotify',
        'boto>=2.6.0',
        'argparse',
        'python-dateutil',
    ],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: BSD License',
        'Natural Language :: English',
        'Operating System :: POSIX :: Linux',
        'Programming Language :: Python',
        'Topic :: Database',
        'Topic :: System :: Archiving :: Backup',
        'Topic :: Utilities',
    ]
)
<|endoftext|>


<commit_before>from setuptools import find_packages
from setuptools import setup

setup(
    name='pre-commit-mirror-maker',
    description="Scripts for creating mirror repositories that do not have hooks.yaml",
    url='https://github.com/pre-commit/pre-commit-mirror-maker',
    version='0.3.2',

    author='Anthony Sottile',
    author_email='asottile@umich.edu',

    platforms='all',
    classifiers=[
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: Implementation :: CPython',
        'Programming Language :: Python :: Implementation :: PyPy',
    ],

    packages=find_packages(exclude=('tests*', 'testing*')),
    install_requires=[
        'pyyaml',
        'requests',
    ],

    entry_points={
        'console_scripts': [
            'pre-commit-mirror = pre_commit_mirror_maker.main:main',
        ],
    },
    package_data={
        'pre_commit_mirror_maker': [
            'all/.pre-commit-hooks.yaml',
            'all/.version',
            'node/.npmignore',
            'node/.pre-commit-hooks.yaml',
            'node/*',
            'python/*',
            'ruby/*',
        ],
    },
)
<commit_msg>v0.4.0<commit_after>from setuptools import find_packages
from setuptools import setup

setup(
    name='pre-commit-mirror-maker',
    description="Scripts for creating mirror repositories that do not have hooks.yaml",
    url='https://github.com/pre-commit/pre-commit-mirror-maker',
    version='0.4.0',

    author='Anthony Sottile',
    author_email='asottile@umich.edu',

    platforms='all',
    classifiers=[
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: Implementation :: CPython',
        'Programming Language :: Python :: Implementation :: PyPy',
    ],

    packages=find_packages(exclude=('tests*', 'testing*')),
    install_requires=[
        'pyyaml',
        'requests',
    ],

    entry_points={
        'console_scripts': [
            'pre-commit-mirror = pre_commit_mirror_maker.main:main',
        ],
    },
    package_data={
        'pre_commit_mirror_maker': [
            'all/.pre-commit-hooks.yaml',
            'all/.version',
            'node/.npmignore',
            'node/.pre-commit-hooks.yaml',
            'node/*',
            'python/*',
            'ruby/*',
        ],
    },
)
<|endoftext|>


<commit_before>import os
from setuptools import setup, find_packages

def read(filename):
    return open(os.path.join(os.path.dirname(__file__), filename)).read()

setup(
    name='django-banzai',
    version='0.1',
    license='MIT',
    description='Django API wrapper for mailing delivery '
                'service: http://get-n-post.ru/',
    long_description=read('README.rst'),
    keywords='mail email send wrapper api delivery django',
    url='https://github.com/saippuakauppias/django-banzai',
    author='Denis Veselov',
    author_email='progr.mail@gmail.com',
    include_package_data=True,
    packages=find_packages(),
    install_requires=['requests', 'lxml', 'django'],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Topic :: Internet :: WWW/HTTP'
    ],
)
<commit_msg>bump version number<commit_after>import os
from setuptools import setup, find_packages

def read(filename):
    return open(os.path.join(os.path.dirname(__file__), filename)).read()

setup(
    name='django-banzai',
    version='0.2',
    license='MIT',
    description='Django API wrapper for mailing delivery '
                'service: http://get-n-post.ru/',
    long_description=read('README.rst'),
    keywords='mail email send wrapper api delivery django',
    url='https://github.com/saippuakauppias/django-banzai',
    author='Denis Veselov',
    author_email='progr.mail@gmail.com',
    include_package_data=True,
    packages=find_packages(),
    install_requires=['requests', 'lxml', 'django'],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Topic :: Internet :: WWW/HTTP'
    ],
)
<|endoftext|>


<commit_before>#!/usr/bin/env python
from setuptools import setup, find_packages

setup(name="bipy",
      version="0.0.1",
      author="Rory Kirchner",
      author_email="rory.kirchner@gmail.com",
      description="Simple analysis pipelines",
      url="https://github.com/roryk/bipy",
      license="MIT",
      namespace_packages=["bipy"],
      packages=find_packages(),
      install_requires=[
          "ipython >= 0.11",
          "bcbio",
          "sh"])
<commit_msg>Added package_data to setup.py.<commit_after>#!/usr/bin/env python
from setuptools import setup, find_packages

setup(name="bipy",
      version="0.0.1",
      author="Rory Kirchner",
      author_email="rory.kirchner@gmail.com",
      description="Simple analysis pipelines",
      url="https://github.com/roryk/bipy",
      license="MIT",
      namespace_packages=["bipy"],
      packages=find_packages(),
      package_data={'bipy': ['data/*']},
      install_requires=[
          "ipython >= 0.11",
          "bcbio",
          "sh"])
<|endoftext|>


<commit_before>#!/usr/bin/env python

from setuptools import setup

try:
    from sphinx.setup_command import BuildDoc as _BuildDoc

    class BuildDoc(_BuildDoc):
        def finalize_options(self):
            super().finalize_options()
            if not self.project:
                self.project = self.distribution.name
            if not self.version:
                self.version = self.distribution.version

except ImportError:
    BuildDoc = None

def readme():
    with open('README') as r:
        return r.read()

setup(
    name="wsql_sdk",
    version="0.3.10",
    description='The chain of tools, that to make work with SQL easier',
    packages=["wsql_sdk", "wsql_sdk._lang"],
    requires=["pyparsing"],
    author="Bulat Gaifullin",
    author_email='gaifullinbf@gmail.com',
    maintainer='Bulat Gaifullin',
    maintainer_email='gaifullinbf@gmail.com',
    url='https://github.com/WebSQL/sdk',
    license='MIT',
    long_description=readme(),
    classifiers=[
        "Development Status :: 4 - Beta",
        "Environment :: Other Environment",
        "License :: OSI Approved :: MIT License",
        "Operating System :: MacOS :: MacOS X",
        "Operating System :: OS Independent",
        "Operating System :: POSIX",
        "Operating System :: POSIX :: Linux",
        "Operating System :: Unix",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.3",
        "Programming Language :: Python :: 3.4",
        "Topic :: Database",
        "Topic :: Database :: Database Engines/Servers",
    ],
    entry_points={
        'console_scripts': [
            'wsql-codegen=wsql_sdk.codegen:main',
            'wsql-trans=wsql_sdk.translator:main',
        ],
    }
)
<commit_msg>Bump version<commit_after>#!/usr/bin/env python

from setuptools import setup

try:
    from sphinx.setup_command import BuildDoc as _BuildDoc

    class BuildDoc(_BuildDoc):
        def finalize_options(self):
            super().finalize_options()
            if not self.project:
                self.project = self.distribution.name
            if not self.version:
                self.version = self.distribution.version

except ImportError:
    BuildDoc = None

def readme():
    with open('README') as r:
        return r.read()

setup(
    name="wsql_sdk",
    version="0.3.11",
    description='The chain of tools, that to make work with SQL easier',
    packages=["wsql_sdk", "wsql_sdk._lang"],
    requires=["pyparsing"],
    author="Bulat Gaifullin",
    author_email='gaifullinbf@gmail.com',
    maintainer='Bulat Gaifullin',
    maintainer_email='gaifullinbf@gmail.com',
    url='https://github.com/WebSQL/sdk',
    license='MIT',
    long_description=readme(),
    classifiers=[
        "Development Status :: 4 - Beta",
        "Environment :: Other Environment",
        "License :: OSI Approved :: MIT License",
        "Operating System :: MacOS :: MacOS X",
        "Operating System :: OS Independent",
        "Operating System :: POSIX",
        "Operating System :: POSIX :: Linux",
        "Operating System :: Unix",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.3",
        "Programming Language :: Python :: 3.4",
        "Topic :: Database",
        "Topic :: Database :: Database Engines/Servers",
    ],
    entry_points={
        'console_scripts': [
            'wsql-codegen=wsql_sdk.codegen:main',
            'wsql-trans=wsql_sdk.translator:main',
        ],
    }
)
<|endoftext|>


<commit_before>from setuptools import setup, find_packages

import imp

version = imp.load_source('jams.version', 'jams/version.py')

setup(
    name='jams',
    version=version.version,
    description='A JSON Annotated Music Specification for Reproducible MIR Research',
    author='JAMS development crew',
    url='http://github.com/marl/jams',
    download_url='http://github.com/marl/jams/releases',
    packages=find_packages(),
    package_data={'': ['schemata/*.json',
                       'schemata/namespaces/*.json',
                       'schemata/namespaces/*/*.json']},
    long_description='A JSON Annotated Music Specification for Reproducible MIR Research',
    classifiers=[
        "License :: OSI Approved :: ISC License (ISCL)",
        "Programming Language :: Python",
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Topic :: Multimedia :: Sound/Audio :: Analysis",
        "Programming Language :: Python :: 2",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
        "Programming Language :: Python :: 3.6",
    ],
    keywords='audio music json',
    license='ISC',
    install_requires=[
        'pandas',
        'sortedcontainers>=2.0.0',
        'jsonschema==2.6',
        'numpy>=1.8.0',
        'six',
        'decorator',
        'mir_eval>=0.5',
    ],
    extras_require={
        'display': ['matplotlib>=1.5.0'],
        'tests': ['pytest', 'pytest-cov'],
    },
    scripts=['scripts/jams_to_lab.py']
)
<commit_msg>pin pytest version < 4 until we fix yield tests<commit_after>from setuptools import setup, find_packages

import imp

version = imp.load_source('jams.version', 'jams/version.py')

setup(
    name='jams',
    version=version.version,
    description='A JSON Annotated Music Specification for Reproducible MIR Research',
    author='JAMS development crew',
    url='http://github.com/marl/jams',
    download_url='http://github.com/marl/jams/releases',
    packages=find_packages(),
    package_data={'': ['schemata/*.json',
                       'schemata/namespaces/*.json',
                       'schemata/namespaces/*/*.json']},
    long_description='A JSON Annotated Music Specification for Reproducible MIR Research',
    classifiers=[
        "License :: OSI Approved :: ISC License (ISCL)",
        "Programming Language :: Python",
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Topic :: Multimedia :: Sound/Audio :: Analysis",
        "Programming Language :: Python :: 2",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
        "Programming Language :: Python :: 3.6",
    ],
    keywords='audio music json',
    license='ISC',
    install_requires=[
        'pandas',
        'sortedcontainers>=2.0.0',
        'jsonschema==2.6',
        'numpy>=1.8.0',
        'six',
        'decorator',
        'mir_eval>=0.5',
    ],
    extras_require={
        'display': ['matplotlib>=1.5.0'],
        'tests': ['pytest < 4', 'pytest-cov'],
    },
    scripts=['scripts/jams_to_lab.py']
)
<|endoftext|>


<commit_before>#!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
import codecs
import os
import re
import sys

# When creating the sdist, make sure the django.mo file also exists:
if 'sdist' in sys.argv or 'develop' in sys.argv:
    try:
        os.chdir('fluent_contents')
        from django.core.management.commands.compilemessages import compile_messages
        compile_messages(sys.stderr)
    finally:
        os.chdir('..')

def read(*parts):
    file_path = path.join(path.dirname(__file__), *parts)
    return codecs.open(file_path, encoding='utf-8').read()

def find_version(*parts):
    version_file = read(*parts)
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
    if version_match:
        return str(version_match.group(1))
    raise RuntimeError("Unable to find version string.")

setup(
    name='django-fluent-contents',
    version=find_version('fluent_contents', '__init__.py'),
    license='Apache License, Version 2.0',

    install_requires=[
        'django-fluent-utils>=1.0',        # DRY utility code
        'django-parler>=1.0',              # In practice only visible for sharedcontent, but integrated globally for admin support.
        'django-polymorphic>=0.5.3',       # Need 0.5.3 at least for several upstream fixes (for the multilingual API urls)
        'django-tag-parser>=2.0b1',
        'django-template-analyzer>=1.3',
        'future>=0.12.2',
    ],
    requires=[
        'Django (>=1.4)',
    ],
    extras_require = {
        'code': ['Pygments'],
        'disquscommentsarea': ['django-disqus'],
        'formdesignerlink': ['django-form-designer'],
        'markup': ['docutils', 'textile', 'Markdown>=1.7'],
        'oembeditem': ['micawber>=0.2.6'],
        'text': ['django-wysiwyg>=0.5.1'],
        'twitterfeed': ['twitter-text-py>=1.0.3'],
    },
    dependency_links = [
        'git+https://github.com/philomat/django-form-designer.git#egg=django-form-designer-dev',
    ],

    description='A widget engine to display various content on Django pages',
    long_description=read('README.rst'),

    author='Diederik van der Boor',
    author_email='opensource@edoburu.nl',

    url='https://github.com/edoburu/django-fluent-contents',
    download_url='https://github.com/edoburu/django-fluent-contents/zipball/master',

    packages=find_packages(exclude=('example*',)),
    include_package_data=True,

    test_suite = 'runtests',

    zip_safe=False,
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Software Development :: Libraries :: Application Frameworks',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ]
)
<commit_msg>setup.py: need newer releases for Django 1.7 compatibility<commit_after>#!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
import codecs
import os
import re
import sys

# When creating the sdist, make sure the django.mo file also exists:
if 'sdist' in sys.argv or 'develop' in sys.argv:
    try:
        os.chdir('fluent_contents')
        from django.core.management.commands.compilemessages import compile_messages
        compile_messages(sys.stderr)
    finally:
        os.chdir('..')

def read(*parts):
    file_path = path.join(path.dirname(__file__), *parts)
    return codecs.open(file_path, encoding='utf-8').read()

def find_version(*parts):
    version_file = read(*parts)
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
    if version_match:
        return str(version_match.group(1))
    raise RuntimeError("Unable to find version string.")

setup(
    name='django-fluent-contents',
    version=find_version('fluent_contents', '__init__.py'),
    license='Apache License, Version 2.0',

    install_requires=[
        'django-fluent-utils>=1.0',        # DRY utility code
        'django-parler>=1.1',              # Needed for Django 1.7 compatibility
        'django-polymorphic>=0.6',         # Needed for Django 1.7 compatibility
        'django-tag-parser>=2.0b1',
        'django-template-analyzer>=1.4',   # Needed for Django 1.7 compatibility
        'future>=0.12.2',
    ],
    requires=[
        'Django (>=1.4)',
    ],
    extras_require = {
        'code': ['Pygments'],
        'disquscommentsarea': ['django-disqus'],
        'formdesignerlink': ['django-form-designer'],
        'markup': ['docutils', 'textile', 'Markdown>=1.7'],
        'oembeditem': ['micawber>=0.2.6'],
        'text': ['django-wysiwyg>=0.5.1'],
        'twitterfeed': ['twitter-text-py>=1.0.3'],
    },
    dependency_links = [
        'git+https://github.com/philomat/django-form-designer.git#egg=django-form-designer-dev',
    ],

    description='A widget engine to display various content on Django pages',
    long_description=read('README.rst'),

    author='Diederik van der Boor',
    author_email='opensource@edoburu.nl',

    url='https://github.com/edoburu/django-fluent-contents',
    download_url='https://github.com/edoburu/django-fluent-contents/zipball/master',

    packages=find_packages(exclude=('example*',)),
    include_package_data=True,

    test_suite = 'runtests',

    zip_safe=False,
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Software Development :: Libraries :: Application Frameworks',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ]
)
<|endoftext|>


<commit_before>#!/usr/bin/env python

# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------------------------------------------------------------

__version__ = "0.2.0-dev"

import os
from setuptools import find_packages, setup
from setuptools.extension import Extension

import numpy as np

classes = """
    Development Status :: 1 - Planning
    License :: OSI Approved :: BSD License
    Topic :: Software Development :: Libraries
    Topic :: Scientific/Engineering
    Topic :: Scientific/Engineering :: Bio-Informatics
    Programming Language :: Python
    Programming Language :: Python :: 2
    Programming Language :: Python :: 2.7
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3.3
    Programming Language :: Python :: 3.4
    Operating System :: Unix
    Operating System :: POSIX
    Operating System :: MacOS :: MacOS X
"""
classifiers = [s.strip() for s in classes.split('\n') if s]

description = ('Data structures, algorithms and educational '
               'resources for bioinformatics.')

with open('README.rst') as f:
    long_description = f.read()

# Dealing with Cython
USE_CYTHON = os.environ.get('USE_CYTHON', False)
ext = '.pyx' if USE_CYTHON else '.c'
extensions = [
    Extension("skbio.stats._subsample._subsample",
              ["skbio/stats/_subsample/_subsample" + ext]),
    Extension("skbio.alignment._ssw._ssw_wrapper",
              ["skbio/alignment/_ssw/_ssw_wrapper" + ext,
               "skbio/alignment/_ssw/ssw.c"],
              extra_compile_args=["-Wno-error=declaration-after-statement"])
]

if USE_CYTHON:
    from Cython.Build import cythonize
    extensions = cythonize(extensions)

setup(name='scikit-bio',
      version=__version__,
      license='BSD',
      description=description,
      long_description=long_description,
      author="scikit-bio development team",
      author_email="gregcaporaso@gmail.com",
      maintainer="scikit-bio development team",
      maintainer_email="gregcaporaso@gmail.com",
      url='http://scikit-bio.org',
      test_suite='nose.collector',
      packages=find_packages(),
      ext_modules=extensions,
      include_dirs=[np.get_include()],
      install_requires=['numpy >= 1.7', 'matplotlib >= 1.1.0',
                        'scipy >= 0.13.0', 'pandas', 'future', 'natsort',
                        'IPython'],
      extras_require={'test': ["nose >= 0.10.1", "pep8", "flake8",
                               "python-dateutil"],
                      'doc': ["Sphinx >= 1.2.2", "sphinx-bootstrap-theme"]},
      classifiers=classifiers,
      package_data={
          'skbio.stats.tests': ['data/*'],
          'skbio.stats.distance.tests': ['data/*'],
          'skbio.stats.ordination.tests': ['data/*'],
          'skbio.parse.sequences.tests': ['data/*'],
          }
      )
<commit_msg>Revert "Add -Wno-error=declaration-after-statement to extra_compile_args"<commit_after>#!/usr/bin/env python

# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------------------------------------------------------------

__version__ = "0.2.0-dev"

import os
from setuptools import find_packages, setup
from setuptools.extension import Extension

import numpy as np

classes = """
    Development Status :: 1 - Planning
    License :: OSI Approved :: BSD License
    Topic :: Software Development :: Libraries
    Topic :: Scientific/Engineering
    Topic :: Scientific/Engineering :: Bio-Informatics
    Programming Language :: Python
    Programming Language :: Python :: 2
    Programming Language :: Python :: 2.7
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3.3
    Programming Language :: Python :: 3.4
    Operating System :: Unix
    Operating System :: POSIX
    Operating System :: MacOS :: MacOS X
"""
classifiers = [s.strip() for s in classes.split('\n') if s]

description = ('Data structures, algorithms and educational '
               'resources for bioinformatics.')

with open('README.rst') as f:
    long_description = f.read()

# Dealing with Cython
USE_CYTHON = os.environ.get('USE_CYTHON', False)
ext = '.pyx' if USE_CYTHON else '.c'
extensions = [Extension("skbio.stats._subsample._subsample",
                        ["skbio/stats/_subsample/_subsample" + ext]),
              Extension("skbio.alignment._ssw._ssw_wrapper",
                        ["skbio/alignment/_ssw/_ssw_wrapper" + ext,
                         "skbio/alignment/_ssw/ssw.c"])]

if USE_CYTHON:
    from Cython.Build import cythonize
    extensions = cythonize(extensions)

setup(name='scikit-bio',
      version=__version__,
      license='BSD',
      description=description,
      long_description=long_description,
      author="scikit-bio development team",
      author_email="gregcaporaso@gmail.com",
      maintainer="scikit-bio development team",
      maintainer_email="gregcaporaso@gmail.com",
      url='http://scikit-bio.org',
      test_suite='nose.collector',
      packages=find_packages(),
      ext_modules=extensions,
      include_dirs=[np.get_include()],
      install_requires=['numpy >= 1.7', 'matplotlib >= 1.1.0',
                        'scipy >= 0.13.0', 'pandas', 'future', 'natsort',
                        'IPython'],
      extras_require={'test': ["nose >= 0.10.1", "pep8", "flake8",
                               "python-dateutil"],
                      'doc': ["Sphinx >= 1.2.2", "sphinx-bootstrap-theme"]},
      classifiers=classifiers,
      package_data={
          'skbio.stats.tests': ['data/*'],
          'skbio.stats.distance.tests': ['data/*'],
          'skbio.stats.ordination.tests': ['data/*'],
          'skbio.parse.sequences.tests': ['data/*'],
          }
      )
<|endoftext|>


<commit_before>'''
Inner Functions - What Are They Good For?

1. Encapsulation
You use inner functions to protect them from anything happening outside of the
function, meaning that they are hidden from the global scope.

2. Closures and Factory Functions
Now we come to the most important reason to use inner functions. All of the
inner function examples we’ve seen so far have been ordinary functions that
merely happened to be nested inside another function. In other words,
we could have defined these functions in another way (as discussed);
there is no specific reason for why they should be nested.

But when it comes to closure, that is not the case: You must utilize nested functions.

What’s a closure?
A closure simply causes the inner function to remember the state of its environment
when called. Beginners often think that a closure is the inner function,
when it’s really caused by the inner function. The closure “closes” the local variable
on the stack and this stays around after the the stack creation has finished executing.
'''

# EXAMPLE 1:
# ==============================================================================
# This is a simplified function to check if a certain user has the correct
# permissions to access a certain page. You could easily modify this to grab the
# user in session to check if they have the correct credentials to access a
# certain route. Instead of checking if the user is just equal to "Admin",
# you could query the database to check the permission then return the correct
# view depending on whether the credentials are correct or not.

def has_permission(page):
    def inner(username):
        if username == 'admin':
            return '{} have access to {}'.format(username, page)
        else:
            return '{} does not have access to {}'.format(username, page)
    return inner

current_user = has_permission('Admin Area')
print
print current_user('admin')

random_user = has_permission('Admin Area')
print random_user('not admin')
print

# EXAMPLE 2:
# ==============================================================================
# The ‘generate_power()’ function is a factory function – which simply means
# that it creates a new function each time it is called and then returns the
# newly created function.

# What does this inner function do? It takes a single argument, power,
# and returns number**power.

# Where does the inner function get the value of number from? This is where the
# closure comes into play: nth_power() gets the value of power from the outer
# function, the factory function.

def generate_power(number):
    def nth_power(power):
        return number ** power
    return nth_power

# EXAMPLE 3:
# ==============================================================================
# You use inner functions to protect them from anything happening outside of the
# function, meaning that they are hidden from the global scope.
#
def make_adder(num1):
    def add(num2):
        return num1 + num2
    return add

sum_result = make_adder(3)
print sum_result(7)
print

# EXAMPLE 4:
# ==============================================================================
def print_msg(msg):
    '''This is the outer enclosing function'''

    def printer():
        '''This is the nested function'''
        print msg

    return printer

my_print_msg = print_msg('Hello')
my_print_msg()
print

# EXAMPLE 5:
# ==============================================================================
import sys

def Foo():
    def err(s):
        sys.stderr.write('ERROR: ')
        sys.stderr.write(s)
        sys.stderr.write('\n')
    err('I regret to inform you')
    err('that a shameful thing has happened.')
    err('Thus, I must issue this desultory message')
    err('across numerous lines.')
Foo()

# EXAMPLE 6:
# ==============================================================================
class SomeClass(object):
    def __init__(self):
        pass

    def _add(self, x, y):
        return x + y

    def doOp(self, x, y):
        return self._add(x, y)

print
print 'Result =', SomeClass().doOp(1, 2)
<commit_msg>Refactoring documentation on inner functions.<commit_after>'''
Inner Functions - What Are They Good For?

1. Encapsulation
You use inner functions to protect them from anything happening outside of the
function, meaning that they are hidden from the global scope.

2. Closures and Factory Functions
Now we come to the most important reason to use inner functions.
All of the inner function examples we’ve seen so far have been ordinary
functions that merely happened to be nested inside another function.
In other words, we could have defined these functions in another way
(as discussed); there is no specific reason for why they should be nested.

But when it comes to closure, that is not the case: You must utilize nested
functions.

What’s a closure?
A closure simply causes the inner function to remember the state of its
environment when called. Beginners often think that a closure is the inner
function, when it’s really caused by the inner function. The closure "closes"
the local variable on the stack and this stays around after the the stack
creation has finished executing.
'''

# EXAMPLE 1:
# ==============================================================================
# This is a simplified function to check if a certain user has the correct
# permissions to access a certain page. You could easily modify this to grab the
# user in session to check if they have the correct credentials to access a
# certain route. Instead of checking if the user is just equal to "Admin",
# you could query the database to check the permission then return the correct
# view depending on whether the credentials are correct or not.

def has_permission(page):
    def inner(username):
        if username == 'admin':
            return '{} have access to {}'.format(username, page)
        else:
            return '{} does not have access to {}'.format(username, page)
    return inner

current_user = has_permission('Admin Area')
print
print current_user('admin')

random_user = has_permission('Admin Area')
print random_user('not admin')
print

# EXAMPLE 2:
# ==============================================================================
# The ‘generate_power()’ function is a factory function – which simply means
# that it creates a new function each time it is called and then returns the
# newly created function.

# What does this inner function do? It takes a single argument, power,
# and returns number**power.

# Where does the inner function get the value of number from? This is where the
# closure comes into play: nth_power() gets the value of power from the outer
# function, the factory function.

def generate_power(number):
    def nth_power(power):
        return number ** power
    return nth_power

# EXAMPLE 3:
# ==============================================================================
# You use inner functions to protect them from anything happening outside of the
# function, meaning that they are hidden from the global scope.
#
def make_adder(num1):
    def add(num2):
        return num1 + num2
    return add

sum_result = make_adder(3)
print sum_result(7)
print

# EXAMPLE 4:
# ==============================================================================
def print_msg(msg):
    '''This is the outer enclosing function'''

    def printer():
        '''This is the nested function'''
        print msg

    return printer

my_print_msg = print_msg('Hello')
my_print_msg()
print

# EXAMPLE 5:
# ==============================================================================
import sys

def Foo():
    def err(s):
        sys.stderr.write('ERROR: ')
        sys.stderr.write(s)
        sys.stderr.write('\n')
    err('I regret to inform you')
    err('that a shameful thing has happened.')
    err('Thus, I must issue this desultory message')
    err('across numerous lines.')
Foo()

# EXAMPLE 6:
# ==============================================================================
class SomeClass(object):
    def __init__(self):
        pass

    def _add(self, x, y):
        return x + y

    def doOp(self, x, y):
        return self._add(x, y)

print
print 'Result =', SomeClass().doOp(1, 2)
<|endoftext|>


<commit_before>from setuptools import setup

setup(
    name='SQLDatabase',
    version='0.1dev',
    py_modules=['data_compare',],
    license='Creative Commons Attribution-Noncommercial-Share Alike license',
    long_description=open('README.txt').read(),
    install_requires=[
        'sqlalchemy',
        'sqlalchemy-utils',
        'psycopg2',
    ],
)
<commit_msg>CNF: add nose to setup.<commit_after>from setuptools import setup

setup(
    name='SQLDatabase',
    version='0.1dev',
    py_modules=['data_compare',],
    license='Creative Commons Attribution-Noncommercial-Share Alike license',
    long_description=open('README.txt').read(),
    install_requires=[
        'nose',
        'nose-pudb',
        'sqlalchemy',
        'sqlalchemy-utils',
        'psycopg2',
    ],
)
<|endoftext|>


<commit_before>import json
import logging
from sleekxmpp import ClientXMPP

from events.pgnotify import pg_notify
from otrbackend.magic import OTRContextManager, OTRContext

class XMPPOTRContext(OTRContext):

    def __init__(self, user, other, xmpp_client):
        super(XMPPOTRContext, self).__init__(user, other)
        self.xmpp_client = xmpp_client

    def inject(self, msg, appdata=None):
        # This method send some message from account to the target peer
        logging.getLogger().debug('Call inject; %s => %s; %s',
                                  self.user, self.peer, msg)
        self.xmpp_client.send_message(mto=self.peer, mbody=msg)

class XMPPOTRContextManager(OTRContextManager):

    def __init__(self, xmpp_client):
        super(XMPPOTRContextManager, self).__init__(unicode(xmpp_client.jid))
        self.xmpp_client = xmpp_client

    def context_to(self, other):
        if other not in self.contexts:
            # No context already for other than create a new context
            self.contexts[other] = XMPPOTRContext(self.account, other,
                                                  self.xmpp_client)
        return self.contexts[other]

class OTRMeClient(ClientXMPP):

    def __init__(self, jid, password):
        super(OTRMeClient, self).__init__(jid, password)
        self.resource = 'OTRMe'

        self.otr = XMPPOTRContextManager(self)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
        self.add_event_handler("changed_status", self.changed_status)
        self.add_event_handler("roster_update", self.roster_update)

    def session_start(self, event):
        self.send_presence(pshow="chat", pstatus="Using OTRMe!", ppriority=20)
        roster = self.get_roster()

        for jid in self.client_roster:
            print self.client_roster[jid]

            connections = self.client_roster.presence(jid)
            for res, pres in connections.items():
                print res, pres

        print ""
        print roster
        print ""
        print self.client_roster
        print ""

    def message(self, msg):
        plain_msg, was_encrypted = self.otr.incoming({
            'from': unicode(msg['from']),
            'type': unicode(msg['type']),
            'body': unicode(msg['body']).encode('utf8')
        })

        context = self.otr.context_to(unicode(msg['from']))

        if msg['type'] in ('chat', 'normal'):
            event_payload = {
                'name': 'Gentle',
                'jid': unicode(msg['from']),
                'message': unicode(msg['body']),
                'time': '2013-09-09 18:24'
            }
            pg_notify(
                'events/%s' % unicode(msg['from'].bare),
                json.dumps(["message", event_payload])
            )

            if context.state == 0:
                self.otr.outgoing(
                    msg['from'],
                    "Your message was not encrypted. AARRRR!"
                )
            elif context.state == 1:
                self.otr.outgoing(
                    msg['from'],
                    "Your message was encrypted. Great secret plan!"
                )
            elif context.state == 2:
                self.otr.outgoing(
                    msg['from'],
                    "Okay no OTR anymore. Silence now!"
                )
            else:
                self.otr.outgoing(
                    msg['from'],
                    "Something went terrible wrong..."
                )

        print msg
        print was_encrypted
        print plain_msg

    def changed_status(self, presence):
        print presence['from']
        print presence.get_type()

    def roster_update(self, roster):
        print roster

<commit_msg>Add otr state into event channel and decrypted message<commit_after>import json
import logging
from sleekxmpp import ClientXMPP

from events.pgnotify import pg_notify
from otrbackend.magic import OTRContextManager, OTRContext

class XMPPOTRContext(OTRContext):

    def __init__(self, user, other, xmpp_client):
        super(XMPPOTRContext, self).__init__(user, other)
        self.xmpp_client = xmpp_client

    def inject(self, msg, appdata=None):
        # This method send some message from account to the target peer
        logging.getLogger().debug('Call inject; %s => %s; %s',
                                  self.user, self.peer, msg)
        self.xmpp_client.send_message(mto=self.peer, mbody=msg)

class XMPPOTRContextManager(OTRContextManager):

    def __init__(self, xmpp_client):
        super(XMPPOTRContextManager, self).__init__(unicode(xmpp_client.jid))
        self.xmpp_client = xmpp_client

    def context_to(self, other):
        if other not in self.contexts:
            # No context already for other than create a new context
            self.contexts[other] = XMPPOTRContext(self.account, other,
                                                  self.xmpp_client)
        return self.contexts[other]

class OTRMeClient(ClientXMPP):

    def __init__(self, jid, password):
        super(OTRMeClient, self).__init__(jid, password)
        self.resource = 'OTRMe'

        self.otr = XMPPOTRContextManager(self)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
        self.add_event_handler("changed_status", self.changed_status)
        self.add_event_handler("roster_update", self.roster_update)

    def session_start(self, event):
        self.send_presence(pshow="chat", pstatus="Using OTRMe!", ppriority=20)
        roster = self.get_roster()

        for jid in self.client_roster:
            print self.client_roster[jid]

            connections = self.client_roster.presence(jid)
            for res, pres in connections.items():
                print res, pres

        print ""
        print roster
        print ""
        print self.client_roster
        print ""

    def message(self, msg):
        plain_msg, was_encrypted = self.otr.incoming({
            'from': unicode(msg['from']),
            'type': unicode(msg['type']),
            'body': unicode(msg['body']).encode('utf8')
        })

        context = self.otr.context_to(unicode(msg['from']))
        if msg['type'] in ('chat', 'normal'):
            event_payload = {
                'name': 'Gentle',
                'jid': unicode(msg['from']),
                'message': plain_msg,
                'time': '2013-09-09 18:24',
                'otr_state': context.state
            }
            pg_notify(
                'events/%s' % unicode(msg['from'].bare),
                json.dumps(["message", event_payload])
            )

    def changed_status(self, presence):
        print presence['from']
        print presence.get_type()

    def roster_update(self, roster):
        print roster

<|endoftext|>


<commit_before>"""
setup.py for Contact Map Explorer
"""
import os
import subprocess
import inspect
from setuptools import setup

####################### USER SETUP AREA #################################
# * VERSION: base version (do not include .dev0, etc -- that's automatic)
# * IS_RELEASE: whether this is a release
VERSION = "0.5.0"
IS_RELEASE = False

DEV_NUM = 0  # always 0: we don't do public (pypi) .dev releases
PRE_TYPE = ""  # a, b, or rc (although we rarely release such versions)
PRE_NUM = 0

# REQUIREMENTS should list any required packages
REQUIREMENTS=['future', 'numpy', 'mdtraj', 'scipy', 'pandas']

# PACKAGES should list any subpackages of the code. The assumption is that
# package.subpackage is located at package/subpackage
PACKAGES=['contact_map', 'contact_map.tests']

# This DESCRIPTION is only used if a README.rst hasn't been made from the
# markdown version
DESCRIPTION="""
Contact maps based on MDTraj; useful for studying for intramolecular and
intermolecular contacts (atom-atom or residue-residue) from simulations of
biomolecular systems. For a more detailed description, see package
documentation at http://contact-map.readthedocs.io/
"""
SHORT_DESCRIPTION="Contact maps based on MDTraj"

# note: leave the triple quotes on separate lines from the classifiers
CLASSIFIERS="""
Development Status :: 4 - Beta
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Operating System :: POSIX
Operating System :: Microsoft :: Windows
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Scientific/Engineering :: Chemistry
"""
####################### USER SETUP AREA #################################

# * VERSION: the release version number
# * __version__: ?? how is this used ??
# * PACKAGE_VERSION: the version used in setup.py info
PACKAGE_VERSION = VERSION
if PRE_TYPE != "":
    PACKAGE_VERSION += "." + PRE_TYPE + str(PRE_NUM)
if not IS_RELEASE:
    PACKAGE_VERSION += ".dev" + str(DEV_NUM)
__version__ = PACKAGE_VERSION

if os.path.isfile('README.rst'):
    DESCRIPTION = open('README.rst').read()

################################################################################
# Writing version control information to the module
################################################################################
def get_git_version():
    """
    Return the git hash as a string.

    Apparently someone got this from numpy's setup.py. It has since been
    modified a few times.
    """
    # Return the git revision as a string
    # copied from numpy setup.py
    def _minimal_ext_cmd(cmd):
        # construct minimal environment
        env = {}
        for k in ['SYSTEMROOT', 'PATH']:
            v = os.environ.get(k)
            if v is not None:
                env[k] = v
        # LANGUAGE is used on win32
        env['LANGUAGE'] = 'C'
        env['LANG'] = 'C'
        env['LC_ALL'] = 'C'
        with open(os.devnull, 'w') as err_out:
            out = subprocess.Popen(cmd,
                                   stdout=subprocess.PIPE,
                                   stderr=err_out, # maybe debug later?
                                   env=env).communicate()[0]
        return out

    try:
        git_dir = os.path.dirname(os.path.realpath(__file__))
        out = _minimal_ext_cmd(['git', '-C', git_dir, 'rev-parse', 'HEAD'])
        GIT_REVISION = out.strip().decode('ascii')
    except OSError:
        GIT_REVISION = 'Unknown'

    return GIT_REVISION

# TODO: this may get moved into another file
VERSION_PY_CONTENT = """
# This file is automatically generated by setup.py
\"\"\"
Version info for Contact Map Explorer.

``full_version`` gives the most information about the current state. It is
always the short (PEP440) version string, followed by a git hash as
``+gGITHASH``. If the install is not in a live git repository, that hash is
followed by ``.install``, and represents the commit that was installed. In a
live repository, it represents the active state.
\"\"\"

import os
import subprocess

# this is automatically generated from the code in setup.py
%(git_version_code)s

short_version = '%(version)s'
version = '%(version)s'
installed_git_hash = '%(git_revision)s'
full_version = version + '+g' + installed_git_hash[:7] + '.install'
release = %(is_release)s
git_hash = 'Unknown'  # default

if not release:
    git_hash = get_git_version()
    if git_hash != '' and git_hash != 'Unknown':
        full_version = version + '+g' + git_hash[:7]

    version = full_version
"""

def write_version_py(filename):
    # Adding the git rev number needs to be done inside write_version_py(),
    # otherwise the import of numpy.version messes up the build under Python 3.
    git_version_code = inspect.getsource(get_git_version)
    if os.path.exists('.git'):
        GIT_REVISION = get_git_version()
    else:
        GIT_REVISION = 'Unknown'

    content = VERSION_PY_CONTENT % {
        'version': PACKAGE_VERSION,
        'git_revision': GIT_REVISION,
        'is_release': str(IS_RELEASE),
        'git_version_code': str(git_version_code)
    }

    with open(filename, 'w') as version_file:
        version_file.write(content)

################################################################################
# Installation
################################################################################
if __name__ == "__main__":
    write_version_py(os.path.join('contact_map', 'version.py'))
    setup(
        name="contact_map",
        author="David W.H. Swenson and Sander Roet",
        author_email="dwhs@hyperblazer.net, sroet@hotmail.com",
        version=PACKAGE_VERSION,
        license="LGPL-2.1+",
        url="http://github.com/dwhswenson/contact_map",
        packages=PACKAGES,
        package_dir={p: '/'.join(p.split('.')) for p in PACKAGES},
        package_data={'contact_map': ['tests/*pdb']},
        ext_modules=[],
        scripts=[],
        description=SHORT_DESCRIPTION,
        long_description=DESCRIPTION,
        platforms=['Linux', 'Mac OS X', 'Unix', 'Windows'],
        install_requires=REQUIREMENTS,
        requires=REQUIREMENTS,
        tests_require=["pytest", "pytest-cov", "python-coveralls"],
        classifiers=CLASSIFIERS.split('\n')[1:-1]
    )

<commit_msg>use Sander's *actual* email address<commit_after>"""
setup.py for Contact Map Explorer
"""
import os
import subprocess
import inspect
from setuptools import setup

####################### USER SETUP AREA #################################
# * VERSION: base version (do not include .dev0, etc -- that's automatic)
# * IS_RELEASE: whether this is a release
VERSION = "0.5.0"
IS_RELEASE = False

DEV_NUM = 0  # always 0: we don't do public (pypi) .dev releases
PRE_TYPE = ""  # a, b, or rc (although we rarely release such versions)
PRE_NUM = 0

# REQUIREMENTS should list any required packages
REQUIREMENTS=['future', 'numpy', 'mdtraj', 'scipy', 'pandas']

# PACKAGES should list any subpackages of the code. The assumption is that
# package.subpackage is located at package/subpackage
PACKAGES=['contact_map', 'contact_map.tests']

# This DESCRIPTION is only used if a README.rst hasn't been made from the
# markdown version
DESCRIPTION="""
Contact maps based on MDTraj; useful for studying for intramolecular and
intermolecular contacts (atom-atom or residue-residue) from simulations of
biomolecular systems. For a more detailed description, see package
documentation at http://contact-map.readthedocs.io/
"""
SHORT_DESCRIPTION="Contact maps based on MDTraj"

# note: leave the triple quotes on separate lines from the classifiers
CLASSIFIERS="""
Development Status :: 4 - Beta
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Operating System :: POSIX
Operating System :: Microsoft :: Windows
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Scientific/Engineering :: Chemistry
"""
####################### USER SETUP AREA #################################

# * VERSION: the release version number
# * __version__: ?? how is this used ??
# * PACKAGE_VERSION: the version used in setup.py info
PACKAGE_VERSION = VERSION
if PRE_TYPE != "":
    PACKAGE_VERSION += "." + PRE_TYPE + str(PRE_NUM)
if not IS_RELEASE:
    PACKAGE_VERSION += ".dev" + str(DEV_NUM)
__version__ = PACKAGE_VERSION

if os.path.isfile('README.rst'):
    DESCRIPTION = open('README.rst').read()

################################################################################
# Writing version control information to the module
################################################################################
def get_git_version():
    """
    Return the git hash as a string.

    Apparently someone got this from numpy's setup.py. It has since been
    modified a few times.
    """
    # Return the git revision as a string
    # copied from numpy setup.py
    def _minimal_ext_cmd(cmd):
        # construct minimal environment
        env = {}
        for k in ['SYSTEMROOT', 'PATH']:
            v = os.environ.get(k)
            if v is not None:
                env[k] = v
        # LANGUAGE is used on win32
        env['LANGUAGE'] = 'C'
        env['LANG'] = 'C'
        env['LC_ALL'] = 'C'
        with open(os.devnull, 'w') as err_out:
            out = subprocess.Popen(cmd,
                                   stdout=subprocess.PIPE,
                                   stderr=err_out, # maybe debug later?
                                   env=env).communicate()[0]
        return out

    try:
        git_dir = os.path.dirname(os.path.realpath(__file__))
        out = _minimal_ext_cmd(['git', '-C', git_dir, 'rev-parse', 'HEAD'])
        GIT_REVISION = out.strip().decode('ascii')
    except OSError:
        GIT_REVISION = 'Unknown'

    return GIT_REVISION

# TODO: this may get moved into another file
VERSION_PY_CONTENT = """
# This file is automatically generated by setup.py
\"\"\"
Version info for Contact Map Explorer.

``full_version`` gives the most information about the current state. It is
always the short (PEP440) version string, followed by a git hash as
``+gGITHASH``. If the install is not in a live git repository, that hash is
followed by ``.install``, and represents the commit that was installed. In a
live repository, it represents the active state.
\"\"\"

import os
import subprocess

# this is automatically generated from the code in setup.py
%(git_version_code)s

short_version = '%(version)s'
version = '%(version)s'
installed_git_hash = '%(git_revision)s'
full_version = version + '+g' + installed_git_hash[:7] + '.install'
release = %(is_release)s
git_hash = 'Unknown'  # default

if not release:
    git_hash = get_git_version()
    if git_hash != '' and git_hash != 'Unknown':
        full_version = version + '+g' + git_hash[:7]

    version = full_version
"""

def write_version_py(filename):
    # Adding the git rev number needs to be done inside write_version_py(),
    # otherwise the import of numpy.version messes up the build under Python 3.
    git_version_code = inspect.getsource(get_git_version)
    if os.path.exists('.git'):
        GIT_REVISION = get_git_version()
    else:
        GIT_REVISION = 'Unknown'

    content = VERSION_PY_CONTENT % {
        'version': PACKAGE_VERSION,
        'git_revision': GIT_REVISION,
        'is_release': str(IS_RELEASE),
        'git_version_code': str(git_version_code)
    }

    with open(filename, 'w') as version_file:
        version_file.write(content)

################################################################################
# Installation
################################################################################
if __name__ == "__main__":
    write_version_py(os.path.join('contact_map', 'version.py'))
    setup(
        name="contact_map",
        author="David W.H. Swenson and Sander Roet",
        author_email="dwhs@hyperblazer.net, sanderroet@hotmail.com",
        version=PACKAGE_VERSION,
        license="LGPL-2.1+",
        url="http://github.com/dwhswenson/contact_map",
        packages=PACKAGES,
        package_dir={p: '/'.join(p.split('.')) for p in PACKAGES},
        package_data={'contact_map': ['tests/*pdb']},
        ext_modules=[],
        scripts=[],
        description=SHORT_DESCRIPTION,
        long_description=DESCRIPTION,
        platforms=['Linux', 'Mac OS X', 'Unix', 'Windows'],
        install_requires=REQUIREMENTS,
        requires=REQUIREMENTS,
        tests_require=["pytest", "pytest-cov", "python-coveralls"],
        classifiers=CLASSIFIERS.split('\n')[1:-1]
    )

<|endoftext|>


<commit_before>#
# BSD 3-Clause License
#
# Copyright (c) 2017, plures
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived from
#    this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

from distutils.core import setup, Extension
from glob import glob
import platform
import sys, os
import subprocess
import shutil

DESCRIPTION = \
    """Dynamic types for data description and in-memory computations"""

PY_MAJOR = sys.version_info[0]
PY_MINOR = sys.version_info[1]
ARCH = platform.architecture()[0]
BUILD_ALL = True

if PY_MAJOR < 3:
    raise NotImplementedError(
        "python2 support is not implemented")

def get_module_path():
    pathlist = glob("build/lib.*/")
    if pathlist:
        return pathlist[0]
    raise RuntimeError("cannot find ndtypes module in build directory")

def copy_ext():
    if sys.platform == "win32":
        pathlist = glob("build/lib.*/ndtypes/_ndtypes.*.pyd")
    else:
        pathlist = glob("build/lib.*/ndtypes/_ndtypes.*.so")
    if pathlist:
        shutil.copy2(pathlist[0], "python/ndtypes")

if len(sys.argv) == 3 and sys.argv[1] == "install" and \
    sys.argv[2].startswith("--local"):
    localdir = sys.argv[2].split("=")[1]
    sys.argv = sys.argv[:2] + [
        "--install-base=" + localdir,
        "--install-purelib=" + localdir,
        "--install-platlib=" + localdir,
        "--install-scripts=" + localdir,
        "--install-data=" + localdir,
        "--install-headers=" + localdir]

    if sys.platform == "darwin": # homebrew bug
        sys.argv.append("--prefix=")

elif len(sys.argv) == 2:
    if sys.argv[1] == 'module':
       sys.argv[1] = 'build'
       BUILD_ALL = False
    if sys.argv[1] == 'test':
        module_path = get_module_path()
        python_path = os.getenv('PYTHONPATH')
        path = module_path + ':' + python_path if python_path else module_path
        env = os.environ.copy()
        env['PYTHONPATH'] = path
        ret = subprocess.call([sys.executable, "python/test_ndtypes.py"], env=env)
        sys.exit(ret)
    elif sys.argv[1] == 'clean':
        shutil.rmtree("build", ignore_errors=True)
        os.chdir("python/ndtypes")
        shutil.rmtree("__pycache__", ignore_errors=True)
        for f in glob("_ndtypes*.so"):
            os.remove(f)
        sys.exit(0)
    elif sys.argv[1] == 'distclean':
        if sys.platform == "win32":
            os.chdir("vcbuild")
            os.system("vcdistclean.bat")
        else:
            os.system("make distclean")
        sys.exit(0)
    else:
        pass

def ndtypes_ext():
    include_dirs = ["libndtypes"]
    library_dirs = ["libndtypes"]
    depends = ["libndtypes/ndtypes.h"]
    sources = ["python/ndtypes/_ndtypes.c"]

    if sys.platform == "win32":
        libraries = ["libndtypes-0.1.0.dll"]
        extra_compile_args = ["/DIMPORT"]
        extra_link_args = []
        runtime_library_dirs = []

        if BUILD_ALL:
            from distutils.msvc9compiler import MSVCCompiler
            MSVCCompiler().initialize()
            os.chdir("vcbuild")
            if ARCH == "64bit":
                  os.system("vcbuild64.bat")
            else:
                  os.system("vcbuild32.bat")
            os.chdir("..")

    else:
        libraries = ["ndtypes"]
        extra_compile_args = ["-Wextra", "-Wno-missing-field-initializers", "-std=c11"]
        if sys.platform == "darwin":
            extra_link_args = ["-Wl,-rpath,@loader_path"]
            runtime_library_dirs = []
        else:
            extra_link_args = []
            runtime_library_dirs = ["$ORIGIN"]

        if BUILD_ALL:
            os.system("./configure && make")

    return Extension (
      "ndtypes._ndtypes",
      include_dirs = include_dirs,
      library_dirs = library_dirs,
      depends = depends,
      sources = sources,
      libraries = libraries,
      extra_compile_args = extra_compile_args,
      extra_link_args = extra_link_args,
      runtime_library_dirs = runtime_library_dirs
    )

setup (
    name = "ndtypes",
    version = "0.1",
    description = DESCRIPTION,
    url = "https://github.com/plures/ndtypes",
    license = "BSD License",
    keywords = ["ndtypes", "array computing", "data description"],
    platforms = ["Many"],
    classifiers = [
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Programming Language :: C",
        "Programming Language :: Python :: 3"
    ],
    package_dir = {"": "python"},
    packages = ["ndtypes"],
    package_data = {"ndtypes": ["libndtypes*"]},
    ext_modules = [ndtypes_ext()],
)

copy_ext()
<commit_msg>Add new header dependency.<commit_after>#
# BSD 3-Clause License
#
# Copyright (c) 2017, plures
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived from
#    this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

from distutils.core import setup, Extension
from glob import glob
import platform
import sys, os
import subprocess
import shutil

DESCRIPTION = \
    """Dynamic types for data description and in-memory computations"""

PY_MAJOR = sys.version_info[0]
PY_MINOR = sys.version_info[1]
ARCH = platform.architecture()[0]
BUILD_ALL = True

if PY_MAJOR < 3:
    raise NotImplementedError(
        "python2 support is not implemented")

def get_module_path():
    pathlist = glob("build/lib.*/")
    if pathlist:
        return pathlist[0]
    raise RuntimeError("cannot find ndtypes module in build directory")

def copy_ext():
    if sys.platform == "win32":
        pathlist = glob("build/lib.*/ndtypes/_ndtypes.*.pyd")
    else:
        pathlist = glob("build/lib.*/ndtypes/_ndtypes.*.so")
    if pathlist:
        shutil.copy2(pathlist[0], "python/ndtypes")

if len(sys.argv) == 3 and sys.argv[1] == "install" and \
    sys.argv[2].startswith("--local"):
    localdir = sys.argv[2].split("=")[1]
    sys.argv = sys.argv[:2] + [
        "--install-base=" + localdir,
        "--install-purelib=" + localdir,
        "--install-platlib=" + localdir,
        "--install-scripts=" + localdir,
        "--install-data=" + localdir,
        "--install-headers=" + localdir]

    if sys.platform == "darwin": # homebrew bug
        sys.argv.append("--prefix=")

elif len(sys.argv) == 2:
    if sys.argv[1] == 'module':
       sys.argv[1] = 'build'
       BUILD_ALL = False
    if sys.argv[1] == 'test':
        module_path = get_module_path()
        python_path = os.getenv('PYTHONPATH')
        path = module_path + ':' + python_path if python_path else module_path
        env = os.environ.copy()
        env['PYTHONPATH'] = path
        ret = subprocess.call([sys.executable, "python/test_ndtypes.py"], env=env)
        sys.exit(ret)
    elif sys.argv[1] == 'clean':
        shutil.rmtree("build", ignore_errors=True)
        os.chdir("python/ndtypes")
        shutil.rmtree("__pycache__", ignore_errors=True)
        for f in glob("_ndtypes*.so"):
            os.remove(f)
        sys.exit(0)
    elif sys.argv[1] == 'distclean':
        if sys.platform == "win32":
            os.chdir("vcbuild")
            os.system("vcdistclean.bat")
        else:
            os.system("make distclean")
        sys.exit(0)
    else:
        pass

def ndtypes_ext():
    include_dirs = ["libndtypes"]
    library_dirs = ["libndtypes"]
    depends = ["libndtypes/ndtypes.h", "python/ndtypes/pyndtypes.h"]
    sources = ["python/ndtypes/_ndtypes.c"]

    if sys.platform == "win32":
        libraries = ["libndtypes-0.1.0.dll"]
        extra_compile_args = ["/DIMPORT"]
        extra_link_args = []
        runtime_library_dirs = []

        if BUILD_ALL:
            from distutils.msvc9compiler import MSVCCompiler
            MSVCCompiler().initialize()
            os.chdir("vcbuild")
            if ARCH == "64bit":
                  os.system("vcbuild64.bat")
            else:
                  os.system("vcbuild32.bat")
            os.chdir("..")

    else:
        libraries = ["ndtypes"]
        extra_compile_args = ["-Wextra", "-Wno-missing-field-initializers", "-std=c11"]
        if sys.platform == "darwin":
            extra_link_args = ["-Wl,-rpath,@loader_path"]
            runtime_library_dirs = []
        else:
            extra_link_args = []
            runtime_library_dirs = ["$ORIGIN"]

        if BUILD_ALL:
            os.system("./configure && make")

    return Extension (
      "ndtypes._ndtypes",
      include_dirs = include_dirs,
      library_dirs = library_dirs,
      depends = depends,
      sources = sources,
      libraries = libraries,
      extra_compile_args = extra_compile_args,
      extra_link_args = extra_link_args,
      runtime_library_dirs = runtime_library_dirs
    )

setup (
    name = "ndtypes",
    version = "0.1",
    description = DESCRIPTION,
    url = "https://github.com/plures/ndtypes",
    license = "BSD License",
    keywords = ["ndtypes", "array computing", "data description"],
    platforms = ["Many"],
    classifiers = [
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Programming Language :: C",
        "Programming Language :: Python :: 3"
    ],
    package_dir = {"": "python"},
    packages = ["ndtypes"],
    package_data = {"ndtypes": ["libndtypes*"]},
    ext_modules = [ndtypes_ext()],
)

copy_ext()
<|endoftext|>


<commit_before>from distutils.core import setup

setup(
    name='django-cas-cache',
    version='0.1.2',
    packages=[
        'cascache',
        'cascache.backends',
    ],
    license='MIT',
    long_description=open('pypi.rst').read(),
    author="Anentropic",
    author_email="ego@anentropic.com",
    url="https://github.com/anentropic/django-cas-cache",
)
<commit_msg>pypi version bump<commit_after>from distutils.core import setup

setup(
    name='django-cas-cache',
    version='0.1.3',
    packages=[
        'cascache',
        'cascache.backends',
    ],
    license='MIT',
    long_description=open('pypi.rst').read(),
    author="Anentropic",
    author_email="ego@anentropic.com",
    url="https://github.com/anentropic/django-cas-cache",
)
<|endoftext|>


<commit_before>from setuptools import setup, find_packages

setup(
    name='django-setstatus',
    version='0.1.0',
    description='a generic way to set time limited statuses to objects in Django',
    long_description=open('README').read(),
    author='Jervis Whitley',
    author_email='jervisw@whit.com.au',
    url='http://github.com/jtrain/django-setstatus/tree/master',
    packages=find_packages(),
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Framework :: Django',
    ],
    package_data = {
    },
    zip_safe=False,
)
<commit_msg>an error where setup.py was attempting to read from a non-existant README file.<commit_after>from setuptools import setup, find_packages

setup(
    name='django-setstatus',
    version='0.1.0',
    description='a generic way to set time limited statuses to objects in Django',
    long_description=open('README.rst').read(),
    author='Jervis Whitley',
    author_email='jervisw@whit.com.au',
    url='http://github.com/jtrain/django-setstatus/tree/master',
    packages=find_packages(),
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Framework :: Django',
    ],
    package_data = {
    },
    zip_safe=False,
)
<|endoftext|>


<commit_before># coding: utf-8
import sys
from setuptools import setup, find_packages

NAME = 'ios-notification'
VERSION = '0.1.2'

def read(filename):
    import os
    BASE_DIR = os.path.dirname(__file__)
    filename = os.path.join(BASE_DIR, filename)
    with open(filename, 'r') as f:
        return f.read()

def readlist(filename):
    rows = read(filename).split('\n')
    rows = [x.strip() for x in rows if x.strip()]
    return list(rows)

setup(
    name=NAME,
    version=VERSION,
    description='A Django plugin for Apple Notification Service',
    long_description=read('README.rst'),
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Software Development :: Libraries',
        'Topic :: Software Development :: Libraries :: Application Frameworks',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ],
    keywords='django ios push notification apple apns',
    author='nnsnodnb',
    author_email='ahr63_gej@me.com',
    url='https://github.com/nnsnodnb/django-ios-notifications',
    download_url='https://github.com/nnsnodnb/django-ios-notifications/tarball/master',
    license='MIT',
    packages=find_packages(),
    include_package_data=True,
    package_data={
        '': ['README.rst',
             'requirements.txt',
             'requirements-test.txt'],
    },
    zip_safe=True,
    install_requires=readlist('requirements.txt'),
    test_suite='runtests.run_tests',
    tests_require=readlist('requirements-test.txt')
)

<commit_msg>Version up to 0.1.3<commit_after># coding: utf-8
import sys
from setuptools import setup, find_packages

NAME = 'ios-notification'
VERSION = '0.1.3'

def read(filename):
    import os
    BASE_DIR = os.path.dirname(__file__)
    filename = os.path.join(BASE_DIR, filename)
    with open(filename, 'r') as f:
        return f.read()

def readlist(filename):
    rows = read(filename).split('\n')
    rows = [x.strip() for x in rows if x.strip()]
    return list(rows)

setup(
    name=NAME,
    version=VERSION,
    description='A Django plugin for Apple Notification Service',
    long_description=read('README.rst'),
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Software Development :: Libraries',
        'Topic :: Software Development :: Libraries :: Application Frameworks',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ],
    keywords='django ios push notification apple apns',
    author='nnsnodnb',
    author_email='ahr63_gej@me.com',
    url='https://github.com/nnsnodnb/django-ios-notifications',
    download_url='https://github.com/nnsnodnb/django-ios-notifications/tarball/master',
    license='MIT',
    packages=find_packages(),
    include_package_data=True,
    package_data={
        '': ['README.rst',
             'requirements.txt',
             'requirements-test.txt'],
    },
    zip_safe=True,
    install_requires=readlist('requirements.txt'),
    test_suite='runtests.run_tests',
    tests_require=readlist('requirements-test.txt')
)

<|endoftext|>


<commit_before>"""Class to perform random under-sampling."""
from __future__ import print_function
from __future__ import division

import numpy as np

from collections import Counter

from sklearn.utils import check_X_y

from .under_sampler import UnderSampler

class RandomUnderSampler(UnderSampler):
    """Class to perform random under-sampling.

    Object to under sample the majority class(es) by randomly picking samples
    with or without replacement.

    Parameters
    ----------
    ratio : str or float, optional (default='auto')
        If 'auto', the ratio will be defined automatically to balanced
        the dataset. Otherwise, the ratio will corresponds to the number
        of samples in the minority class over the the number of samples
        in the majority class.

    return_indices : bool, optional (default=False)
        Either to return or not the indices which will be selected from
        the majority class.

    random_state : int or None, optional (default=None)
        Seed for random number generation.

    verbose : bool, optional (default=True)
        Boolean to either or not print information about the processing

    n_jobs : int, optional (default=-1)
        The number of thread to open when it is possible.

    Attributes
    ----------
    ratio_ : str or float, optional (default='auto')
        If 'auto', the ratio will be defined automatically to balanced
        the dataset. Otherwise, the ratio will corresponds to the number
        of samples in the minority class over the the number of samples
        in the majority class.

    rs_ : int or None, optional (default=None)
        Seed for random number generation.

    min_c_ : str or int
        The identifier of the minority class.

    max_c_ : str or int
        The identifier of the majority class.

    stats_c_ : dict of str/int : int
        A dictionary in which the number of occurences of each class is
        reported.

    Notes
    -----
    This class supports multi-class.

    """

    def __init__(self, ratio='auto', return_indices=False, random_state=None,
                 verbose=True, replacement=True):
        """Initialse the random under sampler object.

        Parameters
        ----------
        ratio : str or float, optional (default='auto')
            If 'auto', the ratio will be defined automatically to balanced
            the dataset. Otherwise, the ratio will corresponds to the number
            of samples in the minority class over the the number of samples
            in the majority class.

        return_indices : bool, optional (default=False)
            Either to return or not the indices which will be selected from
            the majority class.

        random_state : int or None, optional (default=None)
            Seed for random number generation.

        verbose : bool, optional (default=True)
            Boolean to either or not print information about the processing

        n_jobs : int, optional (default=-1)
            The number of thread to open when it is possible.

        Returns
        -------
        None

        """
        super(RandomUnderSampler, self).__init__(ratio=ratio,
                                                 return_indices=return_indices,
                                                 random_state=random_state,
                                                 verbose=verbose)

        self.replacement = replacement

    def fit(self, X, y):
        """Find the classes statistics before to perform sampling.

        Parameters
        ----------
        X : ndarray, shape (n_samples, n_features)
            Matrix containing the data which have to be sampled.

        y : ndarray, shape (n_samples, )
            Corresponding label for each sample in X.

        Returns
        -------
        self : object,
            Return self.

        """
        # Check the consistency of X and y
        X, y = check_X_y(X, y)

        super(RandomUnderSampler, self).fit(X, y)

        return self

    def transform(self, X, y):
        """Resample the dataset.

        Parameters
        ----------
        X : ndarray, shape (n_samples, n_features)
            Matrix containing the data which have to be sampled.

        y : ndarray, shape (n_samples, )
            Corresponding label for each sample in X.

        Returns
        -------
        X_resampled : ndarray, shape (n_samples_new, n_features)
            The array containing the resampled data.

        y_resampled : ndarray, shape (n_samples_new)
            The corresponding label of `X_resampled`

        idx_under : ndarray, shape (n_samples, )
            If `return_indices` is `True`, a boolean array will be returned
            containing the which samples have been selected.

        """
        # Check the consistency of X and y
        X, y = check_X_y(X, y)

        super(RandomUnderSampler, self).transform(X, y)

        # Compute the number of cluster needed
        if self.ratio_ == 'auto':
            num_samples = self.stats_c_[self.min_c_]
        else:
            num_samples = int(self.stats_c_[self.min_c_] / self.ratio_)

        # All the minority class samples will be preserved
        X_resampled = X[y == self.min_c_]
        y_resampled = y[y == self.min_c_]

        # If we need to offer support for the indices
        if self.return_indices:
            idx_under = np.nonzero(y == self.min_c_)[0]

        # Loop over the other classes under picking at random
        for key in self.stats_c_.keys():

            # If the minority class is up, skip it
            if key == self.min_c_:
                continue

            # Pick some elements at random
            np.random.seed(self.rs_)
            indx = range(np.count_nonzero(y == key))
            indx = np.random.choice(indx, size=num_samples,
                                    replace=self.replacement)

            # If we need to offer support for the indices selected
            if self.return_indices:
                idx_tmp = np.nonzero(y == key)[0][indx]
                idx_under = np.concatenate((idx_under, idx_tmp), axis=0)

            # Concatenate to the minority class
            X_resampled = np.concatenate((X_resampled, X[y == key][indx]),
                                         axis=0)
            y_resampled = np.concatenate((y_resampled, y[y == key][indx]),
                                         axis=0)

        if self.verbose:
            print("Under-sampling performed: {}".format(Counter(y_resampled)))

        # Check if the indices of the samples selected should be returned too
        if self.return_indices:
            # Return the indices of interest
            return X_resampled, y_resampled, idx_under
        else:
            return X_resampled, y_resampled
<commit_msg>Minor documentation edits<commit_after>"""Class to perform random under-sampling."""
from __future__ import print_function
from __future__ import division

import numpy as np

from collections import Counter

from sklearn.utils import check_X_y

from .under_sampler import UnderSampler

class RandomUnderSampler(UnderSampler):
    """Class to perform random under-sampling.

    Under-sample the majority class(es) by randomly picking samples
    with or without replacement.

    Parameters
    ----------
    ratio : str or float, optional (default='auto')
        If 'auto', the ratio will be defined automatically to balance
        the dataset. Otherwise, the ratio is defined as the number
        of samples in the minority class over the the number of samples
        in the majority class.

    return_indices : bool, optional (default=False)
        Whether or not to return the indices of the samples randomly selected
        from the majority class.

    random_state : int or None, optional (default=None)
        Seed for random number generation.

    verbose : bool, optional (default=True)
        Whether or not to print information about the processing.

    n_jobs : int, optional (default=-1)
        The number of threads to open if possible.

    Attributes
    ----------
    ratio_ : str or float, optional (default='auto')
        If 'auto', the ratio will be defined automatically to balance
        the dataset. Otherwise, the ratio is defined as the number
        of samples in the minority class over the the number of samples
        in the majority class.

    rs_ : int or None, optional (default=None)
        Seed for random number generation.

    min_c_ : str or int
        The identifier of the minority class.

    max_c_ : str or int
        The identifier of the majority class.

    stats_c_ : dict of str/int : int
        A dictionary containing the number of occurences of each class.

    Notes
    -----
    This class supports multi-class.

    """

    def __init__(self, ratio='auto', return_indices=False, random_state=None,
                 verbose=True, replacement=True):
        """Initialse the random under-sampler object.

        Parameters
        ----------
        ratio : str or float, optional (default='auto')
            If 'auto', the ratio will be defined automatically to balance
            the dataset. Otherwise, the ratio is defined as the number
            of samples in the minority class over the the number of samples
            in the majority class.

        return_indices : bool, optional (default=False)
            Whether or not to return the indices of the samples randomly selected
            from the majority class.

        random_state : int or None, optional (default=None)
            Seed for random number generation.

        verbose : bool, optional (default=True)
            Whether or not to print information about the processing

        n_jobs : int, optional (default=-1)
            The number of threads to open if possible.

        Returns
        -------
        None

        """
        super(RandomUnderSampler, self).__init__(ratio=ratio,
                                                 return_indices=return_indices,
                                                 random_state=random_state,
                                                 verbose=verbose)

        self.replacement = replacement

    def fit(self, X, y):
        """Find the class statistics before performing sampling.

        Parameters
        ----------
        X : ndarray, shape (n_samples, n_features)
            Matrix containing the data to be sampled.

        y : ndarray, shape (n_samples, )
            Corresponding label for each sample in X.

        Returns
        -------
        self : object,
            Return self.

        """
        # Check the consistency of X and y
        X, y = check_X_y(X, y)

        super(RandomUnderSampler, self).fit(X, y)

        return self

    def transform(self, X, y):
        """Resample the dataset.

        Parameters
        ----------
        X : ndarray, shape (n_samples, n_features)
            Matrix containing the data to be sampled.

        y : ndarray, shape (n_samples, )
            Corresponding label for each sample in X.

        Returns
        -------
        X_resampled : ndarray, shape (n_samples_new, n_features)
            The array containing the resampled data.

        y_resampled : ndarray, shape (n_samples_new)
            The corresponding label of `X_resampled`

        idx_under : ndarray, shape (n_samples, )
            If `return_indices` is `True`, an array will be returned
            containing a boolean for each sample to represent whether
            that sample was selected or not.

        """
        # Check the consistency of X and y
        X, y = check_X_y(X, y)

        super(RandomUnderSampler, self).transform(X, y)

        # Compute the number of clusters needed
        if self.ratio_ == 'auto':
            num_samples = self.stats_c_[self.min_c_]
        else:
            num_samples = int(self.stats_c_[self.min_c_] / self.ratio_)

        # All the minority class samples will be preserved
        X_resampled = X[y == self.min_c_]
        y_resampled = y[y == self.min_c_]

        # If we need to offer support for the indices
        if self.return_indices:
            idx_under = np.nonzero(y == self.min_c_)[0]

        # Loop over the other classes under-picking at random
        for key in self.stats_c_.keys():

            # If the minority class is up, skip it
            if key == self.min_c_:
                continue

            # Pick some elements at random
            np.random.seed(self.rs_)
            indx = range(np.count_nonzero(y == key))
            indx = np.random.choice(indx, size=num_samples,
                                    replace=self.replacement)

            # If we need to offer support for the indices selected
            if self.return_indices:
                idx_tmp = np.nonzero(y == key)[0][indx]
                idx_under = np.concatenate((idx_under, idx_tmp), axis=0)

            # Concatenate to the minority class
            X_resampled = np.concatenate((X_resampled, X[y == key][indx]),
                                         axis=0)
            y_resampled = np.concatenate((y_resampled, y[y == key][indx]),
                                         axis=0)

        if self.verbose:
            print("Under-sampling performed: {}".format(Counter(y_resampled)))

        # Check if the indices of the samples selected should be returned as well
        if self.return_indices:
            # Return the indices of interest
            return X_resampled, y_resampled, idx_under
        else:
            return X_resampled, y_resampled
<|endoftext|>


<commit_before>#!/usr/bin/env python
# encoding: utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# $Id$

import os.path

try:
    from ez_setup import use_setuptools
    use_setuptools()
except ImportError:
    pass

try:
    from setuptools import setup, find_packages
except ImportError:
    from distutils.core import setup, find_packages

version = '1.8.3'

_descr = u'''**********
tika
***************

.. contents::
Tika python pure REST based library.
'''
_keywords = 'tika digital babel fish apache'
_classifiers = [
    'Development Status :: 3 - Alpha',
    'Environment :: Console',
    'Intended Audience :: Developers',
    'Intended Audience :: Information Technology',
    'Intended Audience :: Science/Research',
    'License :: OSI Approved :: Apache Software License',
    'Operating System :: OS Independent',
    'Programming Language :: Python',
    'Topic :: Database :: Front-Ends',
    'Topic :: Scientific/Engineering',
    'Topic :: Software Development :: Libraries :: Python Modules',
]

def read(*rnames):
    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()

long_description = _descr

setup(
    name='tika',
    version=version,
    description='Apache Tika Python library',
    long_description=long_description,
    classifiers=_classifiers,
    keywords=_keywords,
    author='Chris Mattmann',
    author_email='chris.a.mttmnn@nasa.gov',
    url='http://github.com/chrismattmann/tika-python',
    download_url='http://github.com/chrismattmann/tika-python',
    license=read('LICENSE.txt'),
    packages=find_packages(exclude=['ez_setup']),
    namespace_packages=['tika'],
    include_package_data=True,
    zip_safe=True,
    test_suite='tika.tests',
    entry_points={
        'console_scripts': [
            'tika-python = tika.tika:main'
        ],
    },
    package_data = {
        # And include any *.conf files found in the 'conf' subdirectory
        # for the package
    },
    install_requires=[
        'setuptools',
        'requests'
    ],
    extras_require={
    },
)
<commit_msg>- time for a republish<commit_after>#!/usr/bin/env python
# encoding: utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# $Id$

import os.path

try:
    from ez_setup import use_setuptools
    use_setuptools()
except ImportError:
    pass

try:
    from setuptools import setup, find_packages
except ImportError:
    from distutils.core import setup, find_packages

version = '1.8.4'

_descr = u'''**********
tika
***************

.. contents::
Tika python pure REST based library.
'''
_keywords = 'tika digital babel fish apache'
_classifiers = [
    'Development Status :: 3 - Alpha',
    'Environment :: Console',
    'Intended Audience :: Developers',
    'Intended Audience :: Information Technology',
    'Intended Audience :: Science/Research',
    'License :: OSI Approved :: Apache Software License',
    'Operating System :: OS Independent',
    'Programming Language :: Python',
    'Topic :: Database :: Front-Ends',
    'Topic :: Scientific/Engineering',
    'Topic :: Software Development :: Libraries :: Python Modules',
]

def read(*rnames):
    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()

long_description = _descr

setup(
    name='tika',
    version=version,
    description='Apache Tika Python library',
    long_description=long_description,
    classifiers=_classifiers,
    keywords=_keywords,
    author='Chris Mattmann',
    author_email='chris.a.mttmnn@nasa.gov',
    url='http://github.com/chrismattmann/tika-python',
    download_url='http://github.com/chrismattmann/tika-python',
    license=read('LICENSE.txt'),
    packages=find_packages(exclude=['ez_setup']),
    namespace_packages=['tika'],
    include_package_data=True,
    zip_safe=True,
    test_suite='tika.tests',
    entry_points={
        'console_scripts': [
            'tika-python = tika.tika:main'
        ],
    },
    package_data = {
        # And include any *.conf files found in the 'conf' subdirectory
        # for the package
    },
    install_requires=[
        'setuptools',
        'requests'
    ],
    extras_require={
    },
)
<|endoftext|>


<commit_before>#!/usr/bin/env python
from setuptools import setup, find_packages
import os
import re
import sys

version = '0.1.0'
name = 'django-allejo'
package = 'allejo'
description = 'Management and creation for custom tournaments and \
rankings for many sports.'
url = 'http://github.com/lerrua/django-allejo'
author = 'Igor P. Leroy'
author_email = 'ip.leroy@gmail.com'
license = 'BSD'
install_requires = []

setup(
    name=name,
    version=version,
    url=url,
    author=author,
    author_email=author_email,
    license=license,
    packages=find_packages(),
    include_package_data=True,
    description=description,
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: Apache Software License",
        "Programming Language :: Python",
        "Operating System :: OS Independent",
        "Topic :: Software Development :: Libraries",
        "Topic :: Utilities",
        "Environment :: Web Environment",
        "Framework :: Django",
    ],
    install_requires=install_requires
)
<commit_msg>Set keyworks key at setup.py<commit_after>#!/usr/bin/env python
from setuptools import setup, find_packages
import os
import re
import sys

version = '0.1.0'
name = 'django-allejo'
package = 'allejo'
description = 'Management and creation for custom tournaments and \
rankings for many sports.'
url = 'http://github.com/lerrua/django-allejo'
author = 'Igor P. Leroy'
author_email = 'ip.leroy@gmail.com'
license = 'BSD'
install_requires = []

setup(
    name=name,
    version=version,
    url=url,
    author=author,
    author_email=author_email,
    license=license,
    packages=find_packages(),
    include_package_data=True,
    description=description,
    keywords = ['standings', 'soccer', 'football', 'ranking'],
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: Apache Software License",
        "Programming Language :: Python",
        "Operating System :: OS Independent",
        "Topic :: Software Development :: Libraries",
        "Topic :: Utilities",
        "Environment :: Web Environment",
        "Framework :: Django",
    ],
    install_requires=install_requires
)
<|endoftext|>