commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
18e310680f7dfd8f5a5186baf37cab9968f19012
django_base/urls.py
django_base/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/', include(admin.site.urls)), )
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), )
Remove admin docs by default since they are never used.
Remove admin docs by default since they are never used.
Python
bsd-3-clause
SheepDogInc/django-base,SheepDogInc/django-base
24045cd16a862ebd31f4a88a733a05bf2aff03a5
easygeoip/urls_api.py
easygeoip/urls_api.py
from django.conf.urls import patterns, url # API URLs from .views import LocationFromIpView urlpatterns = patterns('', url(r'^location/(?P<ip_address>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))/$', LocationFromIpView.as_view(), name='geoip-explicit-ip-view'), url(r'^location/$', LocationFromIpView.as_view()...
from django.conf.urls import url # API URLs from .views import LocationFromIpView urlpatterns = [ url(r'^location/(?P<ip_address>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))/$', LocationFromIpView.as_view(), name='geoip-explicit-ip-view'), url(r'^location/$', LocationFromIpView.as_view(), name='geoip-implici...
Upgrade to new urlpatterns format
Upgrade to new urlpatterns format
Python
mit
lambdacomplete/django-easygeoip
cb4973909ea662abdf718e5a831806dcb0ecc821
14B-088/HI/HI_correct_mask_model.py
14B-088/HI/HI_correct_mask_model.py
''' Swap the spatial axes. Swap the spectral and stokes axes. ''' import sys from astropy.io import fits hdu = fits.open(sys.argv[1], mode='update') hdu[0].data = hdu[0].data.swapaxes(0, 1) hdu[0].data = hdu[0].data[:, :, :, ::-1] hdu[0].data = hdu[0].data[:, :, ::-1, :] hdu.flush() execfile("~/Dropbox/code_dev...
''' \Swap the spectral and stokes axes. Needed due to issue in regridding function ''' import sys from astropy.io import fits hdu = fits.open(sys.argv[1], mode='update') hdu[0].data = hdu[0].data.swapaxes(0, 1) execfile("/home/eric/Dropbox/code_development/ewky_scripts/header_swap_axis.py") hdu[0].header = heade...
Update what's needed to correct mask and model
Update what's needed to correct mask and model
Python
mit
e-koch/VLA_Lband,e-koch/VLA_Lband
f16add1160e5a76f94be30ea54cea27045c32705
tests/test_blacklist.py
tests/test_blacklist.py
import unittest import config from .. import ntokloapi class BlacklistTest(unittest.TestCase): def setUp(self): self.blacklist = ntokloapi.Blacklist(config.TEST_KEY, config.TEST_SECRET) def test_blacklist_add_singleitem(self): response = self.blacklist.add(productid=['10201', ]) as...
import unittest import config import ntokloapi class BlacklistTest(unittest.TestCase): def setUp(self): self.blacklist = ntokloapi.Blacklist(config.TEST_KEY, config.TEST_SECRET) def test_blacklist_add_singleitem(self): response = self.blacklist.add(productid=['10201', ]) assert res...
Fix unit tests for the blacklist
Fix unit tests for the blacklist
Python
apache-2.0
nToklo/ntokloapi-python
f8f0335a1a790b1ef8163a2be968b29769be80a2
arim/models.py
arim/models.py
from django.db import models class Lease(models.Model): class Meta: db_table = 'autoreg' mac = models.CharField(max_length=17, db_index=True) ip = models.IntegerField(primary_key=True) date = models.IntegerField()
from django.db import models from ipaddr import IPv4Address class Lease(models.Model): class Meta: db_table = 'autoreg' mac = models.CharField(max_length=17, db_index=True) ip = models.IntegerField(primary_key=True) date = models.IntegerField() def __str__(self): return unicode(s...
Add __str__, __unicode__, and __repr__
Add __str__, __unicode__, and __repr__
Python
bsd-3-clause
drkitty/arim,OSU-Net/arim,OSU-Net/arim,drkitty/arim,drkitty/arim,OSU-Net/arim
f21ae3ffb99c5b90cb329317b2c6282e4992f6cc
safety/utils.py
safety/utils.py
# -*- coding: utf-8 -*- import importlib import re import warnings from django.conf import settings from django.utils.translation import ugettext_lazy as _, ugettext BROWSERS = ( (re.compile('Chrome'), _('Chrome')), (re.compile('Safari'), _('Safari')), (re.compile('Firefox'), _('Firefox')), (re.compi...
# -*- coding: utf-8 -*- try: from django.utils.importlib import import_module except ImportError: from importlib import import_module from django.conf import settings from django.core.exceptions import ImproperlyConfigured def get_session_store(): mod = getattr(settings, 'SESSION_ENGINE', 'django.contrib...
Add get_resolver() util and remove get_device() (now use ua-parser).
Add get_resolver() util and remove get_device() (now use ua-parser).
Python
mit
ulule/django-safety,ulule/django-safety
8b374d041d97307962cdf562c52b2a72345a4efc
snowman/urls.py
snowman/urls.py
"""snowman URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
"""snowman URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
Add simple login form in the API.
Add simple login form in the API. This is usefull for developers to explore the Browlable api directly on the browser.
Python
mit
johnnywell/snowman
edf38ad11631ad5e793eb9ac95dbc865595d517b
glue_vispy_viewers/common/layer_state.py
glue_vispy_viewers/common/layer_state.py
from __future__ import absolute_import, division, print_function from glue.external.echo import CallbackProperty, keep_in_sync from glue.core.state_objects import State __all__ = ['VispyLayerState'] class VispyLayerState(State): """ A base state object for all Vispy layers """ layer = CallbackPrope...
from __future__ import absolute_import, division, print_function from glue.external.echo import CallbackProperty, keep_in_sync from glue.core.state_objects import State from glue.core.message import LayerArtistUpdatedMessage __all__ = ['VispyLayerState'] class VispyLayerState(State): """ A base state object...
Make sure layer artist icon updates when changing the color mode or colormaps
Make sure layer artist icon updates when changing the color mode or colormaps
Python
bsd-2-clause
glue-viz/glue-vispy-viewers,PennyQ/astro-vispy,astrofrog/glue-3d-viewer,glue-viz/glue-3d-viewer,astrofrog/glue-vispy-viewers
818d6584164f04001bf0e75f62c526284521ce69
demae/dest/s3_dest.py
demae/dest/s3_dest.py
import pandas as pd import gzip import boto3 import re def default_key_map(key): return re.sub('_input', '_output', key) class S3Dest(): def __init__(self, key_map=default_key_map): self.key_map = key_map def skip_keys(self, bucket, source_prefix): s3 = boto3.resource('s3') obj...
import pandas as pd import gzip import boto3 import re import io def default_key_map(key): return re.sub('_input', '_output', key) class S3Dest(): def __init__(self, key_map=default_key_map): self.key_map = key_map def skip_keys(self, bucket, source_prefix): s3 = boto3.resource('s3') ...
Use managed transfer for uploading
Use managed transfer for uploading
Python
mit
uiureo/demae
f6e18d142ac965221737205f65d66751ea02f168
hack_plot/management/commands/parse_authlog.py
hack_plot/management/commands/parse_authlog.py
from django.core.management.base import BaseCommand, CommandError from ...cron import parse_auth_log class Command(BaseCommand): def handle(self, *args, **options): parse_auth_log()
from django.conf import settings from django.core.management.base import BaseCommand, CommandError try: import simplejson as json except ImportError as e: import json from rest_framework.renderers import JSONRenderer from unipath import Path from ...api.serializers import HackLocationSerializer from ...cron ...
Write hack locations to json after parsing log file
Write hack locations to json after parsing log file
Python
mit
hellsgate1001/graphs,hellsgate1001/graphs,hellsgate1001/graphs
49069663a3fe3d44be9ab59e59a90d0dfcf49f0c
mayatools/qt.py
mayatools/qt.py
try: import sip from uitools.qt import QtCore import maya.OpenMayaUI as apiUI # These modules will not exist while building the docs. except ImportError: import os if os.environ.get('SPHINX') != 'True': raise def get_maya_window(): """Get the main Maya window as a QtGui.QMainWindow."...
try: from uitools.sip import wrapinstance from uitools.qt import QtCore import maya.OpenMayaUI as apiUI # These modules will not exist while building the docs. except ImportError: import os if os.environ.get('SPHINX') != 'True': raise def get_maya_window(): """Get the main Maya windo...
Use uitools.sip instead of straight sip
Use uitools.sip instead of straight sip
Python
bsd-3-clause
westernx/mayatools,westernx/mayatools
5446b0cc9335a3fe6c88158c1b864cdc1b0988d5
onestop/stopbins.py
onestop/stopbins.py
"""Stop Bins.""" import util import errors import registry import entities class StopBin(object): def __init__(self, prefix): self.prefix = prefix self._stops = {} def stops(self): return self._stops.values() def add_stop(self, stop): key = stop.onestop() # New stop if key not i...
"""Stop Bins.""" import util import errors import registry import entities class StopBin(object): def __init__(self, prefix): self.prefix = prefix self._stops = {} def stops(self): return self._stops.values() def add_stop(self, stop): key = stop.onestop() # New stop if key not i...
Return added stop in StopBin.add_stop()
Return added stop in StopBin.add_stop()
Python
mit
transitland/transitland-python-client,srthurman/transitland-python-client
73877a82bf9b690827102d1a932a31af94ab78e9
partner_event/models/res_partner.py
partner_event/models/res_partner.py
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields, api class ResPartn...
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields, api class ResPartn...
Revert last commit and tiggers _count_attended_registration method when one registrations.state changes
Revert last commit and tiggers _count_attended_registration method when one registrations.state changes
Python
agpl-3.0
open-synergy/event,open-synergy/event,Endika/event,Antiun/event
c6e130682712e8534e773036ba3d87c09b91ff1c
knowledge_repo/postprocessors/format_checks.py
knowledge_repo/postprocessors/format_checks.py
from ..constants import FORMAT_CHECKS from ..post import HEADER_OPTIONAL_FIELD_TYPES, HEADER_REQUIRED_FIELD_TYPES from ..postprocessor import KnowledgePostProcessor class FormatChecks(KnowledgePostProcessor): _registry_keys = [FORMAT_CHECKS] def process(self, kp): headers = kp.headers for fie...
from ..constants import FORMAT_CHECKS from ..post import HEADER_OPTIONAL_FIELD_TYPES, HEADER_REQUIRED_FIELD_TYPES from ..postprocessor import KnowledgePostProcessor class FormatChecks(KnowledgePostProcessor): _registry_keys = [FORMAT_CHECKS] def process(self, kp): headers = kp.headers for fie...
Fix lint issues related to long lines
Fix lint issues related to long lines
Python
apache-2.0
airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo
bf264d5683c7fcab69e117f235fbe16298ac90b8
wal_e/worker/wabs/wabs_deleter.py
wal_e/worker/wabs/wabs_deleter.py
from wal_e import retries from wal_e.worker.base import _Deleter class Deleter(_Deleter): def __init__(self, wabs_conn, container): super(Deleter, self).__init__() self.wabs_conn = wabs_conn self.container = container @retries.retry() def _delete_batch(self, page): # Azur...
from wal_e import retries from wal_e import log_help from wal_e.worker.base import _Deleter try: # New class name in the Azure SDK sometime after v1.0. # # See # https://github.com/Azure/azure-sdk-for-python/blob/master/ChangeLog.txt from azure.common import AzureMissingResourceHttpError except Imp...
Fix infinite retry while deleting missing resource in WABS
Fix infinite retry while deleting missing resource in WABS
Python
bsd-3-clause
wal-e/wal-e
62845279b46d6f4394e05e666fe459a427bdd358
enthought/qt/QtCore.py
enthought/qt/QtCore.py
import os qt_api = os.environ.get('QT_API', 'pyqt') if qt_api == 'pyqt': from PyQt4.QtCore import * from PyQt4.QtCore import pyqtSignal as Signal from PyQt4.Qt import QCoreApplication from PyQt4.Qt import Qt else: from PySide.QtCore import *
import os qt_api = os.environ.get('QT_API', 'pyqt') if qt_api == 'pyqt': from PyQt4.QtCore import * from PyQt4.QtCore import pyqtSignal as Signal from PyQt4.Qt import QCoreApplication from PyQt4.Qt import Qt # Emulate PySide version metadata. __version__ = QT_VERSION_STR __version_info__...
Add PySide-style version metadata when PyQt4 is present.
Add PySide-style version metadata when PyQt4 is present.
Python
bsd-3-clause
burnpanck/traits,burnpanck/traits
cc87cf3967e14274b7819f5424b80bd7e491f0ce
alg_kruskal_minimum_spanning_tree.py
alg_kruskal_minimum_spanning_tree.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function def kruskal(): """Kruskal's algorithm for minimum spanning tree in weighted graph. Time complexity for graph G(V, E): TBD. """ pass def main(): pass if __name__ == '__main__': main()
from __future__ import absolute_import from __future__ import division from __future__ import print_function def kruskal(): """Kruskal's algorithm for minimum spanning tree in weighted graph. Time complexity for graph G(V, E): TBD. """ pass def main(): w_graph_d = { 'a': {'b': 1, 'd': 4, 'e': 3}, ...
Add weighted graph in main()
Add weighted graph in main()
Python
bsd-2-clause
bowen0701/algorithms_data_structures
a5ae06630ef96d1093e4498e0e5437c0a7e65bfa
parse.py
parse.py
from PIL import Image import sys import pyocr import pyocr.builders tools = pyocr.get_available_tools() if len(tools) == 0: print("Error: No OCR tool found") sys.exit(1) # should be 'Tesseract (sh)' tool = tools[0] orig_image = Image.open('test.png') # crop to only the section with the number of problems ...
from PIL import Image import sys import pyocr import pyocr.builders image_loc = ' '.join(sys.argv[1:]) tools = pyocr.get_available_tools() if len(tools) == 0: print("Error: No OCR tool found") sys.exit(1) # should be 'Tesseract (sh)' tool = tools[0] orig_image = Image.open(image_loc) # crop to only the se...
Allow user to specify image file w argv
Allow user to specify image file w argv
Python
bsd-2-clause
iandioch/euler-foiler
a16889f353873e3d08a24440b9aa83177ffd001f
engine.py
engine.py
#!/usr/bin/env python import json import sys import os # For os.path and the like class DictWrapper(object): def __init__(self, d): self.__dict__ = d def eval_script(self): return eval(self.script) # With self as context d = json.load(sys.stdin) dw = DictWrapper(d) json.dump(dw.eval_script()...
#!/usr/bin/env python import json import sys import os # For os.path and the like class DictWrapper(object): def __init__(self, d): self.__dict__ = d def eval_script(self): return eval(self.script) # With self as context def __getattr__(self, attr): return None if __name__ ...
Implement __getattr__ to handle KeyErrors
Implement __getattr__ to handle KeyErrors
Python
mit
dleehr/py-expr-engine
fc7beded3d286d831df29b8b32614b2eb56ef206
enasearch/__main__.py
enasearch/__main__.py
#!/usr/bin/env python import click import ebisearch from pprint import pprint @click.group() def main(): pass @click.command('get_results', short_help='Get list of results') def get_results(): """Return the list of domains in EBI""" ebisearch.get_results(verbose=True) @click.command('get_filter_field...
#!/usr/bin/env python import click import ebisearch from pprint import pprint @click.group() def main(): pass @click.command('get_results', short_help='Get list of results') def get_results(): """Return the list of domains in EBI""" ebisearch.get_results(verbose=True) @click.command('get_filter_field...
Add function for get filter types
Add function for get filter types
Python
mit
bebatut/enasearch
9fcfd8e13b5c4684a1cb3890427662ded2d28c24
examples/get_dataset.py
examples/get_dataset.py
#!/usr/bin/env python3 # # This script is used for downloading the dataset used by the examples. # Dataset used: UCI / Pima Indians Diabetes (in libsvm format) import os import urllib.request DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/diabetes' TARGET_PATH = os.path.dirname(os.path....
#!/usr/bin/env python3 # # This script is used for downloading the dataset used by the examples. # Dataset used: Statlog / Letter (in libsvm format) import os import urllib.request import random DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/letter.scale' DATASET_SIZE = 1000 TARGET_...
Change dataset used in example (letter)
Change dataset used in example (letter) XXX: UncertaintySampling(le) weird?
Python
bsd-2-clause
ntucllab/libact,ntucllab/libact,ntucllab/libact
8923d10fc831afe7ade5dad4e14167f3525396b6
scripts/nipy_4dto3D.py
scripts/nipy_4dto3D.py
#!/usr/bin/env python ''' Tiny script to write 4D files in any format that we read (nifti, analyze, MINC, at the moment, as nifti 3D files ''' import os import sys import nipy.io.imageformats as nii if __name__ == '__main__': try: fname = sys.argv[1] except IndexError: raise OSError('Expecti...
#!/usr/bin/env python ''' Tiny script to write 4D files in any format that we read (nifti, analyze, MINC, at the moment, as nifti 3D files ''' import os import nipy.externals.argparse as argparse import nipy.io.imageformats as nii def main(): # create the parser parser = argparse.ArgumentParser() # add ...
Use argparse for 4D to 3D
Use argparse for 4D to 3D
Python
bsd-3-clause
yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD
ebb3ea0d72835c4acdc38ba241cf8fd4f828c5cd
setup.py
setup.py
from distutils.core import setup, Extension import sys ext_modules = [ Extension('classified._platform', ['src/classified._platform.c'], extra_compile_args=[ '-DPLATFORM_%s' % (sys.platform.upper()), '-Wunused', ] ) ] setup( name = 'classified', ...
from distutils.core import setup, Extension import sys ext_modules = [ Extension('classified._platform', ['src/classified._platform.c'], extra_compile_args=[ '-DPLATFORM_%s' % (sys.platform.upper()), '-Wunused', ] ) ] setup( name = 'classified', ...
Move probes to their own directory
Move probes to their own directory
Python
mit
tehmaze/classified,tehmaze/classified,tehmaze/classified
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
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
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
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
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
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
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
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...
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
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...
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
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
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
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
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
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
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
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
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...
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
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...
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
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...
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
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...
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
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
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
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
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
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
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
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
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
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
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
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
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
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...
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
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...
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...
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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...
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
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
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
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
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
0f5224c825c5fbd1aa4d4c89eeb9d35f55e845ee
setup.py
setup.py
#-*- coding: utf-8 -*- # # setup.py # anytop # # Created by Lars Yencken on 2011-10-09. # Copyright 2011 Lars Yencken. All rights reserved. # from distutils.core import setup setup( name='anytop', version='0.1.2', description='Streaming frequency distribution viewer.', long_description=open('READM...
#-*- coding: utf-8 -*- # # setup.py # anytop # # Created by Lars Yencken on 2011-10-09. # Copyright 2011 Lars Yencken. All rights reserved. # from distutils.core import setup setup( name='anytop', version='0.1.2', description='Streaming frequency distribution viewer.', long_description=open('READM...
Add anyhist as an installed script.
Add anyhist as an installed script.
Python
isc
larsyencken/anytop
71ca6c8516e5b887a22d2e16f3fdea72f7d041d9
STAF/__init__.py
STAF/__init__.py
# Copyright 2012 Kevin Goodsell # # This software is licensed under the Eclipse Public License (EPL) V1.0. ''' Interface to the STAF API. ''' # Using __all__ makes pydoc work properly. Otherwise it looks at the modules the # items actually come from and assumes they don't belong in the docs for # __init__. __all__ = ...
# Copyright 2012 Kevin Goodsell # # This software is licensed under the Eclipse Public License (EPL) V1.0. ''' Interface to the STAF API. ''' # Using __all__ makes pydoc work properly. Otherwise it looks at the modules the # items actually come from and assumes they don't belong in the docs for # __init__. __all__ = ...
Add missing function in __all__.
Add missing function in __all__.
Python
epl-1.0
KevinGoodsell/caduceus
7fb5df76dc3b0e044c2ae6fe5f860a9edad76f83
backend/breach/tests/test_sniffer.py
backend/breach/tests/test_sniffer.py
from mock import patch from django.test import TestCase from breach.sniffer import Sniffer class SnifferTest(TestCase): def setUp(self): self.endpoint = 'http://localhost' self.sniffer = Sniffer(self.endpoint) self.source_ip = '147.102.239.229' self.destination_host = 'dionyziz.c...
from mock import patch from django.test import TestCase from breach.sniffer import Sniffer class SnifferTest(TestCase): def setUp(self): self.endpoint = 'http://localhost' self.sniffer = Sniffer(self.endpoint) self.source_ip = '147.102.239.229' self.destination_host = 'dionyziz.c...
Fix sniffer test, rename stop to delete
Fix sniffer test, rename stop to delete
Python
mit
dimkarakostas/rupture,dimkarakostas/rupture,dimriou/rupture,dionyziz/rupture,dionyziz/rupture,dionyziz/rupture,dimkarakostas/rupture,dimriou/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture,dionyziz/rupture,dimriou/rupture,dimriou/rupture,esarafianou/rupture,dimkarakostas/rupture,esarafianou/rupture,es...
6ccc4a267f939d60ab8948874d9b066ff2b2e5ee
grader/grader/test/test_build.py
grader/grader/test/test_build.py
import os import pytest from subprocess import Popen, PIPE def has_installed(program): """Checks to see if a program is installed using ``which``. :param str program: the name of the program we're looking for :rtype bool: :return: True if it's installed, otherwise False. """ proc = Popen(...
import os import pytest import shutil hasdocker = pytest.mark.skipif(shutil.which("docker") is None, reason="Docker must be installed.") """A decorator to skip a test if docker is not installed.""" @hasdocker def test_build(parse_and_run): """Test vanilla assignment build """ ...
Use shutil for 'which docker'
Use shutil for 'which docker'
Python
mit
redkyn/grader,redkyn/grader,grade-it/grader
de43482266fa71adb8393823680675145ffe93e0
hr_switzerland/models/hr_expense.py
hr_switzerland/models/hr_expense.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2017 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file __manifest__.py...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2017 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file __manifest__.py...
Add notification to manager at expense creation
Add notification to manager at expense creation
Python
agpl-3.0
CompassionCH/compassion-switzerland,CompassionCH/compassion-switzerland,ecino/compassion-switzerland,eicher31/compassion-switzerland,eicher31/compassion-switzerland,CompassionCH/compassion-switzerland,ecino/compassion-switzerland,eicher31/compassion-switzerland,ecino/compassion-switzerland
9830a8d3cf140af5af53918db51ede4b82392dd5
dbcollection/datasets/mscoco/load_data_test.py
dbcollection/datasets/mscoco/load_data_test.py
import os from dbcollection.utils.file_load import load_json def load_data_test(set_name, image_dir, annotation_path, verbose=True): """ Load test data annotations. """ data = {} # load annotation file if verbose: print('> Loading annotation file: ' + annotation_path) annotations ...
import os from dbcollection.utils.file_load import load_json def load_data_test(set_name, image_dir, annotation_path, verbose=True): """ Load test data annotations. """ data = {} # load annotation file if verbose: print('> Loading annotation file: ' + annotation_path) annotations ...
Add annotations var to returned data
db: Add annotations var to returned data
Python
mit
dbcollection/dbcollection,farrajota/dbcollection
867c71f0f2d3c2898815334a5d76063cd7671fae
processors/fix_changeline_budget_titles.py
processors/fix_changeline_budget_titles.py
import json if __name__ == "__main__": input = sys.argv[1] output = sys.argv[2] processor = fix_changeline_budget_titles().process(input,output,[]) class fix_changeline_budget_titles(object): def process(self,inputs,output): out = [] budgets = {} changes_jsons, budget_jsons...
import json import logging if __name__ == "__main__": input = sys.argv[1] output = sys.argv[2] processor = fix_changeline_budget_titles().process(input,output,[]) class fix_changeline_budget_titles(object): def process(self,inputs,output): out = [] budgets = {} changes_json...
Fix bug in changeling title fix - it used to remove some lines on the way...
Fix bug in changeling title fix - it used to remove some lines on the way...
Python
mit
OpenBudget/open-budget-data,OpenBudget/open-budget-data,omerbartal/open-budget-data,omerbartal/open-budget-data
c988925927ec9d50ded81c92b85c3abce6c2638f
fireplace/carddata/minions/neutral/legendary.py
fireplace/carddata/minions/neutral/legendary.py
import random from ...card import * # Ragnaros the Firelord class EX1_298(Card): cantAttack = True def onTurnEnd(self, player): self.hit(random.choice(self.controller.getTargets(TARGET_ENEMY_CHARACTERS)), 8) # Harrison Jones class EX1_558(Card): def action(self): weapon = self.controller.opponent.hero.weapon...
import random from ...card import * # Cairne Bloodhoof class EX1_110(Card): deathrattle = summonMinion("EX1_110t") # Baron Geddon class EX1_249(Card): def action(self): for target in self.controller.getTargets(TARGET_ALL_MINIONS): if target is not self: self.hit(target, 2) # Ragnaros the Firelord class...
Implement Baron Geddon, Cairne Bloodhoof and Malygos
Implement Baron Geddon, Cairne Bloodhoof and Malygos
Python
agpl-3.0
amw2104/fireplace,beheh/fireplace,smallnamespace/fireplace,liujimj/fireplace,butozerca/fireplace,oftc-ftw/fireplace,Ragowit/fireplace,Ragowit/fireplace,smallnamespace/fireplace,NightKev/fireplace,Meerkov/fireplace,jleclanche/fireplace,butozerca/fireplace,Meerkov/fireplace,amw2104/fireplace,oftc-ftw/fireplace,liujimj/fi...
679c2daceb7f4e9d193e345ee42b0334dd576c64
changes/web/index.py
changes/web/index.py
import changes import urlparse from flask import render_template, current_app, redirect, url_for, session from flask.views import MethodView class IndexView(MethodView): def get(self, path=''): # require auth if not session.get('email'): return redirect(url_for('login')) if c...
import changes import urlparse from flask import render_template, current_app, redirect, url_for, session from flask.views import MethodView class IndexView(MethodView): def get(self, path=''): # require auth if not session.get('email'): return redirect(url_for('login')) if c...
Disable Sentry due to sync behavior
Disable Sentry due to sync behavior
Python
apache-2.0
bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes
1a0c9fd8e8d6ce59c2d6ea42c59dfa6497400753
buildscripts/condarecipe/run_test.py
buildscripts/condarecipe/run_test.py
import sys import platform import llvm from llvm.core import Module from llvm.ee import EngineBuilder from llvm.utils import check_intrinsics m = Module.new('fjoidajfa') eb = EngineBuilder.new(m) target = eb.select_target() print('target.triple=%r' % target.triple) if sys.platform == 'darwin': s = {'64bit': 'x86...
import sys import platform import llvm from llvm.ee import TargetMachine target = TargetMachine.new() print('target.triple=%r' % target.triple) if sys.platform == 'darwin': s = {'64bit': 'x86_64', '32bit': 'x86'}[platform.architecture()[0]] assert target.triple.startswith(s + '-apple-darwin') assert llvm.test...
Fix buildscript for Python2 on OSX
Fix buildscript for Python2 on OSX
Python
bsd-3-clause
llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy
9021b035cc7bc63603fce3f626ca6c92c0ba3f9b
pygraphc/clustering/ConnectedComponents.py
pygraphc/clustering/ConnectedComponents.py
import networkx as nx from ClusterUtility import ClusterUtility class ConnectedComponents: """This is a class for connected component detection method to cluster event logs [1]_. References ---------- .. [1] H. Studiawan, B. A. Pratomo, and R. Anggoro, Connected component detection for authentication...
import networkx as nx from ClusterUtility import ClusterUtility class ConnectedComponents: """This is a class for connected component detection method to cluster event logs [Studiawan2016a]_. References ---------- .. [Studiawan2016a] H. Studiawan, B. A. Pratomo, and R. Anggoro, Connected component de...
Fix bug in docstring references Studiawan2016a
Fix bug in docstring references Studiawan2016a
Python
mit
studiawan/pygraphc
895af0411bc8f45f48265872ccbba9c2a040f7d1
ds_graph.py
ds_graph.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function class Vertex(object): """Vertex class. It uses a dict to keep track of the vertices which it's connected. """ class Graph(object): """Graph class. It contains a dict to map vertex name to ver...
from __future__ import absolute_import from __future__ import division from __future__ import print_function class Vertex(object): """Vertex class. It uses a dict to keep track of the vertices which it's connected. """ def __init__(self, key): self.id = key self.connected_to_dict = {} def add_neighnor(s...
Implement Vertex class’s __init__ and helper functions
Implement Vertex class’s __init__ and helper functions
Python
bsd-2-clause
bowen0701/algorithms_data_structures
9769f66101a2927ec4fc2f978a8c6401219624ad
account_move_fiscal_year/models/account_move_line.py
account_move_fiscal_year/models/account_move_line.py
# Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models class AccountMoveLine(models.Model): _inherit = 'account.move.line' date_range_fy_id = fields.Many2one( related='move_id.date_range_fy_id', store=True, copy=False)
# Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models class AccountMoveLine(models.Model): _inherit = 'account.move.line' date_range_fy_id = fields.Many2one( related='move_id.date_range_fy_id', )
Remove unneeded and inefficient "store=True"
[FIX] Remove unneeded and inefficient "store=True"
Python
agpl-3.0
OCA/account-financial-tools,OCA/account-financial-tools
7dd723874ac5bae83039b313abd00393636f1d80
modernrpc/tests/test_entry_points.py
modernrpc/tests/test_entry_points.py
# coding: utf-8 import requests def test_forbidden_get(live_server): r = requests.get(live_server.url + '/all-rpc/') assert r.status_code == 405 r2 = requests.post(live_server.url + '/all-rpc/') assert r2.status_code == 200 def test_allowed_get(live_server): r = requests.get(live_server.url +...
# coding: utf-8 import requests from django.core.exceptions import ImproperlyConfigured from pytest import raises from modernrpc.views import RPCEntryPoint def test_forbidden_get(live_server): r = requests.get(live_server.url + '/all-rpc/') assert r.status_code == 405 r2 = requests.post(live_server.url...
Test for bad setting value
Test for bad setting value
Python
mit
alorence/django-modern-rpc,alorence/django-modern-rpc
bf312434a9b52264dc63667c986ff353d0379e5b
cogs/utils/dataIO.py
cogs/utils/dataIO.py
import redis_collections import threading import time import __main__ class RedisDict(redis_collections.Dict): def __init__(self, **kwargs): super().__init__(**kwargs) self.die = False self.thread = threading.Thread(target=self.update_loop) self.thread.start() self.prev = N...
import redis_collections import threading import time import __main__ class RedisDict(redis_collections.Dict): def __init__(self, **kwargs): super().__init__(**kwargs) self.die = False self.thread = threading.Thread(target=self.update_loop, daemon=True) self.thread.start() ...
Make threads run in daemon mode
Make threads run in daemon mode
Python
mit
Thessia/Liara