commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
f19471414a1517fad1bca015c9ba3aaa4e8e8fda | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name = "gitoriouslib",
version = "0.1",
packages = find_packages(),
install_requires = ['httplib2>=0.7.2']
)
| from setuptools import setup, find_packages
setup(
name = "gitoriouslib",
version = "0.1",
packages = find_packages(),
install_requires = ['httplib2>=0.7.2'],
entry_points = {
'console_scripts': [
'glcreate = gitoriouslib.cmd:create_repo',
'gldelete = gitoriouslib.cmd... | Add entry point scripts for CLI create/delete | Add entry point scripts for CLI create/delete
| Python | apache-2.0 | locke105/gitoriouslib | ---
+++
@@ -3,5 +3,11 @@
name = "gitoriouslib",
version = "0.1",
packages = find_packages(),
- install_requires = ['httplib2>=0.7.2']
+ install_requires = ['httplib2>=0.7.2'],
+ entry_points = {
+ 'console_scripts': [
+ 'glcreate = gitoriouslib.cmd:create_repo',
+ ... |
58faca0b65d2d64f1112f323bd843fc2b23fd086 | setup.py | setup.py | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te... | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te... | Increment version after fix to frozendict version | Increment version after fix to frozendict version | Python | bsd-3-clause | consbio/gis-metadata-parser | ---
+++
@@ -28,7 +28,7 @@
long_description=long_description,
long_description_content_type='text/markdown',
keywords='arcgis,fgdc,iso,ISO-19115,ISO-19139,gis,metadata,parser,xml,gis_metadata,gis_metadata_parser',
- version='1.2.5',
+ version='1.2.6',
packages=[
'gis_metadata', 'gis_... |
4c95937d43f6ec769412b0cb8b58546ecb5617ec | setup.py | setup.py | from distutils.core import setup
setup(
name='jute',
packages=['jute'],
package_dir={'jute': 'python3/jute'},
version='0.1',
description='Yet another interface module for Python',
author='Jonathan Patrick Giddy',
author_email='jongiddy@gmail.com',
url='https://github.com/jongiddy/jute',
... | from distutils.core import setup
setup(
name='jute',
packages=['jute'],
package_dir={'jute': 'python3/jute'},
version='0.1.0',
description='An interface module that verifies both providers and callers',
author='Jonathan Patrick Giddy',
author_email='jongiddy@gmail.com',
url='https://gith... | Change the tagline for PyPI | Change the tagline for PyPI
| Python | mit | jongiddy/jute,jongiddy/jute | ---
+++
@@ -3,12 +3,12 @@
name='jute',
packages=['jute'],
package_dir={'jute': 'python3/jute'},
- version='0.1',
- description='Yet another interface module for Python',
+ version='0.1.0',
+ description='An interface module that verifies both providers and callers',
author='Jonathan Pa... |
4d1d4c6730c2d09ec387267f5eebbcc24f70ed38 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name='requests-facebook',
version='0.3.0',
install_requires=['requests>=1.0.0'],
author='Mike Helmick',
author_email='me@michaelhelmick.com',
license='BSD',
url='https://github.com/michaelhelmick/requests-facebook/',
keywords='p... | #!/usr/bin/env python
from setuptools import setup
setup(
name='requests-facebook',
version='0.4.0',
install_requires=['requests>=1.0.0'],
author='Mike Helmick',
author_email='me@michaelhelmick.com',
license='BSD',
url='https://github.com/michaelhelmick/requests-facebook/',
keywords='p... | Upgrade requests-facebook version to 0.4.0 | Upgrade requests-facebook version to 0.4.0
| Python | bsd-2-clause | michaelhelmick/requests-facebook | ---
+++
@@ -4,7 +4,7 @@
setup(
name='requests-facebook',
- version='0.3.0',
+ version='0.4.0',
install_requires=['requests>=1.0.0'],
author='Mike Helmick',
author_email='me@michaelhelmick.com', |
9b2a016c5652d65aa8f223c0554d1766721ac2a8 | setup.py | setup.py | import io
import os
import re
from setuptools import setup, find_packages
def find_version():
file_dir = os.path.dirname(__file__)
with io.open(os.path.join(file_dir, 'auth0', '__init__.py')) as f:
version = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', f.read())
if version:
ret... | import io
import os
import re
from setuptools import setup, find_packages
def find_version():
file_dir = os.path.dirname(__file__)
with io.open(os.path.join(file_dir, 'auth0', '__init__.py')) as f:
version = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', f.read())
if version:
ret... | Remove 3.1 and 3.2 from python_requires (and classifiers) to allow it to still install for those versions | Remove 3.1 and 3.2 from python_requires (and classifiers) to allow it to still install for those versions
| Python | mit | auth0/auth0-python,auth0/auth0-python | ---
+++
@@ -24,7 +24,7 @@
packages=find_packages(),
install_requires=['requests'],
extras_require={'test': ['mock']},
- python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
+ python_requires='>=2.7, !=3.0.*, !=3.1.*',
classifiers=[
'Development Status :: 4 - Beta',
... |
44e88adcc2ba62892828e1ec98543dff9218524a | setup.py | setup.py | __author__ = 'katharine'
import sys
from setuptools import setup, find_packages
requires = [
'backports.ssl-match-hostname==3.4.0.2',
'gevent>=1.1b5',
'gevent-websocket==0.9.3',
'greenlet==0.4.9',
'peewee==2.4.7',
'pygeoip==0.3.2',
'pypng==0.0.17',
'python-dateutil==2.4.1',
'requests==2.5.0',
'sh=... | __author__ = 'katharine'
import sys
from setuptools import setup, find_packages
requires = [
'backports.ssl-match-hostname==3.4.0.2',
'gevent>=1.1b5',
'gevent-websocket==0.9.3',
'greenlet==0.4.9',
'peewee==2.4.7',
'pygeoip==0.3.2',
'pypng==0.0.17',
'python-dateutil==2.4.1',
'requests==2.5.0',
'sh=... | Address review comments, remove zip_safe=True because GeoIP | Address review comments, remove zip_safe=True because GeoIP
| Python | mit | pebble/pypkjs | ---
+++
@@ -21,9 +21,6 @@
'netaddr==0.7.18'
]
-packages = find_packages()
-print packages
-
setup(name='pypkjs',
version='3.6',
description='PebbleKit JS in Python!',
@@ -31,11 +28,10 @@
author='Pebble Technology Corporation',
author_email='katharine@pebble.com',
license='MIT... |
b1e5ed0fa032550395c18fbebab629144e5fed36 | setup.py | setup.py | import sys
from setuptools import setup
from setuptools.extension import Extension
#XXX gettid only works on Linux, don't bother else
if 'linux' in sys.platform:
exts = [Extension('_libgettid', sources=['_libgettid.c'])]
else:
exts = []
setup(
name='mmstats',
version='0.1',
license='BSD',
aut... | import sys
from setuptools import setup
from setuptools.extension import Extension
#XXX gettid only works on Linux, don't bother else
if 'linux' in sys.platform:
exts = [Extension('_libgettid', sources=['_libgettid.c'])]
else:
exts = []
setup(
name='mmstats',
version='0.1',
license='BSD',
aut... | Add missing libgettid to py_modules | Add missing libgettid to py_modules
| Python | bsd-3-clause | schmichael/mmstats,schmichael/mmstats,schmichael/mmstats,schmichael/mmstats | ---
+++
@@ -16,7 +16,12 @@
author='Michael Schurter',
author_email='m@schmichael.com',
description='Stat publishing and consuming tools',
- py_modules=['mmstats', 'slurpstats', 'mmash', 'mmash_settings'],
+ py_modules=['libgettid',
+ 'mmstats',
+ 'slurpstats',
+ ... |
556eada791fca84432e36c3e1fcf722ecf0580ff | setup.py | setup.py | from __future__ import absolute_import
from setuptools import setup, find_packages
long_desc = """
Transform Excel spreadsheets
"""
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers for classifiers
conf = dict(
name='databaker',
version='1.2.1',
description="DataBaker, part of QuickCode for ON... | from setuptools import setup, find_packages
long_desc = """
Transform Excel spreadsheets
"""
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers for classifiers
conf = dict(
name='databaker',
version='1.2.1',
description="DataBaker, part of QuickCode for ONS",
long_description=long_desc,
... | Remove an overlooked from __future__ import | Remove an overlooked from __future__ import
| Python | agpl-3.0 | scraperwiki/databaker,scraperwiki/databaker | ---
+++
@@ -1,4 +1,3 @@
-from __future__ import absolute_import
from setuptools import setup, find_packages
long_desc = """ |
510b52357e6266faec6338abd8fed46102acceca | setup.py | setup.py | # Copyright (c) 2015 CaT Concepts and Training GmbH
try:
from setuptools import setup, find_packages, Command
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Command
import platform
import os
import subprocess
import sys
if platf... | # Copyright (c) 2015 CaT Concepts and Training GmbH
try:
from setuptools import setup, find_packages, Command
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Command
import platform
import os
import subprocess
import sys
if platf... | Bump version: 0.0.2 -> 0.0.3 | Bump version: 0.0.2 -> 0.0.3
PyPI won't let me delete the 0.0.2 release, so we have to issue a new one to add the project URL.
| Python | mit | jameshy/libtree,conceptsandtraining/libtree | ---
+++
@@ -22,7 +22,7 @@
setup(
name='libtree',
- version='0.0.2',
+ version='0.0.3',
author='Fabian Kochem',
author_email='fabian.kochem@concepts-and-training.de',
description='Postgres-based library to handle and persist wide trees', |
5d57e9a6a456a6919bb6c39bd34dad76a2a6356f | setup.py | setup.py | #!/usr/bin/env python
"""
setup.py file for helium-client-python
"""
from distutils.core import setup, Extension
sourcefiles = ['src/helium_client.c',
'src/helium-serial.c',
'src/helium-client/helium-client.c',
'src/helium-client/cauterize/atom_api.c',
'src... | #!/usr/bin/env python
"""
setup.py file for helium-client-python
"""
from distutils.core import setup, Extension
sourcefiles = ['src/helium_client.c',
'src/helium-serial.c',
'src/helium-client/helium-client.c',
'src/helium-client/cauterize/atom_api.c',
'src... | Add gnu99 build flag for linuxy builds | Add gnu99 build flag for linuxy builds
| Python | bsd-3-clause | helium/helium-client-python,helium/helium-client-python | ---
+++
@@ -15,6 +15,7 @@
extensions = [Extension('helium_client',
include_dirs=['src/helium-client'],
+ extra_compile_args=['-std=gnu99'],
sources=sourcefiles)]
setup(name='helium-client', |
cb7d601f6e983df6a9633804f5483470f7dce27f | setup.py | setup.py | __author__ = 'mbach'
import multiprocessing # avoid crash on teardown
from setuptools import setup, find_packages
setup(
name = 'Brandon',
version = '0.1-dev',
packages = find_packages(exclude=['tests']),
author='Matthias Bach',
author_email='matthias.bach@blue-yonder.com',
description='Fill ... | __author__ = 'mbach'
import multiprocessing # avoid crash on teardown
from setuptools import setup, find_packages
setup(
name = 'Brandon',
version = '0.1-dev',
packages = find_packages(exclude=['tests']),
author='Matthias Bach',
author_email='matthias.bach@blue-yonder.com',
description='Fill ... | Make sure wheel is installed. | Make sure wheel is installed.
| Python | bsd-3-clause | tylerdave/devpi-builder | ---
+++
@@ -14,7 +14,8 @@
license='Proprietary',
install_requires=[
'setuptools',
- 'devpi-client'
+ 'devpi-client',
+ 'wheel'
],
setup_requires=[
'nose>=1.0' |
c3c48bdeeb772a43491f73690215aede6d171516 | setup.py | setup.py | #!/usr/bin/env python
try:
from setuptools import setup
extra = dict(test_suite="tests.test.suite", include_package_data=True)
except ImportError:
from distutils.core import setup
extra = {}
long_description = \
'''
qav is a Python library for console-based question and answering, with the
ability to ... | #!/usr/bin/env python
try:
from setuptools import setup
extra = dict(test_suite="tests.test.suite", include_package_data=True)
except ImportError:
from distutils.core import setup
extra = {}
long_description = \
'''
qav is a Python library for console-based question and answering, with the
ability to ... | Revert "Added netaddr as an install-time requirement." | Revert "Added netaddr as an install-time requirement."
This reverts commit a0bf258c63ad71b7301b51dcc8e470d43b4a9c82.
| Python | lgpl-2.1 | raushan802/qav,UMIACS/qav | ---
+++
@@ -25,8 +25,5 @@
license='MIT',
description='Question Answer Validation',
long_description=long_description,
- install_requires=[
- 'netaddr',
- ],
**extra
) |
a9cd9a95f387fd62058b9fbb5597ef64e1e8c422 | setup.py | setup.py | from setuptools import setup
from os import path
import codecs
here = path.abspath(path.dirname(__file__))
with codecs.open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='data-tracking',
version='1.5.11',
zip_safe=False,
url='https://github.com/LRE... | from setuptools import setup
from os import path
import codecs
here = path.abspath(path.dirname(__file__))
with codecs.open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='data-tracking',
version='1.5.11',
zip_safe=False,
url='https://github.com/LRE... | Update to Apache Airflow 1.8.1 | Update to Apache Airflow 1.8.1
| Python | apache-2.0 | LREN-CHUV/mri-meta-extract,LREN-CHUV/mri-meta-extract | ---
+++
@@ -20,7 +20,7 @@
packages=['data_tracking'],
keywords='mri dicom nifti',
install_requires=[
- 'airflow>=1.7.0',
+ 'apache-airflow>=1.8.1',
'pydicom>=0.9.9',
'SQLAlchemy>=1.1.6',
'python-magic>=0.4.12', |
8954f0d63dd45e9eec1a7f935870ac7c7d2d0bf2 | setup.py | setup.py | from setuptools import setup
setup(
name="pytest-xdist",
use_scm_version={'write_to': 'xdist/_version.py'},
description='py.test xdist plugin for distributed testing'
' and loop-on-failing modes',
long_description=open('README.rst').read(),
license='MIT',
author='holger krekel a... | from setuptools import setup
setup(
name="pytest-xdist",
use_scm_version={'write_to': 'xdist/_version.py'},
description='py.test xdist plugin for distributed testing'
' and loop-on-failing modes',
long_description=open('README.rst').read(),
license='MIT',
author='holger krekel a... | Add Framework::Pytest to list of classifiers | Add Framework::Pytest to list of classifiers
| Python | mit | pytest-dev/pytest-xdist,nicoddemus/pytest-xdist,RonnyPfannschmidt/pytest-xdist | ---
+++
@@ -24,6 +24,7 @@
setup_requires=['setuptools_scm'],
classifiers=[
'Development Status :: 5 - Production/Stable',
+ 'Framework :: Pytest',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX', |
8b41a38b50b1676f500aeacf9e4d0ee93a92b2d1 | sometimes/decorators.py | sometimes/decorators.py | import random
in_percentage = lambda x: random.randint(1,100) <= x
"""
They've done studies, you know. 50% of the time,
it works every time.
"""
def sometimes(fn):
def wrapped(*args, **kwargs):
wrapped.x += 1
if wrapped.x % 2 == 1:
return fn(*args, **kwargs)
return
... | import random
in_percentage = lambda x: random.randint(1,100) <= x
"""
They've done studies, you know. 50% of the time,
it works every time.
"""
def sometimes(fn):
def wrapped(*args, **kwargs):
wrapped.x += 1
if wrapped.x % 2 == 1:
return fn(*args, **kwargs)
wrapped.x =... | Add rarely, mostly and other alias | Add rarely, mostly and other alias
| Python | mit | aaronbassett/sometimes | ---
+++
@@ -14,10 +14,11 @@
wrapped.x += 1
if wrapped.x % 2 == 1:
return fn(*args, **kwargs)
- return
wrapped.x = 0
return wrapped
+
+half_the_time = sometimes
"""
@@ -28,7 +29,6 @@
def wrapped(*args, **kwargs):
if random.randint(1,2) == 1:
... |
51d6e5f994d0a081b8f381f7c4fbd2b54b78bb02 | xos/xos/apps.py | xos/xos/apps.py | from suit.apps import DjangoSuitConfig
class MyDjangoSuitConfig(DjangoSuitConfig):
admin_name = 'XOS'
menu_position = 'vertical'
menu_open_first_child = False
menu = (
{'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'},
{'label': 'Sites', 'icon':'icon-site'... | from suit.apps import DjangoSuitConfig
class MyDjangoSuitConfig(DjangoSuitConfig):
admin_name = 'XOS'
menu_position = 'vertical'
menu_open_first_child = False
menu = (
{'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'},
{'label': 'Sites', 'icon':'icon-site'... | Revert service grid to tabular view | Revert service grid to tabular view
| Python | apache-2.0 | cboling/xos,cboling/xos,cboling/xos,cboling/xos,cboling/xos | ---
+++
@@ -9,5 +9,5 @@
{'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'},
{'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'},
{'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'},
- {'label': 'Services', 'icon':'icon-cog', 'url': '/serviceGr... |
4d212e2f796bc6e473292dab7a56ce74d7c96e41 | moksha/api/widgets/containers/dashboardcontainer.py | moksha/api/widgets/containers/dashboardcontainer.py | from moksha.api.widgets.layout.layout import layout_js, layout_css, ui_core_js, ui_draggable_js, ui_droppable_js, ui_sortable_js
from tw.api import Widget
from tw.jquery import jquery_js
from moksha.lib.helpers import eval_app_config, ConfigWrapper
from tg import config
class AppListWidget(Widget):
template = 'ma... | from tg import config
from tw.api import Widget
from moksha.lib.helpers import eval_app_config, ConfigWrapper
class AppListWidget(Widget):
template = 'mako:moksha.api.widgets.containers.templates.layout_applist'
properties = ['category']
def update_params(self, d):
super(AppListWidget, self).upda... | Clean up some of our dashboard container imports | Clean up some of our dashboard container imports
| Python | apache-2.0 | lmacken/moksha,ralphbean/moksha,pombredanne/moksha,pombredanne/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha | ---
+++
@@ -1,9 +1,7 @@
-from moksha.api.widgets.layout.layout import layout_js, layout_css, ui_core_js, ui_draggable_js, ui_droppable_js, ui_sortable_js
+from tg import config
+from tw.api import Widget
-from tw.api import Widget
-from tw.jquery import jquery_js
from moksha.lib.helpers import eval_app_config, Con... |
545e573c9542d33e80dfe5e7e6bb17487835e053 | profile_collection/startup/00-startup.py | profile_collection/startup/00-startup.py | import sys
import logging
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
handler = logging.StreamHandler(sys.stderr)
fmt = logging.Formatter("%(asctime)-15s [%(name)5s:%(levelname)s] %(message)s")
handler.setFormatter(fmt)
logging.getLogger('hxntools').addHandler(handler)
logging.getLogger('hxnfly').ad... | import sys
import logging
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
handler = logging.StreamHandler(sys.stderr)
fmt = logging.Formatter("%(asctime)-15s [%(name)5s:%(levelname)s] %(message)s")
handler.setFormatter(fmt)
handler.setLevel(logging.INFO)
logging.getLogger('hxntools').addHandler(handler... | Tweak logging configuration - record debug info, display info level | Tweak logging configuration - record debug info, display info level
| Python | bsd-2-clause | NSLS-II-HXN/ipython_ophyd,NSLS-II-HXN/ipython_ophyd | ---
+++
@@ -9,12 +9,14 @@
handler = logging.StreamHandler(sys.stderr)
fmt = logging.Formatter("%(asctime)-15s [%(name)5s:%(levelname)s] %(message)s")
handler.setFormatter(fmt)
+handler.setLevel(logging.INFO)
+
logging.getLogger('hxntools').addHandler(handler)
logging.getLogger('hxnfly').addHandler(handler)
logg... |
4bc8d4016954e82fb566d7cf43ec21825a0e89de | indra/tests/test_tsv_assembler.py | indra/tests/test_tsv_assembler.py | import os
from indra.assemblers.tsv_assembler import TsvAssembler
from indra.sources.signor import SignorProcessor
# Get some statements from Signor
sp = SignorProcessor()
stmts = sp.statements
def test_tsv_init():
ta = TsvAssembler(stmts)
ta.make_model('tsv_test')
def test_tsv_add_stmts():
ta = TsvAssem... | import os
from indra.sources import signor
from indra.assemblers.tsv_assembler import TsvAssembler
# Get some statements from Signor
from .test_signor import test_data_file, test_complexes_file
sp = signor.process_from_file(test_data_file, test_complexes_file)
stmts = sp.statements
def test_tsv_init():
ta = TsvAs... | Fix TSV Assembler reference to Signor files | Fix TSV Assembler reference to Signor files
| Python | bsd-2-clause | sorgerlab/belpy,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,pvtodorov/indra,pvtodorov/indra,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,sorgerlab/indra,bgyori/indra,bgyori/indra,bgyori/indra | ---
+++
@@ -1,9 +1,10 @@
import os
+from indra.sources import signor
from indra.assemblers.tsv_assembler import TsvAssembler
-from indra.sources.signor import SignorProcessor
# Get some statements from Signor
-sp = SignorProcessor()
+from .test_signor import test_data_file, test_complexes_file
+sp = signor.proce... |
37715104dec586ea67b253e4e7ed35795cb5ea8c | track.py | track.py | # from google_measurement_protocol import Event, report
import uuid
GENDERS = {
'female': 'Gender Female',
'male': 'Gender Male'
}
def log_fetch(count, gender):
label = GENDERS.get(gender, 'Gender Neutral')
client_id = uuid.uuid4()
# event = Event('API', 'Fetch', label=label, value=count)
# ... | from google_measurement_protocol import event, report
import uuid
GENDERS = {
'female': 'Gender Female',
'male': 'Gender Male'
}
def log_fetch(count, gender):
label = GENDERS.get(gender, 'Gender Neutral')
client_id = uuid.uuid4()
data = event('API', 'Fetch', label=label, value=count)
report(... | Add google measurement protocol back | Add google measurement protocol back
| Python | mit | reneepadgham/diverseui,reneepadgham/diverseui,reneepadgham/diverseui | ---
+++
@@ -1,4 +1,4 @@
-# from google_measurement_protocol import Event, report
+from google_measurement_protocol import event, report
import uuid
@@ -11,5 +11,5 @@
def log_fetch(count, gender):
label = GENDERS.get(gender, 'Gender Neutral')
client_id = uuid.uuid4()
- # event = Event('API', 'Fetch'... |
30fae197ff6561a58df33868b3379a41d6a9d9dd | settings_test.py | settings_test.py | SQLALCHEMY_DATABASE_TEST_URI = 'postgresql://postgres:@localhost/pybossa'
GOOGLE_CLIENT_ID = ''
GOOGLE_CLIENT_SECRET = ''
TWITTER_CONSUMER_KEY=''
TWITTER_CONSUMER_SECRET=''
FACEBOOK_APP_ID=''
FACEBOOK_APP_SECRET=''
TERMSOFUSE = 'http://okfn.org/terms-of-use/'
DATAUSE = 'http://opendatacommons.org/licenses/by/'
ITSDANGE... | SQLALCHEMY_DATABASE_TEST_URI = 'postgresql://postgres:@localhost/pybossa'
GOOGLE_CLIENT_ID = ''
GOOGLE_CLIENT_SECRET = ''
TWITTER_CONSUMER_KEY=''
TWITTER_CONSUMER_SECRET=''
FACEBOOK_APP_ID=''
FACEBOOK_APP_SECRET=''
TERMSOFUSE = 'http://okfn.org/terms-of-use/'
DATAUSE = 'http://opendatacommons.org/licenses/by/'
ITSDANGE... | Add ENFORCE_PRIVACY to Travis testing settings. | Add ENFORCE_PRIVACY to Travis testing settings.
| Python | agpl-3.0 | geotagx/geotagx-pybossa-archive,inteligencia-coletiva-lsd/pybossa,Scifabric/pybossa,geotagx/geotagx-pybossa-archive,jean/pybossa,CulturePlex/pybossa,PyBossa/pybossa,geotagx/geotagx-pybossa-archive,CulturePlex/pybossa,inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,PyBossa/pybossa,OpenNewsLabs/pybossa,proyectos-a... | ---
+++
@@ -17,3 +17,4 @@
MAIL_DEFAULT_SENDER = 'PyBossa Support <info@pybossa.com>'
ANNOUNCEMENT = {'admin': 'Root Message', 'user': 'User Message', 'owner': 'Owner Message'}
LOCALES = ['en', 'es']
+ENFORCE_PRIVACY = False |
d1e64b8cf97f8a89d61ecd5d5bd7f9ba6f5ff6b8 | extruct/jsonld.py | extruct/jsonld.py | # -*- coding: utf-8 -*-
"""
JSON-LD extractor
"""
import json
import re
import lxml.etree
import lxml.html
HTML_OR_JS_COMMENTLINE = re.compile('^\s*(//.*|<!--.*-->)')
class JsonLdExtractor(object):
_xp_jsonld = lxml.etree.XPath('descendant-or-self::script[@type="application/ld+json"]')
def extract(self, ... | # -*- coding: utf-8 -*-
"""
JSON-LD extractor
"""
import json
import re
import lxml.etree
import lxml.html
HTML_OR_JS_COMMENTLINE = re.compile('^\s*(//.*|<!--.*-->)')
class JsonLdExtractor(object):
_xp_jsonld = lxml.etree.XPath('descendant-or-self::script[@type="application/ld+json"]')
def extract(self, ... | Remove leading comments and allow control characters directly. | Mod: Remove leading comments and allow control characters directly.
| Python | bsd-3-clause | scrapinghub/extruct | ---
+++
@@ -29,15 +29,9 @@
def _extract_items(self, node):
script = node.xpath('string()')
- try:
- data = json.loads(script)
- except ValueError:
- # sometimes JSON-decoding errors are due to leading HTML or JavaScript comments
- try:
- da... |
9f02929673389884d4dd261964b7b1be6c959caa | vault.py | vault.py | import os
import urllib2
import json
import sys
from urlparse import urljoin
from ansible import utils, errors
from ansible.utils import template
class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
def run(self, terms, inject=None, **kwargs):
try:
... | import os
import urllib2
import json
import sys
from urlparse import urljoin
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
def run(self, terms, variables, **kwargs):
key = terms[0]
url = os.getenv('VAULT_ADDR')
if n... | Update plugin for ansible 2.0 | Update plugin for ansible 2.0
| Python | bsd-3-clause | jhaals/ansible-vault,jhaals/ansible-vault,locationlabs/ansible-vault | ---
+++
@@ -4,37 +4,33 @@
import sys
from urlparse import urljoin
-from ansible import utils, errors
-from ansible.utils import template
+from ansible.errors import AnsibleError
+from ansible.plugins.lookup import LookupBase
-class LookupModule(object):
- def __init__(self, basedir=None, **kwargs):
- ... |
5f8d59646875d4e4aa75ec22a2ddc666c1802a23 | readthedocs/core/utils/tasks/__init__.py | readthedocs/core/utils/tasks/__init__.py | from .permission_checks import user_id_matches
from .public import permission_check
from .public import get_public_task_data
from .retrieve import TaskNotFound
from .retrieve import get_task_data
| from .permission_checks import user_id_matches
from .public import PublicTask
from .public import TaskNoPermission
from .public import permission_check
from .public import get_public_task_data
from .retrieve import TaskNotFound
from .retrieve import get_task_data
| Revert previous commit by adding missing imports | Revert previous commit by adding missing imports
| Python | mit | rtfd/readthedocs.org,tddv/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,davidfischer/readthedocs.org,pombredanne/readthedocs.org,pombredanne/readthedocs.org,pombredanne/readthedocs.org,safwanrahman/readthedocs.org,tddv/readthedocs.org,davidfischer/readthedocs.org,tddv/readthedoc... | ---
+++
@@ -1,4 +1,6 @@
from .permission_checks import user_id_matches
+from .public import PublicTask
+from .public import TaskNoPermission
from .public import permission_check
from .public import get_public_task_data
from .retrieve import TaskNotFound |
1706472a183d50fb11513345b4c82ac201a00306 | me_api/configs.py | me_api/configs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
from os import path
class Config(object):
cwd = path.abspath(path.dirname(__file__))
with open(path.join(cwd, 'me.json')) as me:
me = json.load(me)
with open(path.join(cwd, 'modules... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
from os import path
class Config(object):
CACHE_TYPE = 'simple'
cwd = path.abspath(path.dirname(__file__))
with open(path.join(cwd, 'me.json')) as me:
me = json.load(me)
with o... | Move CACHE_TYPE to Config; add TestingConfig | Move CACHE_TYPE to Config; add TestingConfig
| Python | mit | lord63/me-api | ---
+++
@@ -8,6 +8,8 @@
class Config(object):
+ CACHE_TYPE = 'simple'
+
cwd = path.abspath(path.dirname(__file__))
with open(path.join(cwd, 'me.json')) as me:
me = json.load(me)
@@ -17,8 +19,11 @@
class DevelopConfig(Config):
DEBUG = True
- CACHE_TYPE = 'simple'
class Produc... |
9467cfc4fa3f0bd2c269f3d7b61460ddc6851f9f | tests/test_dfw_uncomparables.py | tests/test_dfw_uncomparables.py | """Test dfw.uncomparables."""
from check import Check
from proselint.checks.wallace import uncomparables as chk
class TestCheck(Check):
"""The test class for dfw.uncomparables."""
__test__ = True
@property
def this_check(self):
"""Bolierplate."""
return chk
def test_sample_phr... | """Test dfw.uncomparables."""
from check import Check
from proselint.checks.wallace import uncomparables as chk
class TestCheck(Check):
"""The test class for dfw.uncomparables."""
__test__ = True
@property
def this_check(self):
"""Bolierplate."""
return chk
def test_sample_phr... | Add test for exception to uncomparable check | Add test for exception to uncomparable check
| Python | bsd-3-clause | jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint | ---
+++
@@ -23,3 +23,6 @@
"""Handle linebreaks correctly."""
assert not self.passes("""This sentence is very\nunique.""")
+ def test_constitutional(self):
+ """Don't flag 'more perfect'."""
+ assert self.passes("""A more perfect union.""") |
7e23d49dbd66fac972539326c81448e8439206e8 | PyGitUp/utils.py | PyGitUp/utils.py | # coding=utf-8
"""
Some simple, generic usefull methods.
"""
import subprocess
import sys
def find(seq, test):
""" Return first item in sequence where test(item) == True """
for item in seq:
if test(item):
return item
def uniq(seq):
""" Return a copy of seq without ... | # coding=utf-8
"""
Some simple, generic usefull methods.
"""
import subprocess
import sys
def find(seq, test):
""" Return first item in sequence where test(item) == True """
for item in seq:
if test(item):
return item
def uniq(seq):
""" Return a copy of seq without ... | Hide stderr messages when detecting git dir | Hide stderr messages when detecting git dir
| Python | mit | msiemens/PyGitUp | ---
+++
@@ -23,7 +23,9 @@
def execute(cmd, cwd=None):
""" Execute a command and return it's output. """
try:
- lines = subprocess.check_output(cmd, cwd=cwd).splitlines()
+ lines = subprocess\
+ .check_output(cmd, cwd=cwd, stderr=subprocess.DEVNULL)\
+ .splitlines()
... |
8b2f251be2c5723e7825a38634e84dbb82b0d844 | sir/__main__.py | sir/__main__.py | # Copyright (c) 2014 Wieland Hoffmann
# License: MIT, see LICENSE for details
import argparse
import logging
from . import config
from .indexing import reindex
logger = logging.getLogger("sir")
def watch(args):
raise NotImplementedError
def main():
loghandler = logging.StreamHandler()
formatter = lo... | # Copyright (c) 2014 Wieland Hoffmann
# License: MIT, see LICENSE for details
import argparse
import logging
from . import config
from .indexing import reindex
logger = logging.getLogger("sir")
def watch(args):
raise NotImplementedError
def main():
loghandler = logging.StreamHandler()
formatter = lo... | Include timestamps in log messages | Include timestamps in log messages
| Python | mit | jeffweeksio/sir | ---
+++
@@ -17,7 +17,7 @@
def main():
loghandler = logging.StreamHandler()
- formatter = logging.Formatter(fmt="%(threadName)s %(levelname)s: %(message)s")
+ formatter = logging.Formatter(fmt="%(asctime)s %(threadName)s %(levelname)s: %(message)s")
loghandler.setFormatter(formatter)
logger.add... |
2156fbea296484d528a1fbd1a2f4e4ac76af970d | salt/states/disk.py | salt/states/disk.py | '''
Disk monitoring state
Monitor the state of disk resources
'''
def status(name, max=None, min=None):
'''
Return the current disk usage stats for the named device
'''
# Monitoring state, no changes will be made so no test interface needed
ret = {'name': name,
'result': False,
... | '''
Disk monitoring state
Monitor the state of disk resources
'''
def status(name, max=None, min=None):
'''
Return the current disk usage stats for the named device
'''
# Monitoring state, no changes will be made so no test interface needed
ret = {'name': name,
'result': False,
... | Fix bad ref, forgot the __salt__ :P | Fix bad ref, forgot the __salt__ :P
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -15,7 +15,7 @@
'changes': {},
'data': {}} # Data field for monitoring state
- data = disk.usage()
+ data = __salt__['disk.usage']()
if not name in data:
ret['result'] = False
ret['comment'] += 'Named disk mount not present ' |
27e2dcb42f4d485b09aa043a19dfc37a8d01c4c5 | test_package.py | test_package.py | import caniusepython3 as ciu
def main():
import sys
project = sys.argv[1]
result = ciu.check(projects=[project])
print(result)
if __name__ == '__main__':
main()
| from urllib.parse import urlparse
import caniusepython3 as ciu
def main():
import sys
project = sys.argv[1]
# check if there is github page
with ciu.pypi.pypi_client() as client:
releases = client.package_releases(project)
if not releases:
print('NO releases found for {}'... | Update the script to directly use pypi client | Update the script to directly use pypi client
* Faster to get to the data
| Python | mit | PythonCharmers/autoporter | ---
+++
@@ -1,11 +1,38 @@
+from urllib.parse import urlparse
+
import caniusepython3 as ciu
def main():
import sys
project = sys.argv[1]
- result = ciu.check(projects=[project])
- print(result)
+
+ # check if there is github page
+ with ciu.pypi.pypi_client() as client:
+ releases =... |
696716ed9fb93f12bcb36d16611ea26bead0aafe | test_portend.py | test_portend.py | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = ''
port = portend.find_available_local_port()
infos = socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
for info in infos:
yield host, port, info
@pytest.fixtu... | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = ''
port = portend.find_available_local_port()
return socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
def id_for_info(info):
af, = info[:1]
return str(af)
def... | Refactor fixture to provide meaningful ids | Refactor fixture to provide meaningful ids
| Python | mit | jaraco/portend | ---
+++
@@ -11,15 +11,22 @@
"""
host = ''
port = portend.find_available_local_port()
- infos = socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
- for info in infos:
- yield host, port, info
+ return socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
-@pytest.fixture(pa... |
ce344bac2ca4ddb027a50f523e6bd8ce04de6ca8 | matrix.py | matrix.py | from __future__ import division
import itertools
def get_offsets(span):
"""
Get matrix offsets for a square of distance `span`.
"""
if span < 0:
raise ValueError('Cannot return neighbours for negative distance')
all_offsets = set(itertools.product([x for x in range(-span, span + 1)], rep... | from __future__ import division
import itertools
def get_offsets(span):
"""
Get matrix offsets for a square of distance `span`.
"""
if span < 0:
raise ValueError('Cannot return neighbours for negative distance')
all_offsets = set(itertools.product([x for x in range(-span, span + 1)], rep... | Fix find_neighbours_2D to ignore out of bounds points | Fix find_neighbours_2D to ignore out of bounds points
... rather than 'trim' the coords, which made no sense.
| Python | mit | supermitch/Island-Gen | ---
+++
@@ -21,16 +21,19 @@
def find_neighbours_2D(array, start, span):
"""
Return neighbours in a 2D array, given a start point and range.
+
+ Checks array bounds so we don't get index errors.
"""
x, y = start # Start coords
rows = len(array) # How many rows
cols = len(array[0]) ... |
b7d8e70bf74be142f70bf12635a4bb1632d166ed | funnel/forms/label.py | funnel/forms/label.py | # -*- coding: utf-8 -*-
from baseframe import __
import baseframe.forms as forms
__all__ = ['LabelForm', 'LabelOptionForm']
class LabelForm(forms.Form):
name = forms.StringField(
"", widget=forms.HiddenInput(), validators=[forms.validators.Optional()]
)
title = forms.StringField(
__("Lab... | # -*- coding: utf-8 -*-
from baseframe import __
import baseframe.forms as forms
__all__ = ['LabelForm', 'LabelOptionForm']
class LabelForm(forms.Form):
name = forms.StringField(
"", widget=forms.HiddenInput(), validators=[forms.validators.Optional()]
)
title = forms.StringField(
__("Lab... | Add form validator for icon_emoji | Add form validator for icon_emoji | Python | agpl-3.0 | hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel | ---
+++
@@ -18,7 +18,9 @@
],
filters=[forms.filters.strip()],
)
- icon_emoji = forms.StringField("")
+ icon_emoji = forms.StringField(
+ "", validators=[forms.validators.IsEmoji()]
+ )
required = forms.BooleanField(
__("Make this label mandatory in proposal forms")... |
eeb7b25b59d7ed28c76a288fd7e29c8953ac4503 | pluginsmanager/model/lv2/lv2_effect_builder.py | pluginsmanager/model/lv2/lv2_effect_builder.py | import os
import json
from pluginsmanager.model.lv2.lv2_plugin import Lv2Plugin
from pluginsmanager.model.lv2.lv2_effect import Lv2Effect
class Lv2EffectBuilder(object):
"""
Generates lv2 audio plugins instance (as :class:`Lv2Effect` object).
.. note::
In the current implementation, the data pl... | import os
import json
from pluginsmanager.model.lv2.lv2_plugin import Lv2Plugin
from pluginsmanager.model.lv2.lv2_effect import Lv2Effect
class Lv2EffectBuilder(object):
"""
Generates lv2 audio plugins instance (as :class:`Lv2Effect` object).
.. note::
In the current implementation, the data pl... | Fix lv2 effect builder for travis build | Fix lv2 effect builder for travis build
| Python | apache-2.0 | PedalPi/PluginsManager | ---
+++
@@ -24,9 +24,9 @@
with open(plugins_json) as data_file:
data = json.load(data_file)
- supported_plugins = self._supported_plugins
+ #supported_plugins = self._supported_plugins
for plugin in data:
- if plugin['uri'] in supported_plugins:
+ # ... |
e1a61b1f286d7434f2b0d0740f10df8d4b441ec1 | cloudaux/__about__.py | cloudaux/__about__.py | __all__ = [
'__title__',
'__summary__',
'__uri__',
'__version__',
'__author__',
'__email__',
'__license__',
'__copyright__'
]
__title__ = 'cloudaux'
__summary__ = 'Cloud Auxiliary is a python wrapper and orchestration module for interacting with cloud providers'
__uri__ = 'https://githu... | __all__ = [
'__title__',
'__summary__',
'__uri__',
'__version__',
'__author__',
'__email__',
'__license__',
'__copyright__'
]
__title__ = 'cloudaux'
__summary__ = 'Cloud Auxiliary is a python wrapper and orchestration module for interacting with cloud providers'
__uri__ = 'https://githu... | Bump version to 1.4.16 for previous merge | Bump version to 1.4.16 for previous merge
| Python | apache-2.0 | Netflix-Skunkworks/cloudaux | ---
+++
@@ -13,7 +13,7 @@
__summary__ = 'Cloud Auxiliary is a python wrapper and orchestration module for interacting with cloud providers'
__uri__ = 'https://github.com/Netflix-Skunkworks/cloudaux'
-__version__ = '1.4.15'
+__version__ = '1.4.16'
__author__ = 'Patrick Kelley'
__email__ = 'patrick@netflix.com' |
33f050ab022626846510a7cbcd4b299612f2ff85 | tvmaze/tests.py | tvmaze/tests.py | import unittest
from tvmazereader import main
class TestMethods(unittest.TestCase):
def test_readerMain(self):
data = main()
self.assertEqual(len(data),2)
if __name__ == '__main__':
unittest.main() | import unittest
from tvmazereader import main
class TestMethods(unittest.TestCase):
def test_readerMain(self):
data = main()
self.assertEqual(len(data),2)
if __name__ == '__main__':
unittest.main()
#python -m unittest discover -v | Add comment show test usage from console. | Add comment show test usage from console.
| Python | mit | LairdStreak/MyPyPlayGround,LairdStreak/MyPyPlayGround,LairdStreak/MyPyPlayGround | ---
+++
@@ -9,3 +9,5 @@
if __name__ == '__main__':
unittest.main()
+
+ #python -m unittest discover -v |
61f162b7d5a8c9574261705b15b3f8deafffe7bc | froide/team/apps.py | froide/team/apps.py | from django.apps import AppConfig
from django.urls import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
class TeamConfig(AppConfig):
name = 'froide.team'
verbose_name = _('Teams')
def ready(self):
from froide.account.menu import menu_registry, MenuIt... | import json
from django.apps import AppConfig
from django.urls import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
class TeamConfig(AppConfig):
name = 'froide.team'
verbose_name = _('Teams')
def ready(self):
from froide.account.menu import menu_reg... | Add user data export for teams | Add user data export for teams | Python | mit | fin/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide | ---
+++
@@ -1,3 +1,5 @@
+import json
+
from django.apps import AppConfig
from django.urls import reverse
from django.db import models
@@ -11,6 +13,7 @@
def ready(self):
from froide.account.menu import menu_registry, MenuItem
from froide.account import account_canceled
+ from froide.ac... |
0b7c27fec5b1b7ececfcf7556f415e8e53cf69b6 | v1.0/v1.0/search.py | v1.0/v1.0/search.py | #!/usr/bin/env python
# Toy program to search inverted index and print out each line the term
# appears.
import sys
mainfile = sys.argv[1]
indexfile = sys.argv[1] + ".idx1"
term = sys.argv[2]
main = open(mainfile)
index = open(indexfile)
st = term + ": "
for a in index:
if a.startswith(st):
n = [int(i... | #!/usr/bin/env python
# Toy program to search inverted index and print out each line the term
# appears.
from __future__ import print_function
import sys
mainfile = sys.argv[1]
indexfile = sys.argv[1] + ".idx1"
term = sys.argv[2]
main = open(mainfile)
index = open(indexfile)
st = term + ": "
for a in index:
... | Make conformance test 55 compatible with Python 3 | Make conformance test 55 compatible with Python 3
| Python | apache-2.0 | curoverse/common-workflow-language,curoverse/common-workflow-language,mr-c/common-workflow-language,common-workflow-language/common-workflow-language,mr-c/common-workflow-language,dleehr/common-workflow-language,dleehr/common-workflow-language,common-workflow-language/common-workflow-language,dleehr/common-workflow-lan... | ---
+++
@@ -2,6 +2,8 @@
# Toy program to search inverted index and print out each line the term
# appears.
+
+from __future__ import print_function
import sys
@@ -21,5 +23,5 @@
for l in main:
linenum += 1
if linenum in n:
- print linenum, l.rstrip()
+ ... |
10246ab476980053131c9f2b852116793fd8e1cd | flask_mongorest/__init__.py | flask_mongorest/__init__.py | from flask import Blueprint
from functools import wraps
from flask_mongorest.methods import Create, Update, BulkUpdate, Fetch, List, Delete
class MongoRest(object):
def __init__(self, app, **kwargs):
self.app = app
self.url_prefix = kwargs.pop('url_prefix', '')
app.register_blueprint(Bluep... | from flask import Blueprint
from functools import wraps
from flask_mongorest.methods import Create, Update, BulkUpdate, Fetch, List, Delete
class MongoRest(object):
def __init__(self, app, **kwargs):
self.app = app
self.url_prefix = kwargs.pop('url_prefix', '')
app.register_blueprint(Bluep... | Allow passing extra kwargs into register decorator | Allow passing extra kwargs into register decorator
In order to support extra key-word arguments in add_url_rule method, e.g. subdomain. | Python | bsd-3-clause | elasticsales/flask-mongorest,DropD/flask-mongorest,elasticsales/flask-mongorest,DropD/flask-mongorest | ---
+++
@@ -19,10 +19,10 @@
pk_type = kwargs.pop('pk_type', 'string')
view_func = klass.as_view(name)
if List in klass.methods:
- self.app.add_url_rule(url, defaults={'pk': None}, view_func=view_func, methods=[List.method])
+ self.app.add_url_rule(... |
e1791d929bccd1f5e9382e45fb90bd8257ef597d | src/toil/version.py | src/toil/version.py | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | Prepare next development cycle 3.1.0a1 | Prepare next development cycle 3.1.0a1
| Python | apache-2.0 | BD2KGenomics/slugflow,BD2KGenomics/slugflow | ---
+++
@@ -11,4 +11,5 @@
# 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.
-version='3.0.6'
+
+version = '3.1.0a1' |
7024d3b36176ec11142ee10884936ff329aece49 | tests/test_cookiecutter_invocation.py | tests/test_cookiecutter_invocation.py | # -*- coding: utf-8 -*-
"""
test_cookiecutter_invocation
----------------------------
Tests to make sure that cookiecutter can be called from the cli without
using the entry point set up for the package.
"""
import os
import pytest
import subprocess
from cookiecutter import utils
def test_should_raise_error_witho... | # -*- coding: utf-8 -*-
"""
test_cookiecutter_invocation
----------------------------
Tests to make sure that cookiecutter can be called from the cli without
using the entry point set up for the package.
"""
import os
import pytest
import subprocess
import sys
from cookiecutter import utils
def test_should_raise_... | Set PYTHONPATH and use sys.executable | Set PYTHONPATH and use sys.executable
| Python | bsd-3-clause | agconti/cookiecutter,stevepiercy/cookiecutter,sp1rs/cookiecutter,Vauxoo/cookiecutter,hackebrot/cookiecutter,hackebrot/cookiecutter,ramiroluz/cookiecutter,kkujawinski/cookiecutter,pjbull/cookiecutter,ramiroluz/cookiecutter,cguardia/cookiecutter,cguardia/cookiecutter,sp1rs/cookiecutter,venumech/cookiecutter,Vauxoo/cookie... | ---
+++
@@ -11,6 +11,7 @@
import os
import pytest
import subprocess
+import sys
from cookiecutter import utils
@@ -37,12 +38,15 @@
return rendered_dir
-def test_should_invoke_main(project_dir):
+def test_should_invoke_main(monkeypatch, project_dir):
+ monkeypatch.setenv('PYTHONPATH', '.')
+
s... |
7127d138bacf507360b6b8c0386187d2e1be32a6 | ifilter/__init__.py | ifilter/__init__.py | import sys
import tempfile
import os
from subprocess import call
import argparse
guide = """# Remove or modify lines.
# Lines that are prefixed with the # character are filtered out.
# When you are done, save the file and exit.
"""
description = """Interactively filter lines in a pipe.
Example: Delete selected file... | import sys
import tempfile
import os
from subprocess import call
import argparse
guide = """# Remove or modify lines.
# Lines that are prefixed with the # character are filtered out.
# When you are done, save the file and exit.
"""
description = """Interactively filter lines in a pipe.
Example: Delete selected file... | Add finally block for deletion of temp file | Add finally block for deletion of temp file
| Python | apache-2.0 | stefan-hudelmaier/ifilter | ---
+++
@@ -29,31 +29,35 @@
def main():
- parser = argparse.ArgumentParser(
- prog='ifilter',
- formatter_class=argparse.RawDescriptionHelpFormatter,
- description=description)
- # Currently args are unused
- args = parser.parse_args()
+ try:
+
+ parser = argpars... |
aed451bc41ee09a9ff11f350881c320557fea71b | bin/debug/load_timeline_for_day_and_user.py | bin/debug/load_timeline_for_day_and_user.py | import json
import bson.json_util as bju
import emission.core.get_database as edb
import sys
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage: %s <filename>" % (sys.argv[0])
fn = sys.argv[1]
print "Loading file " + fn
entries = json.load(open(fn), object_hook = bju.object_hook)
... | import json
import bson.json_util as bju
import emission.core.get_database as edb
import sys
import argparse
import uuid
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("timeline_filename",
help="the name of the file that contains the json representation of the timelin... | Support loading with a specified username so that we can test more easily | Support loading with a specified username so that we can test more easily
Example timelines that can be used with the data are at:
https://github.com/shankari/data-collection-eval/tree/master/results_dec_2015/ucb.sdb.android.1/timeseries
Note that timeline dumps contain object IDS, so reloading the same timeline
with... | Python | bsd-3-clause | yw374cornell/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,sunil07t/e-mi... | ---
+++
@@ -2,13 +2,25 @@
import bson.json_util as bju
import emission.core.get_database as edb
import sys
+import argparse
+import uuid
if __name__ == '__main__':
- if len(sys.argv) != 2:
- print "Usage: %s <filename>" % (sys.argv[0])
-
- fn = sys.argv[1]
+ parser = argparse.ArgumentParser()
+ ... |
318cbaabb289034584cdfb82639c84ed91fc6e2e | tests/test_io.py | tests/test_io.py | import pytest
from pikepdf import Pdf
from io import BytesIO
@pytest.fixture
def sandwich(resources):
# Has XMP, docinfo, <?adobe-xap-filters esc="CRLF"?>, shorthand attribute XMP
return Pdf.open(resources / 'sandwich.pdf')
class LimitedBytesIO(BytesIO):
"""Version of BytesIO that only accepts small re... | import pytest
from pikepdf import Pdf
from pikepdf._cpphelpers import fspath
from io import BytesIO
from shutil import copy
import sys
@pytest.fixture
def sandwich(resources):
# Has XMP, docinfo, <?adobe-xap-filters esc="CRLF"?>, shorthand attribute XMP
return Pdf.open(resources / 'sandwich.pdf')
class Lim... | Add test to check that we do not overwrite input file | Add test to check that we do not overwrite input file
| Python | mpl-2.0 | pikepdf/pikepdf,pikepdf/pikepdf,pikepdf/pikepdf | ---
+++
@@ -1,7 +1,10 @@
import pytest
from pikepdf import Pdf
+from pikepdf._cpphelpers import fspath
from io import BytesIO
+from shutil import copy
+import sys
@pytest.fixture
@@ -30,3 +33,11 @@
(outdir / 'example.pdf').touch()
pdf = Pdf.new()
pdf.save(outdir / 'example.pdf')
+
+
+@pytest.... |
b8f6027f475025f1b04c26e1ff4e9c6ff659e362 | templates/button.py | templates/button.py | from copy import deepcopy as copy
from text import TextTemplate
TextTemplate.get_text = lambda self: self.get_message()['text']
TEXT_CHARACTER_LIMIT = 320
template = {
'template_type': 'button',
'value': {
'attachment': {
'type': 'template',
'payload': {
'templ... | from copy import deepcopy as copy
from text import TextTemplate
TextTemplate.get_text = lambda self: self.get_message()['text']
TEXT_CHARACTER_LIMIT = 640
template = {
'template_type': 'button',
'value': {
'attachment': {
'type': 'template',
'payload': {
'templ... | Update TEXT_CHARACTER_LIMIT from 320 to 640 in ButtonTemplate | Update TEXT_CHARACTER_LIMIT from 320 to 640 in ButtonTemplate
| Python | mit | jaskaransarkaria/JARVIS-on-Messenger,ZuZuD/JARVIS-on-Messenger,swapagarwal/JARVIS-on-Messenger,edadesd/JARVIS-on-Messenger | ---
+++
@@ -3,7 +3,7 @@
from text import TextTemplate
TextTemplate.get_text = lambda self: self.get_message()['text']
-TEXT_CHARACTER_LIMIT = 320
+TEXT_CHARACTER_LIMIT = 640
template = {
'template_type': 'button', |
2fa0c333cb92557b5ba39e91db41327ae381b6a7 | Tools/px4params/xmlout.py | Tools/px4params/xmlout.py | from xml.dom.minidom import getDOMImplementation
import codecs
class XMLOutput():
def __init__(self, groups):
impl = getDOMImplementation()
xml_document = impl.createDocument(None, "parameters", None)
xml_parameters = xml_document.documentElement
for group in groups:
xml... | from xml.dom.minidom import getDOMImplementation
import codecs
class XMLOutput():
def __init__(self, groups):
impl = getDOMImplementation()
xml_document = impl.createDocument(None, "parameters", None)
xml_parameters = xml_document.documentElement
xml_version = xml_document.createEle... | Add version number to parameter meta data | Add version number to parameter meta data
| Python | mit | darknight-007/Firmware,Aerotenna/Firmware,mcgill-robotics/Firmware,PX4/Firmware,PX4/Firmware,acfloria/Firmware,acfloria/Firmware,mcgill-robotics/Firmware,mcgill-robotics/Firmware,jlecoeur/Firmware,dagar/Firmware,PX4/Firmware,acfloria/Firmware,mje-nz/PX4-Firmware,dagar/Firmware,darknight-007/Firmware,PX4/Firmware,darkni... | ---
+++
@@ -6,6 +6,10 @@
impl = getDOMImplementation()
xml_document = impl.createDocument(None, "parameters", None)
xml_parameters = xml_document.documentElement
+ xml_version = xml_document.createElement("version")
+ xml_parameters.appendChild(xml_version)
+ xml_versio... |
04703b3d13d512c1a4d1c24f6e8a02c6164f5d53 | tests/test_utils.py | tests/test_utils.py | import unittest
from app import create_app, db
from app.utils import get_or_create
from app.models import User
class TestUtils(unittest.TestCase):
def setUp(self):
self.app = create_app("testing")
self.app_ctx = self.app.app_context()
self.app_ctx.push()
db.create_all()
def t... | import unittest
from app import create_app, db
from app.utils import get_or_create
from app.models import User
class TestUtils(unittest.TestCase):
def setUp(self):
self.app = create_app("testing")
self.app_ctx = self.app.app_context()
self.app_ctx.push()
db.create_all()
def t... | Use class methods for unittests | Use class methods for unittests
| Python | mit | Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary | ---
+++
@@ -22,6 +22,6 @@
db.session.add(user1)
db.session.commit()
user2, created2 = get_or_create(User, name="foo", social_id="bar")
- assert created1
- assert not created2
- assert user1 == user2
+ self.assertTrue(created1)
+ self.assertFalse(created2)
... |
cadd4aa2bed67cad605937788d58e598ab1cdfc8 | tistory/__init__.py | tistory/__init__.py | #!/usr/bin/env python3
import json
import os
from shlex import quote as shlex_quote
from tistory.api import Tistory, TistoryError
from tistory.auth import TistoryOAuth2
def load_config(fname):
fname = shlex_quote(fname)
cf_path = os.path.dirname(os.path.realpath(__file__))
abspath = os.path.abspath(os.p... | #!/usr/bin/env python3
from tistory.api import Tistory, TistoryError
from tistory.auth import TistoryOAuth2
if __name__ == "__main__":
pass
| Remove load_config() from the tistory module | Remove load_config() from the tistory module
| Python | mit | kastden/tistory | ---
+++
@@ -1,22 +1,7 @@
#!/usr/bin/env python3
-
-import json
-import os
-from shlex import quote as shlex_quote
from tistory.api import Tistory, TistoryError
from tistory.auth import TistoryOAuth2
-
-def load_config(fname):
- fname = shlex_quote(fname)
- cf_path = os.path.dirname(os.path.realpath(__fil... |
ec7e03b778c8f6b47af4647d440b4838221a4e33 | jose/constants.py | jose/constants.py | import hashlib
class Algorithms(object):
NONE = 'none'
HS256 = 'HS256'
HS384 = 'HS384'
HS512 = 'HS512'
RS256 = 'RS256'
RS384 = 'RS384'
RS512 = 'RS512'
ES256 = 'ES256'
ES384 = 'ES384'
ES512 = 'ES512'
HMAC = set([HS256, HS384, HS512])
RSA = set([RS256, RS384, RS512])
... | import hashlib
class Algorithms(object):
NONE = 'none'
HS256 = 'HS256'
HS384 = 'HS384'
HS512 = 'HS512'
RS256 = 'RS256'
RS384 = 'RS384'
RS512 = 'RS512'
ES256 = 'ES256'
ES384 = 'ES384'
ES512 = 'ES512'
HMAC = {HS256, HS384, HS512}
RSA = {RS256, RS384, RS512}
EC = {ES2... | Replace function calls with set literals | Replace function calls with set literals
| Python | mit | mpdavis/python-jose | ---
+++
@@ -13,9 +13,9 @@
ES384 = 'ES384'
ES512 = 'ES512'
- HMAC = set([HS256, HS384, HS512])
- RSA = set([RS256, RS384, RS512])
- EC = set([ES256, ES384, ES512])
+ HMAC = {HS256, HS384, HS512}
+ RSA = {RS256, RS384, RS512}
+ EC = {ES256, ES384, ES512}
SUPPORTED = HMAC.union(RSA).... |
4db4eb6ce512b3356559fe3efc988627c3324838 | nonbias_weight_decay.py | nonbias_weight_decay.py | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import int
from future import standard_library
standard_library.install_aliases()
from chainer import cuda
class NonbiasWeightDecay(object):
"""Optimi... | # This caused an error in py2 because cupy expect non-unicode str
# from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import int
from future import standard_library
standard_library.install_aliases()
from ch... | Fix an error of passing unicode literals to cupy | Fix an error of passing unicode literals to cupy
| Python | mit | toslunar/chainerrl,toslunar/chainerrl | ---
+++
@@ -1,4 +1,5 @@
-from __future__ import unicode_literals
+# This caused an error in py2 because cupy expect non-unicode str
+# from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import |
570a1468796c6afdcbd77052227d9a155601e710 | app/__init__.py | app/__init__.py | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_oauthlib.client import OAuth
from config import config
db = SQLAlchemy()
oa = OAuth()
lm = LoginManager()
lm.login_view = "main.login"
from app.models import User
@lm.user_loader
def load_user(id):
r... | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_oauthlib.client import OAuth
from config import config
db = SQLAlchemy()
oa = OAuth()
lm = LoginManager()
lm.login_view = "main.login"
from app.models import User
@lm.user_loader
def load_user(id):
r... | Add word class converter to URL map | Add word class converter to URL map
| Python | mit | Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary | ---
+++
@@ -31,4 +31,7 @@
app.register_blueprint(main)
app.register_blueprint(oauth)
+ from app.converters import WordClassConverter
+ app.url_map.converters["word_class"] = WordClassConverter
+
return app |
4de5994b977ca7a0cb9086def22432d72fec0f34 | app/settings.py | app/settings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Flask application default config:
# http://flask.pocoo.org/docs/config/#configuring-from-files
# https://github.com/mbr/flask-appconfig
project_name = u'Skeleton \u2620'
class Default(object):
DEBUG = False
TESTING = False
JS_LOG_LEVEL = 3 # log (1) < d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Flask application default config:
# http://flask.pocoo.org/docs/config/#configuring-from-files
# https://github.com/mbr/flask-appconfig
project_name = u'Skeleton'
class Default(object):
DEBUG = False
TESTING = False
JS_LOG_LEVEL = 3 # log (1) < debug (2... | Drop the unicode skull-and-crossbones from the project name. Causes problems too easily. | Drop the unicode skull-and-crossbones from the project name. Causes problems too easily.
| Python | mit | peterhil/skeleton,peterhil/ninhursag,peterhil/skeleton,peterhil/ninhursag,peterhil/ninhursag,peterhil/skeleton,peterhil/ninhursag | ---
+++
@@ -6,7 +6,7 @@
# https://github.com/mbr/flask-appconfig
-project_name = u'Skeleton \u2620'
+project_name = u'Skeleton'
class Default(object): |
2e8373019f76a51da482df6415bbecd8b2f821ac | zephyrus/message.py | zephyrus/message.py | import json
class Message:
def __init__(self, sender, message_type, content=None):
self.message = {
'sender': sender,
'type': message_type,
'content': content
}
def __str__(self):
return json.dumps(self.message)
def __repr__(self):
retu... | import json
class Message:
def __init__(self, sender, message_type, content=None):
self.message = {
'sender': sender,
'type': message_type,
'content': content
}
def __str__(self):
return json.dumps(self.message)
def __repr__(self):
retu... | Add object creation methods for Message | Add object creation methods for Message
| Python | mit | wairton/zephyrus-mas | ---
+++
@@ -14,6 +14,15 @@
def __repr__(self):
return "Message: %s" % self
+
+ @classmethod
+ def from_json(self, json_dict):
+ # TODO: missing attributes parsing
+ return Message(json_dict['sender'], json_dict['type'], json_dict['content'])
+
+ @classmethod
+ def from_string... |
cabc7da28989f1cc000f7219845222992846631a | datasets/templatetags/general_templatetags.py | datasets/templatetags/general_templatetags.py | from django import template
from django.core import urlresolvers
import datetime
import time
register = template.Library()
# Adapted from: http://blog.scur.pl/2012/09/highlighting-current-active-page-django/
@register.simple_tag(takes_context=True)
def current(context, url_name, return_value=' current', **kwargs):
... | from django import template
from django.core import urlresolvers
import datetime
import time
register = template.Library()
# Adapted from: http://blog.scur.pl/2012/09/highlighting-current-active-page-django/
@register.simple_tag(takes_context=True)
def current(context, url_name, return_value=' current', **kwargs):
... | Fix bug with timestamp_to_datetime when value is not a number | Fix bug with timestamp_to_datetime when value is not a number
| Python | agpl-3.0 | MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets | ---
+++
@@ -40,5 +40,7 @@
@register.filter()
def timestamp_to_datetime(value):
+ if not value or value is None:
+ return None
return datetime.datetime.fromtimestamp(value)
|
504045eb346fd8ff3ce968a3140520cff99165cc | ibmcnx/doc/DataSources.py | ibmcnx/doc/DataSources.py | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | Create documentation of DataSource Settings | 8: Create documentation of DataSource Settings
Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8 | Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 | ---
+++
@@ -14,12 +14,14 @@
import ibmcnx.functions
-dbs = ['FNOSDS', 'FNGCDDS', 'IBM_FORMS_DATA_SOURCE', 'activities', 'blogs', 'communities', 'dogear', 'files', 'forum', 'homepage', 'metrics', 'mobile', 'news', 'oauth provider', 'profiles', 'search', 'wikis'] # List of all databases to check
-
-for db in db... |
4c5855b53bd3c9f945ea55291c2abdd94d309201 | ibmcnx/doc/Documentation.py | ibmcnx/doc/Documentation.py | ######
# Create a file (html or markdown) with the output of
# - JVMHeap
# - LogFiles
# - Ports
# - Variables
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-08
... | ######
# Create a file (html or markdown) with the output of
# - JVMHeap
# - LogFiles
# - Ports
# - Variables
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-08
... | Create script to save documentation to a file | 4: Create script to save documentation to a file
Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4 | Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 | ---
+++
@@ -22,7 +22,15 @@
filename = raw_input( 'Path and Filename to Documentation file: ' )
-sys.stdout = open( filename, "w")
+if (os.path.isfile( fileopen )):
+ answer = raw_input( "File exists, Overwrite, Append or Abort? (O|A|X)" ).lower()
+ if answer == "o":
+ sys.std... |
ef93478a0bb4f4eaea470e96b740d55bf8b6f3b5 | python/ecep/portal/management/commands/populate_availability.py | python/ecep/portal/management/commands/populate_availability.py | import random
import csv
from django.core.management.base import BaseCommand, CommandError
from portal.models import Location
class Command(BaseCommand):
"""
"""
def handle(self, *args, **options):
"""
"""
with open('availability.csv', 'rb') as availability_file:
re... | import random
import csv
from django.core.management.base import BaseCommand, CommandError
from portal.models import Location
class Command(BaseCommand):
"""
"""
def handle(self, *args, **options):
"""
"""
with open('availability.csv', 'rb') as availability_file:
re... | Add logic for availability population | Add logic for availability population
| Python | mit | smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning | ---
+++
@@ -22,5 +22,12 @@
try:
key = row['Key']
l = Location.objects.get(ecm_key=key)
- print l.site_name
+ l.availability = row['Availability']
+ l.save()
+ print l.availability
+ ... |
afb4e0d036fd93ba5e2c02e5d935452ab1a22e4e | emission/core/wrapper/cleanedtrip.py | emission/core/wrapper/cleanedtrip.py | import emission.core.wrapper.trip as ecwt
import emission.core.wrapper.wrapperbase as ecwb
class Cleanedtrip(ecwt.Trip):
props = ecwt.Trip.props
props.update({"raw_trip": ecwb.WrapperBase.Access.WORM,
"distance": ecwb.WrapperBase.Access.WORM,
})
def _populateDependencie... | import emission.core.wrapper.trip as ecwt
import emission.core.wrapper.wrapperbase as ecwb
class Cleanedtrip(ecwt.Trip):
props = ecwt.Trip.props
props.update({"raw_trip": ecwb.WrapperBase.Access.WORM
})
def _populateDependencies(self):
super(Cleanedtrip, self)._populateDependenci... | Remove the distance from the cleaned trip | Remove the distance from the cleaned trip
Since it is already in the base class (trip) and has been there since the very
first wrapper class commit.
https://github.com/e-mission/e-mission-server/commit/c4251f5de5dc65f0ddd458dc909c111ddec67153
| Python | bsd-3-clause | shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,shankari/e-mission-server | ---
+++
@@ -3,8 +3,7 @@
class Cleanedtrip(ecwt.Trip):
props = ecwt.Trip.props
- props.update({"raw_trip": ecwb.WrapperBase.Access.WORM,
- "distance": ecwb.WrapperBase.Access.WORM,
+ props.update({"raw_trip": ecwb.WrapperBase.Access.WORM
})
def _populateDependen... |
4f8a84171bdbe24701351a54230768069a5f27fc | deployments/prob140/image/ipython_config.py | deployments/prob140/image/ipython_config.py | # Disable history manager, we don't really use it
# and by default it puts an sqlite file on NFS, which is not something we wanna do
c.Historymanager.enabled = False
| # Disable history manager, we don't really use it
# and by default it puts an sqlite file on NFS, which is not something we wanna do
c.Historymanager.enabled = False
# Use memory for notebook notary file to workaround corrupted files on nfs
# https://www.sqlite.org/inmemorydb.html
# https://github.com/jupyter/jupyter/... | Use memory for notebook notary file. | Use memory for notebook notary file.
Workaround possible file integrity issues.
| Python | bsd-3-clause | ryanlovett/datahub,berkeley-dsep-infra/datahub,berkeley-dsep-infra/datahub,berkeley-dsep-infra/datahub,ryanlovett/datahub,ryanlovett/datahub | ---
+++
@@ -1,3 +1,9 @@
# Disable history manager, we don't really use it
# and by default it puts an sqlite file on NFS, which is not something we wanna do
c.Historymanager.enabled = False
+
+# Use memory for notebook notary file to workaround corrupted files on nfs
+# https://www.sqlite.org/inmemorydb.html
+# ht... |
787c8a1f1f000b75095fab5cc6b3e8e5d4ef60d8 | usingnamespace/models/Domain.py | usingnamespace/models/Domain.py | # File: Domain.py
# Author: Bert JW Regeer <bertjw@regeer.org>
# Created: 2013-09-02
from meta import Base
from sqlalchemy import (
Boolean,
Column,
ForeignKey,
Table,
Integer,
Unicode,
PrimaryKeyConstraint,
UniqueConstraint,
)
class Domain(Base... | # File: Domain.py
# Author: Bert JW Regeer <bertjw@regeer.org>
# Created: 2013-09-02
from meta import Base
from sqlalchemy import (
Boolean,
Column,
ForeignKey,
Integer,
PrimaryKeyConstraint,
String,
Table,
Unicode,
UniqueConstraint,
)
c... | Change from unicode to string for domain | Change from unicode to string for domain
DNS entries won't contain unicode characters, and by default are ASCII.
| Python | isc | usingnamespace/usingnamespace | ---
+++
@@ -8,17 +8,18 @@
Boolean,
Column,
ForeignKey,
+ Integer,
+ PrimaryKeyConstraint,
+ String,
Table,
- Integer,
Unicode,
- PrimaryKeyConstraint,
UniqueConstraint,
)
class Domain(Base):
__table__ = Table('do... |
f1d076b4e4fc834a4336141025387862b4decc5b | utest/libdoc/test_libdoc_api.py | utest/libdoc/test_libdoc_api.py | from io import StringIO
import sys
import tempfile
import unittest
from robot import libdoc
from robot.utils.asserts import assert_equal
class TestLibdoc(unittest.TestCase):
def setUp(self):
sys.stdout = StringIO()
def test_html(self):
output = tempfile.mkstemp(suffix='.html')[1]
li... | import sys
import tempfile
import unittest
from robot import libdoc
from robot.utils.asserts import assert_equal
from robot.utils import StringIO
class TestLibdoc(unittest.TestCase):
def setUp(self):
sys.stdout = StringIO()
def test_html(self):
output = tempfile.mkstemp(suffix='.html')[1]
... | Fix Libdoc API unit tests on Python 2 | Fix Libdoc API unit tests on Python 2
| Python | apache-2.0 | robotframework/robotframework,robotframework/robotframework,HelioGuilherme66/robotframework,HelioGuilherme66/robotframework,robotframework/robotframework,HelioGuilherme66/robotframework | ---
+++
@@ -1,10 +1,10 @@
-from io import StringIO
import sys
import tempfile
import unittest
from robot import libdoc
from robot.utils.asserts import assert_equal
+from robot.utils import StringIO
class TestLibdoc(unittest.TestCase): |
1a361002b974ee9fc4f728339ea6f4d63eeb9bf1 | binary.py | binary.py | #!/usr/bin/env python
# coding=utf-8
"""
Balanced ternary binary encoding
============
Tools for encoding balanced ternary data into binary formats and back again.
The encoded scheme used here uses 8-bit segments to represent 5-trit segments.
Each 5-trit segment is mapped to an 8-bit binary value which corresponds to... | #!/usr/bin/env python
# coding=utf-8
"""
Balanced ternary binary encoding
============
Tools for encoding balanced ternary data into binary formats and back again.
The encoded scheme used here uses 8-bit segments to represent 5-trit segments.
Each 5-trit segment is mapped to an 8-bit binary value which corresponds to... | Use 'range' rather than 'xrange' for Python 3 compatibility. | Use 'range' rather than 'xrange' for Python 3 compatibility.
| Python | bsd-2-clause | direvus/btern | ---
+++
@@ -28,7 +28,7 @@
def encode(source):
result = b''
- for i in xrange(0, len(source), 5):
+ for i in range(0, len(source), 5):
value = integer.UInt(source[i:i+5], 5)
result += chr(value)
return result
@@ -36,7 +36,7 @@
def decode(binary):
trits = trit.Trits('')
- ... |
b52e32cba060e5a51f2f012d3cad7cddd7dde3cc | lc0345_reverse_vowels_of_a_string.py | lc0345_reverse_vowels_of_a_string.py | """Leetcode 345. Reverse Vowels of a String
Easy
URL: https://leetcode.com/problems/reverse-vowels-of-a-string/
Write a function that takes a string as input and reverse only the vowels of
a string.
Example 1:
Input: "hello"
Output: "holle"
Example 2:
Input: "leetcode"
Output: "leotcede"
Note:
The vowels does not ... | """Leetcode 345. Reverse Vowels of a String
Easy
URL: https://leetcode.com/problems/reverse-vowels-of-a-string/
Write a function that takes a string as input and reverse only the vowels of
a string.
Example 1:
Input: "hello"
Output: "holle"
Example 2:
Input: "leetcode"
Output: "leotcede"
Note:
The vowels does not ... | Complete reversed vowel pos sol | Complete reversed vowel pos sol
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | ---
+++
@@ -18,17 +18,57 @@
The vowels does not include the letter "y".
"""
-class Solution(object):
+class SolutionReversedVowelPosDict(object):
def reverseVowels(self, s):
"""
:type s: str
:rtype: str
+
+ Time complexity: O(n).
+ Space complexity: O(n).
"""... |
bda9bc3574b14ead6f51e1fb0f6864e07ccefd88 | Orange/classification/random_forest.py | Orange/classification/random_forest.py | # import numpy
from sklearn.ensemble import RandomForestClassifier as RandomForest
from sklearn.preprocessing import Imputer
from numpy import isnan
import Orange.data
import Orange.classification
def replace_nan(X, imp_model):
# Default scikit Imputer
# Use Orange imputer when implemented
if i... | import numbers
from sklearn.ensemble import RandomForestClassifier as RandomForest
from sklearn.preprocessing import Imputer
from numpy import isnan
import Orange.data
import Orange.classification
def replace_nan(X, imp_model):
# Default scikit Imputer
# Use Orange imputer when implemented
if isnan(X).s... | Fix an error when number of predictor columns is less than max_features. | Fix an error when number of predictor columns is less than max_features.
| Python | bsd-2-clause | marinkaz/orange3,marinkaz/orange3,kwikadi/orange3,marinkaz/orange3,qPCR4vir/orange3,kwikadi/orange3,cheral/orange3,kwikadi/orange3,marinkaz/orange3,cheral/orange3,qPCR4vir/orange3,qPCR4vir/orange3,qPCR4vir/orange3,kwikadi/orange3,cheral/orange3,marinkaz/orange3,qusp/orange3,cheral/orange3,qusp/orange3,kwikadi/orange3,q... | ---
+++
@@ -1,18 +1,21 @@
-# import numpy
+import numbers
+
from sklearn.ensemble import RandomForestClassifier as RandomForest
from sklearn.preprocessing import Imputer
from numpy import isnan
+
import Orange.data
import Orange.classification
+
def replace_nan(X, imp_model):
- # Default scikit Imputer... |
83e0394dc837e55a3ed544e54f6e84954f9311b0 | onepercentclub/settings/travis.py | onepercentclub/settings/travis.py | # TODO: not sure why but we need to include the SECRET_KEY here - importing from the test_runner file doesn't work
SECRET_KEY = 'hbqnTEq+m7Tk61bvRV/TLANr3i0WZ6hgBXDh3aYpSU8m+E1iCtlU3Q=='
from .test_runner import *
# Use firefox for running tests on Travis
SELENIUM_WEBDRIVER = 'firefox'
ROOT_URLCONF = 'onepercentclu... | # TODO: not sure why but we need to include the SECRET_KEY here - importing from the test_runner file doesn't work
SECRET_KEY = 'hbqnTEq+m7Tk61bvRV/TLANr3i0WZ6hgBXDh3aYpSU8m+E1iCtlU3Q=='
from .test_runner import *
# Use firefox for running tests on Travis
SELENIUM_WEBDRIVER = 'remote'
SELENIUM_TESTS = False
ROOT_UR... | Disable front end tests on Travis for now. | Disable front end tests on Travis for now.
| Python | bsd-3-clause | onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site | ---
+++
@@ -5,6 +5,7 @@
# Use firefox for running tests on Travis
-SELENIUM_WEBDRIVER = 'firefox'
+SELENIUM_WEBDRIVER = 'remote'
+SELENIUM_TESTS = False
ROOT_URLCONF = 'onepercentclub.urls' |
124aeb597db4f4a0aa1c6d6117fe8d2facb4aacd | linkatos/activities.py | linkatos/activities.py | import time
import linkatos.parser as parser
import linkatos.printer as printer
import linkatos.firebase as fb
import linkatos.reaction as react
def is_empty(events):
return ((events is None) or (len(events) == 0))
def is_url(url_message):
return url_message['type'] == 'url'
def event_consumer(expecting_u... | import time
import linkatos.parser as parser
import linkatos.printer as printer
import linkatos.firebase as fb
import linkatos.reaction as react
def is_empty(events):
return ((events is None) or (len(events) == 0))
def is_url(url_message):
return url_message['type'] == 'url'
def event_consumer(expecting_u... | Delete condition of type in event as it should always be true | feat: Delete condition of type in event as it should always be true
| Python | mit | iwi/linkatos,iwi/linkatos | ---
+++
@@ -26,23 +26,22 @@
for event in events:
print(event)
print('expecting_url: ', expecting_url)
- print('expecting_reaction: ', expecting_reaction)
- if 'type' in event:
- if expecting_url and event['type'] == 'message':
- parsed_url_message = parse... |
d830e9ebe103b94fd214477cb83ad824fd27e70f | mcbench/settings.py | mcbench/settings.py | import os
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DB_PATH = os.path.join(root, 'mcbench.sqlite')
DATA_ROOT = os.path.expanduser('~/mcbench-benchmarks')
SECRET_KEY = ''
try:
from local_settings import *
except ImportError:
pass
| import os
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DB_PATH = os.path.join(root, 'mcbench.sqlite')
DATA_ROOT = os.path.expanduser('~/mcbench-benchmarks')
SECRET_KEY = 'dummy'
try:
from local_settings import *
except ImportError:
pass
| Add dummy SECRET_KEY for development (and Travis). | Add dummy SECRET_KEY for development (and Travis).
| Python | mit | isbadawi/mcbench,isbadawi/mcbench | ---
+++
@@ -3,7 +3,7 @@
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DB_PATH = os.path.join(root, 'mcbench.sqlite')
DATA_ROOT = os.path.expanduser('~/mcbench-benchmarks')
-SECRET_KEY = ''
+SECRET_KEY = 'dummy'
try:
from local_settings import * |
7cb7a37206d4b729dc8708e3152f5423ddfa1b8a | wagtail/admin/forms/choosers.py | wagtail/admin/forms/choosers.py | from django import forms
from django.core import validators
from django.forms.widgets import TextInput
from django.utils.translation import ugettext_lazy
class URLOrAbsolutePathValidator(validators.URLValidator):
@staticmethod
def is_absolute_path(value):
return value.startswith('/')
def __call__... | from django import forms
from django.core import validators
from django.forms.widgets import TextInput
class URLOrAbsolutePathValidator(validators.URLValidator):
@staticmethod
def is_absolute_path(value):
return value.startswith('/')
def __call__(self, value):
if URLOrAbsolutePathValidato... | Remove redundant ugettext_lazy from non-text labels | Remove redundant ugettext_lazy from non-text labels
| Python | bsd-3-clause | thenewguy/wagtail,FlipperPA/wagtail,jnns/wagtail,mixxorz/wagtail,kaedroho/wagtail,jnns/wagtail,thenewguy/wagtail,torchbox/wagtail,timorieber/wagtail,takeflight/wagtail,thenewguy/wagtail,gasman/wagtail,kaedroho/wagtail,zerolab/wagtail,kaedroho/wagtail,kaedroho/wagtail,torchbox/wagtail,jnns/wagtail,wagtail/wagtail,mixxor... | ---
+++
@@ -1,7 +1,6 @@
from django import forms
from django.core import validators
from django.forms.widgets import TextInput
-from django.utils.translation import ugettext_lazy
class URLOrAbsolutePathValidator(validators.URLValidator):
@@ -27,12 +26,12 @@
class ExternalLinkChooserForm(forms.Form):
- ... |
874ead2ed9de86eea20c4a67ce7b53cb2766c09e | erpnext/patches/v5_0/link_warehouse_with_account.py | erpnext/patches/v5_0/link_warehouse_with_account.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql("""update tabAccount set warehouse=master_name
where ifnull(account_type, '') = 'Warehouse' and ifnull(ma... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
if "master_name" in frappe.db.get_table_columns("Account"):
frappe.db.sql("""update tabAccount set warehouse=master_na... | Update warehouse as per master_name if master_name exists | Update warehouse as per master_name if master_name exists
| Python | agpl-3.0 | indictranstech/fbd_erpnext,gangadharkadam/saloon_erp_install,mbauskar/helpdesk-erpnext,gmarke/erpnext,Tejal011089/paypal_erpnext,Tejal011089/trufil-erpnext,treejames/erpnext,indictranstech/reciphergroup-erpnext,pombredanne/erpnext,gangadharkadam/saloon_erp,gangadharkadam/vlinkerp,hatwar/buyback-erpnext,shft117/SteckerA... | ---
+++
@@ -5,5 +5,6 @@
import frappe
def execute():
- frappe.db.sql("""update tabAccount set warehouse=master_name
- where ifnull(account_type, '') = 'Warehouse' and ifnull(master_name, '') != ''""")
+ if "master_name" in frappe.db.get_table_columns("Account"):
+ frappe.db.sql("""update tabAccount set warehou... |
c8392e6c0210c9b308927c807c44449ebd31694e | enthought/traits/ui/editors/date_editor.py | enthought/traits/ui/editors/date_editor.py | #------------------------------------------------------------------------------
#
# Copyright (c) 2008, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions... | #------------------------------------------------------------------------------
#
# Copyright (c) 2008, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions... | Add multi_select in the DateEditor params for Custom editors. | Add multi_select in the DateEditor params for Custom editors.
| Python | bsd-3-clause | burnpanck/traits,burnpanck/traits | ---
+++
@@ -20,6 +20,7 @@
import datetime
from enthought.traits.traits import Property
+from enthought.traits.trait_types import Bool
from enthought.traits.ui.editor_factory import EditorFactory
from enthought.traits.ui.toolkit import toolkit_object
@@ -33,8 +34,9 @@
#---------------------------------... |
d9d22ea370f794681e5a3e6e7683a83f4bbe356a | feature_extraction/measurements/texture_haralick.py | feature_extraction/measurements/texture_haralick.py | from . import Measurement
import feature_extraction.util.cleanup as cleanup
from skimage.morphology import binary_erosion, disk
class HaralickTexture(Measurement):
default_options = {
'clip_cell_borders': True,
'erode_cell': False,
'erode_cell_amount': False,
}
def __init__(self, options=None):
super(Harali... | from . import Measurement
import feature_extraction.util.cleanup as cleanup
from skimage.morphology import binary_erosion, disk
class HaralickTexture(Measurement):
default_options = {
'clip_cell_borders': True,
'erode_cell': False,
'erode_cell_amount': False,
}
def __init__(self, options=None):
super(Harali... | Fix the image masking in HaralickTexture | Fix the image masking in HaralickTexture
| Python | apache-2.0 | widoptimization-willett/feature-extraction | ---
+++
@@ -22,7 +22,9 @@
mask = binary_erosion(cleanup.cell_boundary_mask(), disk(self.options.erode_cell_amount))
# mask the image
- image = image[mask]
+ # TODO(liam): we can probably use scipy.MaskedArray to get a speedup here
+ image = image.copy()
+ image[~mask] = 0 # set everything *outside*... |
edfbeabb802e64527094d46680f994a44ed7f0bd | froide_campaign/providers/amenity_local.py | froide_campaign/providers/amenity_local.py | from django.contrib.gis.measure import D
from django.contrib.gis.db.models.functions import Distance
from froide.publicbody.models import PublicBody
from .amenity import AmenityProvider
class AmenityLocalProvider(AmenityProvider):
'''
Like Amenity provider but tries to find the public body
for the amen... | from django.contrib.gis.measure import D
from django.contrib.gis.db.models.functions import Distance
from froide.publicbody.models import PublicBody
from .amenity import AmenityProvider
class AmenityLocalProvider(AmenityProvider):
'''
Like Amenity provider but tries to find the public body
for the amen... | Select popular pbs first instead of only closest | Select popular pbs first instead of only closest | Python | mit | okfde/froide-campaign,okfde/froide-campaign,okfde/froide-campaign | ---
+++
@@ -15,7 +15,7 @@
NEARBY_RADIUS = 200
def _get_publicbody(self, amenity):
- nearby_pbs = PublicBody.objects.filter(
+ nearby_popular_pbs = PublicBody.objects.filter(
geo__isnull=False
).filter(
geo__dwithin=(amenity.geo, self.NEARBY_RADIUS)
@@ -23,9... |
39ea591073339ad86f77c22f7b29436efcf01a0e | egpackager/datamanager.py | egpackager/datamanager.py | import logging
from collections import OrderedDict
from egpackager.datasources import GspreadDataSource, RasterDataSource
class DataManager(object):
def __init__(self, debug=False):
# Set up logging
if debug:
logging.basicConfig(level=logging.DEBUG)
else:
logging.... | import logging
from collections import OrderedDict
from egpackager.datasources import GspreadDataSource, RasterDataSource
class DataManager(object):
def __init__(self, debug=False):
# Set up logging
if debug:
logging.basicConfig(level=logging.DEBUG)
else:
logging.... | Add metadata and resource distinction in DataManager | Add metadata and resource distinction in DataManager
| Python | mit | VUEG/egpackager | ---
+++
@@ -25,14 +25,29 @@
# Remove keyword argument 'type' as it us not needed anymore
del kwargs['type']
self.logger.debug('Adding Google Sheets data source')
- self._data[kwargs['uri']] = GspreadDataSource(*args, **kwargs)
+ self._data['metadata'] = Gsp... |
e0d2ce09475e3ae07e2740cbf0e342f68c1564a8 | gn/standalone/toolchain/linux_find_llvm.py | gn/standalone/toolchain/linux_find_llvm.py | # Copyright (C) 2017 The Android Open Source Project
#
# 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 ... | # Copyright (C) 2017 The Android Open Source Project
#
# 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 ... | Fix issue with finding llvm when using python3 | gn: Fix issue with finding llvm when using python3
With python3, subprocess output is a byte sequence. This needs to be
decoded to string so that the string functions work. Fix it so we can
find LLVM when building perfetto.
Also fix 'print' operator which is a function in python3.
Bug: 147789115
Signed-off-by: Joel... | Python | apache-2.0 | google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto | ---
+++
@@ -22,7 +22,7 @@
for clang in ('clang', 'clang-3.8', 'clang-3.5'):
if subprocess.call(['which', clang], stdout=devnull, stderr=devnull) != 0:
continue
- res = subprocess.check_output([clang, '-print-search-dirs'])
+ res = subprocess.check_output([clang, '-print-search-dirs']).decode("utf... |
d3febefc0927968ca8e5040c74478a81aef31692 | ml_adv_logistic_reg/python_code/advanced_log_reg.py | ml_adv_logistic_reg/python_code/advanced_log_reg.py | from get_data_from_source import GetDataFromSource
from regularized_log_reg import RegularizedLogReg
import matplotlib.pyplot as plt
class AdvancedLogReg(RegularizedLogReg):
def test_something(self):
print self.m, self.n | from get_data_from_source import GetDataFromSource
from regularized_log_reg import RegularizedLogReg
import matplotlib.pyplot as plt
class AdvancedLogReg(RegularizedLogReg):
def test_something(self):
print self.m, self.n
print self.X
# def oneVsAll(self, theta_len, lambda_val): | Add preprocessing steps for mat input | Add preprocessing steps for mat input
| Python | mit | pmb311/Machine_Learning,pmb311/Machine_Learning,pmb311/Machine_Learning,pmb311/Machine_Learning | ---
+++
@@ -5,3 +5,6 @@
class AdvancedLogReg(RegularizedLogReg):
def test_something(self):
print self.m, self.n
+ print self.X
+
+ # def oneVsAll(self, theta_len, lambda_val): |
db15dc066e238022dcf23559d882a29fbc42a90b | mxfield/validators.py | mxfield/validators.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from django.core import validators
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
@deconstructible
class CURPValidator(validators.RegexValidator):
regex = re.compile(r'^([A-Z][A,E,I,O,U,X][A-Z]{2}[0... | Add class validator for CURP field | Add class validator for CURP field
| Python | mit | krescruz/django-mxfield | ---
+++
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from django.core import validators
+from django.utils.deconstruct import deconstructible
+from django.utils.translation import ugettext_lazy as _
+
+@deconstructible
+class CURPValidator(validators.RegexValidator):
+ regex = re.c... | |
ab9ec5d7b2e8675cb9e7593a8adc0a0e9f0955bb | IPython/html/widgets/__init__.py | IPython/html/widgets/__init__.py | from .widget import Widget, DOMWidget, CallbackDispatcher, register
from .widget_bool import Checkbox, ToggleButton
from .widget_button import Button
from .widget_box import Box, Popup, FlexBox, HBox, VBox
from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress, FloatRangeSlider
from .widget_... | from .widget import Widget, DOMWidget, CallbackDispatcher, register
from .widget_bool import Checkbox, ToggleButton
from .widget_button import Button
from .widget_box import Box, Popup, FlexBox, HBox, VBox
from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress, FloatRangeSlider
from .widget_... | Make the widget error message shorter and more understandable. | Make the widget error message shorter and more understandable.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -26,4 +26,4 @@
# Warn on import
from warnings import warn
-warn("""The widget API is still considered experimental and may change in the future.""", FutureWarning, stacklevel=2)
+warn("IPython widgets are experimental and may change in the future.", FutureWarning, stacklevel=2) |
37f365449089e45dc68f32ff7dbd6db781ad3b9f | LiSE/LiSE/tests/test_examples.py | LiSE/LiSE/tests/test_examples.py | from LiSE.examples import college, kobold, polygons, sickle
def test_college(engy):
college.install(engy)
engy.turn = 10 # wake up the students
engy.next_turn()
def test_kobold(engy):
kobold.inittest(engy, shrubberies=20, kobold_sprint_chance=.9)
for i in range(10):
engy.next_turn()
d... | from LiSE.examples import college, kobold, polygons, sickle
def test_college(engy):
college.install(engy)
engy.turn = 10 # wake up the students
engy.next_turn()
def test_kobold(engy):
kobold.inittest(engy, shrubberies=20, kobold_sprint_chance=.9)
for i in range(10):
engy.next_turn()
d... | Use more turns in test_sickle | Use more turns in test_sickle
The weird bugs only showed up late
| Python | agpl-3.0 | LogicalDash/LiSE,LogicalDash/LiSE | ---
+++
@@ -21,5 +21,5 @@
def test_sickle(engy):
sickle.install(engy)
- for i in range(10):
+ for i in range(100):
engy.next_turn() |
da6406d1c419f18bd128af4d2d4e2578142cd783 | zou/migrations/versions/5a291251823c_add_max_retake_parameter.py | zou/migrations/versions/5a291251823c_add_max_retake_parameter.py | """add max retake parameter
Revision ID: 5a291251823c
Revises: 4095103c7d01
Create Date: 2022-06-29 10:56:13.556495
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '5a291251823c'
down_revision = '4095103c7d01'
branch_labels = None
depend... | """add max retake parameter
Revision ID: 5a291251823c
Revises: 4095103c7d01
Create Date: 2022-06-29 10:56:13.556495
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '5a291251823c'
down_revision = '4095103c7d01'
branch_labels = None
depend... | Fix max retake migration file | [db] Fix max retake migration file
| Python | agpl-3.0 | cgwire/zou | ---
+++
@@ -20,16 +20,10 @@
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('project', sa.Column('max_retakes', sa.Integer(), nullable=True))
- op.drop_index('ix_task_status_is_default', table_name='task_status')
- op.create_index(op.f('ix_task_status_is_def... |
4d1a7b48b450ebcf06c90dd618622b0ddafcba03 | xorgauth/accounts/password_validators.py | xorgauth/accounts/password_validators.py | # -*- coding: utf-8 -*-
# Copyright (c) Polytechnique.org
# This code is distributed under the Affero General Public License version 3
import crypt
import sys
from django.core.exceptions import ObjectDoesNotExist
from django.utils.crypto import get_random_string
from . import models
class GoogleAppsPasswordValidato... | # -*- coding: utf-8 -*-
# Copyright (c) Polytechnique.org
# This code is distributed under the Affero General Public License version 3
import crypt
import sys
from django.core.exceptions import ObjectDoesNotExist
from django.utils.crypto import get_random_string
from . import models
class GoogleAppsPasswordValidato... | Add missing validate method to GoogleAppsPasswordValidator | Add missing validate method to GoogleAppsPasswordValidator
Django complains when updating the password:
'GoogleAppsPasswordValidator' object has no attribute 'validate'
| Python | agpl-3.0 | Polytechnique-org/xorgauth,Polytechnique-org/xorgauth | ---
+++
@@ -13,6 +13,9 @@
class GoogleAppsPasswordValidator(object):
"""Update the Google Apps password when a user changes her password"""
+ def validate(self, password, user=None):
+ return
+
def password_changed(self, raw_password, user):
# Hash the password in a way compatible with... |
d96dbe9f5688e469f34c7428569eda7d2c86f3d7 | tests/test_err.py | tests/test_err.py | # Testing use of cpl_errs
import pytest
import rasterio
from rasterio.errors import RasterioIOError
def test_io_error(tmpdir):
with pytest.raises(RasterioIOError) as exc_info:
rasterio.open(str(tmpdir.join('foo.tif')))
msg = exc_info.value.message
assert msg.startswith("'{0}'".format(tmpdir.join... | # Testing use of cpl_errs
import pytest
import rasterio
from rasterio.errors import RasterioIOError
def test_io_error(tmpdir):
with pytest.raises(RasterioIOError) as exc_info:
rasterio.open(str(tmpdir.join('foo.tif')))
msg = str(exc_info.value)
assert msg.startswith("'{0}'".format(tmpdir.join('f... | Test str repr of exception | Test str repr of exception
| Python | bsd-3-clause | kapadia/rasterio,brendan-ward/rasterio,brendan-ward/rasterio,brendan-ward/rasterio,kapadia/rasterio,kapadia/rasterio | ---
+++
@@ -9,7 +9,7 @@
def test_io_error(tmpdir):
with pytest.raises(RasterioIOError) as exc_info:
rasterio.open(str(tmpdir.join('foo.tif')))
- msg = exc_info.value.message
+ msg = str(exc_info.value)
assert msg.startswith("'{0}'".format(tmpdir.join('foo.tif')))
assert ("does not exist... |
4b30bbcde1ae9cdb3b8fda242e32d44025ef1e0a | articles/migrations/0010_create_indepth_page.py | articles/migrations/0010_create_indepth_page.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
from django.db import migrations
def create_indepth_page(apps, schema_editor):
Page = apps.get_model("wagtailcore", "Page")
InDepthListPage = apps.get_model("articles", "InDepthListPage")
home_pag... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
from django.contrib.contenttypes.management import update_contenttypes
from django.db import migrations
def create_indepth_page(apps, schema_editor):
update_contenttypes(apps.app_configs['articles'], inte... | Update the contenttypes before trying to access them. | Update the contenttypes before trying to access them.
| Python | mit | OpenCanada/website,albertoconnor/website,albertoconnor/website,OpenCanada/website,albertoconnor/website,OpenCanada/website,albertoconnor/website,OpenCanada/website | ---
+++
@@ -2,21 +2,18 @@
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
+from django.contrib.contenttypes.management import update_contenttypes
from django.db import migrations
def create_indepth_page(apps, schema_editor):
+ update_contenttypes(apps.app_configs['art... |
c7550b21b8424bb11ad31b9755d910690e386b40 | salt/_beacons/default_network_interface_settings.py | salt/_beacons/default_network_interface_settings.py | # -*- coding: utf-8 -*-
'''
Beacon to monitor default network adapter setting changes on Linux
'''
from salt.beacons import network_settings
import logging
log = logging.getLogger(__name__)
__virtual_name__ = 'default_network_interface_settings'
def __virtual__():
if network_settings.__virtual__():
ret... | # -*- coding: utf-8 -*-
'''
Beacon to monitor default network adapter setting changes on Linux
'''
from salt.beacons import network_settings
import logging
log = logging.getLogger(__name__)
__virtual_name__ = 'default_network_interface_settings'
def __virtual__():
if network_settings.__virtual__():
ret... | Adjust network_settings config format for salt 2018.3.0. | Adjust network_settings config format for salt 2018.3.0.
Before this release the format did not use the 'interfaces' key.
| Python | apache-2.0 | ereslibre/salt,ereslibre/salt,kubic-project/salt,kubic-project/salt,ereslibre/salt,kubic-project/salt | ---
+++
@@ -42,7 +42,12 @@
promiscuity:
onvalue: 1
'''
-
default_interface = __salt__['network.default_route']()[0]['interface']
- return network_settings.beacon({default_interface: config['watch']})
+ config = {default_interface: config['watch']}
+
+ if __salt__['... |
a3ebec3a7d5b47b008eb5c8bee51ad21188a8adf | testsuite/node_test.py | testsuite/node_test.py | #!/usr/bin/env python2
from testlib import *
set_port("80")
set_server("us.bittoll.com")
def test_page_error():
r = apicall("nonexistant", "hi")
assert "error" in r
assert r["error"] != ""
assert int(r["error_code"]) == 0
def test_login(login):
info = login
assert 'username' in info
asser... | #!/usr/bin/env python2
from testlib import *
set_port("80")
set_server("us.bittoll.com")
def test_page_error():
r = apicall("nonexistant", "hi")
assert "error" in r
assert r["error"] != ""
assert int(r["error_code"]) == 1
def test_login(login):
info = login
assert 'username' in info
asser... | Fix error code on non existent page | Fix error code on non existent page
| Python | mit | c00w/BitToll,c00w/BitToll,c00w/BitToll,c00w/BitToll | ---
+++
@@ -8,7 +8,7 @@
r = apicall("nonexistant", "hi")
assert "error" in r
assert r["error"] != ""
- assert int(r["error_code"]) == 0
+ assert int(r["error_code"]) == 1
def test_login(login):
info = login |
90c816bd40a4971dda8bd96d865efb1dee131566 | files/install_workflow.py | files/install_workflow.py | #!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--workflow_path", help='Path to workflow file... | #!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--workflow_path", help='Path to workflow file... | Make sure the opened workflow file gets closed after it's been loaded | Make sure the opened workflow file gets closed after it's been loaded
| Python | mit | galaxyproject/ansible-galaxy-tools,galaxyproject/ansible-tools,nuwang/ansible-galaxy-tools,anmoljh/ansible-galaxy-tools | ---
+++
@@ -22,7 +22,8 @@
gi = galaxy.GalaxyInstance(url=args.galaxy_url, key=args.api_key)
- import_uuid = json.load(open(args.workflow_path, 'r')).get('uuid')
+ with open(args.workflow_path, 'r') as wf_file:
+ import_uuid = json.load(wf_file).get('uuid')
existing_uuids = [d.get('latest_wo... |
c740a0118035023a3770334f35bba2cf4506dbdf | firecares/settings/production.py | firecares/settings/production.py | from firecares.settings.base import *
INSTALLED_APPS = (
'django_statsd',
) + INSTALLED_APPS
STATSD_HOST = 'stats.garnertb.com'
STATSD_PREFIX = 'firecares'
STATSD_PATCHES = [
'django_statsd.patches.db',
'django_statsd.patches.cache',
]
MIDDLEWARE_CLASSES = (
'django_statsd.middleware.GraphiteRequest... | from firecares.settings.base import *
INSTALLED_APPS = (
'django_statsd',
) + INSTALLED_APPS
STATSD_HOST = 'stats.garnertb.com'
STATSD_PREFIX = 'firecares'
STATSD_PATCHES = [
'django_statsd.patches.db',
'django_statsd.patches.cache',
]
MIDDLEWARE_CLASSES = (
'django_statsd.middleware.GraphiteRequest... | Disable query string auth for django compressor. | Disable query string auth for django compressor.
| Python | mit | acengic/firecares,acengic/firecares,acengic/firecares,acengic/firecares | ---
+++
@@ -37,6 +37,7 @@
STATICFILES_STORAGE = "firecares.utils.CachedS3BotoStorage"
STATIC_URL = COMPRESS_URL
DEBUG = False
+AWS_QUERYSTRING_AUTH = False
try:
from local_settings import * # noqa |
135ac2fa3aa978328ba72db6ca84920f3da0f39a | furikura/desktop/unity.py | furikura/desktop/unity.py | import gi
import time
gi.require_version('Unity', '7.0')
from gi.repository import Unity, GObject
def update_counter(count):
launcher = Unity.LauncherEntry.get_for_desktop_id("furikura.desktop")
launcher.set_property("count", count)
launcher.set_property("count_visible", True)
| import gi
gi.require_version('Unity', '7.0')
from gi.repository import Unity
def update_counter(count):
launcher = Unity.LauncherEntry.get_for_desktop_id("furikura.desktop")
launcher.set_property("count", count)
launcher.set_property("count_visible", True)
| Remove unnecessary imports for Unity module | Remove unnecessary imports for Unity module
| Python | mit | benjamindean/furi-kura,benjamindean/furi-kura | ---
+++
@@ -1,14 +1,10 @@
import gi
-import time
gi.require_version('Unity', '7.0')
-from gi.repository import Unity, GObject
+from gi.repository import Unity
def update_counter(count):
launcher = Unity.LauncherEntry.get_for_desktop_id("furikura.desktop")
launcher.set_property("count", count)
... |
2559a1bd8cb8c41df165022074d1b123d4a0345a | hecuba_py/tests/storage_api_tests.py | hecuba_py/tests/storage_api_tests.py | import unittest
from storage.api import getByID
from hecuba.hdict import StorageDict
class ApiTestSDict(StorageDict):
'''
@TypeSpec <<key:int>, value:double>
'''
class StorageApi_Tests(unittest.TestCase):
def setUp(self):
pass
def class_type_test(self):
base_dict = ApiTestSDict(... | import unittest
from storage.api import getByID
from hecuba import config, StorageDict
class ApiTestSDict(StorageDict):
'''
@TypeSpec <<key:int>, value:double>
'''
class StorageApi_Tests(unittest.TestCase):
def setUp(self):
config.reset(mock_cassandra=False)
def class_type_test(self):
... | Reset Hecuba config when setUp a test | Reset Hecuba config when setUp a test
| Python | apache-2.0 | bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba | ---
+++
@@ -1,7 +1,7 @@
import unittest
from storage.api import getByID
-from hecuba.hdict import StorageDict
+from hecuba import config, StorageDict
class ApiTestSDict(StorageDict):
@@ -11,7 +11,7 @@
class StorageApi_Tests(unittest.TestCase):
def setUp(self):
- pass
+ config.reset(mock... |
f6ce7485f18d3c5299b64a9b10af08f5da1c2335 | infrastructure/control/osimctrl/src/start-opensim.py | infrastructure/control/osimctrl/src/start-opensim.py | #!/usr/bin/python
import os.path
import re
import subprocess
import sys
### CONFIGURE THESE PATHS ###
binaryPath = "/home/opensim/opensim/opensim-current/bin"
pidPath = "/tmp/OpenSim.pid"
### END OF CONFIG ###
if os.path.exists(pidPath):
print >> sys.stderr, "ERROR: OpenSim PID file %s still present. Assuming Ope... | #!/usr/bin/python
import os.path
import re
import subprocess
import sys
### CONFIGURE THESE PATHS ###
binaryPath = "/home/opensim/opensim/opensim-current/bin"
pidPath = "/tmp/OpenSim.pid"
### END OF CONFIG ###
### FUNCTIONS ###
def execCmd(cmd):
print "Executing command: %s" % cmd
return subprocess.check_out... | Create execCmd function and use | Create execCmd function and use
| Python | bsd-3-clause | justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools | ---
+++
@@ -10,6 +10,12 @@
pidPath = "/tmp/OpenSim.pid"
### END OF CONFIG ###
+### FUNCTIONS ###
+def execCmd(cmd):
+ print "Executing command: %s" % cmd
+ return subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
+
+### SCRIPT ###
if os.path.exists(pidPath):
print >> sys.stderr,... |
ee401cae95fe5244314a8cb032623779ac7e4842 | aragog/routing/decorator.py | aragog/routing/decorator.py | #! /usr/bin/env python
"""
Aragog Router Decorator
-----------------------
Convert any function into a WSGI endpoint with a simple decorator.
"""
from aragog.wsgi import get_url
from aragog.routing.client_error import HTTP404
class Router(object):
"""
Router holds the mapping of routes to callables.
"""... | #! /usr/bin/env python
"""
Aragog Router Decorator
-----------------------
Convert any function into a WSGI endpoint with a simple decorator.
"""
from aragog.wsgi import get_url
from aragog.routing.client_error import HTTP404
class Router(object):
"""
Router holds the mapping of routes to callables.
"""... | Fix call to HTTP404 now it is a function. | Fix call to HTTP404 now it is a function.
| Python | apache-2.0 | bramwelt/aragog | ---
+++
@@ -25,7 +25,7 @@
"""
Get a WSGI request, and pass it on to the correct callable.
"""
- routing = self.mapping.get(get_url(environ), HTTP404())
+ routing = self.mapping.get(get_url(environ), HTTP404)
return routing(environ, start_response)
def add_route... |
1ef76b4f4395c9b5e3c2338822947999d5581013 | labs/lab-3/ex-3-2.events.py | labs/lab-3/ex-3-2.events.py | #!/usr/bin/env python
#
# Copyright 2016 BMC Software, Inc.
#
# 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 applicabl... | #!/usr/bin/env python
#
# Copyright 2016 BMC Software, Inc.
#
# 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 applicabl... | Add type field to source | Add type field to source
| Python | apache-2.0 | jdgwartney/tsi-lab,boundary/tsi-lab,jdgwartney/tsi-lab,boundary/tsi-lab,boundary/tsi-lab,boundary/tsi-lab,jdgwartney/tsi-lab,jdgwartney/tsi-lab | ---
+++
@@ -18,5 +18,5 @@
api = tspapi.API()
-source = tspapi.Source(ref='myhost')
+source = tspapi.Source(ref='myhost', _type='host')
api.event_create(title="bar", fingerprint_fields=['@title'], source=source) |
3aeae9c3cde1976b43667d0a42039b8dd9bf52d9 | bitHopper/Website/Worker_Page.py | bitHopper/Website/Worker_Page.py | from bitHopper.Website import app, flask
import btcnet_info
import bitHopper.Configuration.Workers
@app.route("/worker", methods=['POST', 'GET'])
def worker():
#Check if this is a form submission
handle_worker_post(flask.request.form)
#Get a list of currently configured workers
pools_workers ... | from bitHopper.Website import app, flask
import btcnet_info
import bitHopper.Configuration.Workers
@app.route("/worker", methods=['POST', 'GET'])
def worker():
#Check if this is a form submission
handle_worker_post(flask.request.form)
#Get a list of currently configured workers
pools_workers ... | Add some debugging for the worker generation | Add some debugging for the worker generation
| Python | mit | c00w/bitHopper,c00w/bitHopper | ---
+++
@@ -11,7 +11,8 @@
#Get a list of currently configured workers
pools_workers = {}
for pool in btcnet_info.get_pools():
- if not pool.name:
+ if pool.name is None:
+ logging.debug('Ignoring %s', pool)
continue
pools_workers[pool.name] = bitHopper.Con... |
d5747c8b0f1a82afecf68aadc6b42c77e586493c | tools/perf/benchmarks/rasterize_and_record_micro.py | tools/perf/benchmarks/rasterize_and_record_micro.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import rasterize_and_record_micro
from telemetry import test
@test.Disabled('android', 'linux')
class RasterizeAndRecordMicroTop25(test.T... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import rasterize_and_record_micro
from telemetry import test
@test.Disabled('android', 'linux')
class RasterizeAndRecordMicroTop25(test.T... | Add rasterization microbenchmark for silk | Add rasterization microbenchmark for silk
Add rasterize_and_record_micro_key_silk_cases for keeping track of
rasterization and recording performance of silk content. This mirrors
the existing rasterize_and_record_key_silk_cases benchmark and will
potentially allow us to remove it if this microbenchmark produces less
n... | Python | bsd-3-clause | markYoungH/chromium.src,anirudhSK/chromium,ondra-novak/chromium.src,ltilve/chromium,jaruba/chromium.src,bright-sparks/chromium-spacewalk,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk-efl,anirudhSK/chromium,markYoungH/chromium.src,dednal/chromium.src,ltilve/chromium,chuan9/chromium-crosswalk,axinging/chrom... | ---
+++
@@ -21,3 +21,11 @@
http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
test = rasterize_and_record_micro.RasterizeAndRecordMicro
page_set = 'page_sets/key_mobile_sites.json'
+
+
+class RasterizeAndRecordMicroKeySilkCases(test.Test):
+ """Measures rasterize and record performa... |
a6837da2e52753745b07f888ce3797cf0d0efd70 | setup.py | setup.py | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved
#
# 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... | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved
#
# 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... | Set path.py to a fixed version | Set path.py to a fixed version | Python | apache-2.0 | dankilman/clash,dankilman/clash | ---
+++
@@ -29,7 +29,7 @@
'argcomplete',
'ansicolors',
'argh',
- 'path.py',
+ 'path.py==8.1.2',
'cloudify-plugins-common==3.3.1',
'cloudify-dsl-parser==3.3.1',
'cloudify-script-plugin==1.3.1' |
a15701a49c1fffedc30f939c231be4936d3ab790 | setup.py | setup.py | import setuptools
from valohai_yaml import __version__
dev_dependencies = [
'flake8',
'isort',
'pydocstyle',
'pytest-cov',
]
if __name__ == '__main__':
setuptools.setup(
name='valohai-yaml',
description='Valohai.yaml validation and parsing',
version=__version__,
ur... | import ast
import os
import re
import setuptools
with open(os.path.join(os.path.dirname(__file__), 'valohai_yaml', '__init__.py')) as infp:
version = ast.literal_eval(re.search('__version__ = (.+?)$', infp.read(), re.M).group(1))
dev_dependencies = [
'flake8',
'isort',
'pydocstyle',
'pytest-cov',
... | Read version without importing package | Read version without importing package
| Python | mit | valohai/valohai-yaml | ---
+++
@@ -1,6 +1,10 @@
+import ast
+import os
+import re
import setuptools
-from valohai_yaml import __version__
+with open(os.path.join(os.path.dirname(__file__), 'valohai_yaml', '__init__.py')) as infp:
+ version = ast.literal_eval(re.search('__version__ = (.+?)$', infp.read(), re.M).group(1))
dev_depend... |
6a9d8a10d6fdf4f4cfdf8ae5af9b172d9b53e8e9 | drawer.py | drawer.py | import matplotlib.pyplot as plt
import numpy as np
def display_result(vectors, clusters):
colors = [np.random.rand(3, 1) for i in range(len(clusters))]
for cluster_index, (centroid, cluster) in enumerate(clusters.items()):
current_cluster = [vectors[i] for i in cluster]
xs = list(map(lambda x:... | import matplotlib.pyplot as plt
import numpy as np
def display_result(vectors, clusters):
colors = [np.random.rand(3, 1) for i in range(len(clusters))]
centroids_colors = [[1-x for x in color] for color in colors]
for cluster_index, (centroid, cluster) in enumerate(clusters.items()):
current_clust... | Add drawing centroids with inverted colors | Add drawing centroids with inverted colors
| Python | mit | vanashimko/k-means | ---
+++
@@ -4,10 +4,11 @@
def display_result(vectors, clusters):
colors = [np.random.rand(3, 1) for i in range(len(clusters))]
+ centroids_colors = [[1-x for x in color] for color in colors]
for cluster_index, (centroid, cluster) in enumerate(clusters.items()):
current_cluster = [vectors[i] f... |
f82861e1698d101dc61ca8891b38e68f57262334 | chroma-manager/chroma_cli/commands/__init__.py | chroma-manager/chroma_cli/commands/__init__.py | #
# ========================================================
# Copyright (c) 2012 Whamcloud, Inc. All rights reserved.
# ========================================================
from chroma_cli.commands.dispatcher import CommandDispatcher
CommandDispatcher # stupid pyflakes
| #
# ========================================================
# Copyright (c) 2012 Whamcloud, Inc. All rights reserved.
# ========================================================
| Remove some cruft that was accidentally pushed | Remove some cruft that was accidentally pushed
Change-Id: If75577316398c9d02230882766463f00aa13efd9
| Python | mit | intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre | ---
+++
@@ -2,7 +2,3 @@
# ========================================================
# Copyright (c) 2012 Whamcloud, Inc. All rights reserved.
# ========================================================
-
-
-from chroma_cli.commands.dispatcher import CommandDispatcher
-CommandDispatcher # stupid pyflakes |
b76a7c4a60fbe3ea367a14e5fa19283fee062870 | pinboard_linkrot.py | pinboard_linkrot.py | #!/usr/bin/env python
from __future__ import division
import requests
import json
import sys
from requests.exceptions import SSLError, InvalidSchema, ConnectionError
def get_link_status_code(link):
headers = {'User-agent':'Mozilla/5.0'}
try:
r = requests.head(link, headers=headers, allow_redirects=Tru... | #!/usr/bin/env python
from __future__ import division
import requests
import json
import sys
from requests.exceptions import SSLError, InvalidSchema, ConnectionError
def get_link_status_code(link):
headers = {'User-agent':'Mozilla/5.0'}
try:
r = requests.head(link, headers=headers, allow_redirects=Tru... | Return exception details when failing to load link | Return exception details when failing to load link
| Python | mit | edgauthier/pinboard_linkrot | ---
+++
@@ -11,8 +11,8 @@
try:
r = requests.head(link, headers=headers, allow_redirects=True)
return r.status_code
- except (SSLError, InvalidSchema, ConnectionError):
- return 409
+ except (Exception) as e:
+ return '%s: %s' % (type(e).__name__, str(e))
def is_valid_lin... |
84396970c866ced0264c4a84b1300df23fede36a | bermann/spark_context_test.py | bermann/spark_context_test.py | import unittest
from bermann.spark_context import SparkContext
class TestSparkContext(unittest.TestCase):
def test_parallelize_with_list_input(self):
sc = SparkContext()
self.assertEqual([1, 2, 3], sc.parallelize([1, 2, 3]).collect())
def test_parallelize_with_generator_input(self):
... | import unittest
from bermann.spark_context import SparkContext
import bermann.rdd
class TestSparkContext(unittest.TestCase):
def test_parallelize_with_list_input(self):
sc = SparkContext()
self.assertEqual([1, 2, 3], sc.parallelize([1, 2, 3]).collect())
def test_parallelize_with_generator_i... | Add test case for SparkContext.emptyRDD() | Add test case for SparkContext.emptyRDD()
| Python | mit | oli-hall/bermann | ---
+++
@@ -1,7 +1,7 @@
import unittest
from bermann.spark_context import SparkContext
-
+import bermann.rdd
class TestSparkContext(unittest.TestCase):
@@ -18,3 +18,10 @@
yield i
self.assertEqual([0, 1, 2, 3], sc.parallelize(gen_range(4)).collect())
+
+ def test_empty_rdd_retur... |
3452603d99d82c76e3119c2da77c2f4a63777611 | assisstant/keyboard/ui/components.py | assisstant/keyboard/ui/components.py | from PyQt5.QtWidgets import QOpenGLWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QBrush
class FlashingBox(QOpenGLWidget):
def __init__(self, parent, freq, color):
super(FlashingBox, self).__init__(parent)
self.freq = freq
self.brushes = [QBrush(Qt.black), QBrush(color)]
self.i... | from PyQt5.QtWidgets import QOpenGLWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QBrush
class FlashingBox(QOpenGLWidget):
def __init__(self, parent, freq=1, color=Qt.black):
super(FlashingBox, self).__init__(parent)
self.freq = freq
self.brushes = [QBrush(Qt.black), QBrush(color)]
... | Add setFreq/setColor methods for FlashingBox | Add setFreq/setColor methods for FlashingBox
| Python | apache-2.0 | brainbots/assistant | ---
+++
@@ -3,30 +3,29 @@
from PyQt5.QtGui import QPainter, QBrush
class FlashingBox(QOpenGLWidget):
-
- def __init__(self, parent, freq, color):
+ def __init__(self, parent, freq=1, color=Qt.black):
super(FlashingBox, self).__init__(parent)
self.freq = freq
self.brushes = [QBrush(Qt.black), QBru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.