<commit_before>from setuptools import setup, find_packages

with open('parsl/version.py') as f:
    exec(f.read())

with open('requirements.txt') as f:
    install_requires = f.readlines()

setup(
    name='parsl',
    version=VERSION,
    description='Simple data dependent workflows in Python',
    long_description='Simple parallel workflows system for Python',
    url='https://github.com/Parsl/parsl',
    author='The Parsl Team',
    author_email='parsl-user@googlegroups.com',
    license='Apache 2.0',
    download_url='https://github.com/Parsl/parsl/archive/{}.tar.gz'.format(VERSION),
    package_data={'': ['LICENSE']},
    packages=find_packages(),
    install_requires=install_requires,
    extras_require = {
        'db_logging' : ['CMRESHandler', 'psutil', 'sqlalchemy'],
        'aws' : ['boto3'],
        'azure' : ['azure-mgmt>=2.0.0', 'haikunator'],
        'jetstream' : ['python-novaclient']
        },
    classifiers = [
        # Maturity
        'Development Status :: 3 - Alpha',
        # Intended audience
        'Intended Audience :: Developers',
        # Licence, must match with licence above
        'License :: OSI Approved :: Apache Software License',
        # Python versions supported
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
    ],
    keywords=['Workflows', 'Scientific computing'],
)
<commit_msg>Use non-user parsl email<commit_after>from setuptools import setup, find_packages

with open('parsl/version.py') as f:
    exec(f.read())

with open('requirements.txt') as f:
    install_requires = f.readlines()

setup(
    name='parsl',
    version=VERSION,
    description='Simple data dependent workflows in Python',
    long_description='Simple parallel workflows system for Python',
    url='https://github.com/Parsl/parsl',
    author='The Parsl Team',
    author_email='parsl@googlegroups.com',
    license='Apache 2.0',
    download_url='https://github.com/Parsl/parsl/archive/{}.tar.gz'.format(VERSION),
    package_data={'': ['LICENSE']},
    packages=find_packages(),
    install_requires=install_requires,
    extras_require = {
        'db_logging' : ['CMRESHandler', 'psutil', 'sqlalchemy'],
        'aws' : ['boto3'],
        'azure' : ['azure-mgmt>=2.0.0', 'haikunator'],
        'jetstream' : ['python-novaclient']
        },
    classifiers = [
        # Maturity
        'Development Status :: 3 - Alpha',
        # Intended audience
        'Intended Audience :: Developers',
        # Licence, must match with licence above
        'License :: OSI Approved :: Apache Software License',
        # Python versions supported
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
    ],
    keywords=['Workflows', 'Scientific computing'],
)
<|endoftext|>


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

import pylibdmtx

SCRIPTS = ['read_datamatrix']

# Optional dependency
PILLOW = 'Pillow>=3.2.0'

URL = 'https://github.com/NaturalHistoryMuseum/pylibdmtx/'

setup_data = {
    'name': 'pylibdmtx',
    'version': pylibdmtx.__version__,
    'author': 'Lawrence Hudson',
    'author_email': 'l.hudson@nhm.ac.uk',
    'url': URL,
    'license': 'MIT',
    'description': pylibdmtx.__doc__,
    'long_description': 'Visit {0} for more details.'.format(URL),
    'packages': ['pylibdmtx', 'pylibdmtx.tests'],
    'test_suite': 'pylibdmtx.tests',
    'scripts': ['pylibdmtx/scripts/{0}.py'.format(script) for script in SCRIPTS],
    'entry_points': {
        'console_scripts':
            ['{0}=pylibdmtx.scripts.{0}:main'.format(script) for script in SCRIPTS],
    },
    'extras_require': {
        ':python_version=="2.7"': ['enum34>=1.1.6', 'pathlib>=1.0.1'],
        'scripts': [
            PILLOW,
        ],
    },
    'tests_require': [
        # TODO How to specify OpenCV? 'cv2>=2.4.8,<3',
        'nose>=1.3.4',
        PILLOW
    ],
    'include_package_data': True,
    'package_data': {'pylibdmtx': ['pylibdmtx/tests/*.png']},
    'classifiers': [
        'Development Status :: 4 - Beta',
        'License :: OSI Approved :: MIT License',
        'Topic :: Utilities',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
    ],
}

if 'bdist_wheel' in sys.argv and ('--plat-name=win32' in sys.argv or '--plat-name=win_amd64' in sys.argv):
    # Include the libdmtx runtime DLL and its license in 'data_files'
    dll = 'libdmtx-{0}.dll'.format(
        '32' if '--plat-name=win32' in sys.argv else '64'
    )
    data_files = setup_data.get('data_files', [])
    data_files.append(('', ['libdmtx-LICENSE.txt', '{0}'.format(dll)]))
    setup_data['data_files'] = data_files

def setuptools_setup():
    from setuptools import setup
    setup(**setup_data)

if (2, 7) == sys.version_info[:2] or (3, 4) <= sys.version_info:
    setuptools_setup()
else:
    sys.exit('Python versions 2.7 and >= 3.4 are supported')
<commit_msg>Include rst README and scripts package<commit_after>#!/usr/bin/env python
import sys

import pylibdmtx

SCRIPTS = ['read_datamatrix']

# Optional dependency
PILLOW = 'Pillow>=3.2.0'

URL = 'https://github.com/NaturalHistoryMuseum/pylibdmtx/'

def readme():
    try:
        # README.rst is generated from README.md (see DEVELOPING.md)
        with open('README.rst') as f:
            return f.read()
    except:
        return 'Visit {0} for more details.'.format(URL)

setup_data = {
    'name': 'pylibdmtx',
    'version': pylibdmtx.__version__,
    'author': 'Lawrence Hudson',
    'author_email': 'l.hudson@nhm.ac.uk',
    'url': URL,
    'license': 'MIT',
    'description': pylibdmtx.__doc__,
    'packages': ['pylibdmtx', 'pylibdmtx.scripts', 'pylibdmtx.tests'],
    'test_suite': 'pylibdmtx.tests',
    'scripts': ['pylibdmtx/scripts/{0}.py'.format(script) for script in SCRIPTS],
    'entry_points': {
        'console_scripts':
            ['{0}=pylibdmtx.scripts.{0}:main'.format(script) for script in SCRIPTS],
    },
    'extras_require': {
        ':python_version=="2.7"': ['enum34>=1.1.6', 'pathlib>=1.0.1'],
        'scripts': [
            PILLOW,
        ],
    },
    'tests_require': [
        # TODO How to specify OpenCV? 'cv2>=2.4.8,<3',
        'nose>=1.3.4',
        PILLOW
    ],
    'include_package_data': True,
    'package_data': {'pylibdmtx': ['pylibdmtx/tests/*.png']},
    'classifiers': [
        'Development Status :: 4 - Beta',
        'License :: OSI Approved :: MIT License',
        'Topic :: Utilities',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
    ],
}

if 'bdist_wheel' in sys.argv and ('--plat-name=win32' in sys.argv or '--plat-name=win_amd64' in sys.argv):
    # Include the libdmtx runtime DLL and its license in 'data_files'
    dll = 'libdmtx-{0}.dll'.format(
        '32' if '--plat-name=win32' in sys.argv else '64'
    )
    data_files = setup_data.get('data_files', [])
    data_files.append(('', ['libdmtx-LICENSE.txt', '{0}'.format(dll)]))
    setup_data['data_files'] = data_files

def setuptools_setup():
    from setuptools import setup
    setup(**setup_data)

if (2, 7) == sys.version_info[:2] or (3, 4) <= sys.version_info:
    setuptools_setup()
else:
    sys.exit('Python versions 2.7 and >= 3.4 are supported')
<|endoftext|>


<commit_before>###############################################################################
# Copyright 2015-2020 University of Florida. All rights reserved.
# This file is part of UF CTS-IT's NACCulator project.
# Use of this source code is governed by the license found in the LICENSE file.
###############################################################################

from setuptools import setup, find_packages

VERSION = "1.2.0"

setup(
    name="nacculator",
    version=VERSION,
    author="Taeber Rapczak",
    author_email="taeber@ufl.edu",
    maintainer="UF CTS-IT",
    maintainer_email="ctsit@ctsi.ufl.edu",
    url="https://github.com/ctsit/nacculator",
    license="BSD 2-Clause",
    description="CSV to NACC's UDS3 format converter",
    keywords=["REDCap", "NACC", "UDS", "Clinical data"],
    download_url="https://github.com/ctsit/nacculator/releases/tag/" + VERSION,

    package_dir={'nacc': 'nacc'},
    packages=find_packages(),

    entry_points={
        "console_scripts": [
            "redcap2nacc = nacc.redcap2nacc:main",
            "nacculator_filters = nacc.run_filters:main"
        ]
    },

    install_requires=[
        "cappy @ git+https://github.com/ctsit/cappy.git@2.0.0"
    ],

    python_requires=">=3.6.0",
)
<commit_msg>Modify cappy dependency to work with Python 3.8<commit_after>###############################################################################
# Copyright 2015-2020 University of Florida. All rights reserved.
# This file is part of UF CTS-IT's NACCulator project.
# Use of this source code is governed by the license found in the LICENSE file.
###############################################################################

from setuptools import setup, find_packages

VERSION = "1.2.0"

setup(
    name="nacculator",
    version=VERSION,
    author="Taeber Rapczak",
    author_email="taeber@ufl.edu",
    maintainer="UF CTS-IT",
    maintainer_email="ctsit@ctsi.ufl.edu",
    url="https://github.com/ctsit/nacculator",
    license="BSD 2-Clause",
    description="CSV to NACC's UDS3 format converter",
    keywords=["REDCap", "NACC", "UDS", "Clinical data"],
    download_url="https://github.com/ctsit/nacculator/releases/tag/" + VERSION,

    package_dir={'nacc': 'nacc'},
    packages=find_packages(),

    entry_points={
        "console_scripts": [
            "redcap2nacc = nacc.redcap2nacc:main",
            "nacculator_filters = nacc.run_filters:main"
        ]
    },

    dependency_links=[
        "git+https://github.com/ctsit/cappy.git@2.0.0#egg=cappy-2.0.0"
    ],
    install_requires=[
        "cappy==2.0.0"
    ],

    python_requires=">=3.6.0",
)
<|endoftext|>


<commit_before>"""Defines Hello message."""

# System imports

# Third-party imports

from pyof.foundation.base import GenericMessage
from pyof.v0x01.common.header import Header, Type

__all__ = ('Hello',)

# Classes

class Hello(GenericMessage):
    """OpenFlow Hello Message.

    This message does not contain a body beyond the OpenFlow Header.
    """

    header = Header(message_type=Type.OFPT_HELLO, length=8)
<commit_msg>Add optional elements in v0x01 Hello<commit_after>"""Defines Hello message."""

# System imports

# Third-party imports

from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import BinaryData
from pyof.v0x01.common.header import Header, Type

__all__ = ('Hello',)

# Classes

class Hello(GenericMessage):
    """OpenFlow Hello Message.

    This message does not contain a body beyond the OpenFlow Header.
    """

    header = Header(message_type=Type.OFPT_HELLO, length=8)
    elements = BinaryData()
<|endoftext|>


<commit_before>from setuptools import setup
import os

with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as desc_file:
    description = desc_file.read().replace(':class:', '')

setup(
    name='aiowerkzeug',
    url='https://github.com/alfred82santa/aiowerkzeug',
    author='alfred82santa',
    version='0.1.1',
    author_email='alfred82santa@gmail.com',
    classifiers=[
        'Intended Audience :: Developers',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.4',
        'License :: OSI Approved :: MIT License',
        'Development Status :: 3 - Alpha'],
    packages=['aiowerkzeug'],
    include_package_data=True,
    install_requires=['werkzeug', 'hachiko', 'aiohttp'],
    description="Werkzeug for asyncio",
    long_description=description,
    test_suite="nose.collector",
    tests_require="nose",
    zip_safe=True,
)
<commit_msg>Better pypi desc<commit_after>from setuptools import setup
import os

with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as desc_file:
    description = desc_file.read().replace(':class:', '').replace(':func:', '')

setup(
    name='aiowerkzeug',
    url='https://github.com/alfred82santa/aiowerkzeug',
    author='alfred82santa',
    version='0.1.2',
    author_email='alfred82santa@gmail.com',
    classifiers=[
        'Intended Audience :: Developers',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.4',
        'License :: OSI Approved :: MIT License',
        'Development Status :: 3 - Alpha'],
    packages=['aiowerkzeug'],
    include_package_data=True,
    install_requires=['werkzeug', 'hachiko', 'aiohttp'],
    description="Werkzeug for asyncio",
    long_description=description,
    test_suite="nose.collector",
    tests_require="nose",
    zip_safe=True,
)
<|endoftext|>


<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Colin Duquesnoy
#
# This file is part of pyQode.
#
# pyQode is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# pyQode is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with pyQode. If not, see http://www.gnu.org/licenses/.
#
""" Contains the automatic generic indenter """
import re
from pyqode.core.mode import Mode
from pyqode.qt.QtCore import Qt
from pyqode.qt.QtGui import QTextCursor, QKeyEvent

class AutoIndentMode(Mode):
    """ A basic auto indent mode that provides a basic auto indentation based
    on the previous line indentation.

    This mode can be extended by overriding the _getIndent method.
    """
    #: Mode identifier
    IDENTIFIER = "autoIndentMode"
    DESCRIPTION = """ A basic auto indent mode that provides a basic auto
    indentation based on the previous line indentation.
    """

    def __init__(self):
        super(AutoIndentMode, self).__init__()
        self.minIndent = 0

    def _getIndent(self, tc):
        """
        Return the indentation text (a series of spaces, tabs)

        :param tc: QTextCursor
        """
        pos = tc.position()
        # tc.movePosition(QTextCursor.StartOfLine)
        # tc.setPosition(tc.position() - 1)
        tc.movePosition(QTextCursor.StartOfLine)
        tc.setPosition(tc.position() - 1)
        tc.select(QTextCursor.LineUnderCursor)
        s = tc.selectedText()
        indent = re.match(r"\s*", s).group()
        tc.setPosition(pos)
        if len(indent) < self.minIndent:
            indent = self.minIndent
        return indent

    def _onStateChanged(self, state):
        if state is True:
            self.editor.postKeyPressed.connect(self.__onKeyPressed)
        else:
            self.editor.postKeyPressed.disconnect(self.__onKeyPressed)

    def __onKeyPressed(self, keyEvent):
        """
        Auto indent if the released key is the return key.
        :param keyEvent: the key event
        """
        if keyEvent.isAccepted():
            return
        if keyEvent.key() == Qt.Key_Return or keyEvent.key() == Qt.Key_Enter:
            tc = self.editor.textCursor()
            indent = self._getIndent(tc)
            tc.insertText(indent)
<commit_msg>IndenterMode: Fix bug with min indent<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Colin Duquesnoy
#
# This file is part of pyQode.
#
# pyQode is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# pyQode is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with pyQode. If not, see http://www.gnu.org/licenses/.
#
""" Contains the automatic generic indenter """
import re
from pyqode.core.mode import Mode
from pyqode.qt.QtCore import Qt
from pyqode.qt.QtGui import QTextCursor, QKeyEvent

class AutoIndentMode(Mode):
    """ A basic auto indent mode that provides a basic auto indentation based
    on the previous line indentation.

    This mode can be extended by overriding the _getIndent method.
    """
    #: Mode identifier
    IDENTIFIER = "autoIndentMode"
    DESCRIPTION = """ A basic auto indent mode that provides a basic auto
    indentation based on the previous line indentation.
    """

    def __init__(self):
        super(AutoIndentMode, self).__init__()
        self.minIndent = 0

    def _getIndent(self, tc):
        """
        Return the indentation text (a series of spaces, tabs)

        :param tc: QTextCursor
        """
        pos = tc.position()
        # tc.movePosition(QTextCursor.StartOfLine)
        # tc.setPosition(tc.position() - 1)
        tc.movePosition(QTextCursor.StartOfLine)
        tc.setPosition(tc.position() - 1)
        tc.select(QTextCursor.LineUnderCursor)
        s = tc.selectedText()
        indent = re.match(r"\s*", s).group()
        tc.setPosition(pos)
        if len(indent) < len(self.minIndent):
            indent = self.minIndent
        return indent

    def _onStateChanged(self, state):
        if state is True:
            self.editor.postKeyPressed.connect(self.__onKeyPressed)
        else:
            self.editor.postKeyPressed.disconnect(self.__onKeyPressed)

    def __onKeyPressed(self, keyEvent):
        """
        Auto indent if the released key is the return key.
        :param keyEvent: the key event
        """
        if keyEvent.isAccepted():
            return
        if keyEvent.key() == Qt.Key_Return or keyEvent.key() == Qt.Key_Enter:
            tc = self.editor.textCursor()
            indent = self._getIndent(tc)
            tc.insertText(indent)
<|endoftext|>


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

from setuptools import find_packages, setup

setup(name='dingo',
      author='openego development group',
      description='DIstribution Network GeneratOr',
      packages=find_packages(),
      install_requires=['networkx >= 1.11, <= 1.11',
                        'geopy >= 1.11.0, <= 1.11.0',
                        'pandas >= 0.17.0 <= 0.19.1',
                        'pyomo >= 5.0.1, <= 5.0.1',
                        'pyproj >= 1.9.5.1, >= 1.9.5.1',
                        'geoalchemy2 >= 0.3.0, <=0.4.0',
                        'matplotlib  >=1.5.3, <= 1.5.3',
                        'egoio >=0.0.2, <= 0.0.2',
                        'oemof.db  >=0.0.4, <= 0.0.4',
                        'egopowerflow >=0.0.2, <= 0.0.2',
                        ]
     )
<commit_msg>add missing requirements to setup.py<commit_after>#! /usr/bin/env python

from setuptools import find_packages, setup

setup(name='dingo',
      author='openego development group',
      description='DIstribution Network GeneratOr',
      packages=find_packages(),
      install_requires=['networkx >= 1.11, <= 1.11',
                        'geopy >= 1.11.0, <= 1.11.0',
                        'pandas >= 0.17.0 <= 0.19.1',
                        'pyomo >= 5.0.1, <= 5.0.1',
                        'pyproj >= 1.9.5.1, <= 1.9.5.1',
                        'sqlalchemy >= 1.0.11, <= 1.1.4',
                        'geoalchemy2 >= 0.2.6, <= 0.4.0',
                        'matplotlib  >= 1.5.3, <= 1.5.3',
                        'egoio >= 0.0.2, <= 0.0.2',
                        'oemof.db  >= 0.0.4, <= 0.0.4',
                        'egopowerflow >= 0.0.2, <= 0.0.2',
                        'shapely >= 1.5.12, <= 1.5.12',
                        'pypsa >= 0.7.1, <= 0.7.1'
                        ]
     )
<|endoftext|>


<commit_before>from setuptools import setup
from setuptools.command.test import test as TestCommand
import os
import sys

if sys.version_info < (3, 4, 2):
    # This is the minimum version supported by aiohttp.
    raise RuntimeError("hangups requires Python 3.4.2+")

# Find __version__ without import that requires dependencies to be installed:
exec(open(os.path.join(
    os.path.dirname(__file__), 'hangups/version.py'
)).read())

class PytestCommand(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = ['hangups']
        self.test_suite = True

    def run_tests(self):
        import pytest
        errno = pytest.main(self.test_args)
        sys.exit(errno)

class PylintCommand(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pylint.lint
        # Exits with number of messages.
        pylint.lint.Run(['--reports=n', 'hangups'])

class Pep8Command(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pycodestyle
        style_guide = pycodestyle.StyleGuide(config_file='setup.cfg')
        report = style_guide.check_files(['hangups'])
        if report.total_errors:
            sys.exit(1)

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

# Dependencies should be specified as a specific version or version range that
# is unlikely to break compatibility in the future. This is required to prevent
# hangups from breaking when new versions of dependencies are released,
# especially for end-users (non-developers) who use pip to install hangups.
install_requires = [
    'ConfigArgParse==0.11.0',
    'aiohttp>=1.2,<3',
    'appdirs>=1.4,<1.5',
    'readlike==0.1.2',
    'requests>=2.6.0,<3',  # uses semantic versioning (after 2.6)
    'ReParser==1.4.3',
    'protobuf>=3.1.0,<3.2.0',
    'urwid==1.3.1',
    'MechanicalSoup==0.6.0',
]

if sys.version_info < (3, 4, 3):
    # For Python earlier than 3.4.3, use a backported asyncio that fixes an
    # issue with an exception being logged on exit.
    install_requires.append('asyncio==3.4.3')

setup(
    name='hangups',
    version=__version__,
    description=('the first third-party instant messaging client for Google '
                 'Hangouts'),
    long_description=readme,
    url='https://github.com/tdryer/hangups',
    author='Tom Dryer',
    author_email='tomdryer.com@gmail.com',
    license='MIT',
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Developers',
        'Intended Audience :: End Users/Desktop',
        'Natural Language :: English',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 3 :: Only',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Communications :: Chat',
        'Environment :: Console :: Curses',
    ],
    packages=['hangups', 'hangups.ui'],
    install_requires=install_requires,
    tests_require=[
        'pytest==3.0.5',
        'pylint==1.6.4',
        'pycodestyle==2.2.0',
        'httpretty==0.8.14',
    ],
    cmdclass={
        'test': PytestCommand,
        'lint': PylintCommand,
        'style': Pep8Command,
    },
    entry_points={
        'console_scripts': [
            'hangups=hangups.ui.__main__:main',
        ],
    },
)
<commit_msg>Increase minimum aiohttp requirement<commit_after>from setuptools import setup
from setuptools.command.test import test as TestCommand
import os
import sys

if sys.version_info < (3, 4, 2):
    # This is the minimum version supported by aiohttp.
    raise RuntimeError("hangups requires Python 3.4.2+")

# Find __version__ without import that requires dependencies to be installed:
exec(open(os.path.join(
    os.path.dirname(__file__), 'hangups/version.py'
)).read())

class PytestCommand(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = ['hangups']
        self.test_suite = True

    def run_tests(self):
        import pytest
        errno = pytest.main(self.test_args)
        sys.exit(errno)

class PylintCommand(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pylint.lint
        # Exits with number of messages.
        pylint.lint.Run(['--reports=n', 'hangups'])

class Pep8Command(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pycodestyle
        style_guide = pycodestyle.StyleGuide(config_file='setup.cfg')
        report = style_guide.check_files(['hangups'])
        if report.total_errors:
            sys.exit(1)

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

# Dependencies should be specified as a specific version or version range that
# is unlikely to break compatibility in the future. This is required to prevent
# hangups from breaking when new versions of dependencies are released,
# especially for end-users (non-developers) who use pip to install hangups.
install_requires = [
    'ConfigArgParse==0.11.0',
    'aiohttp>=1.3,<3',
    'appdirs>=1.4,<1.5',
    'readlike==0.1.2',
    'requests>=2.6.0,<3',  # uses semantic versioning (after 2.6)
    'ReParser==1.4.3',
    'protobuf>=3.1.0,<3.2.0',
    'urwid==1.3.1',
    'MechanicalSoup==0.6.0',
]

if sys.version_info < (3, 4, 3):
    # For Python earlier than 3.4.3, use a backported asyncio that fixes an
    # issue with an exception being logged on exit.
    install_requires.append('asyncio==3.4.3')

setup(
    name='hangups',
    version=__version__,
    description=('the first third-party instant messaging client for Google '
                 'Hangouts'),
    long_description=readme,
    url='https://github.com/tdryer/hangups',
    author='Tom Dryer',
    author_email='tomdryer.com@gmail.com',
    license='MIT',
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Developers',
        'Intended Audience :: End Users/Desktop',
        'Natural Language :: English',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 3 :: Only',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Communications :: Chat',
        'Environment :: Console :: Curses',
    ],
    packages=['hangups', 'hangups.ui'],
    install_requires=install_requires,
    tests_require=[
        'pytest==3.0.5',
        'pylint==1.6.4',
        'pycodestyle==2.2.0',
        'httpretty==0.8.14',
    ],
    cmdclass={
        'test': PytestCommand,
        'lint': PylintCommand,
        'style': Pep8Command,
    },
    entry_points={
        'console_scripts': [
            'hangups=hangups.ui.__main__:main',
        ],
    },
)
<|endoftext|>


<commit_before>import pyroSAR
from pyroSAR import spatial
import pytest
import tarfile as tf
import sys
import os
from datetime import datetime

testdir = os.getenv('TESTDATA_DIR', 'pyroSAR/tests/data/')

testcases = [
    #SAFE
    {'path': os.path.join('pyroSAR/tests/data/', 'S1A_IW_GRDH_1SDV_20150222T170750_20150222T170815_004739_005DD8_3768.zip'),
     'acquisition_mode': 'IW',
     'bbox_area': 7.573045244595988,
     'compression': 'zip',
     'corners': {'ymax': 52.183979, 'ymin': 50.295261, 'xmin': 8.017178, 'xmax': 12.0268},
     'hgt_len': 15,
     'lines': 16685,
     'outname': 'S1A__IW___A_20150222T170750',
     'orbit': 'A',
     'polarizations': ['VV', 'VH'],
     'product': 'GRD',
     'samples': 25368,
     'sensor': 'S1A',
     'spacing': (10.0, 9.998647),
     'start': '20150222T170750',
     'stop': '20150222T170815'
     }
]

@pytest.fixture
def scene(case):
    case['pyro'] = pyroSAR.identify(case['path'])
    return case

@pytest.mark.parametrize('case', testcases)
class Test_Metadata():
    def test_attributes(self, scene):
        assert scene['pyro'].acquisition_mode == scene['acquisition_mode']
        assert scene['pyro'].compression == scene['compression']
        assert scene['pyro'].getCorners() == scene['corners']
        assert scene['pyro'].lines == scene['lines']
        assert scene['pyro'].outname_base() == scene['outname']
        assert scene['pyro'].orbit == scene['orbit']
        assert scene['pyro'].polarizations == scene['polarizations']
        assert scene['pyro'].product == scene['product']
        assert scene['pyro'].samples == scene['samples']
        assert scene['pyro'].start == scene['start']
        assert scene['pyro'].stop == scene['stop']
        assert scene['pyro'].sensor == scene['sensor']
        assert scene['pyro'].spacing == scene['spacing']
        assert len(scene['pyro'].getHGT()) == scene['hgt_len']

testdata = 'pyroSAR/tests/data/'
testfile1 = os.path.join(testdata, 'S1A_IW_GRDH_1SDV_20150222T170750_20150222T170815_004739_005DD8_3768.zip')
testfile2 = os.path.join(testdata, 'S1A__IW___A_20150309T173017_VV_grd_mli_geo_norm_db.tif')

def test_identify_fail():
    with pytest.raises(OSError):
        pyroSAR.identify(os.path.join(testdir, 'foobar'))
    with pytest.raises(RuntimeError):
        pyroSAR.identify(testfile2)

def test_identify_many_fail():
    assert pyroSAR.identify_many([testfile2]) == []

def test_filter_processed():
    scene = pyroSAR.identify(testfile1)
    outdir = 'pyroSAR/tests'
    assert len(pyroSAR.filter_processed([scene], outdir)) == 1

def test_parse_date():
    with pytest.raises(ValueError):
        print(pyroSAR.parse_date(1))
    with pytest.raises(ValueError):
        print(pyroSAR.parse_date('foobar'))
    assert pyroSAR.parse_date(datetime(2006, 11, 21)) == '20061121T000000'

def test_export2dict():
    pass

def test_getFileObj(tmpdir):
    scene = pyroSAR.identify(testfile1)
    scene.unpack(str(tmpdir))
    scene = pyroSAR.identify(scene.scene)
    item = scene.findfiles('manifest.safe')[0]
    assert os.path.basename(item) == 'manifest.safe'
    assert isinstance(scene.getFileObj(item).read(), (bytes, str))

    filename = os.path.join(str(tmpdir), os.path.basename(testfile1.replace('zip', 'tar.gz')))
    with tf.open(filename, 'w:gz') as tar:
        tar.add(scene.scene, arcname=os.path.basename(scene.scene))
    scene = pyroSAR.identify(filename)
    assert scene.compression == 'tar'
    item = scene.findfiles('manifest.safe')[0]
    assert isinstance(scene.getFileObj(item).read(), (bytes, str))
    with pytest.raises(RuntimeError):
        pyroSAR.getFileObj('foo', 'bar')

def test_scene(tmpdir):
    dbfile = os.path.join(str(tmpdir), 'scenes.db')
    id = pyroSAR.identify(testfile1)
    assert isinstance(id.export2dict(), dict)
    with pytest.raises(RuntimeError):
        assert isinstance(id.gdalinfo(), dict)
    id.summary()
    id.bbox(outname=os.path.join(str(tmpdir), 'bbox_test.shp'), overwrite=True)
    assert id.is_processed(str(tmpdir)) is False
    id.unpack(str(tmpdir), overwrite=True)
    assert id.compression is None
    id.export2sqlite(dbfile)
    with pytest.raises(IOError):
        id.getGammaImages()
    assert id.getGammaImages(id.scene) == []
    osvdir = os.path.join(id.scene, 'osv')
    if sys.version_info >= (2, 7, 9):
        id.getOSV(osvdir)
        with pyroSAR.OSV(osvdir) as osv:
            with pytest.raises(IOError):
                osv.catch(osvtype='XYZ')
            res = osv.catch(osvtype='RES', start=osv.mindate('POE'), stop=osv.maxdate('POE'))
            osv.retrieve(res)

            assert len(osv.getLocals('POE')) == 3
            assert len(osv.getLocals('RES')) == 21
            assert osv.match(id.start, 'POE') is not None
            assert osv.match(id.start, 'RES') is None
            osv.clean_res()
    else:
        with pytest.raises(RuntimeError):
            id.getOSV(osvdir, osvType='POE')

def test_archive(tmpdir):
    id = pyroSAR.identify(testfile1)
    dbfile = os.path.join(str(tmpdir), 'scenes.db')
    db = pyroSAR.Archive(dbfile)
    db.insert(testfile1, verbose=False)
    assert db.is_registered(testfile1) is True
    assert len(db.get_unique_directories()) == 1
    assert db.select_duplicates() == []
    assert db.select_duplicates(outname_base='S1A__IW___A_20150222T170750', scene='scene.zip') == []
    assert len(db.select(mindate='20141001T192312', maxdate='20201001T192312')) == 1
    assert len(db.select(polarizations=['VV'])) == 1
    assert len(db.select(vectorobject=id.bbox())) == 1
    with pytest.raises(IOError):
        db.filter_scenelist([1])
    db.close()
    with pyroSAR.Archive(dbfile) as db:
        assert db.size == (1, 0)
        shp = os.path.join(str(tmpdir), 'db.shp')
        db.export2shp(shp)
    assert spatial.Vector(shp).nfeatures == 1
    os.remove(dbfile)
    dbfile_old = os.path.join(testdata, 'archive_outdated.csv')
    with pytest.raises(OSError):
        with pyroSAR.Archive(dbfile) as db:
            db.import_outdated(dbfile_old)
<commit_msg>moved osv testing to separate function<commit_after>import pyroSAR
from pyroSAR import spatial
import pytest
import tarfile as tf
import sys
import os
from datetime import datetime

testdir = os.getenv('TESTDATA_DIR', 'pyroSAR/tests/data/')

testcases = [
    #SAFE
    {'path': os.path.join('pyroSAR/tests/data/', 'S1A_IW_GRDH_1SDV_20150222T170750_20150222T170815_004739_005DD8_3768.zip'),
     'acquisition_mode': 'IW',
     'bbox_area': 7.573045244595988,
     'compression': 'zip',
     'corners': {'ymax': 52.183979, 'ymin': 50.295261, 'xmin': 8.017178, 'xmax': 12.0268},
     'hgt_len': 15,
     'lines': 16685,
     'outname': 'S1A__IW___A_20150222T170750',
     'orbit': 'A',
     'polarizations': ['VV', 'VH'],
     'product': 'GRD',
     'samples': 25368,
     'sensor': 'S1A',
     'spacing': (10.0, 9.998647),
     'start': '20150222T170750',
     'stop': '20150222T170815'
     }
]

@pytest.fixture
def scene(case):
    case['pyro'] = pyroSAR.identify(case['path'])
    return case

@pytest.mark.parametrize('case', testcases)
class Test_Metadata():
    def test_attributes(self, scene):
        assert scene['pyro'].acquisition_mode == scene['acquisition_mode']
        assert scene['pyro'].compression == scene['compression']
        assert scene['pyro'].getCorners() == scene['corners']
        assert scene['pyro'].lines == scene['lines']
        assert scene['pyro'].outname_base() == scene['outname']
        assert scene['pyro'].orbit == scene['orbit']
        assert scene['pyro'].polarizations == scene['polarizations']
        assert scene['pyro'].product == scene['product']
        assert scene['pyro'].samples == scene['samples']
        assert scene['pyro'].start == scene['start']
        assert scene['pyro'].stop == scene['stop']
        assert scene['pyro'].sensor == scene['sensor']
        assert scene['pyro'].spacing == scene['spacing']
        assert len(scene['pyro'].getHGT()) == scene['hgt_len']

testdata = 'pyroSAR/tests/data/'
testfile1 = os.path.join(testdata, 'S1A_IW_GRDH_1SDV_20150222T170750_20150222T170815_004739_005DD8_3768.zip')
testfile2 = os.path.join(testdata, 'S1A__IW___A_20150309T173017_VV_grd_mli_geo_norm_db.tif')

def test_identify_fail():
    with pytest.raises(OSError):
        pyroSAR.identify(os.path.join(testdir, 'foobar'))
    with pytest.raises(RuntimeError):
        pyroSAR.identify(testfile2)

def test_identify_many_fail():
    assert pyroSAR.identify_many([testfile2]) == []

def test_filter_processed():
    scene = pyroSAR.identify(testfile1)
    outdir = 'pyroSAR/tests'
    assert len(pyroSAR.filter_processed([scene], outdir)) == 1

def test_parse_date():
    with pytest.raises(ValueError):
        print(pyroSAR.parse_date(1))
    with pytest.raises(ValueError):
        print(pyroSAR.parse_date('foobar'))
    assert pyroSAR.parse_date(datetime(2006, 11, 21)) == '20061121T000000'

def test_export2dict():
    pass

def test_getFileObj(tmpdir):
    scene = pyroSAR.identify(testfile1)
    scene.unpack(str(tmpdir))
    scene = pyroSAR.identify(scene.scene)
    item = scene.findfiles('manifest.safe')[0]
    assert os.path.basename(item) == 'manifest.safe'
    assert isinstance(scene.getFileObj(item).read(), (bytes, str))

    filename = os.path.join(str(tmpdir), os.path.basename(testfile1.replace('zip', 'tar.gz')))
    with tf.open(filename, 'w:gz') as tar:
        tar.add(scene.scene, arcname=os.path.basename(scene.scene))
    scene = pyroSAR.identify(filename)
    assert scene.compression == 'tar'
    item = scene.findfiles('manifest.safe')[0]
    assert isinstance(scene.getFileObj(item).read(), (bytes, str))
    with pytest.raises(RuntimeError):
        pyroSAR.getFileObj('foo', 'bar')

def test_scene(tmpdir):
    dbfile = os.path.join(str(tmpdir), 'scenes.db')
    id = pyroSAR.identify(testfile1)
    assert isinstance(id.export2dict(), dict)
    with pytest.raises(RuntimeError):
        assert isinstance(id.gdalinfo(), dict)
    id.summary()
    id.bbox(outname=os.path.join(str(tmpdir), 'bbox_test.shp'), overwrite=True)
    assert id.is_processed(str(tmpdir)) is False
    id.unpack(str(tmpdir), overwrite=True)
    assert id.compression is None
    id.export2sqlite(dbfile)
    with pytest.raises(IOError):
        id.getGammaImages()
    assert id.getGammaImages(id.scene) == []

def test_scene_osv(tmpdir):
    id = pyroSAR.identify(testfile1)
    osvdir = os.path.join(str(tmpdir), 'osv')
    if sys.version_info >= (2, 7, 9):
        id.getOSV(osvdir)
        with pyroSAR.OSV(osvdir) as osv:
            with pytest.raises(IOError):
                osv.catch(osvtype='XYZ')
            res = osv.catch(osvtype='RES', start=osv.mindate('POE'), stop=osv.maxdate('POE'))
            osv.retrieve(res)

            assert len(osv.getLocals('POE')) == 3
            assert len(osv.getLocals('RES')) == 21
            assert osv.match(id.start, 'POE') is not None
            assert osv.match(id.start, 'RES') is None
            osv.clean_res()
    else:
        with pytest.raises(RuntimeError):
            id.getOSV(osvdir, osvType='POE')

def test_archive(tmpdir):
    id = pyroSAR.identify(testfile1)
    dbfile = os.path.join(str(tmpdir), 'scenes.db')
    db = pyroSAR.Archive(dbfile)
    db.insert(testfile1, verbose=False)
    assert db.is_registered(testfile1) is True
    assert len(db.get_unique_directories()) == 1
    assert db.select_duplicates() == []
    assert db.select_duplicates(outname_base='S1A__IW___A_20150222T170750', scene='scene.zip') == []
    assert len(db.select(mindate='20141001T192312', maxdate='20201001T192312')) == 1
    assert len(db.select(polarizations=['VV'])) == 1
    assert len(db.select(vectorobject=id.bbox())) == 1
    with pytest.raises(IOError):
        db.filter_scenelist([1])
    db.close()
    with pyroSAR.Archive(dbfile) as db:
        assert db.size == (1, 0)
        shp = os.path.join(str(tmpdir), 'db.shp')
        db.export2shp(shp)
    assert spatial.Vector(shp).nfeatures == 1
    os.remove(dbfile)
    dbfile_old = os.path.join(testdata, 'archive_outdated.csv')
    with pytest.raises(OSError):
        with pyroSAR.Archive(dbfile) as db:
            db.import_outdated(dbfile_old)
<|endoftext|>


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

from os.path import exists

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

__version__ = "1.1.7"

setup(
    name='django-tenants',
    version=__version__,
    author='Thomas Turner',
    author_email='tom@twt.me.uk',
    packages=[
        'django_tenants',
        'django_tenants.postgresql_backend',
        'django_tenants.management',
        'django_tenants.management.commands',
        'django_tenants.migration_executors',
        'django_tenants.templatetags',
        'django_tenants.test',
        'django_tenants.tests',
    ],
    scripts=[],
    url='https://github.com/tomturner/django-tenants',
    license='MIT',
    description='Tenant support for Django using PostgreSQL schemas.',
    long_description=open('README.rst').read() if exists("README.rst") else "",
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'License :: OSI Approved :: MIT License',
        'Framework :: Django',
        'Framework :: Django :: 1.8',
        'Framework :: Django :: 1.9',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Topic :: Software Development :: Libraries :: Python Modules'
    ],
    install_requires=[
        'Django >= 1.8.0,<1.11',
        'psycopg2',
    ],
    zip_safe=False,
)
<commit_msg>Updated version number<commit_after>#!/usr/bin/env python

from os.path import exists

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

__version__ = "1.1.8"

setup(
    name='django-tenants',
    version=__version__,
    author='Thomas Turner',
    author_email='tom@twt.me.uk',
    packages=[
        'django_tenants',
        'django_tenants.postgresql_backend',
        'django_tenants.management',
        'django_tenants.management.commands',
        'django_tenants.migration_executors',
        'django_tenants.templatetags',
        'django_tenants.test',
        'django_tenants.tests',
    ],
    scripts=[],
    url='https://github.com/tomturner/django-tenants',
    license='MIT',
    description='Tenant support for Django using PostgreSQL schemas.',
    long_description=open('README.rst').read() if exists("README.rst") else "",
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'License :: OSI Approved :: MIT License',
        'Framework :: Django',
        'Framework :: Django :: 1.8',
        'Framework :: Django :: 1.9',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Topic :: Software Development :: Libraries :: Python Modules'
    ],
    install_requires=[
        'Django >= 1.8.0,<1.11',
        'psycopg2',
    ],
    zip_safe=False,
)
<|endoftext|>


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

from os.path import exists
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

from seed import __version__

setup(
    name='seed',
    version=__version__,
    author='Adam Charnock',
    author_email='adam@playnice.ly',
    packages=['seed', 'seed.commands', 'seed.vcs'],
    scripts=[],
    url='https://github.com/adamcharnock/seed',
    license='MIT',
    description='A utility for easily creating and releasing Python packages',
    long_description=open('README.rst').read() if exists("README.rst") else "",
    entry_points=dict(console_scripts=['seed=seed.run:main']),
    install_requires=[
        "path.py>=2.2.2",
    ],
    classifiers=[
        'Environment :: Console',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Topic :: System :: Software Distribution',
    ],
)
<commit_msg>Making setup.py executable<commit_after>#!/usr/bin/env python

from os.path import exists
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

from seed import __version__

setup(
    name='seed',
    version=__version__,
    author='Adam Charnock',
    author_email='adam@playnice.ly',
    packages=['seed', 'seed.commands', 'seed.vcs'],
    scripts=[],
    url='https://github.com/adamcharnock/seed',
    license='MIT',
    description='A utility for easily creating and releasing Python packages',
    long_description=open('README.rst').read() if exists("README.rst") else "",
    entry_points=dict(console_scripts=['seed=seed.run:main']),
    install_requires=[
        "path.py>=2.2.2",
    ],
    classifiers=[
        'Environment :: Console',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Topic :: System :: Software Distribution',
    ],
)
<|endoftext|>


<commit_before>from __future__ import division, print_function

import numpy as np

from boltons.iterutils import chunked

from .datasets import create_subset

def train_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='train')

def validation_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='val')

def test_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='test')

def crossval_splits(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return (
        crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='train'),
        crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='val'),
        crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='test'),
    )

def crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True, split='train'):
    train_folds, val_folds, test_folds = get_crossval_folds(crossval_folds, fold_no, test_folds=test_folds, val_folds=val_folds)

    if split == 'train':
        folds = train_folds
    elif split == 'val':
        folds = val_folds
    elif split == 'test':
        folds = test_folds
    else:
        raise ValueError(split)

    return _get_crossval_split(stimuli, fixations, crossval_folds, included_splits=folds, random=random)

def _get_crossval_split(stimuli, fixations, split_count, included_splits, random=True):
    inds = list(range(len(stimuli)))
    if random:
        print("Using random shuffles for crossvalidation")
        rst = np.random.RandomState(seed=42)
        rst.shuffle(inds)
        inds = list(inds)
    size = int(np.ceil(len(inds) / split_count))
    chunks = chunked(inds, size=size)

    inds = []
    for split_nr in included_splits:
        inds.extend(chunks[split_nr])

    stimuli, fixations = create_subset(stimuli, fixations, inds)
    return stimuli, fixations

def create_train_folds(crossval_folds, val_folds, test_folds):
    all_folds = list(range(crossval_folds))
    if isinstance(val_folds, int):
        val_folds = [val_folds]
    if isinstance(test_folds, int):
        test_folds = [test_folds]

    train_folds = [f for f in all_folds if not (f in val_folds or f in test_folds)]

    return train_folds, val_folds, test_folds

def get_crossval_folds(crossval_folds, crossval_no, test_folds=1, val_folds=1):
    assert test_folds <= 1
    if test_folds:
        _test_folds = [crossval_no]
        _val_folds = [(crossval_no - i - 1) % crossval_folds for i in range(val_folds)]

    else:
        assert val_folds == 1

        _test_folds = [crossval_no]
        _val_folds = [crossval_no]

    _train_folds, _val_folds, _test_folds = create_train_folds(crossval_folds, _val_folds, _test_folds)

    return _train_folds, _val_folds, _test_folds

def parse_list_of_intervals(description):
    """parses a string as "1.0:3.0,5.0:5.6,7" into [(1.0, 3.0), (5.0, 5.6), (7,)]
    """
    intervals = description.split(',')
    return [parse_interval(interval) for interval in intervals]

def parse_interval(interval):
    parts = interval.split(':')
    if len(parts) not in [1, 2]:
        raise ValueError("Invalid interval", interval)
    return tuple([float(part.strip()) for part in parts])

def filter_fixations_by_number(fixations, intervals):
    intervals = _check_intervals(intervals, type=int)
    inds = np.zeros_like(fixations.x, dtype=bool)

    for n1, n2 in intervals:
        _inds = np.logical_and(fixations.lengths >= n1, fixations.lengths < n2)
        inds = np.logical_or(inds, _inds)

    return fixations[inds]

def filter_stimuli_by_number(stimuli, fixations, intervals):
    intervals = _check_intervals(intervals, type=int)
    mask = np.zeros(len(stimuli), dtype=bool)

    for n1, n2 in intervals:
        mask[n1:n2] = True

    indices = np.nonzero(mask)[0]

    return create_subset(stimuli, fixations, indices)

def _check_intervals(intervals, type=float):
    if isinstance(intervals, (float, int)):
        intervals = [intervals]

    new_intervals = []
    for interval in intervals:
        new_intervals.append(_check_interval(interval, type=type))
    return new_intervals

def _check_interval(interval, type=float):
    if isinstance(interval, (float, int)):
        interval = [interval]

    if len(interval) == 1:
        if type != int:
            raise ValueError("single-value intervals only allowed for integer data!")
        interval = [interval[0], interval[0] + 1]

    if len(interval) != 2:
        raise ValueError("Intervals need two values", interval)
    new_interval = []
    for value in interval:
        if type(value) != value:
            raise ValueError("Invalid value for this type", value, type)
        new_interval.append(type(value))

    return tuple(new_interval)
<commit_msg>Bugfix<commit_after>from __future__ import division, print_function

import numpy as np

from boltons.iterutils import chunked

from .datasets import create_subset

def train_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='train')

def validation_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='val')

def test_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='test')

def crossval_splits(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True):
    return (
        crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='train'),
        crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='val'),
        crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=val_folds, test_folds=test_folds, random=random, split='test'),
    )

def crossval_split(stimuli, fixations, crossval_folds, fold_no, val_folds=1, test_folds=1, random=True, split='train'):
    train_folds, val_folds, test_folds = get_crossval_folds(crossval_folds, fold_no, test_folds=test_folds, val_folds=val_folds)

    if split == 'train':
        folds = train_folds
    elif split == 'val':
        folds = val_folds
    elif split == 'test':
        folds = test_folds
    else:
        raise ValueError(split)

    return _get_crossval_split(stimuli, fixations, crossval_folds, included_splits=folds, random=random)

def _get_crossval_split(stimuli, fixations, split_count, included_splits, random=True):
    inds = list(range(len(stimuli)))
    if random:
        print("Using random shuffles for crossvalidation")
        rst = np.random.RandomState(seed=42)
        rst.shuffle(inds)
        inds = list(inds)
    size = int(np.ceil(len(inds) / split_count))
    chunks = chunked(inds, size=size)

    inds = []
    for split_nr in included_splits:
        inds.extend(chunks[split_nr])

    stimuli, fixations = create_subset(stimuli, fixations, inds)
    return stimuli, fixations

def create_train_folds(crossval_folds, val_folds, test_folds):
    all_folds = list(range(crossval_folds))
    if isinstance(val_folds, int):
        val_folds = [val_folds]
    if isinstance(test_folds, int):
        test_folds = [test_folds]

    train_folds = [f for f in all_folds if not (f in val_folds or f in test_folds)]

    return train_folds, val_folds, test_folds

def get_crossval_folds(crossval_folds, crossval_no, test_folds=1, val_folds=1):
    assert test_folds <= 1
    if test_folds:
        _test_folds = [crossval_no]
        _val_folds = [(crossval_no - i - 1) % crossval_folds for i in range(val_folds)]

    else:
        assert val_folds == 1

        _test_folds = [crossval_no]
        _val_folds = [crossval_no]

    _train_folds, _val_folds, _test_folds = create_train_folds(crossval_folds, _val_folds, _test_folds)

    return _train_folds, _val_folds, _test_folds

def parse_list_of_intervals(description):
    """parses a string as "1.0:3.0,5.0:5.6,7" into [(1.0, 3.0), (5.0, 5.6), (7,)]
    """
    intervals = description.split(',')
    return [parse_interval(interval) for interval in intervals]

def parse_interval(interval):
    parts = interval.split(':')
    if len(parts) not in [1, 2]:
        raise ValueError("Invalid interval", interval)
    return tuple([float(part.strip()) for part in parts])

def filter_fixations_by_number(fixations, intervals):
    intervals = _check_intervals(intervals, type=int)
    inds = np.zeros_like(fixations.x, dtype=bool)

    for n1, n2 in intervals:
        _inds = np.logical_and(fixations.lengths >= n1, fixations.lengths < n2)
        inds = np.logical_or(inds, _inds)

    return fixations[inds]

def filter_stimuli_by_number(stimuli, fixations, intervals):
    intervals = _check_intervals(intervals, type=int)
    mask = np.zeros(len(stimuli), dtype=bool)

    for n1, n2 in intervals:
        mask[n1:n2] = True

    indices = list(np.nonzero(mask)[0])

    return create_subset(stimuli, fixations, indices)

def _check_intervals(intervals, type=float):
    if isinstance(intervals, (float, int)):
        intervals = [intervals]

    new_intervals = []
    for interval in intervals:
        new_intervals.append(_check_interval(interval, type=type))
    return new_intervals

def _check_interval(interval, type=float):
    if isinstance(interval, (float, int)):
        interval = [interval]

    if len(interval) == 1:
        if type != int:
            raise ValueError("single-value intervals only allowed for integer data!")
        interval = [interval[0], interval[0] + 1]

    if len(interval) != 2:
        raise ValueError("Intervals need two values", interval)
    new_interval = []
    for value in interval:
        if type(value) != value:
            raise ValueError("Invalid value for this type", value, type)
        new_interval.append(type(value))

    return tuple(new_interval)
<|endoftext|>


<commit_before>from distutils.core import setup

setup(
    name='gcm-client',
    version='0.1',
    author='Sardar Yumatov',
    author_email='ja.doma@gmail.com',
    url='https://bitbucket.org/sardarnl/gcm-client',
    description='Python client for Google Cloud Messaging (GCM)',
    long_description=open('README.rst').read(),
    packages=['gcmclient'],
    license=open('LICENSE').read(),
    keywords='gcm push notification google cloud messaging android',
    requires=['requests'],
    platforms = ('Any',),
    classifiers = [ 'Development Status :: 4 - Beta',
                    'Intended Audience :: Developers',
                    'License :: OSI Approved :: Apache Software License',
                    'Programming Language :: Python',
                    'Topic :: Software Development :: Libraries :: Python Modules',
                    ],
)
<commit_msg>Distutils fixes<commit_after>try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

setup(
    name='gcm-client',
    version='0.1.1',
    author='Sardar Yumatov',
    author_email='ja.doma@gmail.com',
    url='https://bitbucket.org/sardarnl/gcm-client',
    description='Python client for Google Cloud Messaging (GCM)',
    long_description=open('README.rst').read(),
    packages=['gcmclient'],
    license="Apache 2.0",
    keywords='gcm push notification google cloud messaging android',
    install_requires=['requests'],
    classifiers = [ 'Development Status :: 4 - Beta',
                    'Intended Audience :: Developers',
                    'License :: OSI Approved :: Apache Software License',
                    'Programming Language :: Python',
                    'Topic :: Software Development :: Libraries :: Python Modules']
)
<|endoftext|>


<commit_before>import copy
from pyschema import types
import pyschema
import os
import sys
from collections import defaultdict

DEFAULT_INDENT = " " * 4

class SourceGenerationError(Exception):
    pass

def to_python_source(classes, indent=DEFAULT_INDENT):
    """Convert a set of pyschemas to executable python source code

    Currently supports all built-in types for basic usage.

    Notably not supported:
    * Maintaining class hierarchy
    * Methods, properties and non-field attributes
    * SELF-references
    """
    return header_source() + "\n" + classes_source(classes, indent)

class PackageBuilder(object):
    def __init__(self, target_folder, parent_package, indent=DEFAULT_INDENT):
        self.target_folder = target_folder
        self.parent_package = parent_package
        self.indent = indent

    def get_namespace(self, schema):
        try:
            namespace = schema._namespace
        except AttributeError:
            namespace = None
        return namespace

    def get_namespace_clusters(self, all_classes):
        namespace_cluster = defaultdict(set)
        for c in all_classes:
            namespace = self.get_namespace(c)
            namespace_cluster[namespace].add(c)
        return namespace_cluster

    def format_definitions(self, classes):
        return "\n\n".join([_class_source(c, self.indent) for c in classes])

    def write_namespace_file(self, namespace, module_code):
        if namespace is None:
            key = ['__init__']
        else:
            key = namespace.split('.')
        output_file = os.path.join(self.target_folder, *key) + '.py'
        output_dir = os.path.dirname(output_file)
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)

        with open(output_file, 'w') as out_fn:
            out_fn.write(module_code)

    def write_init_files(self):
        def touch_init_file_in_folder(folder):
            path = os.path.join(folder, '__init__.py')
            if not os.path.exists(path):
                open(path, 'w').close()

        touch_init_file_in_folder(self.target_folder)
        for root, dirs, _ in os.walk(self.target_folder):
            for d in dirs:
                touch_init_file_in_folder(os.path.join(root, d))

    def format_imports(self, imported_classes):
        if not imported_classes:
            return "\n"
        imported_namespaces = self.get_namespace_clusters(imported_classes)
        lines = []
        for namespace, schemas in imported_namespaces.iteritems():
            if self.parent_package:
                if namespace:
                    module = "{}.{}".format(self.parent_package, namespace)
                else:
                    module = self.parent_package
            else:
                if not namespace:
                    module = "."
                else:
                    module = namespace
            class_part = ", ".join(s.__name__ for s in schemas)
            lines.append("from {} import {}".format(module, class_part))
        return "\n".join(lines) + "\n\n"

    def from_classes_with_refs(self, classes):
        class_graph = CachedGraphTraverser()

        all_classes = set(classes)
        for c in classes:
            referenced_schemas = class_graph.find_descendants(c)
            all_classes |= set(referenced_schemas)

        namespace_cluster = self.get_namespace_clusters(all_classes)

        ordered_schemas = class_graph.get_reference_ordered_schemas(all_classes)

        # Since we don't want to use the previous cached results we create a new instance
        one_stack_level_class_graph = CachedGraphTraverser()
        for namespace, classes in namespace_cluster.iteritems():
            inlined_classes = [c for c in ordered_schemas if c in classes]
            imported_classes = set()

            for inlined in inlined_classes:
                direct_references = child_only_class_graph.find_descendants(inlined, max_depth=1)
                imported_classes |= set([c for c in direct_references if c not in inlined_classes])

            module_code = (
                header_source() +
                self.format_imports(imported_classes) +
                self.format_definitions(inlined_classes)
            )
            self.write_namespace_file(namespace, module_code)
            self.write_init_files()

def to_python_package(classes, target_folder, parent_package=None, indent=DEFAULT_INDENT):
    '''
    This function can be used to build a python package representation of pyschema classes.
    One module is created per namespace in a package matching the namespace hierarchy.

    Args:
        classes: A collection of classes to build the package from
        target_folder: Root folder of the package
        parent_package: Prepended on all import statements in order to support absolute imports.
            parent_package is not used when building the package file structure
        indent: Indent level. Defaults to 4 spaces
    '''
    PackageBuilder(target_folder, parent_package, indent).from_classes_with_refs(classes)

def classes_source(classes, indent=DEFAULT_INDENT):
    all_classes = set(classes)
    class_graph = CachedGraphTraverser()
    for c in classes:
        referenced_schemas = class_graph.find_descendants(c)
        all_classes |= set(referenced_schemas)

    ordered = class_graph.get_reference_ordered_schemas(all_classes)
    return "\n\n".join([_class_source(c, indent) for c in ordered])

def header_source():
    """Get the required header for generated source"""
    return (
        "import pyschema\n"
        "from pyschema.types import *\n"
        "from pyschema.core import NO_DEFAULT\n"
    )

def _class_source(schema, indent):
    """Generate Python source code for one specific class

    Doesn't include or take into account any dependencies between record types
    """

    def_pattern = (
        "class {class_name}(pyschema.Record):\n"
        "{indent}# WARNING: This class was generated by pyschema.to_python_source\n"
        "{indent}# there is a risk that any modification made to this class will be overwritten\n"
        "{optional_namespace_def}"
        "{field_defs}\n"
    )
    if hasattr(schema, '_namespace'):
        optional_namespace_def = "{indent}_namespace = {namespace!r}\n".format(
            namespace=schema._namespace, indent=indent)
    else:
        optional_namespace_def = ""

    field_defs = [
        "{indent}{field_name} = {field!r}".format(field_name=field_name, field=field, indent=indent)
        for field_name, field in schema._fields.iteritems()
    ]
    if not field_defs:
        field_defs = ["{indent}pass".format(indent=indent)]

    return def_pattern.format(
        class_name=schema._schema_name,
        optional_namespace_def=optional_namespace_def,
        field_defs="\n".join(field_defs),
        indent=indent
    )

class CachedGraphTraverser(object):
    def __init__(self):
        self.descendants = {}
        self.started = set()

    def find_descendants(self, a, max_depth=sys.getrecursionlimit()):
        if a in self.descendants:
            # fetch from cache
            return self.descendants[a]
        self.started.add(a)
        subs = set()
        if max_depth > 0:
            if pyschema.ispyschema(a):
                for _, field in a._fields.iteritems():
                    subs |= self.find_descendants(field, max_depth)
                self.descendants[a] = subs
            elif isinstance(a, types.List):
                subs |= self.find_descendants(a.field_type, max_depth)
            elif isinstance(a, types.Map):
                subs |= self.find_descendants(a.value_type, max_depth)
            elif isinstance(a, types.SubRecord):
                subs.add(a._schema)
                if a._schema not in self.started:  # otherwise there is a circular reference
                    subs |= self.find_descendants(a._schema, max_depth-1)
            self.started.remove(a)
        return subs

    def get_reference_ordered_schemas(self, schema_set):
        for schema in schema_set:
            self.find_descendants(schema)
        descendants = copy.deepcopy(self.descendants)  # a working copy

        ordered_output = []
        while descendants:
            leaves = []
            for root, referenced in descendants.iteritems():
                if len(referenced) == 0:
                    leaves.append(root)

            if not leaves:
                raise SourceGenerationError("Circular reference in input schemas, aborting")
            ordered_output += leaves
            for leaf in leaves:
                # remove all leaves
                descendants.pop(leaf)
                for root, referenced in descendants.iteritems():
                    if leaf in referenced:
                        referenced.remove(leaf)
        return ordered_output
<commit_msg>Fix incorrect name<commit_after>import copy
from pyschema import types
import pyschema
import os
import sys
from collections import defaultdict

DEFAULT_INDENT = " " * 4

class SourceGenerationError(Exception):
    pass

def to_python_source(classes, indent=DEFAULT_INDENT):
    """Convert a set of pyschemas to executable python source code

    Currently supports all built-in types for basic usage.

    Notably not supported:
    * Maintaining class hierarchy
    * Methods, properties and non-field attributes
    * SELF-references
    """
    return header_source() + "\n" + classes_source(classes, indent)

class PackageBuilder(object):
    def __init__(self, target_folder, parent_package, indent=DEFAULT_INDENT):
        self.target_folder = target_folder
        self.parent_package = parent_package
        self.indent = indent

    def get_namespace(self, schema):
        try:
            namespace = schema._namespace
        except AttributeError:
            namespace = None
        return namespace

    def get_namespace_clusters(self, all_classes):
        namespace_cluster = defaultdict(set)
        for c in all_classes:
            namespace = self.get_namespace(c)
            namespace_cluster[namespace].add(c)
        return namespace_cluster

    def format_definitions(self, classes):
        return "\n\n".join([_class_source(c, self.indent) for c in classes])

    def write_namespace_file(self, namespace, module_code):
        if namespace is None:
            key = ['__init__']
        else:
            key = namespace.split('.')
        output_file = os.path.join(self.target_folder, *key) + '.py'
        output_dir = os.path.dirname(output_file)
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)

        with open(output_file, 'w') as out_fn:
            out_fn.write(module_code)

    def write_init_files(self):
        def touch_init_file_in_folder(folder):
            path = os.path.join(folder, '__init__.py')
            if not os.path.exists(path):
                open(path, 'w').close()

        touch_init_file_in_folder(self.target_folder)
        for root, dirs, _ in os.walk(self.target_folder):
            for d in dirs:
                touch_init_file_in_folder(os.path.join(root, d))

    def format_imports(self, imported_classes):
        if not imported_classes:
            return "\n"
        imported_namespaces = self.get_namespace_clusters(imported_classes)
        lines = []
        for namespace, schemas in imported_namespaces.iteritems():
            if self.parent_package:
                if namespace:
                    module = "{}.{}".format(self.parent_package, namespace)
                else:
                    module = self.parent_package
            else:
                if not namespace:
                    module = "."
                else:
                    module = namespace
            class_part = ", ".join(s.__name__ for s in schemas)
            lines.append("from {} import {}".format(module, class_part))
        return "\n".join(lines) + "\n\n"

    def from_classes_with_refs(self, classes):
        class_graph = CachedGraphTraverser()

        all_classes = set(classes)
        for c in classes:
            referenced_schemas = class_graph.find_descendants(c)
            all_classes |= set(referenced_schemas)

        namespace_cluster = self.get_namespace_clusters(all_classes)

        ordered_schemas = class_graph.get_reference_ordered_schemas(all_classes)

        # Since we don't want to use the previous cached results we create a new instance
        # This CachedGraphTraverser will only keep one-child depth for its find_descendants
        child_only_class_graph = CachedGraphTraverser()
        for namespace, classes in namespace_cluster.iteritems():
            inlined_classes = [c for c in ordered_schemas if c in classes]
            imported_classes = set()

            for inlined in inlined_classes:
                direct_references = child_only_class_graph.find_descendants(inlined, max_depth=1)
                imported_classes |= set([c for c in direct_references if c not in inlined_classes])

            module_code = (
                header_source() +
                self.format_imports(imported_classes) +
                self.format_definitions(inlined_classes)
            )
            self.write_namespace_file(namespace, module_code)
            self.write_init_files()

def to_python_package(classes, target_folder, parent_package=None, indent=DEFAULT_INDENT):
    '''
    This function can be used to build a python package representation of pyschema classes.
    One module is created per namespace in a package matching the namespace hierarchy.

    Args:
        classes: A collection of classes to build the package from
        target_folder: Root folder of the package
        parent_package: Prepended on all import statements in order to support absolute imports.
            parent_package is not used when building the package file structure
        indent: Indent level. Defaults to 4 spaces
    '''
    PackageBuilder(target_folder, parent_package, indent).from_classes_with_refs(classes)

def classes_source(classes, indent=DEFAULT_INDENT):
    all_classes = set(classes)
    class_graph = CachedGraphTraverser()
    for c in classes:
        referenced_schemas = class_graph.find_descendants(c)
        all_classes |= set(referenced_schemas)

    ordered = class_graph.get_reference_ordered_schemas(all_classes)
    return "\n\n".join([_class_source(c, indent) for c in ordered])

def header_source():
    """Get the required header for generated source"""
    return (
        "import pyschema\n"
        "from pyschema.types import *\n"
        "from pyschema.core import NO_DEFAULT\n"
    )

def _class_source(schema, indent):
    """Generate Python source code for one specific class

    Doesn't include or take into account any dependencies between record types
    """

    def_pattern = (
        "class {class_name}(pyschema.Record):\n"
        "{indent}# WARNING: This class was generated by pyschema.to_python_source\n"
        "{indent}# there is a risk that any modification made to this class will be overwritten\n"
        "{optional_namespace_def}"
        "{field_defs}\n"
    )
    if hasattr(schema, '_namespace'):
        optional_namespace_def = "{indent}_namespace = {namespace!r}\n".format(
            namespace=schema._namespace, indent=indent)
    else:
        optional_namespace_def = ""

    field_defs = [
        "{indent}{field_name} = {field!r}".format(field_name=field_name, field=field, indent=indent)
        for field_name, field in schema._fields.iteritems()
    ]
    if not field_defs:
        field_defs = ["{indent}pass".format(indent=indent)]

    return def_pattern.format(
        class_name=schema._schema_name,
        optional_namespace_def=optional_namespace_def,
        field_defs="\n".join(field_defs),
        indent=indent
    )

class CachedGraphTraverser(object):
    def __init__(self):
        self.descendants = {}
        self.started = set()

    def find_descendants(self, a, max_depth=sys.getrecursionlimit()):
        if a in self.descendants:
            # fetch from cache
            return self.descendants[a]
        self.started.add(a)
        subs = set()
        if max_depth > 0:
            if pyschema.ispyschema(a):
                for _, field in a._fields.iteritems():
                    subs |= self.find_descendants(field, max_depth)
                self.descendants[a] = subs
            elif isinstance(a, types.List):
                subs |= self.find_descendants(a.field_type, max_depth)
            elif isinstance(a, types.Map):
                subs |= self.find_descendants(a.value_type, max_depth)
            elif isinstance(a, types.SubRecord):
                subs.add(a._schema)
                if a._schema not in self.started:  # otherwise there is a circular reference
                    subs |= self.find_descendants(a._schema, max_depth-1)
            self.started.remove(a)
        return subs

    def get_reference_ordered_schemas(self, schema_set):
        for schema in schema_set:
            self.find_descendants(schema)
        descendants = copy.deepcopy(self.descendants)  # a working copy

        ordered_output = []
        while descendants:
            leaves = []
            for root, referenced in descendants.iteritems():
                if len(referenced) == 0:
                    leaves.append(root)

            if not leaves:
                raise SourceGenerationError("Circular reference in input schemas, aborting")
            ordered_output += leaves
            for leaf in leaves:
                # remove all leaves
                descendants.pop(leaf)
                for root, referenced in descendants.iteritems():
                    if leaf in referenced:
                        referenced.remove(leaf)
        return ordered_output
<|endoftext|>


<commit_before>import os
from setuptools import setup

with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
    README = readme.read()

# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
    name='django-basic-blog',
    version='0.8',
    packages=['blog'],
    include_package_data=True,
    license='MIT License',  # example license
    description='A stupid-simple blog app.',
    long_description=README,
    url='https://github.com/bwarren2/django-basic-blog',
    author='Ben Warren',
    author_email='bwarren2@gmail.com',
    classifiers=[
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',  # example license
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        # Replace these appropriately if you are stuck on Python 2.
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
    ],
)
<commit_msg>Version bump<commit_after>import os
from setuptools import setup

with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
    README = readme.read()

# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
    name='django-basic-blog',
    version='0.9',
    packages=['blog'],
    include_package_data=True,
    license='MIT License',  # example license
    description='A stupid-simple blog app.',
    long_description=README,
    url='https://github.com/bwarren2/django-basic-blog',
    author='Ben Warren',
    author_email='bwarren2@gmail.com',
    classifiers=[
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',  # example license
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        # Replace these appropriately if you are stuck on Python 2.
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
    ],
)
<|endoftext|>


<commit_before>#!/usr/bin/env python
from __future__ import print_function
import io
import os.path
import subprocess
import sys
import contextlib
import distutil.util
from distutils.command.build_ext import build_ext
from distutils.sysconfig import get_python_inc
from distutils import ccompiler, msvccompiler
from distutils.ccompiler import new_compiler
import platform

from setuptools import Extension, setup

def is_new_osx():
    '''Check whether we're on OSX >= 10.10'''
    print(sys.platform, platform.mac_ver(), distutils.util.get_platform())
    if sys.platform != 'darwin':
        return False
    else:
        version = platform.mac_ver()[0]
        major, minor, patch = version.split('.')
        if int(major) >= 10 and int(minor) >= 10:
            return True
        else:
            return False

PACKAGES = [
    "thinc",
    "thinc.tests",
    "thinc.tests.unit",
    "thinc.tests.integration",
    "thinc.tests.linear",
    "thinc.linear",
    "thinc.neural",
    "thinc.extra",
    "thinc.neural._classes",
    "thinc.extra._vendorized",
]

MOD_NAMES = [
    "thinc.linalg",
    "thinc.structs",
    "thinc.typedefs",
    "thinc.linear.avgtron",
    "thinc.linear.features",
    "thinc.linear.serialize",
    "thinc.linear.sparse",
    "thinc.linear.linear",
    "thinc.neural.optimizers",
    "thinc.neural.ops",
    "thinc.neural.gpu_ops",
    "thinc.neural._aligned_alloc",
    #'thinc.neural._fast_maxout_cnn',
    "thinc.extra.eg",
    "thinc.extra.mb",
    "thinc.extra.search",
    "thinc.extra.cache",
]

COMPILE_OPTIONS = {
    "msvc": ["/Ox", "/EHsc"],
    "other": ["-O3", "-Wno-strict-prototypes", "-Wno-unused-function"],
}
LINK_OPTIONS = {"msvc": [], "other": []}

if is_new_osx():
    # On Mac, use libc++ because Apple deprecated use of
    # libstdc
    COMPILE_OPTIONS["other"].append("-stdlib=libc++")
    LINK_OPTIONS["other"].append("-lc++")
    # g++ (used by unix compiler on mac) links to libstdc++ as a default lib.
    # See: https://stackoverflow.com/questions/1653047/avoid-linking-to-libstdc
    LINK_OPTIONS["other"].append("-nodefaultlibs")

# By subclassing build_extensions we have the actual compiler that will be used
# which is really known only after finalize_options
# http://stackoverflow.com/questions/724664/python-distutils-how-to-get-a-compiler-that-is-going-to-be-used
class build_ext_options:
    def build_options(self):
        src_dir = os.path.join(os.path.dirname(__file__), "thinc", "_files")
        if hasattr(self.compiler, "initialize"):
            self.compiler.initialize()
        self.compiler.platform = sys.platform[:6]
        for e in self.extensions:
            e.extra_compile_args = COMPILE_OPTIONS.get(
                self.compiler.compiler_type, COMPILE_OPTIONS["other"]
            )
            e.extra_link_args = LINK_OPTIONS.get(
                self.compiler.compiler_type, LINK_OPTIONS["other"]
            )

class build_ext_subclass(build_ext, build_ext_options):
    def build_extensions(self):
        build_ext_options.build_options(self)
        build_ext.build_extensions(self)

def generate_cython(root, source):
    print("Cythonizing sources")
    p = subprocess.call(
        [sys.executable, os.path.join(root, "bin", "cythonize.py"), source],
        env=os.environ,
    )
    if p != 0:
        raise RuntimeError("Running cythonize failed")

def find_in_path(name, path):
    "Find a file in a search path"
    # adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
    for dir in path.split(os.pathsep):
        binpath = os.path.join(dir, name)
        if os.path.exists(binpath):
            return os.path.abspath(binpath)
    return None

def is_source_release(path):
    return os.path.exists(os.path.join(path, "PKG-INFO"))

def clean(path):
    for name in MOD_NAMES:
        name = name.replace(".", "/")
        for ext in [".so", ".html", ".cpp", ".c"]:
            file_path = os.path.join(path, name + ext)
            if os.path.exists(file_path):
                os.unlink(file_path)

@contextlib.contextmanager
def chdir(new_dir):
    old_dir = os.getcwd()
    try:
        os.chdir(new_dir)
        sys.path.insert(0, new_dir)
        yield
    finally:
        del sys.path[0]
        os.chdir(old_dir)

def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, "thinc", "about.py")) as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, "README.md"), encoding="utf8") as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "include"),
        ]

        if (
            ccompiler.new_compiler().compiler_type == "msvc"
            and msvccompiler.get_build_version() == 9
        ):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            if mod_name.endswith("gpu_ops"):
                continue
            mod_path = mod_name.replace(".", "/") + ".cpp"
            ext_modules.append(
                Extension(
                    mod_name, [mod_path], language="c++", include_dirs=include_dirs
                )
            )

        if not is_source_release(root):
            generate_cython(root, "thinc")

        setup(
            name=about["__title__"],
            zip_safe=False,
            packages=PACKAGES,
            package_data={"": ["*.pyx", "*.pxd", "*.pxi", "*.cpp"]},
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=ext_modules,
            setup_requires=["numpy>=1.7.0"],
            install_requires=[
                "blis>=0.2.1,<0.3.0",
                "thinc_gpu_ops>=0.0.1,<0.1.0",
                "numpy>=1.7.0",
                "murmurhash>=0.28.0,<1.1.0",
                "cymem>=2.0.2,<2.1.0",
                "preshed>=1.0.1,<2.1.0",
                "wrapt>=1.10.0,<1.11.0",
                "plac>=0.9.6,<1.0.0",
                "tqdm>=4.10.0,<5.0.0",
                "six>=1.10.0,<2.0.0",
                "wasabi>=0.0.9,<1.1.0",
                "srsly>=0.0.5,<1.1.0",
                'pathlib==1.0.1; python_version < "3.4"',
            ],
            extras_require={
                "cuda": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy>=5.0.0b4"],
                "cuda80": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda80>=5.0.0b4"],
                "cuda90": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda90>=5.0.0b4"],
                "cuda91": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda91>=5.0.0b4"],
                "cuda92": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda92>=5.0.0b4"],
                "cuda100": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda100>=5.0.0b4"],
            },
            classifiers=[
                "Development Status :: 5 - Production/Stable",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2.6",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3.3",
                "Programming Language :: Python :: 3.4",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )

setup_package()
<commit_msg>Try more debugging<commit_after>#!/usr/bin/env python
from __future__ import print_function
import io
import os.path
import subprocess
import sys
import contextlib
import distutil.util
from distutils.command.build_ext import build_ext
from distutils.sysconfig import get_python_inc
from distutils import ccompiler, msvccompiler
from distutils.ccompiler import new_compiler
import platform

from setuptools import Extension, setup

def is_new_osx():
    '''Check whether we're on OSX >= 10.10'''
    print(sys.platform, platform.mac_ver(), distutils.util.get_platform())
    print('uname', platform.uname())
    print('platform', platform.platform())
    if sys.platform != 'darwin':
        return False
    else:
        version = platform.mac_ver()[0]
        major, minor, patch = version.split('.')
        if int(major) >= 10 and int(minor) >= 10:
            return True
        else:
            return False

PACKAGES = [
    "thinc",
    "thinc.tests",
    "thinc.tests.unit",
    "thinc.tests.integration",
    "thinc.tests.linear",
    "thinc.linear",
    "thinc.neural",
    "thinc.extra",
    "thinc.neural._classes",
    "thinc.extra._vendorized",
]

MOD_NAMES = [
    "thinc.linalg",
    "thinc.structs",
    "thinc.typedefs",
    "thinc.linear.avgtron",
    "thinc.linear.features",
    "thinc.linear.serialize",
    "thinc.linear.sparse",
    "thinc.linear.linear",
    "thinc.neural.optimizers",
    "thinc.neural.ops",
    "thinc.neural.gpu_ops",
    "thinc.neural._aligned_alloc",
    #'thinc.neural._fast_maxout_cnn',
    "thinc.extra.eg",
    "thinc.extra.mb",
    "thinc.extra.search",
    "thinc.extra.cache",
]

COMPILE_OPTIONS = {
    "msvc": ["/Ox", "/EHsc"],
    "other": ["-O3", "-Wno-strict-prototypes", "-Wno-unused-function"],
}
LINK_OPTIONS = {"msvc": [], "other": []}

if is_new_osx():
    # On Mac, use libc++ because Apple deprecated use of
    # libstdc
    COMPILE_OPTIONS["other"].append("-stdlib=libc++")
    LINK_OPTIONS["other"].append("-lc++")
    # g++ (used by unix compiler on mac) links to libstdc++ as a default lib.
    # See: https://stackoverflow.com/questions/1653047/avoid-linking-to-libstdc
    LINK_OPTIONS["other"].append("-nodefaultlibs")

# By subclassing build_extensions we have the actual compiler that will be used
# which is really known only after finalize_options
# http://stackoverflow.com/questions/724664/python-distutils-how-to-get-a-compiler-that-is-going-to-be-used
class build_ext_options:
    def build_options(self):
        src_dir = os.path.join(os.path.dirname(__file__), "thinc", "_files")
        if hasattr(self.compiler, "initialize"):
            self.compiler.initialize()
        self.compiler.platform = sys.platform[:6]
        for e in self.extensions:
            e.extra_compile_args = COMPILE_OPTIONS.get(
                self.compiler.compiler_type, COMPILE_OPTIONS["other"]
            )
            e.extra_link_args = LINK_OPTIONS.get(
                self.compiler.compiler_type, LINK_OPTIONS["other"]
            )

class build_ext_subclass(build_ext, build_ext_options):
    def build_extensions(self):
        build_ext_options.build_options(self)
        build_ext.build_extensions(self)

def generate_cython(root, source):
    print("Cythonizing sources")
    p = subprocess.call(
        [sys.executable, os.path.join(root, "bin", "cythonize.py"), source],
        env=os.environ,
    )
    if p != 0:
        raise RuntimeError("Running cythonize failed")

def find_in_path(name, path):
    "Find a file in a search path"
    # adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
    for dir in path.split(os.pathsep):
        binpath = os.path.join(dir, name)
        if os.path.exists(binpath):
            return os.path.abspath(binpath)
    return None

def is_source_release(path):
    return os.path.exists(os.path.join(path, "PKG-INFO"))

def clean(path):
    for name in MOD_NAMES:
        name = name.replace(".", "/")
        for ext in [".so", ".html", ".cpp", ".c"]:
            file_path = os.path.join(path, name + ext)
            if os.path.exists(file_path):
                os.unlink(file_path)

@contextlib.contextmanager
def chdir(new_dir):
    old_dir = os.getcwd()
    try:
        os.chdir(new_dir)
        sys.path.insert(0, new_dir)
        yield
    finally:
        del sys.path[0]
        os.chdir(old_dir)

def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, "thinc", "about.py")) as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, "README.md"), encoding="utf8") as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "include"),
        ]

        if (
            ccompiler.new_compiler().compiler_type == "msvc"
            and msvccompiler.get_build_version() == 9
        ):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            if mod_name.endswith("gpu_ops"):
                continue
            mod_path = mod_name.replace(".", "/") + ".cpp"
            ext_modules.append(
                Extension(
                    mod_name, [mod_path], language="c++", include_dirs=include_dirs
                )
            )

        if not is_source_release(root):
            generate_cython(root, "thinc")

        setup(
            name=about["__title__"],
            zip_safe=False,
            packages=PACKAGES,
            package_data={"": ["*.pyx", "*.pxd", "*.pxi", "*.cpp"]},
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=ext_modules,
            setup_requires=["numpy>=1.7.0"],
            install_requires=[
                "blis>=0.2.1,<0.3.0",
                "thinc_gpu_ops>=0.0.1,<0.1.0",
                "numpy>=1.7.0",
                "murmurhash>=0.28.0,<1.1.0",
                "cymem>=2.0.2,<2.1.0",
                "preshed>=1.0.1,<2.1.0",
                "wrapt>=1.10.0,<1.11.0",
                "plac>=0.9.6,<1.0.0",
                "tqdm>=4.10.0,<5.0.0",
                "six>=1.10.0,<2.0.0",
                "wasabi>=0.0.9,<1.1.0",
                "srsly>=0.0.5,<1.1.0",
                'pathlib==1.0.1; python_version < "3.4"',
            ],
            extras_require={
                "cuda": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy>=5.0.0b4"],
                "cuda80": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda80>=5.0.0b4"],
                "cuda90": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda90>=5.0.0b4"],
                "cuda91": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda91>=5.0.0b4"],
                "cuda92": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda92>=5.0.0b4"],
                "cuda100": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda100>=5.0.0b4"],
            },
            classifiers=[
                "Development Status :: 5 - Production/Stable",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2.6",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3.3",
                "Programming Language :: Python :: 3.4",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )

setup_package()
<|endoftext|>


<commit_before>from distutils.core import setup

setup(name='maxims',
      version='20121107',
      description='A set of tools and reusbale items for Axiom',
      url='https://github.com/lvh/maxims',

      author='Laurens Van Houtven',
      author_email='_@lvh.cc',

      packages=["maxims", "maxims.contrib", "maxims.test"],

      license='ISC',
      classifiers=[
        "Development Status :: 3 - Alpha",
        "Framework :: Twisted",
        "License :: OSI Approved :: ISC License (ISCL)",
        ]
)

<commit_msg>Version bump<commit_after>from distutils.core import setup

setup(name='maxims',
      version='20121114',
      description='A set of tools and reusbale items for Axiom',
      url='https://github.com/lvh/maxims',

      author='Laurens Van Houtven',
      author_email='_@lvh.cc',

      packages=["maxims", "maxims.contrib", "maxims.test"],

      license='ISC',
      classifiers=[
        "Development Status :: 3 - Alpha",
        "Framework :: Twisted",
        "License :: OSI Approved :: ISC License (ISCL)",
        ]
)

<|endoftext|>


<commit_before>from setuptools import setup, find_packages
import moses

setup(name='moses',
      version=moses.__version__,
      python_requires='>=3.5.0',
      packages=find_packages() + ['moses/metrics/SA_Score',
                                  'moses/metrics/NP_Score'],
      install_requires=[
          'tqdm>=4.26.0',
          'keras>=2.2',
          'matplotlib>=3.0.0',
          'numpy>=1.15',
          'pandas>=0.23',
          'scipy>=1.1.0',
          'tensorflow>=1.0',
          'torch>=0.4.1',
          'rdkit>=2018.09.1',
      ],
      description='MOSES: A benchmarking platform for molecular generation models',
      author='Neuromation & Insilico Medicine Teams',
      author_email='engineering@neuromation.io, zhebrak@insilico.com',
      license='MIT',
      package_data={
          '': ['*.csv', '*.h5', '*.gz'],
      }
      )
<commit_msg>rdkit fix<commit_after>from setuptools import setup, find_packages
import moses

setup(name='moses',
      version=moses.__version__,
      python_requires='>=3.5.0',
      packages=find_packages() + ['moses/metrics/SA_Score',
                                  'moses/metrics/NP_Score'],
      install_requires=[
          'tqdm>=4.26.0',
          'keras>=2.2',
          'matplotlib>=3.0.0',
          'numpy>=1.15',
          'pandas>=0.23',
          'scipy>=1.1.0',
          'tensorflow>=1.0',
          'torch>=0.4.1',
      ],
      description='MOSES: A benchmarking platform for molecular generation models',
      author='Neuromation & Insilico Medicine Teams',
      author_email='engineering@neuromation.io, zhebrak@insilico.com',
      license='MIT',
      package_data={
          '': ['*.csv', '*.h5', '*.gz'],
      }
      )
<|endoftext|>


<commit_before>VERSION = "0.3.3"
<commit_msg>[ci skip] Bump version<commit_after>VERSION = "0.4.0"
<|endoftext|>