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

import os
import sys
import re

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

if sys.argv[-1] == 'publish':
    os.system('python setup.py sdist upload')
    sys.exit()

packages = [
    'rwslib',
    'rwslib.rws_requests',
    'rwslib.extras',
    'rwslib.extras.audit_event'
]

rwsinit = open('rwslib/__init__.py').read()
author = re.search("__author__ = '([^']+)'", rwsinit).group(1)
version = re.search("__version__ = '([^']+)'", rwsinit).group(1)

setup(
    name='rwslib',
    version=version,
    description='Rave web services for Python',
    long_description=open('README.md').read(),
    author=author,
    author_email="isparks@mdsol.com",
    packages=packages,
    package_dir={'rwslib': 'rwslib'},
    include_package_data=True,
    install_requires=['requests', 'lxml', 'httpretty', 'six'],
    license=open('LICENSE.txt').read(),
    zip_safe=False,
    test_suite='rwslib.tests.all_tests',
    classifiers=(
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Natural Language :: English',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: Implementation :: PyPy',
    ),
)
<commit_msg>Added tests_require, and rwscmd install_require merged in entry_points from rwscmd<commit_after>#!/usr/bin/env python

import os
import sys
import re

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

if sys.argv[-1] == 'publish':
    os.system('python setup.py sdist upload')
    sys.exit()

packages = [
    'rwslib',
    'rwslib.rws_requests',
    'rwslib.extras',
    'rwslib.extras.audit_event'
]

rwsinit = open('rwslib/__init__.py').read()
author = re.search("__author__ = '([^']+)'", rwsinit).group(1)
version = re.search("__version__ = '([^']+)'", rwsinit).group(1)

setup(
    name='rwslib',
    version=version,
    description='Rave web services for Python',
    long_description=open('README.md').read(),
    author=author,
    author_email="isparks@mdsol.com",
    packages=packages,
    package_dir={'rwslib': 'rwslib'},
    include_package_data=True,
    install_requires=['requests', 'lxml==3.6.2', 'httpretty', 'six', 'click', 'fake-factory', 'enum34'],
    tests_require=['mock'],
    license=open('LICENSE.txt').read(),
    zip_safe=False,
    test_suite='rwslib.tests.all_tests',
    classifiers=(
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Natural Language :: English',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: Implementation :: PyPy',
    ),
    entry_points='''
    [console_scripts]
    rwscmd=rwslib.extras.rwscmd.rwscmd:rws
    ''',
)
<|endoftext|>


<commit_before># Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import io
import os

import setuptools

# Package metadata.

name = "google-cloud-spanner"
description = "Cloud Spanner API client library"
version = "2.1.0"
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
# 'Development Status :: 5 - Production/Stable'
release_status = "Development Status :: 5 - Production/Stable"
dependencies = [
    "google-api-core[grpc] >= 1.22.0, < 2.0.0dev",
    "google-cloud-core >= 1.4.1, < 2.0dev",
    "grpc-google-iam-v1 >= 0.12.3, < 0.13dev",
    "libcst >= 0.2.5",
    "proto-plus == 1.11.0",
    "sqlparse >= 0.3.0",
]
extras = {
    "tracing": [
        "opentelemetry-api==0.11b0",
        "opentelemetry-sdk==0.11b0",
        "opentelemetry-instrumentation==0.11b0",
    ]
}

# Setup boilerplate below this line.

package_root = os.path.abspath(os.path.dirname(__file__))

readme_filename = os.path.join(package_root, "README.rst")
with io.open(readme_filename, encoding="utf-8") as readme_file:
    readme = readme_file.read()

# Only include packages under the 'google' namespace. Do not include tests,
# benchmarks, etc.
packages = [
    package
    for package in setuptools.PEP420PackageFinder.find()
    if package.startswith("google")
]

# Determine which namespaces are needed.
namespaces = ["google"]
if "google.cloud" in packages:
    namespaces.append("google.cloud")

setuptools.setup(
    name=name,
    version=version,
    description=description,
    long_description=readme,
    author="Google LLC",
    author_email="googleapis-packages@google.com",
    license="Apache 2.0",
    url="https://github.com/googleapis/python-spanner",
    classifiers=[
        release_status,
        "Intended Audience :: Developers",
        "License :: OSI Approved :: Apache Software License",
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Operating System :: OS Independent",
        "Topic :: Internet",
    ],
    platforms="Posix; MacOS X; Windows",
    packages=packages,
    namespace_packages=namespaces,
    install_requires=dependencies,
    extras_require=extras,
    python_requires=">=3.6",
    include_package_data=True,
    zip_safe=False,
)
<commit_msg>chore(deps): update dependency proto-plus to v1.13.0 (#185)<commit_after># Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import io
import os

import setuptools

# Package metadata.

name = "google-cloud-spanner"
description = "Cloud Spanner API client library"
version = "2.1.0"
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
# 'Development Status :: 5 - Production/Stable'
release_status = "Development Status :: 5 - Production/Stable"
dependencies = [
    "google-api-core[grpc] >= 1.22.0, < 2.0.0dev",
    "google-cloud-core >= 1.4.1, < 2.0dev",
    "grpc-google-iam-v1 >= 0.12.3, < 0.13dev",
    "libcst >= 0.2.5",
    "proto-plus==1.13.0",
    "sqlparse >= 0.3.0",
]
extras = {
    "tracing": [
        "opentelemetry-api==0.11b0",
        "opentelemetry-sdk==0.11b0",
        "opentelemetry-instrumentation==0.11b0",
    ]
}

# Setup boilerplate below this line.

package_root = os.path.abspath(os.path.dirname(__file__))

readme_filename = os.path.join(package_root, "README.rst")
with io.open(readme_filename, encoding="utf-8") as readme_file:
    readme = readme_file.read()

# Only include packages under the 'google' namespace. Do not include tests,
# benchmarks, etc.
packages = [
    package
    for package in setuptools.PEP420PackageFinder.find()
    if package.startswith("google")
]

# Determine which namespaces are needed.
namespaces = ["google"]
if "google.cloud" in packages:
    namespaces.append("google.cloud")

setuptools.setup(
    name=name,
    version=version,
    description=description,
    long_description=readme,
    author="Google LLC",
    author_email="googleapis-packages@google.com",
    license="Apache 2.0",
    url="https://github.com/googleapis/python-spanner",
    classifiers=[
        release_status,
        "Intended Audience :: Developers",
        "License :: OSI Approved :: Apache Software License",
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Operating System :: OS Independent",
        "Topic :: Internet",
    ],
    platforms="Posix; MacOS X; Windows",
    packages=packages,
    namespace_packages=namespaces,
    install_requires=dependencies,
    extras_require=extras,
    python_requires=">=3.6",
    include_package_data=True,
    zip_safe=False,
)
<|endoftext|>


<commit_before>#inspired by http://warp.byu.edu/site/content/128
from distutils.core import setup
import matplotlib
import sys, os

options = {
    'name':'Aston',
    'version':'0.2.0',
    'description':'Mass/UV Spectral Analysis Program',
    'author':'Roderick Bovee',
    'author_email':'bovee@fas.harvard.edu',
    'url':'http://code.google.com/p/aston',
    'packages':['aston', 'aston.ui', 'aston.Features', \
                'aston.FileFormats', 'aston.Math'],
    'scripts':['aston.py'],
    'data_files':matplotlib.get_py2exe_datafiles(),
}

if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
    #setup the distutils stuff
    try:
        import py2exe
    except ImportError:
        print 'Could not import py2exe. Windows exe could not be built.'
        sys.exit(0)

    options['windows'] = ['aston.py']
    options['options'] = {
        'py2exe':{'skip_archive': False,
        'dll_excludes':['MSVCP90.dll','tcl85.dll','tk85.dll'],
        'includes':['sip'],
        'excludes':['_gtkagg','_tkagg','tcl','Tkconstants','Tkinter']}
    }

    #clean up stuff
    os.system('rmdir dist /s /q')
    os.system('rmdir build /s /q')
    os.system('rmdir dist_win /s /q')

elif len(sys.argv) >= 2 and sys.argv[1] == 'py2app':
    #setup the distutils stuff
    try:
        import py2app
    except ImportError:
        print 'Could not import py2app. Mac bundle could not be built.'
        sys.exit(0)

    options['app'] = ['aston.py']
    options['setup_requires'] = ['py2app']
    options['options'] = {'py2app':{
        'argv_emulation':False,
        'includes':['sip','PyQt4','PyQt4.QtCore','PyQt4.QtGui','matplotlib','numpy','scipy'],
        'excludes':['PyQt4.QtDesigner','PyQt4.QtNetwork','PyQt4.QtOpenGL','PyQt4.QtScript','PyQt4.QtSql','PyQt4.QtTest','PyQt4.QtWebKit','PyQt4.QtXml','PyQt4.phonon','PyQt4.QtHelp','PyQt4.QtMultimedia','PyQt4.QtXmlPatterns','matplotlib.tests','scipy.weave']
    }}

    #clean up stuff
    os.system('rm -rf build')

#all the magic happens right here
setup(**options)

if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
    os.system('rmdir build /s /q')
    os.system('mkdir dist\\aston')
    os.system('mkdir dist\\aston\\ui')
    os.system('mkdir dist\\aston\\ui\\icons')
    os.system('copy aston\\ui\\icons\\*.png dist\\aston\\ui\\icons\\')
    #TODO: create an install wizard
elif len(sys.argv) >= 2 and sys.argv[1] == 'py2app':
    os.system('rm -rf build')
    os.system('cp -rf data/dist-files/qt_menu.nib dist/Aston.app/Contents/Resources/')
    os.system('cp data/dist-files/qt.conf dist/Aston.app/Contents/Resources/')
    os.system('mkdir dist/Aston.app/Contents/Resources/aston')
    os.system('mkdir dist/Aston.app/Contents/Resources/aston/ui')
    os.system('mkdir dist/Aston.app/Contents/Resources/aston/ui/icons')
    os.system('cp aston/ui/icons/*.png dist/Aston.app/Contents/Resources/aston/ui/icons/')
    #TODO: remove stuff from "dist/Aston.app/Contents/Resources/lib/python2.7"
    #matplotlib.tests, scipy.weave, numpy.f2py
    #libQtNetwork.4.dylib, libQtXmlPatterns.4.dylib, libtcl8.5.dylib
    #libtk8.dylib, libQtDeclarative.dylib, libQtScript, libQtScriptTools
    #libQtSql, libX11

    #The following doesn't seem to work?
    #os.system('rm -rf dist_mac')
    #os.system('mkdir dist_mac')
    #os.system('hdiutil create -fs HFS+ -volname "Aston" -srcfolder dist dist_mac/Aston.dmg')
<commit_msg>Updated version.<commit_after>#inspired by http://warp.byu.edu/site/content/128
from distutils.core import setup
import matplotlib
import sys, os

options = {
    'name':'Aston',
    'version':'0.2.2',
    'description':'Mass/UV Spectral Analysis Program',
    'author':'Roderick Bovee',
    'author_email':'bovee@fas.harvard.edu',
    'url':'http://code.google.com/p/aston',
    'packages':['aston', 'aston.ui', 'aston.Features', \
                'aston.FileFormats', 'aston.Math'],
    'scripts':['aston.py'],
    'data_files':matplotlib.get_py2exe_datafiles(),
}

if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
    #setup the distutils stuff
    try:
        import py2exe
    except ImportError:
        print 'Could not import py2exe. Windows exe could not be built.'
        sys.exit(0)

    options['windows'] = ['aston.py']
    options['options'] = {
        'py2exe':{'skip_archive': False,
        'dll_excludes':['MSVCP90.dll','tcl85.dll','tk85.dll'],
        'includes':['sip'],
        'excludes':['_gtkagg','_tkagg','tcl','Tkconstants','Tkinter']}
    }

    #clean up stuff
    os.system('rmdir dist /s /q')
    os.system('rmdir build /s /q')
    os.system('rmdir dist_win /s /q')

elif len(sys.argv) >= 2 and sys.argv[1] == 'py2app':
    #setup the distutils stuff
    try:
        import py2app
    except ImportError:
        print 'Could not import py2app. Mac bundle could not be built.'
        sys.exit(0)

    options['app'] = ['aston.py']
    options['setup_requires'] = ['py2app']
    options['options'] = {'py2app':{
        'argv_emulation':False,
        'includes':['sip','PyQt4','PyQt4.QtCore','PyQt4.QtGui','matplotlib','numpy','scipy'],
        'excludes':['PyQt4.QtDesigner','PyQt4.QtNetwork','PyQt4.QtOpenGL','PyQt4.QtScript','PyQt4.QtSql','PyQt4.QtTest','PyQt4.QtWebKit','PyQt4.QtXml','PyQt4.phonon','PyQt4.QtHelp','PyQt4.QtMultimedia','PyQt4.QtXmlPatterns','matplotlib.tests','scipy.weave']
    }}

    #clean up stuff
    os.system('rm -rf build')

#all the magic happens right here
setup(**options)

if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
    os.system('rmdir build /s /q')
    os.system('mkdir dist\\aston')
    os.system('mkdir dist\\aston\\ui')
    os.system('mkdir dist\\aston\\ui\\icons')
    os.system('copy aston\\ui\\icons\\*.png dist\\aston\\ui\\icons\\')
    #TODO: create an install wizard
elif len(sys.argv) >= 2 and sys.argv[1] == 'py2app':
    os.system('rm -rf build')
    os.system('cp -rf data/dist-files/qt_menu.nib dist/Aston.app/Contents/Resources/')
    os.system('cp data/dist-files/qt.conf dist/Aston.app/Contents/Resources/')
    os.system('mkdir dist/Aston.app/Contents/Resources/aston')
    os.system('mkdir dist/Aston.app/Contents/Resources/aston/ui')
    os.system('mkdir dist/Aston.app/Contents/Resources/aston/ui/icons')
    os.system('cp aston/ui/icons/*.png dist/Aston.app/Contents/Resources/aston/ui/icons/')
    #TODO: remove stuff from "dist/Aston.app/Contents/Resources/lib/python2.7"
    #matplotlib.tests, scipy.weave, numpy.f2py
    #libQtNetwork.4.dylib, libQtXmlPatterns.4.dylib, libtcl8.5.dylib
    #libtk8.dylib, libQtDeclarative.dylib, libQtScript, libQtScriptTools
    #libQtSql, libX11

    #The following doesn't seem to work?
    #os.system('rm -rf dist_mac')
    #os.system('mkdir dist_mac')
    #os.system('hdiutil create -fs HFS+ -volname "Aston" -srcfolder dist dist_mac/Aston.dmg')
<|endoftext|>


<commit_before>import base64
import functools
import inspect
from importlib import import_module

import requests
from django.conf import settings
from django.utils.encoding import force_text

try:
    from django.utils.module_loading import import_string
except ImportError:
    def import_string(value):
        module_name, func_name = value.rsplit('.', 1)
        module = import_module(module_name)
        return getattr(module, func_name)

class PermissionDenied(Exception):
    pass

def create_report(request=None):
    """Run all checks and return a tuple containing results and boolean to
    indicate to indicate if all things are healthy.

    """
    report = {}
    has_error = False

    for service, check_func in _get_check_functions(request=request):
        report[service] = check_func() or False

        if not report[service]:
            has_error = True
    return report, not has_error

def create_service_result(service, request=None):
    functions = list(_get_check_functions(name=service, request=request))
    if not functions:
        return

    check_func = functions[0][1]
    result = check_func() or False
    return result

def _get_check_functions(name=None, request=None):
    checks = _get_registered_health_checks()
    if not checks or (name and name not in checks):
        raise StopIteration()

    checks = _filter_checks_on_permission(request, checks)
    if not checks or (name and name not in checks):
        raise PermissionDenied()

    for service, func_string in checks.items():
        if name and name != service:
            continue

        if func_string.startswith(('https://', 'http://')):
            check_func = _http_healthcheck_func(func_string)
        elif callable(func_string):
            check_func = func_string
        else:
            check_func = import_string(func_string)

        spec = inspect.getargspec(check_func)
        if spec.args == ['request']:
            check_func = functools.partial(check_func, request)

        yield service, check_func

def _get_registered_health_checks():
    return getattr(settings, 'HEALTH_CHECKS', {})

def _http_healthcheck_func(url):
    def handle_remote_request():
        try:
            response = requests.get(url, timeout=_get_http_healthcheck_timeout())
        except requests.exceptions.RequestException:
            return False

        if response.ok:
            return response.json()
        return False

    return handle_remote_request

def _get_http_healthcheck_timeout():
    return getattr(settings, 'HEALTH_CHECKS_HTTP_TIMEOUT', 0.5)

def _filter_checks_on_permission(request, checks):
    permissions = getattr(settings, 'HEALTH_CHECKS_BASIC_AUTH', {})
    if not permissions:
        return checks

    allowed = {}
    for name in checks.keys():
        required_credentials = permissions.get(name, permissions.get('*'))

        if required_credentials:
            credentials = _get_basic_auth(request)
            if not credentials or credentials not in required_credentials:
                continue

        allowed[name] = checks[name]
    return allowed

def _get_basic_auth(request):
    auth = request.META.get('HTTP_AUTHORIZATION')
    if not auth:
        return

    auth = auth.split()
    if len(auth) == 2 and force_text(auth[0]).lower() == u'basic':
        credentials = base64.b64decode(auth[1]).decode('latin-1')
        return tuple(credentials.split(':'))
<commit_msg>Check for callable before something else<commit_after>import base64
import functools
import inspect
from importlib import import_module

import requests
from django.conf import settings
from django.utils.encoding import force_text

try:
    from django.utils.module_loading import import_string
except ImportError:
    def import_string(value):
        module_name, func_name = value.rsplit('.', 1)
        module = import_module(module_name)
        return getattr(module, func_name)

class PermissionDenied(Exception):
    pass

def create_report(request=None):
    """Run all checks and return a tuple containing results and boolean to
    indicate to indicate if all things are healthy.

    """
    report = {}
    has_error = False

    for service, check_func in _get_check_functions(request=request):
        report[service] = check_func() or False

        if not report[service]:
            has_error = True
    return report, not has_error

def create_service_result(service, request=None):
    functions = list(_get_check_functions(name=service, request=request))
    if not functions:
        return

    check_func = functions[0][1]
    result = check_func() or False
    return result

def _get_check_functions(name=None, request=None):
    checks = _get_registered_health_checks()
    if not checks or (name and name not in checks):
        raise StopIteration()

    checks = _filter_checks_on_permission(request, checks)
    if not checks or (name and name not in checks):
        raise PermissionDenied()

    for service, func_string in checks.items():
        if name and name != service:
            continue

        if callable(func_string):
            check_func = func_string
        elif func_string.startswith(('https://', 'http://')):
            check_func = _http_healthcheck_func(func_string)
        else:
            check_func = import_string(func_string)

        spec = inspect.getargspec(check_func)
        if spec.args == ['request']:
            check_func = functools.partial(check_func, request)

        yield service, check_func

def _get_registered_health_checks():
    return getattr(settings, 'HEALTH_CHECKS', {})

def _http_healthcheck_func(url):
    def handle_remote_request():
        try:
            response = requests.get(url, timeout=_get_http_healthcheck_timeout())
        except requests.exceptions.RequestException:
            return False

        if response.ok:
            return response.json()
        return False

    return handle_remote_request

def _get_http_healthcheck_timeout():
    return getattr(settings, 'HEALTH_CHECKS_HTTP_TIMEOUT', 0.5)

def _filter_checks_on_permission(request, checks):
    permissions = getattr(settings, 'HEALTH_CHECKS_BASIC_AUTH', {})
    if not permissions:
        return checks

    allowed = {}
    for name in checks.keys():
        required_credentials = permissions.get(name, permissions.get('*'))

        if required_credentials:
            credentials = _get_basic_auth(request)
            if not credentials or credentials not in required_credentials:
                continue

        allowed[name] = checks[name]
    return allowed

def _get_basic_auth(request):
    auth = request.META.get('HTTP_AUTHORIZATION')
    if not auth:
        return

    auth = auth.split()
    if len(auth) == 2 and force_text(auth[0]).lower() == u'basic':
        credentials = base64.b64decode(auth[1]).decode('latin-1')
        return tuple(credentials.split(':'))
<|endoftext|>


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

setup(name='mani',
      version='0.1',
      packages=['mani'],
      install_requires=['redis',
                        'python-redis-lock'],
      setup_requires=['setuptools'],
      tests_require=['flake8'],
      description='Distributed cron',
      author='Sherin Kurian',
      author_email='sherinkurian.123@gmail.com',
      url='https://github.com/sherinkurian/mani',
      download_url='https://github.com/sherinkurian/mani/tarball/0.1',
      keywords=['cron', 'distributed', 'redis'],
      package_data={'mani.version': ['VERSION']},
      classifiers=['Environment :: Console',
                   'Intended Audience :: Developers',
                   'Operating System :: Unix',
                   'Operating System :: POSIX',
                   'Programming Language :: Python',
                   'Topic :: System',
                   'Topic :: Software Development',
                   'Development Status :: 4 - Beta'])
<commit_msg>upgrade version<commit_after>#!/usr/bin/env python
from setuptools import setup

setup(name='mani',
      version='0.2',
      packages=['mani'],
      install_requires=['redis',
                        'python-redis-lock'],
      setup_requires=['setuptools'],
      tests_require=['flake8'],
      description='Distributed cron',
      author='Sherin Kurian',
      author_email='sherinkurian.123@gmail.com',
      url='https://github.com/sherinkurian/mani',
      download_url='https://github.com/sherinkurian/mani/tarball/0.1',
      keywords=['cron', 'distributed', 'redis'],
      package_data={'mani.version': ['VERSION']},
      classifiers=['Environment :: Console',
                   'Intended Audience :: Developers',
                   'Operating System :: Unix',
                   'Operating System :: POSIX',
                   'Programming Language :: Python',
                   'Topic :: System',
                   'Topic :: Software Development',
                   'Development Status :: 4 - Beta'])
<|endoftext|>


<commit_before># -*- encoding: utf8 -*-
from setuptools import setup, find_packages

import os

setup(
    name = "mongoql-conv",
    version = "0.1.1",
    url = 'https://github.com/ionelmc/python-mongoql-conv',
    download_url = '',
    license = 'BSD',
    description = "Library to convert those MongoDB queries to something else, like a python "
                  "expresion, a function or a Django Q object tree to be used with a ORM query.",
    long_description = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
    author = 'Ionel Cristian Mărieș',
    author_email = 'contact@ionelmc.ro',
    packages = find_packages('src'),
    package_dir = {'':'src'},
    include_package_data = True,
    zip_safe = False,
    classifiers = [
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: Unix',
        'Operating System :: POSIX',
        'Programming Language :: Python',
        'Topic :: Software Development :: Debuggers',
        'Topic :: Utilities',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: Implementation :: CPython',
        'Programming Language :: Python :: Implementation :: PyPy',
    ],
    install_requires=[
        'six',
    ],
    extras_require={
        'django': [
            'Django',
        ]
    }
)
<commit_msg>Up version.<commit_after># -*- encoding: utf8 -*-
from setuptools import setup, find_packages

import os

setup(
    name = "mongoql-conv",
    version = "0.2.0",
    url = 'https://github.com/ionelmc/python-mongoql-conv',
    download_url = '',
    license = 'BSD',
    description = "Library to convert those MongoDB queries to something else, like a python "
                  "expresion, a function or a Django Q object tree to be used with a ORM query.",
    long_description = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
    author = 'Ionel Cristian Mărieș',
    author_email = 'contact@ionelmc.ro',
    packages = find_packages('src'),
    package_dir = {'':'src'},
    include_package_data = True,
    zip_safe = False,
    classifiers = [
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: Unix',
        'Operating System :: POSIX',
        'Programming Language :: Python',
        'Topic :: Software Development :: Debuggers',
        'Topic :: Utilities',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: Implementation :: CPython',
        'Programming Language :: Python :: Implementation :: PyPy',
    ],
    install_requires=[
        'six',
    ],
    extras_require={
        'django': [
            'Django',
        ]
    }
)
<|endoftext|>


<commit_before>from setuptools import setup, find_packages
# buildout build system
# http://www.buildout.org/en/latest/docs/tutorial.html

# setup() documentation:
# http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#setup-py

name = 'son'
setup(
        name=name,
        license='To be determined',
        version='0.0.1',
        url='http://github.com/sonata-nfv',
        author_email='sonata-dev@sonata-nfv.eu',
        package_dir={'': 'src'},
        packages=find_packages('src'),  # dependency resolution
        namespace_packages=['son',],
        include_package_data=True,
        install_requires=['setuptools', 'pyaml', 'jsonschema', 'validators', 'requests'],
        zip_safe=False,
        entry_points={
            'console_scripts': [
                'son-workspace=son.workspace.workspace:main',
                'son-package=son.package.package:main',
                'son-push=son.push.push:main'
            ],
        },
        test_suite='son'
#test_suite='son.workspace.tests.TestSample.main'
    )
<commit_msg>Improve packaging<commit_after>from setuptools import setup, find_packages
import codecs
import os.path as path

# buildout build system
# http://www.buildout.org/en/latest/docs/tutorial.html

# setup() documentation:
# http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#setup-py

cwd = path.dirname(__file__)
longdesc = codecs.open(path.join(cwd, 'README.md'), 'r', 'ascii').read()

name = 'son'
setup(
        name=name,
        license='To be determined',
        version='0.0.1',
        url='https://github.com/sonata-nfv/son-cli',
        author_email='sonata-dev@sonata-nfv.eu',
        long_description=longdesc,
        package_dir={'': 'src'},
        packages=find_packages('src'),  # dependency resolution
        namespace_packages=['son',],
        include_package_data=True,
        package_data= {
            'son': ['workspace/samples/*']
        },
        install_requires=['setuptools', 'pyaml', 'jsonschema', 'validators', 'requests'],
        zip_safe=False,
        entry_points={
            'console_scripts': [
                'son-workspace=son.workspace.workspace:main',
                'son-package=son.package.package:main',
                'son-push=son.push.push:main'
            ],
        },
        test_suite='son'
#test_suite='son.workspace.tests.TestSample.main'
    )
<|endoftext|>


<commit_before>#!/usr/bin/env python
# encoding: utf-8

import os
from distutils.core import setup

print "Welcome to Pyvona setup. Installing Pyvona..."

setup(name='pyvona',
      version='0.2',
      description='Python text-to-speech IVONA Wrapper',
      author='Zachary Bears',
      author_email='bears.zachary@gmail.com',
      url='http://www.zacharybears.com/pyvona',
      py_modules=['pyvona'],
      install_requires=['requests']
    )

print "Please visit zacharybears.com/pyvona for tutorials, feature requests, and questions."
<commit_msg>Changed to version 0.21<commit_after>#!/usr/bin/env python
# encoding: utf-8

import os
from distutils.core import setup

print "Welcome to Pyvona setup. Installing Pyvona..."

setup(name='pyvona',
      version='0.21',
      description='Python text-to-speech IVONA Wrapper',
      author='Zachary Bears',
      author_email='bears.zachary@gmail.com',
      url='http://www.zacharybears.com/pyvona',
      py_modules=['pyvona'],
      install_requires=['requests']
    )

print "Please visit zacharybears.com/pyvona for tutorials, feature requests, and questions."
<|endoftext|>


<commit_before>#!/usr/bin/env python
import os
from setuptools import setup
from ranch.specs import _get_latest_export

try:
    import pypandoc
    long_description = pypandoc.convert('README.md', 'rst')
except ImportError:
    long_description = 'Ranch does addressing in Python'

setup(
    name='Ranch',
    version='1.0.3',
    description='Ranch does addressing in Python',
    long_description=long_description,
    author='Martijn Arts',
    author_email='martijn@3dhubs.com',
    url="https://github.com/3DHubs/ranch",
    packages=['ranch'],
    package_dir={'ranch': 'ranch'},
    package_data={'ranch': [_get_latest_export()]},
    scripts=['scripts/ranch-download'],
    install_requires=['beautifulsoup4', 'flake8', 'requests', 'progressbar2',
                      'percache'],
    classifiers=[
        'Development Status :: 4 - Beta',
        'License :: OSI Approved :: Apache Software License',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3 :: Only',
    ]
)
<commit_msg>Version bump<commit_after>#!/usr/bin/env python
import os
from setuptools import setup
from ranch.specs import _get_latest_export

try:
    import pypandoc
    long_description = pypandoc.convert('README.md', 'rst')
except ImportError:
    long_description = 'Ranch does addressing in Python'

setup(
    name='Ranch',
    version='1.0.4',
    description='Ranch does addressing in Python',
    long_description=long_description,
    author='Martijn Arts',
    author_email='martijn@3dhubs.com',
    url="https://github.com/3DHubs/ranch",
    packages=['ranch'],
    package_dir={'ranch': 'ranch'},
    package_data={'ranch': [_get_latest_export()]},
    scripts=['scripts/ranch-download'],
    install_requires=['beautifulsoup4', 'flake8', 'requests', 'progressbar2',
                      'percache'],
    classifiers=[
        'Development Status :: 4 - Beta',
        'License :: OSI Approved :: Apache Software License',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3 :: Only',
    ]
)
<|endoftext|>


<commit_before>from setuptools import setup, find_packages
from pycalculix.version import __version__

# platform specific builds
# http://stackoverflow.com/questions/6469508/is-it-possible-to-express-a-platform-specific-dependency-in-setup-py-without-bui
# check -format
# check bdst -format=
# check -p for platform
# https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/
# version suggestions
# http://semver.org/

setup(
    name = "pycalculix",
    install_requires = ['matplotlib >= 1.3.1', 'numpy', 'dxfgrabber'],
    version = __version__,
    description = "Python 3 library to build and solve finite element analysis (FEA) models in Calculix.",
    author = "Justin Black",
    author_email = "justin.a.black@gmail.com",
    packages = find_packages(),
    url = "http://justinablack.com/pycalculix/",
    entry_points = {
        'console_scripts': ['pycalculix-add-feaprograms=pycalculix.installer:add',
                            'pycalculix-remove-feaprograms=pycalculix.installer:remove'],
    },
    keywords = ["FEA", "Finite Element Analysis", "Calculix", "Mechanical Engineering", "CAD"],
    classifiers = [
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Development Status :: 7 - Inactive",
        "Intended Audience :: End Users/Desktop",
        "Intended Audience :: Science/Research",
        "Intended Audience :: Education",
        "License :: OSI Approved :: Apache Software License",
        'Operating System :: Microsoft :: Windows',
        'Operating System :: POSIX',
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Topic :: Scientific/Engineering :: Physics",
        "Topic :: Scientific/Engineering"],
    long_description = """\
'''
Python 3 library to automate and build finite element analysis (FEA) models in Calculix.
----------------------------------------------------------------------------------------
Meshing uses Calculix or GMSH.
Website: http://justinablack.com/pycalculix/
Source Code: https://github.com/spacether/pycalculix
Documentation: http://spacether.github.io/pycalculix/pycalculix.html

Useful applications of Pycalculix:
-Trade studies for plane stress, plane strain, or axisymmetric parts
-Quick Kt analysis of 2D geometry
-Learning finite element analyis (FEA) and Python

Notes:
I build a chunker in python which tries to cut big areas (> 5 sides) which
cgx can't mesh into smaller areas (<= 5 sides) which are meshable in cgx.
The chunker may not always be able to cut areas correctly.

Elements Supported:
Axisymmetric, plane stress, and plane strain elements are supported.
First and second order triangles and quadrilaterals are supported.
  First order elements only have corner nodes
  Second order elements have corner and mid-side nodes
Second order elements produce more accurate results
Setting element divisions on lines is supported

Geometry Building:
One can build separate parts made of points, lines, arcs, and areas.
One can draw a part made of straight lines, then smooth out corners by adding
blends/fillets with the part method: part.fillet_lines(L1, L2, arc_radius)
The new fillet will be tangent to both adjacent lines.

Loading:
Force loading
Constant pressure
Linearly varying pressure (water pressure)
Gravity
Rotational speed forces
Displacement constraints are supported
Loads are stored on geometry primitives (points lines etc) and can be applied
before or after meshing.

Examples:
https://github.com/spacether/pycalculix/tree/master/examples
"""
)
<commit_msg>Updates setup.py<commit_after>from setuptools import setup, find_packages
with open('pycalculix/version.py') as f: exec(f.read())

setup(
    name = "pycalculix",
    install_requires = ['matplotlib >= 1.3.1', 'numpy', 'dxfgrabber'],
    version = __version__,
    description = "Python 3 library to build and solve finite element analysis (FEA) models in Calculix.",
    author = "Justin Black",
    author_email = "justin.a.black@gmail.com",
    packages = find_packages(),
    url = "http://justinablack.com/pycalculix/",
    entry_points = {
        'console_scripts': ['pycalculix-add-feaprograms=pycalculix.installer:add',
                            'pycalculix-remove-feaprograms=pycalculix.installer:remove'],
    },
    keywords = ["FEA", "Finite Element Analysis", "Calculix", "Mechanical Engineering", "CAD"],
    classifiers = [
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Development Status :: 7 - Inactive",
        "Intended Audience :: End Users/Desktop",
        "Intended Audience :: Science/Research",
        "Intended Audience :: Education",
        "License :: OSI Approved :: Apache Software License",
        'Operating System :: Microsoft :: Windows',
        'Operating System :: POSIX',
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Topic :: Scientific/Engineering :: Physics",
        "Topic :: Scientific/Engineering"],
    long_description = """\
'''
Python 3 library to automate and build finite element analysis (FEA) models in Calculix.
----------------------------------------------------------------------------------------
Meshing uses Calculix or GMSH.
Website: http://justinablack.com/pycalculix/
Source Code: https://github.com/spacether/pycalculix
Documentation: http://spacether.github.io/pycalculix/pycalculix.html

Useful applications of Pycalculix:
-Trade studies for plane stress, plane strain, or axisymmetric parts
-Quick Kt analysis of 2D geometry
-Learning finite element analyis (FEA) and Python

Notes:
I build a chunker in python which tries to cut big areas (> 5 sides) which
cgx can't mesh into smaller areas (<= 5 sides) which are meshable in cgx.
The chunker may not always be able to cut areas correctly.

Elements Supported:
Axisymmetric, plane stress, and plane strain elements are supported.
First and second order triangles and quadrilaterals are supported.
  First order elements only have corner nodes
  Second order elements have corner and mid-side nodes
Second order elements produce more accurate results
Setting element divisions on lines is supported

Geometry Building:
One can build separate parts made of points, lines, arcs, and areas.
One can draw a part made of straight lines, then smooth out corners by adding
blends/fillets with the part method: part.fillet_lines(L1, L2, arc_radius)
The new fillet will be tangent to both adjacent lines.

Loading:
Force loading
Constant pressure
Linearly varying pressure (water pressure)
Gravity
Rotational speed forces
Displacement constraints are supported
Loads are stored on geometry primitives (points lines etc) and can be applied
before or after meshing.

Examples:
https://github.com/spacether/pycalculix/tree/master/examples
"""
)
<|endoftext|>


<commit_before># -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import os
import io
from setuptools import setup, find_packages

# Helpers
def read(*paths):
    """Read a text file."""
    basedir = os.path.dirname(__file__)
    fullpath = os.path.join(basedir, *paths)
    contents = io.open(fullpath, encoding='utf-8').read().strip()
    return contents

# Prepare
PACKAGE = 'datapackage_pipelines'
NAME = PACKAGE.replace('_', '-')
INSTALL_REQUIRES = [
    'celery',
    'requests',
    'datapackage>=1.5.1',
    'tableschema>=1.2.5',
    'tableschema-sql>=0.10.4',
    'pyyaml',
    'ujson',
    'mistune',
    'redis>=3,<4',
    'click<8.0',
    'awesome-slugify',
    'flask<2.0.0',
    'flask-cors',
    'flask-jsonpify',
    'flask-basicauth',
    'cachetools',
    'tabulator>=1.17.0',
    'globster>=0.1.0',
    'dataflows>=0.0.55',
]
SPEEDUP_REQUIRES = [
    'dataflows[speedup]',
]
LINT_REQUIRES = [
    'pylama',
]
TESTS_REQUIRE = [
    'tox',
    'sqlalchemy',
]
README = read('README.md')
VERSION = read(PACKAGE, 'VERSION')
PACKAGES = find_packages(exclude=['examples', 'tests', '.tox'])

# Run
setup(
    name=NAME,
    version=VERSION,
    packages=PACKAGES,
    include_package_data=True,
    install_requires=INSTALL_REQUIRES,
    tests_require=TESTS_REQUIRE,
    extras_require={
        'develop': LINT_REQUIRES + TESTS_REQUIRE,
        'speedup': SPEEDUP_REQUIRES,
    },
    zip_safe=False,
    long_description=README,
    description='{{ DESCRIPTION }}',
    author='Open Knowledge Foundation',
    author_email='info@okfn.org',
    url='https://github.com/frictionlessdata/datapackage-pipelines',
    license='MIT',
    keywords=[
        'data',
    ],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 3.6',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ],
    entry_points={
      'console_scripts': [
        'dpp = datapackage_pipelines.cli:cli',
      ]
    },
)
<commit_msg>long_description_content_type -> markdown<commit_after># -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import os
import io
from setuptools import setup, find_packages

# Helpers
def read(*paths):
    """Read a text file."""
    basedir = os.path.dirname(__file__)
    fullpath = os.path.join(basedir, *paths)
    contents = io.open(fullpath, encoding='utf-8').read().strip()
    return contents

# Prepare
PACKAGE = 'datapackage_pipelines'
NAME = PACKAGE.replace('_', '-')
INSTALL_REQUIRES = [
    'celery',
    'requests',
    'datapackage>=1.5.1',
    'tableschema>=1.2.5',
    'tableschema-sql>=0.10.4',
    'pyyaml',
    'ujson',
    'mistune',
    'redis>=3,<4',
    'click<8.0',
    'awesome-slugify',
    'flask<2.0.0',
    'flask-cors',
    'flask-jsonpify',
    'flask-basicauth',
    'cachetools',
    'tabulator>=1.17.0',
    'globster>=0.1.0',
    'dataflows>=0.0.55',
]
SPEEDUP_REQUIRES = [
    'dataflows[speedup]',
]
LINT_REQUIRES = [
    'pylama',
]
TESTS_REQUIRE = [
    'tox',
    'sqlalchemy',
]
README = read('README.md')
VERSION = read(PACKAGE, 'VERSION')
PACKAGES = find_packages(exclude=['examples', 'tests', '.tox'])

# Run
setup(
    name=NAME,
    version=VERSION,
    packages=PACKAGES,
    include_package_data=True,
    install_requires=INSTALL_REQUIRES,
    tests_require=TESTS_REQUIRE,
    extras_require={
        'develop': LINT_REQUIRES + TESTS_REQUIRE,
        'speedup': SPEEDUP_REQUIRES,
    },
    zip_safe=False,
    long_description=README,
    long_description_content_type='text/markdown',
    description='{{ DESCRIPTION }}',
    author='Open Knowledge Foundation',
    author_email='info@okfn.org',
    url='https://github.com/frictionlessdata/datapackage-pipelines',
    license='MIT',
    keywords=[
        'data',
    ],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 3.6',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ],
    entry_points={
      'console_scripts': [
        'dpp = datapackage_pipelines.cli:cli',
      ]
    },
)
<|endoftext|>


<commit_before>""" torsionfit: A toolkit for Bayesian torsion parameterization for molecular mechanics forcefields.

This project provides tools for using Bayesian parameterization techniques and Markov chain Monte Carlo
to fit molecular mechanics torsion Fourier terms to quantum chemical data.
"""

from __future__ import print_function

import os
from os.path import relpath, join

import numpy
import versioneer

from setuptools import setup, Extension, find_packages

DOCLINES = __doc__.split("\n")

########################
CLASSIFIERS = """\
Development Status :: 3 - Alpha
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Programming Language :: Python
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Scientific/Engineering :: Chemistry
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating System :: Unix
Operating System :: MacOS
"""

################################################################################
# USEFUL SUBROUTINES
################################################################################
def find_package_data(data_root, package_root):
    files = []
    for root, dirnames, filenames in os.walk(data_root):
        for fn in filenames:
            files.append(relpath(join(root, fn), package_root))
    return files

def package_files(directory):
    paths = []
    for (path, directories, filenames) in os.walk(directory):
        for filename in filenames:
            paths.append(os.path.join('..', path, filename))
    return paths

################################################################################
# SETUP
################################################################################

setup(
    name='torsionfit',
    author='Chaya Stern',
    author_email='chaya.stern@choderalab.org',
    description=DOCLINES[0],
    long_description="\n".join(DOCLINES[2:]),
    version=versioneer.get_version(),
    cmdclass=versioneer.get_cmdclass(),
    license='LGPL',
    url='https://github.com/choderalab/torsions',
    platforms=['Linux', 'Mac OS-X', 'Unix', 'Windows'],
    classifiers=CLASSIFIERS.splitlines(),
    packages=['torsionfit', 'torsionfit.tests', 'torsionfit.qmscan', 'torsionfit.backends', 'torsionfit.database'],
    package_data={'': package_files('torsionfit/tests/reference'), '': package_files('torsionfit/qmscan')},
    zip_safe=False,
    install_requires=[
        'numpy',
        'mdtraj',
        'pymc',
        'pandas',
        'cclib',
        'openmm',
        'parmed'
        ],
    )

<commit_msg>add fgroup_smarts.yml<commit_after>""" torsionfit: A toolkit for Bayesian torsion parameterization for molecular mechanics forcefields.

This project provides tools for using Bayesian parameterization techniques and Markov chain Monte Carlo
to fit molecular mechanics torsion Fourier terms to quantum chemical data.
"""

from __future__ import print_function

import os
from os.path import relpath, join

import numpy
import versioneer

from setuptools import setup, Extension, find_packages

DOCLINES = __doc__.split("\n")

########################
CLASSIFIERS = """\
Development Status :: 3 - Alpha
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Programming Language :: Python
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Scientific/Engineering :: Chemistry
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating System :: Unix
Operating System :: MacOS
"""

################################################################################
# USEFUL SUBROUTINES
################################################################################
def find_package_data(data_root, package_root):
    files = []
    for root, dirnames, filenames in os.walk(data_root):
        for fn in filenames:
            files.append(relpath(join(root, fn), package_root))
    return files

def package_files(directory):
    paths = []
    for (path, directories, filenames) in os.walk(directory):
        for filename in filenames:
            paths.append(os.path.join('..', path, filename))
    return paths

################################################################################
# SETUP
################################################################################

setup(
    name='torsionfit',
    author='Chaya Stern',
    author_email='chaya.stern@choderalab.org',
    description=DOCLINES[0],
    long_description="\n".join(DOCLINES[2:]),
    version=versioneer.get_version(),
    cmdclass=versioneer.get_cmdclass(),
    license='LGPL',
    url='https://github.com/choderalab/torsions',
    platforms=['Linux', 'Mac OS-X', 'Unix', 'Windows'],
    classifiers=CLASSIFIERS.splitlines(),
    packages=['torsionfit', 'torsionfit.tests', 'torsionfit.qmscan', 'torsionfit.backends', 'torsionfit.database'],
    package_data={'tests': package_files('torsionfit/tests/reference'), 'qmscan': package_files('torsionfit/qmscan')},
    zip_safe=False,
    install_requires=[
        'numpy',
        'mdtraj',
        'pymc',
        'pandas',
        'cclib',
        'openmm',
        'parmed'
        ],
    )

<|endoftext|>


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

from distutils import archive_util
from distutils import sysconfig
from distutils.core import setup
from distutils.command.sdist import sdist
import os

EZIP_HEADER="""#! /bin/sh
PYTHONPATH=$0/%s exec python -m scapy.__init__
"""

def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0):
    fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run)
    ofname = fname+".old"
    os.rename(fname,ofname)
    of=open(ofname)
    f=open(fname,"w")
    f.write(EZIP_HEADER % base_dir)
    while True:
        data = of.read(8192)
        if not data:
            break
        f.write(data)
    f.close()
    of.close()
    os.unlink(ofname)
    os.chmod(fname,0755)
    return fname

archive_util.ARCHIVE_FORMATS["ezip"] = (make_ezipfile,[],'Executable ZIP file')

SCRIPTS = ['bin/scapy','bin/UTscapy']
# On Windows we also need additional batch files to run the above scripts
if os.name == "nt":
  SCRIPTS += ['bin/scapy.bat','bin/UTscapy.bat']

setup(
    name = 'scapy',
    version = '2.0.1-dev',
    packages=['scapy','scapy/arch', 'scapy/arch/windows', 'scapy/layers','scapy/asn1','scapy/tools','scapy/modules'],
    scripts = SCRIPTS,
    data_files = [('share/man/man1', ["doc/scapy.1.gz"])],

    # Metadata
    author = 'Philippe BIONDI',
    author_email = 'phil(at)secdev.org',
    description = 'Scapy: interactive packet manipulation tool',
    license = 'GPLv2',
    url = 'http://www.secdev.org/projects/scapy'
    # keywords = '',
    # url = '',
)
<commit_msg>Added scapy/crypto into setup.py<commit_after>#! /usr/bin/env python

from distutils import archive_util
from distutils import sysconfig
from distutils.core import setup
from distutils.command.sdist import sdist
import os

EZIP_HEADER="""#! /bin/sh
PYTHONPATH=$0/%s exec python -m scapy.__init__
"""

def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0):
    fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run)
    ofname = fname+".old"
    os.rename(fname,ofname)
    of=open(ofname)
    f=open(fname,"w")
    f.write(EZIP_HEADER % base_dir)
    while True:
        data = of.read(8192)
        if not data:
            break
        f.write(data)
    f.close()
    of.close()
    os.unlink(ofname)
    os.chmod(fname,0755)
    return fname

archive_util.ARCHIVE_FORMATS["ezip"] = (make_ezipfile,[],'Executable ZIP file')

SCRIPTS = ['bin/scapy','bin/UTscapy']
# On Windows we also need additional batch files to run the above scripts
if os.name == "nt":
  SCRIPTS += ['bin/scapy.bat','bin/UTscapy.bat']

setup(
    name = 'scapy',
    version = '2.0.1-dev',
    packages=['scapy','scapy/arch', 'scapy/arch/windows', 'scapy/layers','scapy/asn1','scapy/tools','scapy/modules', 'scapy/crypto'],
    scripts = SCRIPTS,
    data_files = [('share/man/man1', ["doc/scapy.1.gz"])],

    # Metadata
    author = 'Philippe BIONDI',
    author_email = 'phil(at)secdev.org',
    description = 'Scapy: interactive packet manipulation tool',
    license = 'GPLv2',
    url = 'http://www.secdev.org/projects/scapy'
    # keywords = '',
    # url = '',
)
<|endoftext|>


<commit_before>'''

This tutorial demonstrates reading and writing files to remote archives using
on-disk I/O operations.

To demonstrate this, we make use of the :py:mod:`xarray` module, which cannot
read from a streaming object.

Set up the workspace
--------------------

.. code-block:: python

    >>> from datafs import DataAPI
    >>> from datafs.managers.manager_mongo import MongoDBManager
    >>> from fs.s3fs import S3FS

Initialize the API

.. code-block:: python

    >>> api = DataAPI(
    ...      username='My Name',
    ...      contact = 'my.email@example.com')
    >>>
    >>> manager = MongoDBManager(
    ...     database_name = 'MyDatabase',
    ...     table_name = 'DataFiles')
    >>>
    >>> manager.create_archive_table('DataFiles', raise_on_err=False)
    >>>
    >>> api.attach_manager(manager)

Attach a remote service
~~~~~~~~~~~~~~~~~~~~~~~

In this example we'll use a remote file system, in this case AWS S3. This
filesystem returns streaming objects returned by ``boto`` or ``request`` calls.

    >>> s3 = S3FS(
    ...     'test-bucket',
    ...     aws_access_key='MY_KEY',
    ...     aws_secret_key='MY_SECRET_KEY')
    >>>
    >>> api.attach_authority('aws', s3)
    >>>
    >>> var = api.create(
    ...     'streaming_archive',
    ...     metadata = dict(description = 'My test data archive'))
    >>>

Create sample data
~~~~~~~~~~~~~~~~~~

Create a sample dataset (from the
`xarray docs \
<http://xarray.pydata.org/en/stable/examples/weather-data.html>`_):

.. code-block:: python

    >>> import xarray as xr
    >>> import numpy as np
    >>> import pandas as pd
    >>>
    >>> np.random.seed(123)
    >>>
    >>> times = pd.date_range('2000-01-01', '2001-12-31', name='time')
    >>> annual_cycle = np.sin(2 * np.pi * (times.dayofyear / 365.25 - 0.28))
    >>>
    >>> base = 10 + 15 * annual_cycle.reshape(-1, 1)
    >>> tmin_values = base + 3 * np.random.randn(annual_cycle.size, 3)
    >>> tmax_values = base + 10 + 3 * np.random.randn(annual_cycle.size, 3)
    >>>
    >>> ds = xr.Dataset({'tmin': (('time', 'location'), tmin_values),
    ...                  'tmax': (('time', 'location'), tmax_values)},
    ...                 {'time': times, 'location': ['IA', 'IN', 'IL']})
    >>>
    >>> ds.attrs['version'] = 'version 1'

Upload the dataset to the archive

.. code-block:: python

    >>> with var.get_local_path() as f:
    ...     ds.to_netcdf(f)
    ...

Read and write to disk
----------------------

NetCDF files cannot be read from a streaming object:

.. code-block:: python

    >>> with var.open() as f:
    ...     print(type(f))
    ...
    <type '_io.TextIOWrapper'>

.. code-block:: python

    >>> with var.open() as f:      # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
    ...     with xr.open_dataset(f) as ds:
    ...         print(ds)
    Traceback (most recent call last):
    ...
    UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: \
    invalid start byte

Instead, we can get a local path to open:

.. code-block:: python

    >>> with var.get_local_path() as f:
    ...     with xr.open_dataset(f) as ds:
    ...         print(ds) # doctest: +SKIP
    ...
    <xarray.Dataset>
    Dimensions:   (location: 3, time: 731)
    Coordinates:
      * location  (location) |S2 'IA' 'IN' 'IL'
      * time      (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 ...
    Data variables:
        tmax      (time, location) float64 12.98 3.31 6.779 0.4479 6.373 ...
        tmin      (time, location) float64 -8.037 -1.788 -3.932 -9.341 ...
    Attributes:
        version: version 1

We can update file in the same way:

.. code-block:: python

    >>> with var.get_local_path() as f:
    ...     with xr.open_dataset(f) as ds:
    ...
    ...         # Load the dataset fully into memory and then close the file
    ...
    ...         dsmem = ds.load()
    ...         ds.close()
    ...
    ...     # Update the version and save the file
    ...
    ...     dsmem.attrs['version'] = 'version 2'
    ...     dsmem.to_netcdf(f)
    ...

Now let's open the file and see if our change was saved:

.. code-block:: python

    >>> # Acquire the file from the archive and print the version
    ... with var.get_local_path() as f:
    ...     with xr.open_dataset(f) as ds:
    ...         print(ds) # doctest: +ELLIPSIS
    ...
    <xarray.Dataset>
    Dimensions:   (location: 3, time: 731)
    Coordinates:
      * location  (location) |S2 'IA' 'IN' 'IL'
      * time      (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 ...
    Data variables:
        tmax      (time, location) float64 12.98 3.31 6.779 0.4479 6.373 ...
        tmin      (time, location) float64 -8.037 -1.788 -3.932 -9.341 ...
    Attributes:
        version: version 2

Cleaning up
~~~~~~~~~~~

.. code-block:: python

    >>> var.delete()
    >>> api.manager.delete_table('DataFiles')

'''
<commit_msg>passing flake8<commit_after>'''

This tutorial demonstrates reading and writing files to remote archives using
on-disk I/O operations.

To demonstrate this, we make use of the :py:mod:`xarray` module, which cannot
read from a streaming object.

Set up the workspace
--------------------

.. code-block:: python

    >>> from datafs import DataAPI
    >>> from datafs.managers.manager_mongo import MongoDBManager
    >>> from fs.s3fs import S3FS

Initialize the API

.. code-block:: python

    >>> api = DataAPI(
    ...      username='My Name',
    ...      contact = 'my.email@example.com')
    >>>
    >>> manager = MongoDBManager(
    ...     database_name = 'MyDatabase',
    ...     table_name = 'DataFiles')
    >>>
    >>> manager.create_archive_table('DataFiles', raise_on_err=False)
    >>>
    >>> api.attach_manager(manager)

Attach a remote service
~~~~~~~~~~~~~~~~~~~~~~~

In this example we'll use a remote file system, in this case AWS S3. This
filesystem returns streaming objects returned by ``boto`` or ``request`` calls.

    >>> s3 = S3FS(
    ...     'test-bucket',
    ...     aws_access_key='MY_KEY',
    ...     aws_secret_key='MY_SECRET_KEY')
    >>>
    >>> api.attach_authority('aws', s3)
    >>>
    >>> var = api.create(
    ...     'streaming_archive',
    ...     metadata = dict(description = 'My test data archive'))
    >>>

Create sample data
~~~~~~~~~~~~~~~~~~

Create a sample dataset (from the
`xarray docs \
<http://xarray.pydata.org/en/stable/examples/weather-data.html>`_):

.. code-block:: python

    >>> import xarray as xr
    >>> import numpy as np
    >>> import pandas as pd
    >>>
    >>> np.random.seed(123)
    >>>
    >>> times = pd.date_range('2000-01-01', '2001-12-31', name='time')
    >>> annual_cycle = np.sin(2 * np.pi * (times.dayofyear / 365.25 - 0.28))
    >>>
    >>> base = 10 + 15 * annual_cycle.reshape(-1, 1)
    >>> tmin_values = base + 3 * np.random.randn(annual_cycle.size, 3)
    >>> tmax_values = base + 10 + 3 * np.random.randn(annual_cycle.size, 3)
    >>>
    >>> ds = xr.Dataset({'tmin': (('time', 'location'), tmin_values),
    ...                  'tmax': (('time', 'location'), tmax_values)},
    ...                 {'time': times, 'location': ['IA', 'IN', 'IL']})
    >>>
    >>> ds.attrs['version'] = 'version 1'

Upload the dataset to the archive

.. code-block:: python

    >>> with var.get_local_path() as f:
    ...     ds.to_netcdf(f)
    ...

Read and write to disk
----------------------

NetCDF files cannot be read from a streaming object:

.. code-block:: python

    >>> with var.open() as f:
    ...     print(type(f))
    ...
    <type '_io.TextIOWrapper'>

.. code-block:: python

    >>> with var.open() as f:      # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
    ...     with xr.open_dataset(f) as ds:
    ...         print(ds)
    Traceback (most recent call last):
    ...
    UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: \
    invalid start byte

Instead, we can get a local path to open:

.. code-block:: python

    >>> with var.get_local_path() as f:
    ...     with xr.open_dataset(f) as ds:
    ...         print(ds) # doctest: +SKIP
    ...
    <xarray.Dataset>
    Dimensions:   (location: 3, time: 731)
    Coordinates:
      * location  (location) |S2 'IA' 'IN' 'IL'
      * time      (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 ...
    Data variables:
        tmax      (time, location) float64 12.98 3.31 6.779 0.4479 6.373 ...
        tmin      (time, location) float64 -8.037 -1.788 -3.932 -9.341 ...
    Attributes:
        version: version 1

We can update file in the same way:

.. code-block:: python

    >>> with var.get_local_path() as f:
    ...     with xr.open_dataset(f) as ds:
    ...
    ...         # Load the dataset fully into memory and then close the file
    ...
    ...         dsmem = ds.load()
    ...         ds.close()
    ...
    ...     # Update the version and save the file
    ...
    ...     dsmem.attrs['version'] = 'version 2'
    ...     dsmem.to_netcdf(f)
    ...

Now let's open the file and see if our change was saved:

.. code-block:: python

    >>> # Acquire the file from the archive and print the version
    ... with var.get_local_path() as f:
    ...     with xr.open_dataset(f) as ds:
    ...         print(ds) # doctest: +SKIP
    ...
    <xarray.Dataset>
    Dimensions:   (location: 3, time: 731)
    Coordinates:
      * location  (location) |S2 'IA' 'IN' 'IL'
      * time      (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 ...
    Data variables:
        tmax      (time, location) float64 12.98 3.31 6.779 0.4479 6.373 ...
        tmin      (time, location) float64 -8.037 -1.788 -3.932 -9.341 ...
    Attributes:
        version: version 2

Cleaning up
~~~~~~~~~~~

.. code-block:: python

    >>> var.delete()
    >>> api.manager.delete_table('DataFiles')

'''
<|endoftext|>


<commit_before>import os
from setuptools import setup

# pip workaround
os.chdir(os.path.abspath(os.path.dirname(__file__)))

with open('README.rst') as fp:
    description = fp.read()
setup(name='usagestats',
      version='0.7',
      py_modules=['usagestats'],
      description="Anonymous usage statistics collector",
      install_requires=['requests'],
      author="Remi Rampin",
      author_email='remirampin@gmail.com',
      maintainer="Remi Rampin",
      maintainer_email='remirampin@gmail.com',
      url='https://github.com/remram44/usagestats',
      long_description=description,
      license='Apache License 2.0',
      keywords=['server', 'log', 'logging', 'usage', 'stats', 'statistics',
                'collection', 'report'],
      classifiers=[
          'Development Status :: 5 - Production/Stable',
          'Intended Audience :: Developers',
          'License :: OSI Approved :: Apache Software License',
          'Programming Language :: Python',
          'Topic :: Internet',
          'Topic :: Internet :: Log Analysis',
          'Topic :: Software Development',
          'Topic :: System :: Logging',
          'Topic :: Utilities'])
<commit_msg>[Updated] Require to install `distro`<commit_after>import os
from setuptools import setup

# pip workaround
os.chdir(os.path.abspath(os.path.dirname(__file__)))

with open('README.rst') as fp:
    description = fp.read()
setup(name='usagestats',
      version='0.7',
      py_modules=['usagestats'],
      description="Anonymous usage statistics collector",
      install_requires=['requests', 'distro'],
      author="Remi Rampin",
      author_email='remirampin@gmail.com',
      maintainer="Remi Rampin",
      maintainer_email='remirampin@gmail.com',
      url='https://github.com/remram44/usagestats',
      long_description=description,
      license='Apache License 2.0',
      keywords=['server', 'log', 'logging', 'usage', 'stats', 'statistics',
                'collection', 'report'],
      classifiers=[
          'Development Status :: 5 - Production/Stable',
          'Intended Audience :: Developers',
          'License :: OSI Approved :: Apache Software License',
          'Programming Language :: Python',
          'Topic :: Internet',
          'Topic :: Internet :: Log Analysis',
          'Topic :: Software Development',
          'Topic :: System :: Logging',
          'Topic :: Utilities'])
<|endoftext|>


<commit_before>import os
from setuptools import setup
from sirtrevor import __version__

README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
    name='django-sirtrevor',
    version=__version__,
    packages=['sirtrevor'],
    include_package_data=True,
    license='MIT License',
    description='',
    long_description=README,
    url='https://github.com/philippbosch/django-sirtrevor/',
    author='Philipp Bosch',
    author_email='hello@pb.io',
    install_requires=['markdown2', 'django-appconf'],
    classifiers=[
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
    ],
)
<commit_msg>Add description.<commit_after>import os
from setuptools import setup
from sirtrevor import __version__

README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
    name='django-sirtrevor',
    version=__version__,
    packages=['sirtrevor'],
    include_package_data=True,
    license='MIT License',
    description='A simple Django app that provides a model field and corresponding widget based on the fantastic Sir Trevor project',
    long_description=README,
    url='https://github.com/philippbosch/django-sirtrevor/',
    author='Philipp Bosch',
    author_email='hello@pb.io',
    install_requires=['markdown2', 'django-appconf'],
    classifiers=[
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
    ],
)
<|endoftext|>


<commit_before># -*- coding: utf-8 -*-

import argparse
import os
import re
import sys
import json
import platform
from pprint import pprint

# ------------------------------------------------------------------------------

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')

# ------------------------------------------------------------------------------

import ccxt  # noqa: E402

# ------------------------------------------------------------------------------

print('Python v' + platform.python_version())
print('CCXT v' + ccxt.__version__)

# ------------------------------------------------------------------------------

class Argv(object):

    table = False
    verbose = False
    nonce = None
    exchange_id = None
    method = None
    symbol = None

argv = Argv()

parser = argparse.ArgumentParser()

parser.add_argument('--table', action='store_true', help='output as table')
parser.add_argument('--verbose', action='store_true', help='enable verbose output')
parser.add_argument('exchange_id', type=str, help='exchange id in lowercase', nargs='?')
parser.add_argument('method', type=str, help='method or property', nargs='?')
parser.add_argument('args', type=str, help='arguments', nargs='*')

parser.parse_args(namespace=argv)

# ------------------------------------------------------------------------------

def table(values):
    first = values[0]
    keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
    widths = [max([len(str(v[k])) for v in values]) for k in keys]
    string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
    return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])

# ------------------------------------------------------------------------------

def print_supported_exchanges():
    print('Supported exchanges: ' + ', '.join(ccxt.exchanges) + '\n')

# ------------------------------------------------------------------------------

def print_usage():
    print('\nThis is an example of a basic command-line interface to all exchanges\n')
    print('Usage:\n')
    print('python ' + sys.argv[0] + ' exchange_id method "param1" param2 "param3" param4 ...\n')
    print('Examples:\n')
    print('python ' + sys.argv[0] + ' okcoin fetch_ohlcv BTC/USD 15m')
    print('python ' + sys.argv[0] + ' bitfinex fetch_balance')
    print('python ' + sys.argv[0] + ' kraken fetch_order_book ETH/BTC\n')
    print_supported_exchanges()

# ------------------------------------------------------------------------------

# prefer local testing keys to global keys
keys_global = root + '/keys.json'
keys_local = root + '/keys.local.json'
keys_file = keys_local if os.path.exists(keys_local) else keys_global

# load the api keys and other settings from a JSON config
with open(keys_file) as file:
    keys = json.load(file)

config = {
    # 'verbose': argv.verbose,  # set later, after load_markets
    'timeout': 30000,
    'enableRateLimit': True,
}

if not argv.exchange_id:
    print_usage()
    sys.exit()

# ------------------------------------------------------------------------------

if argv.exchange_id not in ccxt.exchanges:
    print_usage()
    raise Exception('Exchange "' + argv.exchange_id + '" not found.')

if argv.exchange_id in keys:
    config.update(keys[argv.exchange_id])

exchange = getattr(ccxt, argv.exchange_id)(config)

# pprint(dir(exchange))

# ------------------------------------------------------------------------------

args = []

for arg in argv.args:

    # unpack json objects (mostly for extra params)
    if arg[0] == '{' or arg[0] == '[':
        args.append(exchange.unjson(arg))
    elif arg == 'None':
        args.append(None)
    elif re.match(r'^[0-9+-]+$', arg):
        args.append(int(arg))
    elif re.match(r'^[.eE0-9+-]+$', arg):
        args.append(float(arg))
    elif re.match(r'^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}', arg):
        args.append(exchange.parse8601(arg))
    else:
        args.append(arg)

exchange.load_markets()

exchange.verbose = argv.verbose  # now set verbose mode

if argv.method:
    method = getattr(exchange, argv.method)
    # if it is a method, call it
    if callable(method):
        result = method(*args)
    else:  # otherwise it's a property, print it
        result = method
    if argv.table:
        result = list(result.values()) if isinstance(result, dict) else result
        print(table([exchange.omit(v, 'info') for v in result]))
    else:
        pprint(result)
else:
    pprint(dir(exchange))

<commit_msg>examples/py/cli.py --cors<commit_after># -*- coding: utf-8 -*-

import argparse
import os
import re
import sys
import json
import platform
from pprint import pprint

# ------------------------------------------------------------------------------

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')

# ------------------------------------------------------------------------------

import ccxt  # noqa: E402

# ------------------------------------------------------------------------------

print('Python v' + platform.python_version())
print('CCXT v' + ccxt.__version__)

# ------------------------------------------------------------------------------

class Argv(object):

    table = False
    verbose = False
    nonce = None
    exchange_id = None
    method = None
    symbol = None

argv = Argv()

parser = argparse.ArgumentParser()

parser.add_argument('--table', action='store_true', help='output as table')
parser.add_argument('--cors', action='store_true', help='enable CORS proxy')
parser.add_argument('--verbose', action='store_true', help='enable verbose output')
parser.add_argument('exchange_id', type=str, help='exchange id in lowercase', nargs='?')
parser.add_argument('method', type=str, help='method or property', nargs='?')
parser.add_argument('args', type=str, help='arguments', nargs='*')

parser.parse_args(namespace=argv)

# ------------------------------------------------------------------------------

def table(values):
    first = values[0]
    keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
    widths = [max([len(str(v[k])) for v in values]) for k in keys]
    string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
    return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])

# ------------------------------------------------------------------------------

def print_supported_exchanges():
    print('Supported exchanges: ' + ', '.join(ccxt.exchanges) + '\n')

# ------------------------------------------------------------------------------

def print_usage():
    print('\nThis is an example of a basic command-line interface to all exchanges\n')
    print('Usage:\n')
    print('python ' + sys.argv[0] + ' exchange_id method "param1" param2 "param3" param4 ...\n')
    print('Examples:\n')
    print('python ' + sys.argv[0] + ' okcoin fetch_ohlcv BTC/USD 15m')
    print('python ' + sys.argv[0] + ' bitfinex fetch_balance')
    print('python ' + sys.argv[0] + ' kraken fetch_order_book ETH/BTC\n')
    print_supported_exchanges()

# ------------------------------------------------------------------------------

# prefer local testing keys to global keys
keys_global = root + '/keys.json'
keys_local = root + '/keys.local.json'
keys_file = keys_local if os.path.exists(keys_local) else keys_global

# load the api keys and other settings from a JSON config
with open(keys_file) as file:
    keys = json.load(file)

config = {
    # 'verbose': argv.verbose,  # set later, after load_markets
    'timeout': 30000,
    'enableRateLimit': True,
}

if not argv.exchange_id:
    print_usage()
    sys.exit()

# ------------------------------------------------------------------------------

if argv.exchange_id not in ccxt.exchanges:
    print_usage()
    raise Exception('Exchange "' + argv.exchange_id + '" not found.')

if argv.exchange_id in keys:
    config.update(keys[argv.exchange_id])

exchange = getattr(ccxt, argv.exchange_id)(config)

if argv.cors:
    exchange.proxy = 'https://cors-anywhere.herokuapp.com/';
    exchange.origin = exchange.uuid ()

# pprint(dir(exchange))

# ------------------------------------------------------------------------------

args = []

for arg in argv.args:

    # unpack json objects (mostly for extra params)
    if arg[0] == '{' or arg[0] == '[':
        args.append(exchange.unjson(arg))
    elif arg == 'None':
        args.append(None)
    elif re.match(r'^[0-9+-]+$', arg):
        args.append(int(arg))
    elif re.match(r'^[.eE0-9+-]+$', arg):
        args.append(float(arg))
    elif re.match(r'^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}', arg):
        args.append(exchange.parse8601(arg))
    else:
        args.append(arg)

exchange.load_markets()

exchange.verbose = argv.verbose  # now set verbose mode

if argv.method:
    method = getattr(exchange, argv.method)
    # if it is a method, call it
    if callable(method):
        result = method(*args)
    else:  # otherwise it's a property, print it
        result = method
    if argv.table:
        result = list(result.values()) if isinstance(result, dict) else result
        print(table([exchange.omit(v, 'info') for v in result]))
    else:
        pprint(result)
else:
    pprint(dir(exchange))

<|endoftext|>


<commit_before>from __future__ import unicode_literals

import os

from setuptools import setup

setup(
    name='django-registrationwall',
    version='0.1.0',
    description='A Django mixin application to raise a registration or paywall',
    long_description=open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
    author='Richard Cornish',
    author_email='rich@richardcornish.com',
    url='https://github.com/richardcornish/django-registrationwall',
    license='BSD License',
    zip_safe=False,
    include_package_data=True,
    packages=[
        'regwall',
        'regwall.tests',
        'regwall.tests.articles',
    ],
    test_suite='regwall.tests',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Framework :: Django :: 1.9',
        'Framework :: Django :: 1.10',
        'Framework :: Django :: 1.11',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Utilities',
    ],
)
<commit_msg>Tried find packages again<commit_after>from __future__ import unicode_literals

import os

from setuptools import find_packages, setup

setup(
    name='django-registrationwall',
    version='0.1.0',
    description='A Django mixin application to raise a registration or paywall',
    long_description=open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
    author='Richard Cornish',
    author_email='rich@richardcornish.com',
    url='https://github.com/richardcornish/django-registrationwall',
    license='BSD License',
    zip_safe=False,
    include_package_data=True,
    packages=find_packages(),
    test_suite='regwall.tests',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Framework :: Django :: 1.9',
        'Framework :: Django :: 1.10',
        'Framework :: Django :: 1.11',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Utilities',
    ],
)
<|endoftext|>


<commit_before># -*- coding: utf-8 -*-

import argparse
import os
import re
import sys
import json
import platform
from pprint import pprint

# ------------------------------------------------------------------------------

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')

# ------------------------------------------------------------------------------

import ccxt  # noqa: E402

# ------------------------------------------------------------------------------

print('Python v' + platform.python_version())
print('CCXT v' + ccxt.__version__)

# ------------------------------------------------------------------------------

class Argv(object):

    table = False
    verbose = False
    sandbox = False
    testnet = False
    test = False
    nonce = None
    exchange_id = ''
    debug = False
    cors = False
    method = None
    symbol = None
    spot = False
    swap = False
    future = False
    args = []

argv = Argv()

parser = argparse.ArgumentParser()

parser.add_argument('--table', action='store_true', help='output as table')
parser.add_argument('--cors', action='store_true', help='enable CORS proxy')
parser.add_argument('--verbose', action='store_true', help='enable verbose output')
parser.add_argument('--debug', action='store_true', help='enable debug output')
parser.add_argument('--sandbox', action='store_true', help='enable sandbox/testnet')
parser.add_argument('--testnet', action='store_true', help='enable sandbox/testnet')
parser.add_argument('--test', action='store_true', help='enable sandbox/testnet')
parser.add_argument('--spot', action='store_true', help='enable spot markets')
parser.add_argument('--swap', action='store_true', help='enable swap markets')
parser.add_argument('--future', action='store_true', help='enable future markets')
parser.add_argument('exchange_id', type=str, help='exchange id in lowercase', nargs='?')
parser.add_argument('method', type=str, help='method or property', nargs='?')
parser.add_argument('args', type=str, help='arguments', nargs='*')

parser.parse_args(namespace=argv)

# ------------------------------------------------------------------------------

def table(values):
    first = values[0]
    keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
    widths = [max([len(str(v[k])) for v in values]) for k in keys]
    string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
    return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])

# ------------------------------------------------------------------------------

def print_supported_exchanges():
    print('Supported exchanges: ' + ', '.join(ccxt.exchanges) + '\n')

# ------------------------------------------------------------------------------

def print_usage():
    print('\nThis is an example of a basic command-line interface to all exchanges\n')
    print('Usage:\n')
    print('python ' + sys.argv[0] + ' exchange_id method "param1" param2 "param3" param4 ...\n')
    print('Examples:\n')
    print('python ' + sys.argv[0] + ' okcoin fetch_ohlcv BTC/USD 15m')
    print('python ' + sys.argv[0] + ' bitfinex fetch_balance')
    print('python ' + sys.argv[0] + ' kraken fetch_order_book ETH/BTC\n')
    print_supported_exchanges()

# ------------------------------------------------------------------------------

# prefer local testing keys to global keys
keys_global = root + '/keys.json'
keys_local = root + '/keys.local.json'
keys_file = keys_local if os.path.exists(keys_local) else keys_global

# load the api keys and other settings from a JSON config
with open(keys_file) as file:
    keys = json.load(file)

config = {
    # 'verbose': argv.verbose,  # set later, after load_markets
    'timeout': 30000,
}

if not argv.exchange_id:
    print_usage()
    sys.exit()

# ------------------------------------------------------------------------------

if argv.exchange_id not in ccxt.exchanges:
    print_usage()
    raise Exception('Exchange "' + argv.exchange_id + '" not found.')

if argv.exchange_id in keys:
    config.update(keys[argv.exchange_id])

exchange = getattr(ccxt, argv.exchange_id)(config)

if argv.spot:
    exchange.options['defaultType'] = 'spot'
elif argv.swap:
    exchange.options['defaultType'] = 'swap'
elif argv.future:
    exchange.options['defaultType'] = 'future'

# check auth keys in env var
requiredCredentials = exchange.requiredCredentials
for credential, isRequired in requiredCredentials.items():
    if isRequired and credential and not getattr(exchange, credential, None):
        credentialEnvName = (argv.exchange_id + '_' + credential).upper()  # example: KRAKEN_APIKEY
        if credentialEnvName in os.environ:
            credentialValue = os.environ[credentialEnvName]
            setattr(exchange, credential, credentialValue)

if argv.cors:
    exchange.proxy = 'https://cors-anywhere.herokuapp.com/'
    exchange.origin = exchange.uuid()

# pprint(dir(exchange))

# ------------------------------------------------------------------------------

args = []

for arg in argv.args:

    # unpack json objects (mostly for extra params)
    if arg[0] == '{' or arg[0] == '[':
        args.append(json.loads(arg))
    elif arg == 'None':
        args.append(None)
    elif re.match(r'^[0-9+-]+$', arg):
        args.append(int(arg))
    elif re.match(r'^[.eE0-9+-]+$', arg):
        args.append(float(arg))
    elif re.match(r'^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}', arg):
        args.append(exchange.parse8601(arg))
    else:
        args.append(arg)

if argv.testnet or argv.sandbox or argv.test:
    exchange.set_sandbox_mode(True)

if argv.verbose and argv.debug:
    exchange.verbose = argv.verbose

markets_path = '.cache/' + exchange.id + '-markets.json'
if os.path.exists(markets_path):
    with open(markets_path, 'r') as f:
        exchange.markets = json.load(f)
else:
    exchange.load_markets()

exchange.verbose = argv.verbose  # now set verbose mode

if argv.method:
    method = getattr(exchange, argv.method)
    # if it is a method, call it
    if callable(method):
        print(f"{argv.exchange_id}.{argv.method}({','.join(map(str, args))})")
        result = method(*args)
    else:  # otherwise it's a property, print it
        result = method
    if argv.table:
        result = list(result.values()) if isinstance(result, dict) else result
        print(table([exchange.omit(v, 'info') for v in result]))
    else:
        pprint(result)
else:
    pprint(dir(exchange))
<commit_msg>adapt python cli to handle WS methods<commit_after># -*- coding: utf-8 -*-

import argparse
import os
import re
import sys
import json
import platform
from pprint import pprint
import asyncio

# ------------------------------------------------------------------------------

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')

# ------------------------------------------------------------------------------

import ccxt.async_support as ccxt  # noqa: E402

# ------------------------------------------------------------------------------

print('Python v' + platform.python_version())
print('CCXT v' + ccxt.__version__)

# ------------------------------------------------------------------------------

class Argv(object):

    table = False
    verbose = False
    sandbox = False
    testnet = False
    test = False
    nonce = None
    exchange_id = ''
    debug = False
    cors = False
    method = None
    symbol = None
    spot = False
    swap = False
    future = False
    args = []

argv = Argv()

parser = argparse.ArgumentParser()

parser.add_argument('--table', action='store_true', help='output as table')
parser.add_argument('--cors', action='store_true', help='enable CORS proxy')
parser.add_argument('--verbose', action='store_true', help='enable verbose output')
parser.add_argument('--debug', action='store_true', help='enable debug output')
parser.add_argument('--sandbox', action='store_true', help='enable sandbox/testnet')
parser.add_argument('--testnet', action='store_true', help='enable sandbox/testnet')
parser.add_argument('--test', action='store_true', help='enable sandbox/testnet')
parser.add_argument('--spot', action='store_true', help='enable spot markets')
parser.add_argument('--swap', action='store_true', help='enable swap markets')
parser.add_argument('--future', action='store_true', help='enable future markets')
parser.add_argument('exchange_id', type=str, help='exchange id in lowercase', nargs='?')
parser.add_argument('method', type=str, help='method or property', nargs='?')
parser.add_argument('args', type=str, help='arguments', nargs='*')

parser.parse_args(namespace=argv)

# ------------------------------------------------------------------------------

def table(values):
    first = values[0]
    keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
    widths = [max([len(str(v[k])) for v in values]) for k in keys]
    string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
    return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])

# ------------------------------------------------------------------------------

def print_supported_exchanges():
    print('Supported exchanges: ' + ', '.join(ccxt.exchanges) + '\n')

# ------------------------------------------------------------------------------

def print_usage():
    print('\nThis is an example of a basic command-line interface to all exchanges\n')
    print('Usage:\n')
    print('python ' + sys.argv[0] + ' exchange_id method "param1" param2 "param3" param4 ...\n')
    print('Examples:\n')
    print('python ' + sys.argv[0] + ' okcoin fetch_ohlcv BTC/USD 15m')
    print('python ' + sys.argv[0] + ' bitfinex fetch_balance')
    print('python ' + sys.argv[0] + ' kraken fetch_order_book ETH/BTC\n')
    print_supported_exchanges()

# ------------------------------------------------------------------------------

async def main():
    # prefer local testing keys to global keys
    keys_global = root + '/keys.json'
    keys_local = root + '/keys.local.json'
    keys_file = keys_local if os.path.exists(keys_local) else keys_global

    # load the api keys and other settings from a JSON config
    with open(keys_file) as file:
        keys = json.load(file)

    config = {
        # 'verbose': argv.verbose,  # set later, after load_markets
        'timeout': 30000,
    }

    if not argv.exchange_id:
        print_usage()
        sys.exit()

    # ------------------------------------------------------------------------------

    if argv.exchange_id not in ccxt.exchanges:
        print_usage()
        raise Exception('Exchange "' + argv.exchange_id + '" not found.')

    if argv.exchange_id in keys:
        config.update(keys[argv.exchange_id])

    exchange = getattr(ccxt, argv.exchange_id)(config)

    if argv.spot:
        exchange.options['defaultType'] = 'spot'
    elif argv.swap:
        exchange.options['defaultType'] = 'swap'
    elif argv.future:
        exchange.options['defaultType'] = 'future'

    # check auth keys in env var
    requiredCredentials = exchange.requiredCredentials
    for credential, isRequired in requiredCredentials.items():
        if isRequired and credential and not getattr(exchange, credential, None):
            credentialEnvName = (argv.exchange_id + '_' + credential).upper()  # example: KRAKEN_APIKEY
            if credentialEnvName in os.environ:
                credentialValue = os.environ[credentialEnvName]
                setattr(exchange, credential, credentialValue)

    if argv.cors:
        exchange.proxy = 'https://cors-anywhere.herokuapp.com/'
        exchange.origin = exchange.uuid()

    # pprint(dir(exchange))

    # ------------------------------------------------------------------------------

    args = []

    for arg in argv.args:

        # unpack json objects (mostly for extra params)
        if arg[0] == '{' or arg[0] == '[':
            args.append(json.loads(arg))
        elif arg == 'None':
            args.append(None)
        elif re.match(r'^[0-9+-]+$', arg):
            args.append(int(arg))
        elif re.match(r'^[.eE0-9+-]+$', arg):
            args.append(float(arg))
        elif re.match(r'^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}', arg):
            args.append(exchange.parse8601(arg))
        else:
            args.append(arg)

    if argv.testnet or argv.sandbox or argv.test:
        exchange.set_sandbox_mode(True)

    if argv.verbose and argv.debug:
        exchange.verbose = argv.verbose

    markets_path = '.cache/' + exchange.id + '-markets.json'
    if os.path.exists(markets_path):
        with open(markets_path, 'r') as f:
            exchange.markets = json.load(f)
    else:
        await exchange.load_markets()

    exchange.verbose = argv.verbose  # now set verbose mode

    is_ws_method = False

    if argv.method:
        method = getattr(exchange, argv.method)
        # if it is a method, call it
        if callable(method):
            if argv.method.startswith('watch'):
                is_ws_method = True # handle ws methods
            print(f"{argv.exchange_id}.{argv.method}({','.join(map(str, args))})")
            while True:
                result = await method(*args)
                if argv.table:
                    result = list(result.values()) if isinstance(result, dict) else result
                    print(table([exchange.omit(v, 'info') for v in result]))
                else:
                    pprint(result)
                if not is_ws_method:
                    await exchange.close()
                    break
        else:  # otherwise it's a property, print it
            result = method
        if argv.table:
            result = list(result.values()) if isinstance(result, dict) else result
            print(table([exchange.omit(v, 'info') for v in result]))
        else:
            pprint(result)
    else:
        pprint(dir(exchange))

if __name__ ==  '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())<|endoftext|>


<commit_before>from setuptools import setup

setup(
    name='statirator',
    version='0.1.0',
    author='Meir Kriheli',
    author_email='mkriheli@gmail.com',
    packages=['statirator'],
    url='http://pypi.python.org/pypi/statirator/',
    license='LICENSE.txt',
    description='Multilingual static site and blog generator',
    long_description=open('README.rst').read(),
    install_requires = [
        'setuptools',
        'docutils',
        'Pygments',
        'tornado',
    ],
    entry_points = {
        'console_scripts': [
            'statirator = statirator.main:main',
        ]
    }
)
<commit_msg>Not zip_safe<commit_after>from setuptools import setup

setup(
    name='statirator',
    version='0.1.0',
    author='Meir Kriheli',
    author_email='mkriheli@gmail.com',
    packages=['statirator'],
    url='http://pypi.python.org/pypi/statirator/',
    license='LICENSE.txt',
    description='Multilingual static site and blog generator',
    long_description=open('README.rst').read(),
    zip_safe=False,
    install_requires = [
        'setuptools',
        'docutils',
        'Pygments',
        'tornado',
    ],
    entry_points = {
        'console_scripts': [
            'statirator = statirator.main:main',
        ]
    }
)
<|endoftext|>