commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
1af1a7acface58cd8a6df5671d83b0a1a3ad4f3e | Set the tiddlywebwiki binary limit to 1MB. | FND/tiddlyspace,FND/tiddlyspace,TiddlySpace/tiddlyspace,FND/tiddlyspace,TiddlySpace/tiddlyspace,TiddlySpace/tiddlyspace | tiddlywebplugins/tiddlyspace/config.py | tiddlywebplugins/tiddlyspace/config.py | """
Base configuration for TiddlySpace.
This provides the basics which may be changed in tidlywebconfig.py.
"""
from tiddlywebplugins.instancer.util import get_tiddler_locations
from tiddlywebplugins.tiddlyspace.instance import store_contents
PACKAGE_NAME = 'tiddlywebplugins.tiddlyspace'
config = {
'instance_... | """
Base configuration for TiddlySpace.
This provides the basics which may be changed in tidlywebconfig.py.
"""
from tiddlywebplugins.instancer.util import get_tiddler_locations
from tiddlywebplugins.tiddlyspace.instance import store_contents
PACKAGE_NAME = 'tiddlywebplugins.tiddlyspace'
config = {
'instance_... | bsd-3-clause | Python |
d3591104c0300216bf4c91c23e7befb7d152086a | Update hoomd/pytest/test_dcd.py | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/pytest/test_dcd.py | hoomd/pytest/test_dcd.py | import hoomd
import pytest
import numpy as np
def test_attach(simulation_factory, two_particle_snapshot_factory, tmp_path):
d = tmp_path / "sub"
d.mkdir()
filename = d / "temporary_test_file.dcd"
sim = simulation_factory(two_particle_snapshot_factory())
dcd_dump = hoomd.write.DCD(filename, hoomd.t... | import hoomd
import pytest
import numpy as np
def test_attach(simulation_factory, two_particle_snapshot_factory, tmp_path):
d = tmp_path / "sub"
d.mkdir()
filename = d / "temporary_test_file.dcd"
sim = simulation_factory(two_particle_snapshot_factory())
dcd_dump = hoomd.write.DCD(filename, hoomd.t... | bsd-3-clause | Python |
17e14c82c84dda4cbe6ad76056c53bbce918da55 | use super | SiLab-Bonn/basil,MarcoVogt/basil,SiLab-Bonn/basil | host/TL/TransferLayer.py | host/TL/TransferLayer.py | #
# ------------------------------------------------------------
# Copyright (c) SILAB , Physics Institute of Bonn University
# ------------------------------------------------------------
#
# SVN revision information:
# $Rev:: $:
# $Author:: $:
# $Date:: ... | #
# ------------------------------------------------------------
# Copyright (c) SILAB , Physics Institute of Bonn University
# ------------------------------------------------------------
#
# SVN revision information:
# $Rev:: $:
# $Author:: $:
# $Date:: ... | bsd-3-clause | Python |
18f29b2b1a99614b09591df4a60c1670c845aa9b | Add first set of exercises. | Baumelbi/IntroPython2016,weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016,Baumelbi/IntroPython2016,weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016 | students/crobison/session04/dict_lab.py | students/crobison/session04/dict_lab.py | # Charles Robison
# 2016.10.18
# Dictionary and Set Lab
# Create a dictionary containing “name”, “city”, and “cake”
# for “Chris” from “Seattle” who likes “Chocolate”.
d = {'name': 'Chris', 'city': 'Seattle', 'cake': 'Chocolate'}
#Display the dictionary.
d
# Delete the entry for “cake”.
del d['cake']
# Display the ... | # Charles Robison
# 2016.10.18
# Dictionary and Set Lab
# Create a dictionary containing “name”, “city”, and “cake”
# for “Chris” from “Seattle” who likes “Chocolate”.
d = {'name': 'Chris', 'city': 'Seattle', 'cake': 'Chocolate'}
| unlicense | Python |
1314a5b99f64f96deee423e5189381f332c4419c | add fluct_limit to signal dividend | dyno/LMK,dyno/LMK | ATRCalculator.py | ATRCalculator.py | import log
class ATRCalculator(object):
def __init__(self, atr_period, fluct_limit=0.2):
self.atr_period = atr_period
self.tr_list = []
self.last_tick = None
self.atr = None
self.fluct_limit = fluct_limit
def __call__(self, tick):
# if not self.last_tick:
... | class ATRCalculator(object):
def __init__(self, atr_period):
self.atr_period = atr_period
self.tr_list = []
self.last_tick = None
self.atr = None
def __call__(self, tick):
# if not self.last_tick:
# => ValueError: 'The truth value of an array with more than one e... | mit | Python |
c9b6387702baee3da0a3bca8b302b619e69893f7 | Customize a ChunkList just for IFF chunks | gulopine/steel | steel/chunks/iff.py | steel/chunks/iff.py | import collections
import io
from steel.fields.numbers import BigEndian
from steel import fields
from steel.chunks import base
__all__ = ['Chunk', 'ChunkList', 'Form']
class Chunk(base.Chunk):
id = fields.String(size=4, encoding='ascii')
size = fields.Integer(size=4, endianness=BigEndian)
p... | import collections
import io
from steel.fields.numbers import BigEndian
from steel import fields
from steel.chunks import base
__all__ = ['Chunk', 'Form']
class Chunk(base.Chunk):
id = fields.String(size=4, encoding='ascii')
size = fields.Integer(size=4, endianness=BigEndian)
payload = base... | bsd-3-clause | Python |
2c991dd13e0d8b5242e3e46cb4a782074ad46bed | Remove commented code | knyghty/strapmin,knyghty/strapmin,knyghty/strapmin | strapmin/widgets.py | strapmin/widgets.py | from django import forms
from django.forms.util import flatatt
from django.template.loader import render_to_string
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
class RichTextEditorWidget(forms.Textarea):
class Media:
js = ('admin/js/ckeditor/ckeditor.... | from django import forms
from django.forms.util import flatatt
from django.template.loader import render_to_string
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
class RichTextEditorWidget(forms.Textarea):
#def __init__(self, *args, **kwargs):
# kwargs['... | bsd-2-clause | Python |
3e0e79bbed4b1a8854c90163ea77603beb1f0742 | Switch heroku to english | AmatanHead/collective-blog,AmatanHead/collective-blog,AmatanHead/collective-blog,AmatanHead/collective-blog | collective_blog/settings/prod_settings.py | collective_blog/settings/prod_settings.py | """Production settings
See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
import dj_database_url
print('\033[00;32mLoading production settings\033[0;00m')
DEBUG = False
from .settings import *
A... | """Production settings
See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
"""
from __future__ import unicode_literals
import dj_database_url
print('\033[00;32mLoading production settings\033[0;00m')
DEBUG = False
from .settings import *
ADMINS = (('Zelta', 'dev.zelta@gmail.com'), )
MANAGERS =... | mit | Python |
3ed854140723ee7f0527ba15d9cfe7bba8bbc6e6 | Make the perl wrappers work with python 3 | dnanexus/dx-toolkit,dnanexus/dx-toolkit,dnanexus/dx-toolkit,dnanexus/dx-toolkit,dnanexus/dx-toolkit,dnanexus/dx-toolkit,dnanexus/dx-toolkit,dnanexus/dx-toolkit | contrib/perl/generatePerlAPIWrappers.py | contrib/perl/generatePerlAPIWrappers.py | #!/usr/bin/env python
#
# Copyright (C) 2013-2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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 a... | #!/usr/bin/env python2.7
#
# Copyright (C) 2013-2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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 Licens... | apache-2.0 | Python |
f7d4a3df11a67e3ae679b4c8f25780538c4c3c32 | Use the newer PostUpdate instead of PostMedia | osamak/student-portal,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz | core/management/commands/send_tweets.py | core/management/commands/send_tweets.py | import twitter
from django.core.management.base import BaseCommand
from django.conf import settings
from core.models import Tweet
class Command(BaseCommand):
help = "Send out tweets."
def handle(self, *args, **options):
for tweet in Tweet.objects.filter(was_sent=False, failed_trails__lte=5):
... | import twitter
from django.core.management.base import BaseCommand
from django.conf import settings
from core.models import Tweet
class Command(BaseCommand):
help = "Send out tweets."
def handle(self, *args, **options):
for tweet in Tweet.objects.filter(was_sent=False, failed_trails__lte=5):
... | agpl-3.0 | Python |
16bada3156354ef4d41505b37e31be054c949d93 | Add descripiton to policies in virtual_interfaces.py | jianghuaw/nova,jianghuaw/nova,jianghuaw/nova,vmturbo/nova,rahulunair/nova,gooddata/openstack-nova,vmturbo/nova,mikalstill/nova,jianghuaw/nova,gooddata/openstack-nova,rajalokan/nova,rajalokan/nova,Juniper/nova,rajalokan/nova,vmturbo/nova,phenoxim/nova,gooddata/openstack-nova,openstack/nova,mahak/nova,openstack/nova,Juni... | nova/policies/virtual_interfaces.py | nova/policies/virtual_interfaces.py | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... | apache-2.0 | Python |
3c984a10d0665498f3d1d5f6abf72532cd9d58d5 | bump version | Infinidat/infi.conf,vmalloc/confetti | infi/conf/__version__.py | infi/conf/__version__.py | __version__ = "0.0.3"
| __version__ = "0.0.2"
| bsd-3-clause | Python |
7a952d605b629b9c8ef2c96c451ee4db4274d545 | Set max celery connections to 1. | SuddenDevs/SuddenDev,SuddenDevs/SuddenDev,SuddenDevs/SuddenDev,SuddenDevs/SuddenDev | suddendev/config.py | suddendev/config.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.urandom(32)
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
CELERY_BROKER_URL = os.environ['CLO... | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.urandom(32)
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
CELERY_BROKER_URL = os.environ['CLO... | mit | Python |
2927c6bc4c4e0c975a875d7eb5aa736b6abd66cd | bump version | matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse | synapse/__init__.py | synapse/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018-9 New Vector Ltd
#
# 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... | # -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018-9 New Vector Ltd
#
# 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... | apache-2.0 | Python |
5a23e9d7f412f040c12b1f48d258b83e9eeea5d3 | add crude error checking | jasonrhaas/ducking-adventure | mysite/skynet/views.py | mysite/skynet/views.py | from skynet.models import Messages
from skynet.serializers import SkynetSerializer
from rest_framework import generics
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import renderers
import sys
class SkynetList(... | from skynet.models import Messages
from skynet.serializers import SkynetSerializer
from rest_framework import generics
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import renderers
class SkynetList(generics.Li... | mit | Python |
68dfaecce5d7162201d4851752df185cc2827d7f | Bump version 0.1.1 | slok/prometheus-python,slok/prometheus-python | prometheus/__init__.py | prometheus/__init__.py | __title__ = 'prometheus'
__version__ = '0.1.1'
__author__ = 'Xabier Larrakoetxea'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2015 Xabier Larrakoetxea' | __title__ = 'prometheus'
__version__ = '0.1'
__author__ = 'Xabier Larrakoetxea'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2015 Xabier Larrakoetxea' | mit | Python |
f393b9056169ac86276c867c5b548b91f738b890 | fix sklearn_api | stanfordmlgroup/ngboost,stanfordmlgroup/ngboost | ngboost/sklearn_api.py | ngboost/sklearn_api.py | import numpy as np
from sklearn.base import ClassifierMixin, RegressorMixin
from ngboost.ngboost import NGBoost
from ngboost.distns import Bernoulli, Normal
class NGBRegressor(NGBoost, RegressorMixin):
"""NGBoost for regression with Sklean API."""
def __init__(self, *args, **kwargs):
super(NGBRegress... | import numpy as np
from sklearn.base import ClassifierMixin, RegressorMixin
from ngboost.ngboost import NGBoost
class NGBRegressor(NGBoost, RegressorMixin):
"""NGBoost for regression with Sklean API."""
pass
class NGBClassifier(NGBoost, ClassifierMixin):
"""NGBoost for classification with Sklean API.
... | apache-2.0 | Python |
c8f78f21a2855241c7e1eabfae6e837bd8f8c451 | Corrige migración | abertal/alpha,migonzalvar/alpha,abertal/alpha,migonzalvar/alpha,migonzalvar/alpha,abertal/alpha,abertal/alpha,migonzalvar/alpha | core/migrations/0012_membership_person.py | core/migrations/0012_membership_person.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-19 17:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0011_auto_20161219_1826'),
]
operations = ... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-19 17:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0011_auto_20161219_1826'),
]
operations = ... | bsd-3-clause | Python |
f284768b9d844967c1b8d7c06422fb28a3e88176 | update the streamup.com plugin | bastimeyer/streamlink,wlerin/streamlink,back-to/streamlink,streamlink/streamlink,ethanhlc/streamlink,ethanhlc/streamlink,fishscene/streamlink,chhe/streamlink,mmetak/streamlink,gravyboat/streamlink,beardypig/streamlink,fishscene/streamlink,melmorabity/streamlink,javiercantero/streamlink,chhe/streamlink,sbstp/streamlink,... | src/livestreamer/plugins/streamupcom.py | src/livestreamer/plugins/streamupcom.py | import re
from livestreamer.compat import urljoin
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream, HLSStream
_url_re = re.compile("http(s)?://(\w+\.)?streamup.com/(?P<channel>[^/?]+)")
_hls_manifest_re = re.compile('HlsManifestUrl:\\... | import re
from livestreamer.compat import urljoin
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream
RTMP_URL = "rtmp://{0}/app/{1}"
CHANNEL_DETAILS_URI = "https://api.streamup.com/v1/channels/{0}?access_token={1}"
REDIRECT_SERVICE_URI ... | bsd-2-clause | Python |
7feb26a6478e3a96da57f2825821285c17651545 | Add a missing newline | scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash | src/ocspdash/web/blueprints/__init__.py | src/ocspdash/web/blueprints/__init__.py | # -*- coding: utf-8 -*-
from .api import api
from .ui import ui
__all__ = [
'api',
'ui'
]
| # -*- coding: utf-8 -*-
from .api import api
from .ui import ui
__all__ = [
'api',
'ui'
] | mit | Python |
26e915e391d8554f6e775dd962d63e565066708c | add missing HTTP headers | bastimeyer/streamlink,bastimeyer/streamlink,streamlink/streamlink,streamlink/streamlink,chhe/streamlink,chhe/streamlink | src/streamlink/plugins/goltelevision.py | src/streamlink/plugins/goltelevision.py | """
$description Spanish live TV sports channel owned by Gol Network.
$url goltelevision.com
$type live
$region Spain
"""
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
@pluginmatcher(re.compile(
r"https?://(?:... | """
$description Spanish live TV sports channel owned by Gol Network.
$url goltelevision.com
$type live
$region Spain
"""
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
@pluginmatcher(re.compile(
r"https?://(?:... | bsd-2-clause | Python |
70a40f50e9988fadfbc42f236881c1e3e78f40f1 | Extend base settings for test settings. Don't use live cache backend for tests. | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit | icekit/project/settings/_test.py | icekit/project/settings/_test.py | from ._base import *
# DJANGO ######################################################################
ALLOWED_HOSTS = ('*', )
CSRF_COOKIE_SECURE = False # Don't require HTTPS for CSRF cookie
SESSION_COOKIE_SECURE = False # Don't require HTTPS for session cookie
DATABASES['default'].update({
'TEST': {
'... | from ._develop import *
# DJANGO ######################################################################
DATABASES['default'].update({
'TEST': {
'NAME': DATABASES['default']['NAME'],
# See: https://docs.djangoproject.com/en/1.7/ref/settings/#serialize
'SERIALIZE': False,
},
})
INSTALLE... | mit | Python |
44a6da5f6bc61924c234fc49e90f679b2d9b4c52 | Bump @graknlabs_benchmark | graknlabs/grakn,lolski/grakn,lolski/grakn,lolski/grakn,graknlabs/grakn,lolski/grakn,graknlabs/grakn,graknlabs/grakn | dependencies/graknlabs/dependencies.bzl | dependencies/graknlabs/dependencies.bzl | #
# GRAKN.AI - THE KNOWLEDGE GRAPH
# Copyright (C) 2018 Grakn Labs Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later v... | #
# GRAKN.AI - THE KNOWLEDGE GRAPH
# Copyright (C) 2018 Grakn Labs Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later v... | agpl-3.0 | Python |
c787d090adcfdaaf8d507fd5ca7d54b16d1670b9 | switch to staging_rack | agrc/surface-water-quality,agrc/surface-water-quality,agrc/surface-water-quality | scripts/surface_water_quality_pallet.py | scripts/surface_water_quality_pallet.py | #!/usr/bin/env python
# * coding: utf8 *
'''
surface_water_quality_pallet.py
A module that contains a pallet definition for the surface water quality project
'''
from forklift.models import Pallet
from os.path import join
class SurfaceWaterQualityPallet(Pallet):
def build(self, configuration):
self.arc... | #!/usr/bin/env python
# * coding: utf8 *
'''
surface_water_quality_pallet.py
A module that contains a pallet definition for the surface water quality project
'''
from forklift.models import Pallet
from os.path import join
class SurfaceWaterQualityPallet(Pallet):
def build(self, configuration):
self.arc... | mit | Python |
1e3693eb60edaea9698ba3c761a9964ed51b55a7 | bump version to 0.0.8 | aromanovich/jinja2schema,aromanovich/jinja2schema,aromanovich/jinja2schema | jinja2schema/__init__.py | jinja2schema/__init__.py | # coding: utf-8
"""
jinja2schema
============
Type inference for Jinja2 templates.
See http://jinja2schema.rtfd.org/ for documentation.
:copyright: (c) 2014 Anton Romanovich
:license: BSD
"""
__title__ = 'jinja2schema'
__author__ = 'Anton Romanovich'
__license__ = 'BSD'
__copyright__ = 'Copyright 2014 Anton Roman... | # coding: utf-8
"""
jinja2schema
============
Type inference for Jinja2 templates.
See http://jinja2schema.rtfd.org/ for documentation.
:copyright: (c) 2014 Anton Romanovich
:license: BSD
"""
__title__ = 'jinja2schema'
__author__ = 'Anton Romanovich'
__license__ = 'BSD'
__copyright__ = 'Copyright 2014 Anton Roman... | bsd-3-clause | Python |
4d9b2cecc592cc1075ddea6fcab980997434807f | remove include for admin | thelabnyc/django-activity-stream,justquick/django-activity-stream,justquick/django-activity-stream,pombredanne/django-activity-stream,thelabnyc/django-activity-stream,pombredanne/django-activity-stream | actstream/runtests/urls.py | actstream/runtests/urls.py | import os
from django.contrib import admin
from django.views.static import serve
try:
from django.urls import include, url
except ImportError:
from django.conf.urls import include, url
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^media/(?P<path>.*)$', serve,
{'document_root': os.pa... | import os
from django.contrib import admin
from django.views.static import serve
try:
from django.urls import include, url
except ImportError:
from django.conf.urls import include, url
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^media/(?P<path>.*)$', serve,
{'document_roo... | bsd-3-clause | Python |
a1b6735b49ddebb63e43012fd17a4e467cb0ab1b | Read all files in subdirectories and train one big model | mikedelong/aarhus | demos/matrix_factorization.py | demos/matrix_factorization.py | import cPickle as pickle
import json
import logging
import os
import numpy
import sklearn.feature_extraction.text as text
from sklearn import decomposition
logging.basicConfig(format='%(asctime)s : %(levelname)s :: %(message)s', level=logging.DEBUG)
with open('./matrix_factorization_input.json') as data_file:
dat... | import cPickle as pickle
import json
import logging
import os
import numpy
import sklearn.feature_extraction.text as text
from sklearn import decomposition
logging.basicConfig(format='%(asctime)s : %(levelname)s :: %(message)s', level=logging.DEBUG)
with open('./matrix_factorization_input.json') as data_file:
dat... | apache-2.0 | Python |
dc76e57883a96ba26d1845c7d0633027d4fcf658 | add login url | yueyongyue/saltshaker,yueyongyue/saltshaker,yueyongyue/saltshaker | saltshaker/urls.py | saltshaker/urls.py | """saltshaker URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-... | """saltshaker URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-... | apache-2.0 | Python |
0d3a1adaf2ea6a57a44aa22b9e5715b562712a41 | change test array | windkeepblow/FastDot,windkeepblow/FastDot | test_utils.py | test_utils.py | import time
import numpy as np
from numpy import float32 as REAL
from fast_utils import fast_dot
from fast_utils import fast_dot_blas
def main():
A = np.array(np.random.random((200,300000)),dtype=REAL)
B = np.array(np.random.random((300000,200)),dtype=REAL)
C = np.array(np.random.random((200,300000)),dtyp... | import time
import numpy as np
from numpy import float32 as REAL
from fast_utils import fast_dot
from fast_utils import fast_dot_blas
def main():
'''
A = np.array(np.random.random((2000,3000)),dtype=REAL)
B = np.array(np.random.random((3000,2000)),dtype=REAL)
C = np.array(np.random.random((2000,3000)... | mit | Python |
7a94badfecd929028fb61d365c799dbc01c2833c | add setUpClass and tearDownClass in tests.base | hrbonz/django-flexisettings | tests/base.py | tests/base.py | import unittest2
import sys
import os
import shutil
from django.core.management import call_command
class BaseTestCase(unittest2.TestCase):
test_folder = 't'
test_project = 'testProject'
envvar = 'FLEXI_WRAPPED_MODULE'
@classmethod
def setUpClass(cls):
# create test folder
os.mk... | import unittest2
import sys
import os
import shutil
from django.core.management import call_command
class BaseTestCase(unittest2.TestCase):
test_folder = 't'
test_project = 'testProject'
envvar = 'FLEXI_WRAPPED_MODULE'
def setUp(self):
# create test folder
os.mkdir(self.test_folder)... | bsd-3-clause | Python |
f56c3df433906d89d35762b423c995cd779a9211 | Fix the run step. | Kraus-Lab/active-enhancers,Kraus-Lab/active-enhancers,Kraus-Lab/active-enhancers | tests/base.py | tests/base.py | import subprocess
import pytest
def check_docker_output(tool):
command = 'docker run active-enhancers ' + tool
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = process.communicate()
return output
| import subprocess
import pytest
def check_docker_output(tool):
command = 'docker run --rm -ti active-enhancers ' + tool
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = process.communicate()
return output
| mit | Python |
dc5868414fc7c5ed22978f524463ffbef6d6d392 | Make cookies lazy to evaluate Give access to cookie Morsels | funkybob/antfarm | antfarm/request.py | antfarm/request.py |
from http.cookies import SimpleCookie
from urllib.parse import parse_qs
from .utils.functional import buffered_property
import logging
log = logging.getLogger(__name__)
DEFAULT_ENCODING = 'ISO-8859-1'
class Request(object):
def __init__(self, environ):
self.environ = environ
# XXX Handle encodi... |
from http.cookies import SimpleCookie
from urllib.parse import parse_qs
from .utils.functional import buffered_property
import logging
log = logging.getLogger(__name__)
DEFAULT_ENCODING = 'ISO-8859-1'
class Request(object):
def __init__(self, environ):
self.environ = environ
# XXX Handle encodi... | mit | Python |
88f02fbea11390ec8866c29912ed8beadc31e736 | Exclude preprints from queryset from account/register in the admin app. | adlius/osf.io,mfraezz/osf.io,cslzchen/osf.io,mfraezz/osf.io,baylee-d/osf.io,felliott/osf.io,mfraezz/osf.io,pattisdr/osf.io,brianjgeiger/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,pattisdr/osf.io,aaxelb/osf.io,adlius/osf.io,adlius/osf.io,felli... | admin/common_auth/forms.py | admin/common_auth/forms.py | from __future__ import absolute_import
from django import forms
from django.db.models import Q
from django.contrib.auth.models import Group
from osf.models import AdminProfile
class LoginForm(forms.Form):
email = forms.CharField(label=u'Email', required=True)
password = forms.CharField(
label=u'Pass... | from __future__ import absolute_import
from django import forms
from django.contrib.auth.models import Group
from osf.models import AdminProfile
class LoginForm(forms.Form):
email = forms.CharField(label=u'Email', required=True)
password = forms.CharField(
label=u'Password',
widget=forms.Pas... | apache-2.0 | Python |
378100d978a2bb91bb1e18ef81776ae0d5785a1c | Update Ascii.py | corpnewt/CorpBot.py,corpnewt/CorpBot.py | Cogs/Ascii.py | Cogs/Ascii.py | from discord.ext import commands
from Cogs import Utils, DisplayName, PickList, FuzzySearch, Message
import pyfiglet
def setup(bot):
# Add the bot
bot.add_cog(Ascii(bot))
class Ascii(commands.Cog):
def __init__(self, bot):
self.bot = bot
global Utils, DisplayName
Utils = self.bot.get_cog(... | from discord.ext import commands
from Cogs import Utils, DisplayName, PickList, FuzzySearch, Message
import pyfiglet
def setup(bot):
# Add the bot
bot.add_cog(Ascii(bot))
class Ascii(commands.Cog):
def __init__(self, bot):
self.bot = bot
global Utils, DisplayName
Utils = self.bot.get_cog(... | mit | Python |
756821bb357cb07d979b556dca2b9cd7324e8ff3 | add correct way to handle form usage | tassolom/twq-app,tassolom/twq-app,tassolom/twq-app,teamworkquality/twq-app,teamworkquality/twq-app,teamworkquality/twq-app,teamworkquality/twq-app,tassolom/twq-app | api/forms/views.py | api/forms/views.py | from django.core.exceptions import ObjectDoesNotExist
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Form
from .serializers import FormSerializer
class FormsView(APIView):
queryset = Form.objects.all()
def get(self, request, format=None, **kwargs):
... | from django.core.exceptions import ObjectDoesNotExist
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Form
class FormsView(APIView):
queryset = Form.objects.all()
def get(self, request, format=None, **kwargs):
if kwargs.get('form_id'):
... | mit | Python |
00eae4ad9eea6e161a4c6dee70f49f3946cf8916 | Fix database creation. | AKVorrat/ueberwachungspaket.at,AKVorrat/ueberwachungspaket.at,AKVorrat/ueberwachungspaket.at | ueberwachungspaket/__init__.py | ueberwachungspaket/__init__.py | from flask import Flask
from config import *
from database import init_db, db_session
from .representatives import Representatives
app = Flask(__name__)
app.config.from_pyfile("config.py")
app.config["TWILIO_NUMBERS"] = TWILIO_NUMBERS
reps = Representatives()
init_db()
if __name__ == "__main__":
app.run()
@app.t... | from flask import Flask
from config import *
from database import init_db, db_session
from .representatives import Representatives
app = Flask(__name__)
app.config.from_pyfile("config.py")
app.config["TWILIO_NUMBERS"] = TWILIO_NUMBERS
reps = Representatives()
if __name__ == "__main__":
app.run()
initdb()
@ap... | mit | Python |
9b1d616ac857902dcb25f0cccc1203435d4852cb | Bump to 0.3.0 | aio-libs/aiohttp_jinja2 | aiohttp_jinja2/__init__.py | aiohttp_jinja2/__init__.py | import asyncio
import functools
import jinja2
from aiohttp import web
__version__ = '0.3.0'
__all__ = ('setup', 'get_env', 'render_template', 'template')
APP_KEY = 'aiohttp_jinja2_environment'
def setup(app, *args, app_key=APP_KEY, **kwargs):
env = jinja2.Environment(*args, **kwargs)
app[app_key] = env
... | import asyncio
import functools
import jinja2
from aiohttp import web
__version__ = '0.2.1'
__all__ = ('setup', 'get_env', 'render_template', 'template')
APP_KEY = 'aiohttp_jinja2_environment'
def setup(app, *args, app_key=APP_KEY, **kwargs):
env = jinja2.Environment(*args, **kwargs)
app[app_key] = env
... | apache-2.0 | Python |
d12fecd2eb012862b8d7654c879dccf5ccce833f | Enable Python RSA backend as a fallback. | mpdavis/python-jose | jose/backends/__init__.py | jose/backends/__init__.py |
try:
from jose.backends.pycrypto_backend import RSAKey
except ImportError:
try:
from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey
except ImportError:
from jose.backends.rsa_backend import RSAKey
try:
from jose.backends.cryptography_backend import CryptographyE... |
try:
from jose.backends.pycrypto_backend import RSAKey
except ImportError:
from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey
try:
from jose.backends.cryptography_backend import CryptographyECKey as ECKey
except ImportError:
from jose.backends.ecdsa_backend import ECDSAECKey a... | mit | Python |
6e9deb97f951f0ce2ab4e7710f9cc79af6532dd1 | test connection | vmthunder/virtman | tests/demo.py | tests/demo.py | # -*- coding: utf-8 -*-
import os
import mock
import tests
from tests import test_demo
from tests.test_demo import FunDemo
from tests import base
from oslo_concurrency import processutils as putils
class MyDemo():
def show(self):
print 'funDemo'
class FakeDemo():
def show(self):
print 'FakeD... | # -*- coding: utf-8 -*-
import os
import mock
import tests
from tests import test_demo
from tests.test_demo import FunDemo
from tests import base
from oslo_concurrency import processutils as putils
class MyDemo():
def show(self):
print 'funDemo'
class FakeDemo():
def show(self):
print 'FakeD... | apache-2.0 | Python |
8d6c275b771c73c3b36b38c0511e40f029bb1cfd | Refactor tests | Hipo/university-domains-list | tests/main.py | tests/main.py | import json
import unittest
import requests
class DomainsTests(unittest.TestCase):
def test_json_is_valid(self):
with open("../world_universities_and_domains.json") as json_file:
valid_json = json.load(json_file)
for university in valid_json:
self.assertIn("name", university... | import json
import unittest
import requests
class DomainsTests(unittest.TestCase):
def test_json_is_valid(self):
with open("../world_universities_and_domains.json") as json_file:
valid_json = json.load(json_file)
for university in valid_json:
university["name"]
u... | mit | Python |
7d6559a450b52bae3e402bacb41fc1a7a4d77a77 | Make class declarations consistent. | HubbeKing/Hubbot_Twisted | IRCResponse.py | IRCResponse.py | from enumType import enum
ResponseType = enum('Say', 'Do', 'Notice', 'Raw')
class IRCResponse(object):
def __init__(self, messageType, response, target):
self.Type = messageType
try:
self.Response = unicode(response, 'utf-8')
except TypeError: # Already utf-8?
sel... | from enumType import enum
ResponseType = enum('Say', 'Do', 'Notice', 'Raw')
class IRCResponse:
def __init__(self, messageType, response, target):
self.Type = messageType
try:
self.Response = unicode(response, 'utf-8')
except TypeError: # Already utf-8?
self.Respon... | mit | Python |
3bdf9f01fa3e0454a3e28ab58886742a235f5215 | change config.py to use properties | googleinterns/cloud-monitoring-notification-delivery-integration-sample-code,googleinterns/cloud-monitoring-notification-delivery-integration-sample-code | config.py | config.py | # Copyright 2020 Google, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
fef337b4b161aaf30a9352dd5ae4200ec667c3c5 | Add ASSETS_AUTO_BUILD set to False and set LESS_BIN to location of lessc executable. | mbucknell/PubsWarehouse_UI,jkreft-usgs/PubsWarehouse_UI,ayan-usgs/PubsWarehouse_UI,USGS-CIDA/PubsWarehouse_UI,jkreft-usgs/PubsWarehouse_UI,mbucknell/PubsWarehouse_UI,USGS-CIDA/PubsWarehouse_UI,USGS-CIDA/PubsWarehouse_UI,mbucknell/PubsWarehouse_UI,jkreft-usgs/PubsWarehouse_UI,USGS-CIDA/PubsWarehouse_UI,mbucknell/PubsWar... | config.py | config.py | from datetime import timedelta
import os
import sys
PROJECT_HOME = os.path.dirname(__file__)
DEBUG = False
JS_DEBUG = False
SECRET_KEY = ''
VERIFY_CERT = True
COLLECT_STATIC_ROOT = 'static/'
COLLECT_STORAGE = 'flask.ext.collect.storage.file'
MAIL_USERNAME = 'PUBSV2_NO_REPLY'
PUB_URL = ''
LOOKUP_URL = ''
SUPERSEDES_U... | from datetime import timedelta
import sys
DEBUG = False
JS_DEBUG = False
SECRET_KEY = ''
VERIFY_CERT = True
COLLECT_STATIC_ROOT = 'static/'
COLLECT_STORAGE = 'flask.ext.collect.storage.file'
MAIL_USERNAME = 'PUBSV2_NO_REPLY'
PUB_URL = ''
LOOKUP_URL = ''
SUPERSEDES_URL = ''
BROWSE_URL = ''
BASE_SEARCH_URL = ''
BASE_C... | unlicense | Python |
d21b0898df0d745251735450bceebb341951e807 | Add SECRET_KEY | gordio/prom_test,gordio/prom_test | config.py | config.py | import os
from socket import gethostname
# Project relative -> absolute root path
_PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__)).replace('\\', '/')
# Development hostnames, auto-switch to DEBUG mode
DEV_HOSTS = ('Sun', )
# Administrator auth
LOGIN = 'demo'
PASSWORD = 'demo'
SECRET_KEY = "random.get()"... | import os
from socket import gethostname
# Project relative -> absolute root path
_PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__)).replace('\\', '/')
# Development hostnames, auto-switch to DEBUG mode
DEV_HOSTS = ('Sun', )
# Administrator auth
LOGIN = 'demo'
PASSWORD = 'demo'
# Auto switch to debug?
DEB... | mit | Python |
5017f2bbdc22bafc3173c28f7cb076bffdb94201 | move configs from secret file to config.py | who-emro/meerkat_hermes,meerkat-code/meerkat_hermes,who-emro/meerkat_hermes,meerkat-code/meerkat_hermes | config.py | config.py | """
config.py
Configuration and settings
"""
import os
def from_env(env_var, default):
"""
Gets value from envrionment variable or uses default
Args:
env_var: name of envrionment variable
default: the default value
"""
new = os.environ.get(env_var)
if new:
return new
... | """
config.py
Configuration and settings
"""
import os
def from_env(env_var, default):
"""
Gets value from envrionment variable or uses default
Args:
env_var: name of envrionment variable
default: the default value
"""
new = os.environ.get(env_var)
if new:
return new
... | mit | Python |
dd2643db72ee1bb8560319565244c02e7ab7b6d2 | Allow configuring Gunicorn workers via env. | sgmap/mes-aides-ui,sgmap/mes-aides-ui,sgmap/mes-aides-ui,sgmap/mes-aides-ui | config.py | config.py | import os
bind = os.getenv('OPENFISCA_BIND_HOST', '127.0.0.1:2000')
timeout = 60
workers = os.getenv('OPENFISCA_WORKERS', 4)
| import os
bind = os.getenv('OPENFISCA_BIND_HOST', '127.0.0.1:2000')
timeout = 60
workers = 4
| agpl-3.0 | Python |
2d004e4132b07801d5e3246d114850b0e546c69f | Add news data scraper | gyanesh-m/Sentiment-analysis-of-financial-news-data | scrape_with_bs4.py | scrape_with_bs4.py | import requests
from bs4 import BeautifulSoup
import pandas as pd
import datetime
import os
import _pickle as pickle
def tracker(filename):
f = open("links/tracker.data",'a+')
f.write(filename+"\n")
f.close()
def tracked():
return [line.rstrip('\n') for line in open('links/tracker.data')]
def list_files(path):... | import requests
from bs4 import BeautifulSoup
import pandas as pd
import datetime
import os
import _pickle as pickle
def tracker(filename):
f = open("links/tracker.data",'a+')
f.write(filename+"\n")
f.close()
def tracked():
return [line.rstrip('\n') for line in open('links/tracker.data')]
def list_files(path):
... | mit | Python |
518a66fa6c0fe8fe1cec87a679aa319553e2413e | Use new databse decorators for model management | CenterForOpenScience/scrapi,mehanig/scrapi,jeffreyliu3230/scrapi,mehanig/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,icereval/scrapi,erinspace/scrapi,alexgarciac/scrapi,erinspace/scrapi,felliott/scrapi,fabianvf/scrapi,fabianvf/scrapi,ostwald/scrapi | scrapi/requests.py | scrapi/requests.py | from __future__ import absolute_import
import json
import logging
import functools
from datetime import datetime
import requests
import cqlengine
from cqlengine import columns
from scrapi import database
from scrapi import settings
logger = logging.getLogger(__name__)
@database.register_model
class HarvesterRespo... | from __future__ import absolute_import
import json
import logging
import functools
from datetime import datetime
import requests
import cqlengine
from cqlengine import columns
from scrapi import database # noqa
from scrapi import settings
logger = logging.getLogger(__name__)
class HarvesterResponse(cqlengine.Mo... | apache-2.0 | Python |
6d2e9f69f809c270cee57de5f761f5d915524546 | add default model | viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker | config.py | config.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import string
from core._time import now
def get_config():
return { # OWASP Nettacker Default Configuration
"language": "en",
"verbose_level": 0,
"show_version": False,
"check_update": False,
"log_in_file": "resul... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import string
from core._time import now
def get_config():
return { # OWASP Nettacker Default Configuration
"language": "en",
"verbose_level": 0,
"show_version": False,
"check_update": False,
"log_in_file": "resul... | apache-2.0 | Python |
03d47a0011dc7841bffc2856d49ab3d43ba157f7 | check if cache/flash-dir is writable at configload | balrok/Flashget | config.py | config.py | import os
class config(object):
cache_dir = '/mnt/sda6/prog/flashget/cache'
flash_dir = '/mnt/sda6/prog/flashget/flash'
if not os.access(cache_dir, os.W_OK):
print "your cache-dir isn't writeable please edit config.py"
if not os.access(flash_dir, os.W_OK):
print "your flash-dir isn... |
class config(object):
cache_dir = '/mnt/sda6/prog/flashget/cache'
flash_dir = '/mnt/sda6/prog/flashget/flash'
# TODO: os.access(path, os.W_OK)
| mit | Python |
247e363c01e9ebbc98885f73d0d3bbc5f1699d6d | fix config for heroku | uhjish/4man,uhjish/4man,uhjish/4man,uhjish/4man | config.py | config.py | from datetime import timedelta
import os
pgurl = os.environ.get('HEROKU_POSTGRESQL_SILVER_URL')
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = ''
APP_NAME = 'ApplicationName'
SECRET_KEY = 'add_secret'
JWT_EXPIRATION_DELTA = timedelta(days=30)
JWT_AUTH_URL_RULE = '/api/v1/auth'
... | from datetime import timedelta
import os
pgurl = os.environ.get('HEROKU_POSTGRESQL_SILVER_URL')
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = ''
APP_NAME = 'ApplicationName'
SECRET_KEY = 'add_secret'
JWT_EXPIRATION_DELTA = timedelta(days=30)
JWT_AUTH_URL_RULE = '/api/v1/auth'
... | bsd-2-clause | Python |
882e140c98ffd28d4117e5a3247cb1aaa836b792 | Update config.py formatting | theDrake/asteroids-py | config.py | config.py | #------------------------------------------------------------------------------
# Filename: config.py
#
# Author: David C. Drake (http://davidcdrake.com)
#
# Description: Configuration file for an Asteroids game written in Python 2.7.
#----------------------------------------------------------------------------... | #-------------------------------------------------------------------------------
# Filename: config.py
#
# Author: David C. Drake (http://davidcdrake.com)
#
# Description: Configuration file for an Asteroids game. Developed using Python
# 2.7.
#------------------------------------------------------... | mit | Python |
a5b08698e22b8c46e2f6bbdda2b980dbd8d580ec | move up time for testing again | MinnPost/salesforce-stripe,MinnPost/salesforce-stripe,MinnPost/salesforce-stripe,texastribune/salesforce-stripe,texastribune/salesforce-stripe,texastribune/salesforce-stripe | config.py | config.py | from celery.schedules import crontab
# from datetime import timedelta
import os
def bool_env(val):
"""Replaces string based environment values with Python booleans"""
return True if os.environ.get(val, False) == 'True' else False
TIMEZONE = os.getenv('TIMEZONE', "US/Central")
#######
# Flask
#
FLASK_SECRET... | from celery.schedules import crontab
# from datetime import timedelta
import os
def bool_env(val):
"""Replaces string based environment values with Python booleans"""
return True if os.environ.get(val, False) == 'True' else False
TIMEZONE = os.getenv('TIMEZONE', "US/Central")
#######
# Flask
#
FLASK_SECRET... | mit | Python |
69e8798137ca63b78adf0c41582e89973d2ea129 | Work on model file handling | edx/ease,edx/ease | create.py | create.py | import os
import sys
base_path = os.path.dirname(__file__)
sys.path.append(base_path)
one_up_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))
sys.path.append(one_up_path)
import model_creator
import util_functions
def create(text,score,prompt_string,model_path):
model_path=util_functions.cre... | import os
import sys
base_path = os.path.dirname(__file__)
sys.path.append(base_path)
one_up_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))
sys.path.append(one_up_path)
import model_creator
import util_functions
def create(text,score,prompt_string,model_path):
model_path=util_functions.cre... | agpl-3.0 | Python |
98d0bebbf74c42676a373a3c77bd1bd192129995 | Update trace perf output with struct deserialize example | iovisor/bcc,tuxology/bcc,romain-intel/bcc,iovisor/bcc,mcaleavya/bcc,shodoco/bcc,zaafar/bcc,brendangregg/bcc,romain-intel/bcc,tuxology/bcc,mbudiu-bfn/bcc,mbudiu-bfn/bcc,romain-intel/bcc,zaafar/bcc,zaafar/bcc,brendangregg/bcc,zaafar/bcc,shodoco/bcc,mbudiu-bfn/bcc,mcaleavya/bcc,shodoco/bcc,iovisor/bcc,tuxology/bcc,tuxolog... | examples/tracing/trace_perf_output.py | examples/tracing/trace_perf_output.py | #!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
# This is an example of tracing an event and printing custom fields.
# run in project examples directory with:
# sudo ./trace_fields.py"
import atexit
from bcc import BPF
import ctypes as ct
class Da... | #!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
# This is an example of tracing an event and printing custom fields.
# run in project examples directory with:
# sudo ./trace_fields.py"
import atexit
from bcc import BPF
import ctypes
counter = 0
de... | apache-2.0 | Python |
3654c65fef4eb28ca67ec1a6a63d1b2eed1b50c2 | Update traitmenu example | frostidaho/dynmen | examples/traitmenu_people_n_places.py | examples/traitmenu_people_n_places.py | #!/usr/bin/env python
from __future__ import print_function
import logging
logger = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter(
'%(levelname)-8s %(name)-12s %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
# from f... | #!/usr/bin/env python
from __future__ import print_function
import logging
logger = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter(
'%(levelname)-8s %(name)-12s %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
# from f... | mit | Python |
37b28aed6002f56f4813436ca2ced1f6c98ab84a | Use MOOC title for list name and campaign name | p2pu/mechanical-mooc,p2pu/mechanical-mooc,p2pu/mechanical-mooc,p2pu/mechanical-mooc | sequence/models.py | sequence/models.py | from django.conf import settings
import db
from mailgun import api as mailgun_api
import datetime
def sequence_list_name( sequence_number ):
if settings.DEBUG:
return '{0}-{1}-all-test@{2}'.format(settings.MOOC_TITLE.replace(' ', '-').lower(), sequence_number, settings.EMAIL_DOMAIN)
return '{0}-{1}-... | from django.conf import settings
import db
from mailgun import api as mailgun_api
import datetime
def sequence_list_name( sequence_number ):
if settings.DEBUG:
return 'sequence-{0}-all-test@{1}'.format(sequence_number, settings.EMAIL_DOMAIN)
return 'sequence-{0}-all@{1}'.format(sequence_number, sett... | mit | Python |
fb0a639061f3bb092f0334564b3737da7d00bb8c | Add logger to providers | beeworking/voyant,beeworking/voyant,beeworking/voyant,beeworking/voyant | server/provider.py | server/provider.py | import logging
class Provider(object):
"""Base provider class"""
regions = {}
def __init__(self, key):
self.key = key
self.logger = logging.getLogger('Provider')
def create(self, region):
raise NotImplemented()
def start(self):
raise NotImplemented()
def sto... | class Provider(object):
"""Base provider class"""
regions = {}
def __init__(self, key):
self.key = key
def create(self, region):
raise NotImplemented()
def start(self):
raise NotImplemented()
def stop(self):
raise NotImplemented()
def destroy(self):
... | mit | Python |
fb787e678641c68271fbecebe88d0a9d5371615b | Update tests: "login" & "logout" are no longer on the Kenya homepage | mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,ken-muturi/pombola,patricmutwiri/pombola,patricmutwiri/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,geoffkilpin/pombola,ken-muturi/pombola,hzj123/56th,patricmutwiri/pombola,hzj123/56th,patricmutwiri/pombola,hzj123/56th,patricmutwiri/pombola,hz... | mzalendo/core/tests/test_accounts.py | mzalendo/core/tests/test_accounts.py | import re
from django.conf import settings
from django.core import mail
from django_webtest import WebTest
from core import models
from django.test.client import Client
from django.contrib.auth.models import User
class AccountTest(WebTest):
def setUp(self):
pass
def test_create_acco... | import re
from django.conf import settings
from django.core import mail
from django_webtest import WebTest
from core import models
from django.test.client import Client
from django.contrib.auth.models import User
class AccountTest(WebTest):
def setUp(self):
pass
def test_create_acco... | agpl-3.0 | Python |
23ca85e0911fa49bc2bd784e45ece42c047f830e | Bump to version 0.56.1 | nerevu/riko,nerevu/riko | riko/__init__.py | riko/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | mit | Python |
1187a9895d2ecada06780760c29fe3046eab0715 | Update ipc_lista1.5.py | any1m1c/ipc20161 | lista1/ipc_lista1.5.py | lista1/ipc_lista1.5.py | #ipc_lista1.5
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que converta metros para centímetros.
metros = input("Digite o valor em metros que deseja converter em centímetros: ")
centimetros = metros * 100
print "Esse valor equivale a:
| #ipc_lista1.5
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que converta metros para centímetros.
metros = input("Digite o valor em metros que deseja converter em centímetros: ")
centimetros = metros * 100
print "Esse valor equivale a
| apache-2.0 | Python |
78b9cd6ee72f59743f52d3a8c050d21d368b8ba6 | Update ipc_lista1.5.py | any1m1c/ipc20161 | lista1/ipc_lista1.5.py | lista1/ipc_lista1.5.py | #ipc_lista1.5
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que converta metros para centímetros.
metros = input("Digite o valor em metros que deseja converter em
| #ipc_lista1.5
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que converta metros para centímetros.
metros = input("Digite o valor em metros que deseja converter em
| apache-2.0 | Python |
431aed87ed9ba90178117fa738e8c57ee542b7cc | Update ipc_lista1.8.py | any1m1c/ipc20161 | lista1/ipc_lista1.8.py | lista1/ipc_lista1.8.py | #ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês.
#Calcule e mostre o total do seu salário no referido mês.
QntHora = input("Entre com o valor de seu rendimento por hora: ")
hT = input("E... | #ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês.
#Calcule e mostre o total do seu salário no referido mês.
QntHora = input("Entre com o valor de seu rendimento por hora: ")
hT = input("E... | apache-2.0 | Python |
ad3a7d9bef598d1cdb31cce2f23faf5aa1608c42 | Bump to 0.5.1 | dinoperovic/djangoshop-shopit,dinoperovic/djangoshop-shopit,dinoperovic/djangoshop-shopit,dinoperovic/djangoshop-shopit | shopit/__init__.py | shopit/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
Release logic:
1. Bump the __version__.
2. git add shopit/__init__.py
3. git commit -m 'Bump to <version>'
4. git push
5. Make sure all tests pass on https://travis-ci.com/dinoperovic/django-shopit
6. git tag <version>
7. git p... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
Release logic:
1. Bump the __version__.
2. git add shopit/__init__.py
3. git commit -m 'Bump to <version>'
4. git push
5. Make sure all tests pass on https://travis-ci.com/dinoperovic/django-shopit
6. git tag <version>
7. git p... | bsd-3-clause | Python |
0f1697c589de985c11c92cd9d74377023759875c | Make Elemental autodetect handle lib/ and lib64/ | davidsd/sdpb,davidsd/sdpb,davidsd/sdpb | elemental.py | elemental.py | #! /usr/bin/env python
# encoding: utf-8
def configure(conf):
def get_param(varname,default):
return getattr(Options.options,varname,'')or default
import os
# Find Elemental
if conf.options.elemental_dir:
if not conf.options.elemental_incdir:
conf.options.elemental_incdir=c... | #! /usr/bin/env python
# encoding: utf-8
def configure(conf):
def get_param(varname,default):
return getattr(Options.options,varname,'')or default
# Find Elemental
if conf.options.elemental_dir:
if not conf.options.elemental_incdir:
conf.options.elemental_incdir=conf.options.el... | mit | Python |
5c296010417b0a7c284d443b710f23edd747d3a6 | Fix demo setup.py. | bhy/cython-haoyu,bhy/cython-haoyu,bhy/cython-haoyu,bhy/cython-haoyu | Demos/setup.py | Demos/setup.py | import glob
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
try:
from numpy.distutils.misc_util import get_numpy_include_dirs
numpy_include_dirs = get_numpy_include_dirs()
except:
numpy_include_dirs = []
ext_modules=[
Extension("prime... | import glob
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
try:
from numpy.distutils.misc_util import get_numpy_include_dirs
numpy_include_dirs = get_numpy_include_dirs()
except:
numpy_include_dirs = []
ext_modules=[
Extension("prime... | apache-2.0 | Python |
fb159c1278b9a68e53223ebdf33a0764414f6301 | Fix 404 | otlet/JestemGraczem.pl,otlet/JestemGraczem.pl,otlet/JestemGraczem.pl | JestemGraczem/urls.py | JestemGraczem/urls.py | """JestemGraczem URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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='ho... | """JestemGraczem URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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='ho... | agpl-3.0 | Python |
6e23132432bdbfa654b9ba7aeaa77259205bb29f | Make the test for Elemental more thorough | davidsd/sdpb,davidsd/sdpb,davidsd/sdpb | elemental.py | elemental.py | #! /usr/bin/env python
# encoding: utf-8
def configure(conf):
def get_param(varname,default):
return getattr(Options.options,varname,'')or default
conf.load('compiler_cxx cxx14')
# Find Elemental
if conf.options.elemental_dir:
if not conf.options.elemental_incdir:
conf... | #! /usr/bin/env python
# encoding: utf-8
def configure(conf):
def get_param(varname,default):
return getattr(Options.options,varname,'')or default
conf.load('compiler_cxx cxx14')
# Find Elemental
if conf.options.elemental_dir:
if not conf.options.elemental_incdir:
conf... | mit | Python |
ac20902bad9623806010fbea6ea3e61fbb294664 | Add `MissingSettingException` | shoopio/shoop,suutari-ai/shoop,shoopio/shoop,shoopio/shoop,shawnadelic/shuup,hrayr-artunyan/shuup,hrayr-artunyan/shuup,hrayr-artunyan/shuup,suutari-ai/shoop,suutari/shoop,suutari/shoop,suutari-ai/shoop,shawnadelic/shuup,shawnadelic/shuup,suutari/shoop | shuup/core/excs.py | shuup/core/excs.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.utils.excs import Problem
class ImmutabilityError(ValueError):
... | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.utils.excs import Problem
class ImmutabilityError(ValueError):
... | agpl-3.0 | Python |
33da9e13ce941690f2a202c46254901ddbbd4155 | Add some debugging | ionrock/dadd,ionrock/dadd,ionrock/dadd,ionrock/dadd | dadd/worker/processes/__init__.py | dadd/worker/processes/__init__.py | import os
import shlex
from subprocess import call, STDOUT
from dadd.worker import app
from dadd.worker.utils import printf
from dadd import client
class WorkerProcess(object):
def __init__(self, spec, output, sess=None):
self.spec = spec
# TODO: Add auth from the global config
self.con... | import os
import shlex
from subprocess import call, STDOUT
from dadd.worker import app
from dadd.worker.utils import printf
from dadd import client
class WorkerProcess(object):
def __init__(self, spec, output, sess=None):
self.spec = spec
# TODO: Add auth from the global config
self.con... | bsd-3-clause | Python |
1a6d947022b7e9c7a44939dc69b2ec4ed9e13a5b | Fix a typo in dispatcher.py (main -> ip_whitelist). | modulexcite/catapult,catapult-project/catapult,catapult-project/catapult-csm,zeptonaut/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,catapult-project/catapult-csm,benschmaus/catapult,danbeam/catapult,catapult-project/catapult-csm,dstockwell/catapult,scottmcmaster/catapult,zeptonaut/catapult,catapult-project/... | dashboard/dashboard/dispatcher.py | dashboard/dashboard/dispatcher.py | """Dispatches requests to RequestHandler classes."""
import webapp2
from dashboard import ip_whitelist
from dashboard import main
_ROUTING_TABLE = [
('/ip_whitelist', ip_whitelist.IpWhitelistHandler),
('/', main.MainHandler),
]
app = webapp2.WSGIApplication(_ROUTING_TABLE, debug=True)
| """Dispatches requests to RequestHandler classes."""
import webapp2
from dashboard import ip_whitelist
from dashboard import main
_ROUTING_TABLE = [
('/ip_whitelist', main.IpWhitelistHandler),
('/', main.MainHandler),
]
app = webapp2.WSGIApplication(_ROUTING_TABLE, debug=True)
| bsd-3-clause | Python |
764c2952ac1dd18a213348d3a07097fc40ea9493 | Refresh after drawing menu. | mharriger/reui | reui/Menu.py | reui/Menu.py | from reui import Box
'''
A Box containing a vertical-scrolling menu. Generates event when a menu item is selected. Supports submenus.
'''
class Menu(Box.Box):
'''
Initialize Menu object
'''
items = [("Item 1",),("Item 2",),("Item 3",)]
def __init__(self, width, height, border_flags = 0):
... | from reui import Box
'''
A Box containing a vertical-scrolling menu. Generates event when a menu item is selected. Supports submenus.
'''
class Menu(Box.Box):
'''
Initialize Menu object
'''
items = [("Item 1",),("Item 2",),("Item 3",)]
def __init__(self, width, height, border_flags = 0):
... | mit | Python |
668a42a92aaa794a0fa2d0e269108217d7c32ab9 | fix example to be py3 compatible | mkomitee/wsgi-kerberos | example/example_application.py | example/example_application.py | #!/usr/bin/env python
import sys
def example(environ, start_response):
user = environ.get('REMOTE_USER', 'ANONYMOUS')
start_response('200 OK', [('Content-Type', 'text/plain')])
data = "Hello {}".format(user)
return [data.encode()]
if __name__ == '__main__':
from wsgiref.simple_server import make_s... | #!/usr/bin/env python
def example(environ, start_response):
user = environ.get('REMOTE_USER', 'ANONYMOUS')
start_response('200 OK', [('Content-Type', 'text/plain')])
return ["Hello, %s" % user]
if __name__ == '__main__':
from wsgiref.simple_server import make_server
from wsgi_kerberos import Kerbe... | bsd-2-clause | Python |
c7036d4aa7b02bb7691327cbaf4b31c74bb19349 | Add blank values support | abakar/django-whatever,kmmbvnr/django-any,abakar/django-whatever | django_any/fields.py | django_any/fields.py | #-*- coding: utf-8 -*-
"""
Values generators for common Django Fields
"""
import random
from decimal import Decimal
from django.db import models
import xunit
from multimethod import multimethod, multimethod_decorator
@multimethod_decorator
def any(function):
"""
Selection from field.choices
... | #-*- coding: utf-8 -*-
"""
Values generators for common Django Fields
"""
import random
from decimal import Decimal
from django.db import models
import xunit
from multimethod import multimethod, multimethod_decorator
@multimethod_decorator
def any(function):
"""
Selection from field.choices
... | mit | Python |
cb97f453284658da56d12ab696ef6b7d7991c727 | TEST - add test for value | jyeatman/dipy,beni55/dipy,samuelstjean/dipy,FrancoisRheaultUS/dipy,demianw/dipy,demianw/dipy,nilgoyyou/dipy,jyeatman/dipy,Messaoud-Boudjada/dipy,maurozucchelli/dipy,Messaoud-Boudjada/dipy,StongeEtienne/dipy,villalonreina/dipy,JohnGriffiths/dipy,rfdougherty/dipy,villalonreina/dipy,sinkpoint/dipy,JohnGriffiths/dipy,Franc... | dipy/io/tests/test_csareader.py | dipy/io/tests/test_csareader.py | """ Testing Siemens CSA header reader
"""
import os
from os.path import join as pjoin
import numpy as np
import dipy.io.csareader as csa
from nose.tools import assert_true, assert_false, \
assert_equal, assert_raises
from numpy.testing import assert_array_equal, assert_array_almost_equal
from dipy.testing imp... | """ Testing Siemens CSA header reader
"""
import os
from os.path import join as pjoin
import numpy as np
import dipy.io.csareader as csa
from nose.tools import assert_true, assert_false, \
assert_equal, assert_raises
from numpy.testing import assert_array_equal, assert_array_almost_equal
from dipy.testing imp... | bsd-3-clause | Python |
07374a55b70232120b92d92613b8bfede9631121 | Update blacklist | UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine | upol_search_engine/__main__.py | upol_search_engine/__main__.py | from datetime import datetime
from time import sleep
from upol_search_engine.upol_crawler import tasks
def main():
blacklist = """portal.upol.cz
stag.upol.cz
library.upol.cz
adfs.upol.cz
portalbeta.upol.cz
idp.upol.cz
famaplus.upol.cz
es.upol.cz
smlouvy.upol.cz
menza.upol.cz
... | from datetime import datetime
from time import sleep
from upol_search_engine.upol_crawler import tasks
def main():
blacklist = """portal.upol.cz
stag.upol.cz
library.upol.cz
adfs.upol.cz
portalbeta.upol.cz
idp.upol.cz
famaplus.upol.cz
es.upol.cz
smlouvy.upol.cz
menza.upol.cz
... | mit | Python |
a625fe202134831e2cbb430e33669ab8b846bccc | Add remove tasks | Code4SA/mma-dexter,Code4SA/mma-dexter,Code4SA/mma-dexter | dexter/config/celeryconfig.py | dexter/config/celeryconfig.py | from celery.schedules import crontab
# uses AWS creds from the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env variables
BROKER_URL = 'sqs://'
BROKER_TRANSPORT_OPTIONS = {
'region': 'eu-west-1',
'polling_interval': 15 * 1,
'queue_name_prefix': 'mma-dexter-',
'visibility_timeout': 3600*12,
}
# all ou... | from celery.schedules import crontab
# uses AWS creds from the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env variables
BROKER_URL = 'sqs://'
BROKER_TRANSPORT_OPTIONS = {
'region': 'eu-west-1',
'polling_interval': 15 * 1,
'queue_name_prefix': 'mma-dexter-',
'visibility_timeout': 3600*12,
}
# all ou... | apache-2.0 | Python |
bf8e5606dbcd0bf852205174099ae0d160ea7837 | Add a pause. | c00w/bitHopper,c00w/bitHopper | HTTPCloser.py | HTTPCloser.py | import time, gevent
seen = None
def used(url, http_pool):
__patch()
seen[(url, http_pool)] = time.time()
def __patch():
global seen
if seen is None:
seen = {}
gevent.spawn(clean)
def clean():
while True:
for k, last_seen in seen.items:
if time.time... | import time, gevent
seen = None
def used(url, http_pool):
__patch()
seen[(url, http_pool)] = time.time()
def __patch():
global seen
if seen is None:
seen = {}
gevent.spawn(clean)
def clean():
while True:
for k, last_seen in seen.items:
if time.time... | mit | Python |
4303e9569456093b3f9674071e12a55b36c2a280 | improve memcpy sample to compare synchronous and asynchronous DtoH / HtoD copies | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | examples/stream/cupy_memcpy.py | examples/stream/cupy_memcpy.py | # nvprof --print-gpu-trace python examples/stream/cupy_memcpy.py
import cupy
import numpy
pinned_memory_pool = cupy.cuda.PinnedMemoryPool()
cupy.cuda.set_pinned_memory_allocator(pinned_memory_pool.malloc)
def _pin_memory(array):
mem = cupy.cuda.alloc_pinned_memory(array.nbytes)
ret = numpy.frombuffer(mem, ar... | # nvprof --print-gpu-trace python examples/stream/cupy_memcpy.py
import cupy
import numpy
pinned_memory_pool = cupy.cuda.PinnedMemoryPool()
cupy.cuda.set_pinned_memory_allocator(pinned_memory_pool.malloc)
def _pin_memory(array):
mem = cupy.cuda.alloc_pinned_memory(array.nbytes)
ret = numpy.frombuffer(mem, ar... | mit | Python |
d395c0f895121e5c75820ff2b4fe502086b3fb01 | Bump version to 0.0.4 | Parsely/parsely_raw_data,Parsely/parsely_raw_data | parsely_raw_data/__init__.py | parsely_raw_data/__init__.py | __license__ = """
Copyright 2016 Parsely, 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 applicable law or agreed to in writ... | __license__ = """
Copyright 2016 Parsely, 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 applicable law or agreed to in writ... | apache-2.0 | Python |
78b52553129cbcd94b3e288eed0d60fe91e537aa | Append to sys.path in tests/test.py to find dask_condor libraries | matyasselmeci/dask_condor,matyasselmeci/dask_condor | tests/test.py | tests/test.py | #!/usr/bin/env python
from __future__ import print_function
import logging
import os
import sys
import unittest
import dask.array
import distributed
if __name__ == "__main__" and __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from tests import HTCondorClusterT... | #!/usr/bin/env python
from __future__ import print_function
import logging
import sys
import unittest
import dask.array
import distributed
sys.path.insert(0, '.')
from dask_condor.tests import HTCondorClusterTestCase
from dask_condor import HTCondorCluster
class TestDaskCondor(HTCondorClusterTestCase):
def te... | apache-2.0 | Python |
52d449592feeae436e1df85d9ddec7ef323647fa | Add some basic version information | sbaechler/feincms-elephantblog,michaelkuty/feincms-elephantblog,feincms/feincms-elephantblog,feincms/feincms-elephantblog,michaelkuty/feincms-elephantblog,joshuajonah/feincms-elephantblog,michaelkuty/feincms-elephantblog,matthiask/feincms-elephantblog,matthiask/feincms-elephantblog,matthiask/feincms-elephantblog,joshua... | elephantblog/__init__.py | elephantblog/__init__.py | VERSION = (0, 1, 0)
__version__ = '.'.join(map(str, VERSION))
| bsd-3-clause | Python | |
e11e751dcb6ea967f44503aad8d1c67f3e12826c | test threads | jonathanunderwood/python-lz4,python-lz4/python-lz4,jonathanunderwood/python-lz4,python-lz4/python-lz4 | tests/test.py | tests/test.py | import lz4
import sys
from multiprocessing.pool import ThreadPool
import unittest
import os
class TestLZ4(unittest.TestCase):
def test_random(self):
DATA = os.urandom(128 * 1024) # Read 128kb
self.assertEqual(DATA, lz4.loads(lz4.dumps(DATA)))
def test_threads(self):
data = [os.urandom(... | import lz4
import sys
import unittest
import os
class TestLZ4(unittest.TestCase):
def test_random(self):
DATA = os.urandom(128 * 1024) # Read 128kb
self.assertEqual(DATA, lz4.loads(lz4.dumps(DATA)))
if __name__ == '__main__':
unittest.main()
| bsd-3-clause | Python |
64dc354022f7c9eef73c0218ddf8df79e499c219 | expand sitetree utils to allow updating of programs and program_family permissions | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/sitetree_navigation/utils.py | accelerator/sitetree_navigation/utils.py | from accelerator.models import (
NavTreeItem,
UserRole,
Program,
ProgramFamily,
)
def create_items(tree, item_props_list, parent=None):
for item_props in item_props_list:
item_kwargs = dict(item_props)
item_kwargs.pop('user_roles', None)
NavTreeItem.objects.update_or_create... | from accelerator.models import (
NavTreeItem,
UserRole,
)
def create_items(tree, item_props_list, parent=None):
for item_props in item_props_list:
item_kwargs = dict(item_props)
item_kwargs.pop('user_roles', None)
NavTreeItem.objects.update_or_create(
tree=tree,
... | mit | Python |
63ca4ab4fc7237a9b32d82d73160b7f02c3ac133 | Add "config file was not fount" error handler | vv-p/jira-reports,vv-p/jira-reports | settings.py | settings.py | # coding: utf-8
import os.path
import yaml
import logging
CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'settings.yaml')
logger = logging.getLogger(__name__)
try:
with open(CONFIG_PATH, 'r') as fh:
config = yaml.load(fh)
except FileNotFoundError:
logging.error('Config file was not found: s... | # coding: utf-8
import os.path
import yaml
CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'settings.yaml')
with open(CONFIG_PATH, 'r') as fh:
config = yaml.load(fh)
# Jira settings
JIRA_URL = config['jira']['url']
JIRA_USER = config['jira']['user']
JIRA_PASS = config['jira']['pass']
JIRA_PROJECT = confi... | mit | Python |
7db99f61668060c09f3d5c9b638578013869f464 | add bot.start() to tests to ensure the (now single) eventloop is running | Halibot/halibot,Halibot/halibot | tests/util.py | tests/util.py | # Utilities to assist in writing tests
import halibot
import unittest
import logging
import time
def waitOrTimeout(timeout, condition):
for i in range(timeout):
if condition():
break
time.sleep(0.1)
else:
print("warning: timeout reached") # pragma: no cover
# Provides a unique bot in self.bot for every t... | # Utilities to assist in writing tests
import halibot
import unittest
import logging
import time
def waitOrTimeout(timeout, condition):
for i in range(timeout):
if condition():
break
time.sleep(0.1)
else:
print("warning: timeout reached") # pragma: no cover
# Provides a unique bot in self.bot for every t... | bsd-3-clause | Python |
14c9151d211ec30dd5e00b604bf670a4b957e71a | revert fallback name | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/laser/ethereum/transaction.py | mythril/laser/ethereum/transaction.py | import logging
from mythril.laser.ethereum.state import GlobalState, Environment, CalldataType
from mythril.laser.ethereum.cfg import Node, Edge, JumpType
from z3 import BitVec
class MessageCall:
""" Represents a call value transaction """
def __init__(self, callee_address):
"""
Constructor f... | import logging
from mythril.laser.ethereum.state import GlobalState, Environment, CalldataType
from mythril.laser.ethereum.cfg import Node, Edge, JumpType
from z3 import BitVec
class MessageCall:
""" Represents a call value transaction """
def __init__(self, callee_address):
"""
Constructor f... | mit | Python |
edae444521312c3a90ae71896122f23a9d6d2e61 | make capfd workarounds more specific, always use capsys under idle | xflr6/graphviz | run-tests.py | run-tests.py | #!/usr/bin/env python
# run-tests.py
import sys
import pytest
ARGS = [
#'--exitfirst',
#'--pdb',
]
if 'idlelib' in sys.modules or 'thonny' in sys.modules:
ARGS.extend(['--capture=sys', '--color=no'])
elif sys.version_info[0] == 2 and 'win_unicode_console' in sys.modules:
ARGS.append('--capture=sys')... | #!/usr/bin/env python
# run-tests.py
import sys
import platform
import pytest
ARGS = [
#'--exitfirst',
#'--pdb',
]
if 'idlelib' in sys.modules or 'thonny' in sys.modules:
ARGS.append('--color=no')
if platform.system().lower() == 'windows':
ARGS.append('--capture=sys')
pytest.main(ARGS + sys.argv[1... | mit | Python |
269a4062de8071551048a683fd05c63d31622aea | Update documentation | pa-pyrus/ircCommander | leader.py | leader.py | # vim:fileencoding=utf-8:ts=8:et:sw=4:sts=4:tw=79
from database import Session
from database.models import LeaderBoardEntry, UberAccount
from twisted.internet.defer import Deferred, succeed
from twisted.python import log
class LeaderParser(object):
"""
Retrieves most recently cached rankings for the specifi... | # vim:fileencoding=utf-8:ts=8:et:sw=4:sts=4:tw=79
from database import Session
from database.models import LeaderBoardEntry, UberAccount
from twisted.internet.defer import Deferred, succeed
from twisted.python import log
class LeaderParser(object):
"""
Retrieves most recently cached rankings for the specifi... | mit | Python |
0ad6cb338bbf10c48049d5649b5cd41eab0ed8d1 | Add optional authorizer parameter to session class and function. | praw-dev/prawcore | prawcore/sessions.py | prawcore/sessions.py | """prawcore.sessions: Provides prawcore.Session and prawcore.session."""
import requests
class Session(object):
"""The low-level connection interface to reddit's API."""
def __init__(self, authorizer=None):
"""Preprare the connection to reddit's API.
:param authorizer: An instance of :class... | """prawcore.sessions: Provides prawcore.Session and prawcore.session."""
import requests
class Session(object):
"""The low-level connection interface to reddit's API."""
def __init__(self):
"""Preprare the connection to reddit's API."""
self._session = requests.Session()
def __enter__(s... | bsd-2-clause | Python |
d6e2cf3354af9e4e7e15c486664f65fbd4525ce0 | test error handling a bit. | timo/zasim,timo/zasim | test/test_config.py | test/test_config.py | from __future__ import absolute_import
from zasim import config
import pytest
class TestConfig:
def test_random_1d(self):
a = config.RandomInitialConfiguration()
arr = a.generate((1000,))
assert not any(arr > 2)
assert not any(arr < 0)
assert any(arr == 0)
assert a... | from __future__ import absolute_import
from zasim import config
import pytest
class TestConfig:
def test_random_1d(self):
a = config.RandomInitialConfiguration()
arr = a.generate((1000,))
assert not any(arr > 2)
assert not any(arr < 0)
assert any(arr == 0)
assert a... | bsd-3-clause | Python |
0be901aa2a73ba0eeaaebb7b5069c3a2756bdd7e | Put debug back | OzuYatamutsu/klima,OzuYatamutsu/klima,OzuYatamutsu/klima | test/test_influx.py | test/test_influx.py | from influx.influx_adapter import *
from influx.datapoint_utils import *
from influx.measurement_strings import *
from unittest import TestCase, main
from time import sleep
class TestInflux(TestCase):
def setUp(self):
self.db = get_client()
self.temp_measurement_test_str = 'klima-test_temperature'... | from influx.influx_adapter import *
from influx.datapoint_utils import *
from influx.measurement_strings import *
from unittest import TestCase, main
from time import sleep
class TestInflux(TestCase):
def setUp(self):
self.db = get_client()
self.temp_measurement_test_str = 'klima-test_temperature'... | mit | Python |
3f1fdf4223e1fcc324d23848e3927294516f287a | Remove extraneous whitespace. | microserv/frontend,microserv/frontend,microserv/frontend | editor_backend/editor_backend/views.py | editor_backend/editor_backend/views.py | from django.http import HttpResponse
from django.template.loader import get_template
from django.template import Context
from django.shortcuts import render
import json
import requests
NODE_ADDR = "http://127.0.0.1:9001"
publish_base_url = "http://despina.128.no/publish"
def get_publisher_url():
r = requests.get(NOD... | from django.http import HttpResponse
from django.template.loader import get_template
from django.template import Context
from django.shortcuts import render
import json
import requests
NODE_ADDR = "http://127.0.0.1:9001"
publish_base_url = "http://despina.128.no/publish"
def get_publisher_url():
r = requests.get(NOD... | mit | Python |
1dbacf5e964aab52278868fdb0050925f1b51d7e | bump version to 0.19.0-dev in develop after branching release/0.18.0 | dannyroberts/eulxml,emory-libraries/eulxml | eulxml/__init__.py | eulxml/__init__.py | # file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
# ... | # file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
# ... | apache-2.0 | Python |
e841662f28629a4ed841be99e82d8d92a42b1820 | Remove newline at EOF (flake8) | smanolloff/SublimeLinter-contrib-elixirc,doitian/SublimeLinter-contrib-elixirc | linter.py | linter.py | """This module exports the elixirc plugin class."""
import tempfile
import os
from SublimeLinter.lint import Linter
class Elixirc(Linter):
"""Provides an interface to elixirc."""
syntax = ("elixir")
executable = "elixirc"
tempfile_suffix = "-"
regex = (
r"(?:\*+\s\(.+\) )?(?P<filename... | """This module exports the elixirc plugin class."""
import tempfile
import os
from SublimeLinter.lint import Linter
class Elixirc(Linter):
"""Provides an interface to elixirc."""
syntax = ("elixir")
executable = "elixirc"
tempfile_suffix = "-"
regex = (
r"(?:\*+\s\(.+\) )?(?P<filename... | mit | Python |
4fa8f7cb8a0592ed1d37efa20fd4a23d12e88713 | Update regexp due to changes in stylint | jackbrewer/SublimeLinter-contrib-stylint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""This module exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an inte... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
#
"""This module exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an in... | mit | Python |
982230c4d19bdda0b1e2f76cc731655e7fa4446f | Fix radar recruitment graph | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | api/radar_api/views/recruitment_stats.py | api/radar_api/views/recruitment_stats.py | from flask import request
from radar.cohorts import get_radar_cohort
from radar_api.serializers.recruitment_stats import DataPointsSerializer, CohortRecruitmentRequestSerializer, \
OrganisationRecruitmentRequestSerializer
from radar.models import CohortPatient, OrganisationPatient
from radar.recruitment_stats impo... | from flask import request
from radar.organisations import get_radar_organisation
from radar_api.serializers.recruitment_stats import DataPointsSerializer, CohortRecruitmentRequestSerializer, \
OrganisationRecruitmentRequestSerializer
from radar.models import CohortPatient, OrganisationPatient
from radar.recruitmen... | agpl-3.0 | Python |
cb60f8968c4dc772c60ebf9c5ca77bc950feed29 | fix linting of unsaved files (fix #18) | nirm03/SublimeLinter-clang,Optiligence/SublimeLinter-clang | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by nirm03
# Copyright (c) 2013 nirm03
#
# License: MIT
#
"""This module exports the Clang plugin class."""
import shlex
from SublimeLinter.lint import Linter, persist
import sublime
import os
import string
def get_pr... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by nirm03
# Copyright (c) 2013 nirm03
#
# License: MIT
#
"""This module exports the Clang plugin class."""
import shlex
from SublimeLinter.lint import Linter, persist
import sublime
import os
import string
def get_pr... | mit | Python |
4e779e736f9a79298c884ab5c34fc9032d9cdb3e | Move form calls to views.py. | rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python | fade/fade/views.py | fade/fade/views.py | #!/usr/bin/env python
"""
See LICENSE.txt file for copyright and license details.
"""
from flask import render_template, session, request, abort
from forms import FormLeveragedContracts
from ctypes import cdll
lcf = cdll.LoadLibrary('calculator_finance.so')
@app.route('/')
@app.route('/home')
@app.route('/home/')... | bsd-3-clause | Python | |
266e0976ee41e4dd1a9c543c84d422a8fba61230 | Check if epages6 settings are configured | ePages-rnd/SublimeLinter-contrib-tlec | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jonas Gratz
# Copyright (c) 2015 Jonas Gratz
#
# License: MIT
#
"""This module exports the Tlec plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
class Tlec(Linter):
"""Provides an in... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jonas Gratz
# Copyright (c) 2015 Jonas Gratz
#
# License: MIT
#
"""This module exports the Tlec plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
class Tlec(Linter):
"""Provides an in... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.