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 |
|---|---|---|---|---|---|---|---|---|
a2a4a8e4636051fa84a5cfbaf7f4ff796c59171a | Add build.parent to api response | wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes | changes/api/serializer/models/build.py | changes/api/serializer/models/build.py | from changes.api.serializer import Serializer, register
from changes.constants import Result, Status
from changes.models.build import Build
@register(Build)
class BuildSerializer(Serializer):
def serialize(self, instance):
# TODO(dcramer): this shouldnt be calculated at runtime
last_5_builds = lis... | from changes.api.serializer import Serializer, register
from changes.constants import Result, Status
from changes.models.build import Build
@register(Build)
class BuildSerializer(Serializer):
def serialize(self, instance):
# TODO(dcramer): this shouldnt be calculated at runtime
last_5_builds = lis... | apache-2.0 | Python |
2413a2042745a00b5a220a753aa46177065f3793 | bump version to 0.0.3 | Carreau/nose_warnings_filters | nose_warnings_filters/__init__.py | nose_warnings_filters/__init__.py |
"""
Nose plugin to add warnings filters (turn them into error) using nose.cfg file.
"""
__version__ = '0.0.3'
from nose.plugins import Plugin
import warnings
import sys
if sys.version_info < (3,):
import builtins
else:
builtins = __builtins__
class WarningFilter(Plugin):
def options(self, parser, en... |
"""
Nose plugin to add warnings filters (turn them into error) using nose.cfg file.
"""
__version__ = '0.0.2'
from nose.plugins import Plugin
import warnings
import sys
if sys.version_info < (3,):
import builtins
else:
builtins = __builtins__
class WarningFilter(Plugin):
def options(self, parser, en... | mit | Python |
f8685d8ca3d4d18ca5895d765185993ed2d5bcd7 | Fix citizen subscription to report : DatabaseError: current transaction is aborted, commands ignored until end of transaction block | IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet | django_fixmystreet/fixmystreet/views/reports/subscribers.py | django_fixmystreet/fixmystreet/views/reports/subscribers.py |
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.db import IntegrityError
from django_fixmystreet.fixmystreet.models import FMSUser
from django_fixmystreet.fixmystreet.models ... |
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.db import IntegrityError
from django_fixmystreet.fixmystreet.models import FMSUser
from django_fixmystreet.fixmystreet.models ... | agpl-3.0 | Python |
9a87f83c7060b66f7f95f2823db11b5e86a4fd67 | fix #210 | cnbeining/you-get,shanyimin/you-get,candlewill/you-get,dream1986/you-get,chares-zhang/you-get,qzane/you-get,FelixYin66/you-get,xyuanmu/you-get,lilydjwg/you-get,pastebt/you-get,smart-techs/you-get,pitatensai/you-get,XiWenRen/you-get,forin-xyz/you-get,Red54/you-get,rain1988/you-get,flwh/you-get,jindaxia/you-get,cnbeining... | src/you_get/downloader/dailymotion.py | src/you_get/downloader/dailymotion.py | #!/usr/bin/env python
__all__ = ['dailymotion_download']
from ..common import *
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
"""Downloads Dailymotion videos by URL.
"""
id = match1(url, r'/video/([^\?]+)')
embed_url = 'http://www.dailymotion.com/embed/video/%... | #!/usr/bin/env python
__all__ = ['dailymotion_download']
from ..common import *
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
html = parse.unquote(html).replace('\/', '/')
title = r1(r'meta property="og:title" content="([^"]+)"', html)
tit... | mit | Python |
9358060c648c0ee71498f173dcbf6fc839ba6ff8 | Update expected release date | CodeForPhilly/chime,CodeForPhilly/chime,CodeForPhilly/chime | src/penn_chime/constants.py | src/penn_chime/constants.py | """Constants."""
from datetime import date
"""
This reflects a date from which previously-run reports will no
longer match current results, indicating when users should
re-run their reports
"""
CHANGE_DATE = date(year=2020, month=4, day=8)
VERSION = 'v1.1.3'
DATE_FORMAT = "%b, %d" # see https://strftime.org
DOCS_UR... | """Constants."""
from datetime import date
"""
This reflects a date from which previously-run reports will no
longer match current results, indicating when users should
re-run their reports
"""
CHANGE_DATE = date(year=2020, month=4, day=6)
VERSION = 'v1.1.3'
DATE_FORMAT = "%b, %d" # see https://strftime.org
DOCS_UR... | mit | Python |
2de30c0acdbcc2560ee7c9c472df956441cb2bab | use better filterType | lilydjwg/nvchecker | nvchecker_source/vsmarketplace.py | nvchecker_source/vsmarketplace.py | # MIT licensed
# Copyright (c) 2013-2021 Th3Whit3Wolf <the.white.wolf.is.1337@gmail.com>, et al.
from nvchecker.api import (
VersionResult, Entry, AsyncCache, KeyManager,
TemporaryError, session, GetVersionError,
)
API_URL = 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery'
HEADERS = {
... | # MIT licensed
# Copyright (c) 2013-2021 Th3Whit3Wolf <the.white.wolf.is.1337@gmail.com>, et al.
from nvchecker.api import (
VersionResult, Entry, AsyncCache, KeyManager,
TemporaryError, session, GetVersionError,
)
API_URL = 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery'
HEADERS = {
... | mit | Python |
355372ff51a84c0a6d7d86c0ef1fb12def341436 | Add the score to Engine.chat return values | carrotflakes/invada | invada/engine.py | invada/engine.py | # -*- coding: utf-8 -*-
class Engine:
def __init__(self,
response_pairs,
knowledge={}):
self.response_pairs = response_pairs
self.knowledge = knowledge
def chat(self, user_utterance, context):
best_score = 0
best_response_pair = None
... | # -*- coding: utf-8 -*-
class Engine:
def __init__(self,
response_pairs,
knowledge={}):
self.response_pairs = response_pairs
self.knowledge = knowledge
def chat(self, user_utterance, context):
best_score = 0
best_response_pair = None
... | mit | Python |
ef29e402c58751a938cb11cee480ac4f4e31aef5 | Add warning | mkusz/invoke,pfmoore/invoke,pyinvoke/invoke,tyewang/invoke,frol/invoke,kejbaly2/invoke,singingwolfboy/invoke,sophacles/invoke,frol/invoke,mkusz/invoke,pyinvoke/invoke,kejbaly2/invoke,pfmoore/invoke,mattrobenolt/invoke,mattrobenolt/invoke | invoke/config.py | invoke/config.py | from .vendor.etcaetera.config import Config as EtcConfig
from .vendor.etcaetera.adapter import File
class Config(object):
"""
Invoke's primary configuration handling class.
See :doc:`/concepts/configuration` for details on the configuration system
this class implements, including the :ref:`configurat... | from .vendor.etcaetera.config import Config as EtcConfig
from .vendor.etcaetera.adapter import File
class Config(object):
"""
Invoke's primary configuration handling class.
See :doc:`/concepts/configuration` for details on the configuration system
this class implements, including the :ref:`configurat... | bsd-2-clause | Python |
aa459c2db7f1995fda486ef80c30b541ff1895d8 | Remove unnessesaty params | yshalenyk/openprocurement.ocds.export,yshalenyk/openprocurement.ocds.export,yshalenyk/ocds.export | ocds/databridge/contrib/client.py | ocds/databridge/contrib/client.py | import requests
import requests.adapters
from gevent.pool import Pool
import logging
logger = logging.getLogger(__name__)
class APIClient(object):
def __init__(self, api_key, api_host, api_version, **options):
self.base_url = "{}/api/{}".format(api_host, api_version)
self.session = requests.S... | import requests
import requests.adapters
from gevent.pool import Pool
import logging
logger = logging.getLogger(__name__)
class APIClient(object):
def __init__(self, api_key, api_host, api_version, **options):
self.base_url = "{}/api/{}".format(api_host, api_version)
self.session = requests.S... | apache-2.0 | Python |
48cb3e901917c598294c5431c66efe6ed56e465a | set DEBUG to true | zhemao/speakeasy,zhemao/speakeasy | wsgi/settings.py | wsgi/settings.py | import os
MONGO_HOST = os.getenv('OPENSHIFT_NOSQL_DB_HOST')
MONGO_PORT = os.getenv('OPENSHIFT_NOSQL_DB_PORT')
MONGO_USERNAME = os.getenv('OPENSHIFT_NOSQL_DB_USERNAME')
MONGO_PASSWORD = os.getenv('OPENSHIFT_NOSQL_DB_PASSWORD')
PRIV_KEY = os.getenv('OPENSHIFT_DATA_DIR') + '/server_private.pem'
PUB_KEY = os.getenv('OPEN... | import os
MONGO_HOST = os.getenv('OPENSHIFT_NOSQL_DB_HOST')
MONGO_PORT = os.getenv('OPENSHIFT_NOSQL_DB_PORT')
MONGO_USERNAME = os.getenv('OPENSHIFT_NOSQL_DB_USERNAME')
MONGO_PASSWORD = os.getenv('OPENSHIFT_NOSQL_DB_PASSWORD')
PRIV_KEY = os.getenv('OPENSHIFT_DATA_DIR') + '/server_private.pem'
PUB_KEY = os.getenv('OPEN... | bsd-2-clause | Python |
99f45d201b3513096bf8ebe7c877c836d8e6611a | Add logging to web client | sema/reliable-email | clients/web/rewebclient/rewebclient.py | clients/web/rewebclient/rewebclient.py |
from flask import Flask, request, render_template, flash, redirect, url_for
from reclient.client import ReClient, ReClientException
import os
import logging
DEBUG = False
SECRET_KEY = 'CHANGE ME'
app = Flask(__name__)
app.config.from_object(__name__)
app.config.from_envvar('REWEBCLIENT_SETTINGS', silent=True)
app.c... |
from flask import Flask, request, render_template, flash, redirect, url_for
from reclient.client import ReClient, ReClientException
import os
DEBUG = False
SECRET_KEY = 'CHANGE ME'
app = Flask(__name__)
app.config.from_object(__name__)
app.config.from_envvar('REWEBCLIENT_SETTINGS', silent=True)
app.config['RE_FRONT... | mit | Python |
bffb0c7fb099039afb444cfc641ae7b1978c59f8 | Exit main script when no observations found | jorisvandenbossche/ircelsos | ircelsos/main.py | ircelsos/main.py | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 07 23:11:39 2015
@author: Joris Van den Bossche
"""
from __future__ import print_function
def main():
import argparse
parser = argparse.ArgumentParser(
prog='ircelsos',
description='Download air quality data from the SOS of IRCEL - CELINE.')
... | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 07 23:11:39 2015
@author: Joris Van den Bossche
"""
from __future__ import print_function
def main():
import argparse
parser = argparse.ArgumentParser(
prog='ircelsos',
description='Download air quality data from the SOS of IRCEL - CELINE.')
... | bsd-2-clause | Python |
e85e1021ae20ebecb344c592f60f2ad6607a1db1 | refactor rename variables for clarity | pybuilder/pybuilder,esc/pybuilder,arcivanov/pybuilder,locolupo/pybuilder,locolupo/pybuilder,TimYi/pybuilder,elkingtonmcb/pybuilder,arcivanov/pybuilder,pybuilder/pybuilder,Danielweber7624/pybuilder,TimYi/pybuilder,elkingtonmcb/pybuilder,paolodedios/pybuilder,Designist/pybuilder,Danielweber7624/pybuilder,alex-dow/pybuild... | src/main/python/pybuilder/plugins/filter_resources_plugin.py | src/main/python/pybuilder/plugins/filter_resources_plugin.py | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2014 PyBuilder Team
#
# 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/l... | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2014 PyBuilder Team
#
# 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/l... | apache-2.0 | Python |
ab49b0be58975156f96bd5340da8d06f5b8626a5 | Change to batch_size = 64 | tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples | tensorflow_examples/models/nmt_with_attention/distributed_test.py | tensorflow_examples/models/nmt_with_attention/distributed_test.py | # Copyright 2019 The TensorFlow Authors. 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 required by applica... | # Copyright 2019 The TensorFlow Authors. 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 required by applica... | apache-2.0 | Python |
93ad5396bb1d574c86a6b3323199e75fe3bb34f4 | implement protection for non existing directories | morgenst/PyAnalysisTools,morgenst/PyAnalysisTools,morgenst/PyAnalysisTools | PyAnalysisTools/base/ShellUtils.py | PyAnalysisTools/base/ShellUtils.py | import shutil
import os
import subprocess
def make_dirs(path):
path = os.path.expanduser(path)
if os.path.exists(path):
return
try:
os.makedirs(path)
except OSError as e:
raise OSError
def resolve_path_from_symbolic_links(symbolic_link, relative_path):
def is_symbolic_lin... | import shutil
import os
import subprocess
def make_dirs(path):
path = os.path.expanduser(path)
if os.path.exists(path):
return
try:
os.makedirs(path)
except OSError as e:
raise OSError
def resolve_path_from_symbolic_links(symbolic_link, relative_path):
def is_symbolic_lin... | mit | Python |
632f70d64bac45365974db834a3a6ddcb16e13ad | Add GuardianModelMixin in users/models.py | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | feder/users/models.py | feder/users/models.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import AbstractUser
from django.utils.encoding import python_2_unicode_compatible
from guardian.mixins import GuardianUserMixin
@python_2_unicode_compatible
class User(GuardianUserMixin, AbstractUser):
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import AbstractUser
from django.utils.encoding import python_2_unicode_compatible
# from django.db import models
# from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
cla... | mit | Python |
81b2519f575d35d2f1b735bcaef1901539ee06fa | refactor mgmt cmd update-toplist to use just CouchDB | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/directory/management/commands/update-toplist.py | mygpo/directory/management/commands/update-toplist.py | from datetime import datetime
from django.core.management.base import BaseCommand
from mygpo.core.models import Podcast, SubscriberData
from mygpo.users.models import PodcastUserState
from mygpo.utils import progress
from mygpo.decorators import repeat_on_conflict
class Command(BaseCommand):
def handle(self, *... | from datetime import datetime
from django.core.management.base import BaseCommand
from couchdbkit import ResourceConflict
from mygpo.core.models import Podcast, SubscriberData
from mygpo.users.models import PodcastUserState
from mygpo.utils import progress, multi_request_view
from mygpo.decorators import repeat_on_c... | agpl-3.0 | Python |
48e09e446943b695cc7208bc2a7cad7e53437957 | Bump to 0.1.1 since I apparently pushed 0.1.0 at some point =/ | bitprophet/botox | botox/__init__.py | botox/__init__.py | __version__ = "0.1.1"
| __version__ = "0.1.0"
| bsd-2-clause | Python |
68b1b9d824da9225b8b568348a56d5770195d8f8 | Fix method with classmethod | edx/edx-ora2,edx/edx-ora2,EDUlib/edx-ora2,edx/edx-ora2,edx/edx-ora2,EDUlib/edx-ora2,EDUlib/edx-ora2,EDUlib/edx-ora2 | openassessment/xblock/openassesment_template_mixin.py | openassessment/xblock/openassesment_template_mixin.py | class OpenAssessmentTemplatesMixin(object):
"""
This helps to get templates for different type of assessment that is
offered.
"""
@classmethod
def templates(cls):
"""
Returns a list of dictionary field: value objects that describe possible templates.
VALID_ASSESSMENT_TY... | class OpenAssessmentTemplatesMixin(object):
"""
This helps to get templates for different type of assessment that is
offered.
"""
@classmethod
def templates(cls):
"""
Returns a list of dictionary field: value objects that describe possible templates.
VALID_ASSESSMENT_TY... | agpl-3.0 | Python |
69582dd80518ccc29fc8de9cf5bff54caf62468b | Truncate to exact length | BuildingLink/sentry,jokey2k/sentry,argonemyth/sentry,hongliang5623/sentry,1tush/sentry,songyi199111/sentry,BuildingLink/sentry,zenefits/sentry,felixbuenemann/sentry,mvaled/sentry,drcapulet/sentry,boneyao/sentry,kevinlondon/sentry,jean/sentry,beni55/sentry,gg7/sentry,zenefits/sentry,hongliang5623/sentry,kevinastone/sent... | src/sentry/utils/strings.py | src/sentry/utils/strings.py | """
sentry.utils.strings
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import base64
import zlib
def truncatechars(value, arg):
"""
Truncates a string after a certain number of chars.
Argument: Number of ... | """
sentry.utils.strings
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import base64
import zlib
def truncatechars(value, arg):
"""
Truncates a string after a certain number of chars.
Argument: Number of ... | bsd-3-clause | Python |
a8fb92840ff487c61564175efbf637fec538b480 | Add signup view to fix error | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | features/gestalten/urls.py | features/gestalten/urls.py | from allauth.socialaccount import views as socialaccount_views
from allauth.socialaccount.providers.facebook import views as facebook_views
from django.conf.urls import url
from . import views
urlpatterns = [
url(
r'^stadt/gestalten/$',
views.List.as_view(),
name='gestalten'),
url(
... | from allauth.socialaccount import views as socialaccount_views
from allauth.socialaccount.providers.facebook import views as facebook_views
from django.conf.urls import url
from . import views
urlpatterns = [
url(
r'^stadt/gestalten/$',
views.List.as_view(),
name='gestalten'),
url(
... | agpl-3.0 | Python |
1d52996a88eb5aed643fe61ee959bd88373401b3 | Throw a linebreak in there upon completion | jhaals/filebutler-upload | filebutler_upload/utils.py | filebutler_upload/utils.py | from datetime import datetime, timedelta
import sys
class ProgressBar(object):
def __init__(self, filename, fmt):
self.filename = filename
self.fmt = fmt
self.progress = 0
self.total = 0
self.time_started = datetime.now()
self.time_updated = self.time_started
d... | from datetime import datetime, timedelta
import sys
class ProgressBar(object):
def __init__(self, filename, fmt):
self.filename = filename
self.fmt = fmt
self.progress = 0
self.total = 0
self.time_started = datetime.now()
self.time_updated = self.time_started
d... | bsd-3-clause | Python |
07f96a22afe2d010809d03077d9cdd5ecb43d017 | Update data source unique name migration to support another name of constraint | akariv/redash,chriszs/redash,jmvasquez/redashtest,pubnative/redash,akariv/redash,amino-data/redash,ninneko/redash,ninneko/redash,denisov-vlad/redash,EverlyWell/redash,ninneko/redash,amino-data/redash,44px/redash,moritz9/redash,guaguadev/redash,moritz9/redash,guaguadev/redash,chriszs/redash,pubnative/redash,44px/redash,... | migrations/0020_change_ds_name_to_non_uniqe.py | migrations/0020_change_ds_name_to_non_uniqe.py | from redash.models import db
import peewee
from playhouse.migrate import PostgresqlMigrator, migrate
if __name__ == '__main__':
migrator = PostgresqlMigrator(db.database)
with db.database.transaction():
# Change the uniqueness constraint on data source name to be (org, name):
success = False
... | from redash.models import db
from playhouse.migrate import PostgresqlMigrator, migrate
if __name__ == '__main__':
migrator = PostgresqlMigrator(db.database)
with db.database.transaction():
# Change the uniqueness constraint on data source name to be (org, name):
db.database.execute_sql("ALTER ... | bsd-2-clause | Python |
bc5621afa044a486ef7514e1654224102b3cfd54 | Rename chunk list | WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder | RecordingApp/app/src/scripts/get_chunks.py | RecordingApp/app/src/scripts/get_chunks.py | """ Script to generate a json file containing book name, number of
chapters, number of chunks """
import json
import urllib.request
import re
RESULT_JSON_NAME = "chunks.json"
with open("catalog.json") as file:
DATA = json.load(file)
OUTPUT = []
#skip obs for now, loop over all books
for x in range(1, 67):
... | """ Script to generate a json file containing book name, number of
chapters, number of chunks """
import json
import urllib.request
import re
RESULT_JSON_NAME = "chunks.json"
with open("catalog.json") as file:
DATA = json.load(file)
OUTPUT = []
#skip obs for now, loop over all books
for x in range(1, 67):
... | mit | Python |
d949c21c4b0a54a9a697a07bf12e22a98dc59ff1 | Add `attach` method so we can wrap apps like WSGI middleware | bradwright/flask-mustachejs,bradwright/flask-mustachejs,bradleywright/flask-mustachejs,bradleywright/flask-mustachejs | flask_mustache/__init__.py | flask_mustache/__init__.py | # flask-mustache Flask plugin
import os
from jinja2 import Template
from flask import current_app, Blueprint
__all__ = ('FlaskMustache',)
mustache_app = Blueprint('mustache', __name__, static_folder='static')
class FlaskMustache(object):
"Wrapper to inject Mustache stuff into Flask"
def __init__(self, app=... | # flask-mustache Flask plugin
import os
from jinja2 import Template
from flask import current_app, Blueprint
__all__ = ('FlaskMustache',)
mustache_app = Blueprint('mustache', __name__, static_folder='static')
class FlaskMustache(object):
"Wrapper to inject Mustache stuff into Flask"
def __init__(self, app=... | bsd-3-clause | Python |
c1c5fbdc2d7cda67668df38d91a2becf546fa852 | Update transform config in development | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | backdrop/transformers/config/development.py | backdrop/transformers/config/development.py | TRANSFORMER_AMQP_URL = 'amqp://transformer:notarealpw@localhost:5672/%2Ftransformations'
STAGECRAFT_URL = 'http://localhost:3103'
STAGECRAFT_OAUTH_TOKEN = 'development-oauth-access-token'
BACKDROP_READ_URL = 'http://backdrop-read.dev.gov.uk/data'
BACKDROP_WRITE_URL = 'http://backdrop-write.dev.gov.uk/data'
| TRANSFORMER_AMQP_URL = 'amqp://transformer:notarealpw@localhost:5672/%2Ftransformations'
STAGECRAFT_URL = 'http://localhost:3204'
STAGECRAFT_OAUTH_TOKEN = 'development-oauth-access-token'
BACKDROP_READ_URL = 'http://localhost:3038/data'
BACKDROP_WRITE_URL = 'http://localhost:3039/data'
| mit | Python |
13c74e663dd511f53e6c0b1bb37b5baa12bba016 | add tokens for fco transaction buckets | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | backdrop/write/config/development_tokens.py | backdrop/write/config/development_tokens.py | TOKENS = {
'_foo_bucket': '_foo_bucket-bearer-token',
'bucket': 'bucket-bearer-token',
'foo': 'foo-bearer-token',
'foo_bucket': 'foo_bucket-bearer-token',
'licensing': 'licensing-bearer-token',
'licensing_journey': 'licensing_journey-bearer-token',
'pay_legalisation_post_journey': 'pay_legal... | TOKENS = {
'_foo_bucket': '_foo_bucket-bearer-token',
'bucket': 'bucket-bearer-token',
'foo': 'foo-bearer-token',
'foo_bucket': 'foo_bucket-bearer-token',
'licensing': 'licensing-bearer-token',
'licensing_journey': 'licensing_journey-bearer-token'
}
| mit | Python |
7b27423bef813befe1bb9dd5cb14843d847bff42 | Fix mailhog settings | vintasoftware/django-react-boilerplate,vintasoftware/django-react-boilerplate,vintasoftware/django-react-boilerplate,vintasoftware/django-react-boilerplate | backend/project_name/settings/local_base.py | backend/project_name/settings/local_base.py | from .base import * # noqa
DEBUG = True
HOST = "http://localhost:8000"
SECRET_KEY = "secret"
DATABASES = {
"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": base_dir_join("db.sqlite3"),}
}
STATIC_ROOT = base_dir_join("staticfiles")
STATIC_URL = "/static/"
MEDIA_ROOT = base_dir_join("mediafiles")
M... | from .base import * # noqa
DEBUG = True
HOST = "http://localhost:8000"
SECRET_KEY = "secret"
DATABASES = {
"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": base_dir_join("db.sqlite3"),}
}
STATIC_ROOT = base_dir_join("staticfiles")
STATIC_URL = "/static/"
MEDIA_ROOT = base_dir_join("mediafiles")
M... | mit | Python |
bce815a12a3ce18d23644c08beda5f97271e559e | update token | datawire/forge,sipplified/forge,datawire/forge,sipplified/forge,sipplified/forge,datawire/forge | forge/tests/test_github.py | forge/tests/test_github.py | # Copyright 2017 datawire. 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 required by applicable law or agr... | # Copyright 2017 datawire. 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 required by applicable law or agr... | apache-2.0 | Python |
307e0c4bbd7e76c9a8becf39df539413fef20e60 | Add line magic %cpp | gbitzes/root,CristinaCristescu/root,abhinavmoudgil95/root,CristinaCristescu/root,lgiommi/root,davidlt/root,mattkretz/root,krafczyk/root,gganis/root,satyarth934/root,zzxuanyuan/root,agarciamontoro/root,vukasinmilosevic/root,lgiommi/root,BerserkerTroll/root,davidlt/root,veprbl/root,sirinath/root,gbitzes/root,nilqed/root,... | bindings/pyroot/ROOTaaS/iPyROOT/cppmagic.py | bindings/pyroot/ROOTaaS/iPyROOT/cppmagic.py | import IPython.core.magic as ipym
import ROOT
import utils
@ipym.magics_class
class CppMagics(ipym.Magics):
@ipym.line_cell_magic
def cpp(self, line, cell=None):
"""Inject into root."""
if cell is None: # this is a line magic
utils.processCppCode(line)
else:
util... | import IPython.core.magic as ipym
import ROOT
import utils
@ipym.magics_class
class CppMagics(ipym.Magics):
@ipym.cell_magic
def cpp(self, line, cell=None):
"""Inject into root."""
if cell:
utils.processCppCode(cell)
def load_ipython_extension(ipython):
ipython.register_magics(... | lgpl-2.1 | Python |
082cc2590f7b263e37fe214e3c4e6fc86039327a | correct pyunit | madmax983/h2o-3,spennihana/h2o-3,weaver-viii/h2o-3,h2oai/h2o-3,junwucs/h2o-3,weaver-viii/h2o-3,h2oai/h2o-dev,datachand/h2o-3,PawarPawan/h2o-v3,PawarPawan/h2o-v3,kyoren/https-github.com-h2oai-h2o-3,pchmieli/h2o-3,brightchen/h2o-3,spennihana/h2o-3,mrgloom/h2o-3,michalkurka/h2o-3,nilbody/h2o-3,mrgloom/h2o-3,datachand/h2o-... | h2o-py/tests/testdir_algos/deeplearning/pyunit_tweedie_weightsDeeplearning.py | h2o-py/tests/testdir_algos/deeplearning/pyunit_tweedie_weightsDeeplearning.py | import sys
sys.path.insert(1, "../../../")
import h2o
def tweedie_weights(ip,port):
data = h2o.import_frame(h2o.locate("smalldata/glm_test/cancar_logIn.csv"))
data["C1M3"] = (data["Class"] == 1 and data["Merit"] == 3).asfactor()
data["C3M3"] = (data["Class"] == 3 and data["Merit"] == 3).asfactor()
dat... | import sys
sys.path.insert(1, "../../../")
import h2o
#def tweedie_weights(ip,port):
h2o.init()
data = h2o.import_frame(h2o.locate("smalldata/glm_test/cancar_logIn.csv"))
data["C1M3"] = (data["Class"] == 1 and data["Merit"] == 3).asfactor()
data["C3M3"] = (data["Class"] == 3 and data["Merit"] == 3).asfactor()
data["C... | apache-2.0 | Python |
169dda227f85f77ac52a4295e8fb7acd1b3184f5 | Make byte-separator mandatory in MAC addresses | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | core/observables/mac_address.py | core/observables/mac_address.py | from __future__ import unicode_literals
import re
from core.observables import Observable
class MacAddress(Observable):
regex = r'(?P<search>(([0-9A-Fa-f]{1,2}[.:-]){5,7}([0-9A-Fa-f]{1,2})))'
exclude_fields = Observable.exclude_fields
DISPLAY_FIELDS = Observable.DISPLAY_FIELDS
@classmethod
de... | from __future__ import unicode_literals
import re
from core.observables import Observable
class MacAddress(Observable):
regex = r'(?P<search>(([0-9A-Fa-f]{1,2}[.:-]?){5,7}([0-9A-Fa-f]{1,2})))'
exclude_fields = Observable.exclude_fields
DISPLAY_FIELDS = Observable.DISPLAY_FIELDS
@classmethod
d... | apache-2.0 | Python |
a28f8fe4427c12c2523b16903325d0362b53123e | Drop version dependency | bsmr-misc-forks/letsencrypt,jtl999/certbot,wteiken/letsencrypt,dietsche/letsencrypt,jtl999/certbot,mitnk/letsencrypt,brentdax/letsencrypt,stweil/letsencrypt,thanatos/lets-encrypt-preview,bsmr-misc-forks/letsencrypt,dietsche/letsencrypt,jsha/letsencrypt,kuba/letsencrypt,DavidGarciaCat/letsencrypt,mitnk/letsencrypt,TheBo... | acme/setup.py | acme/setup.py | import sys
from setuptools import setup
from setuptools import find_packages
version = '0.2.0.dev0'
install_requires = [
# load_pem_private/public_key (>=0.6)
# rsa_recover_prime_factors (>=0.8)
'cryptography>=0.8',
'ndg-httpsclient', # urllib3 InsecurePlatformWarning (#304)
'pyasn1', # urllib... | import sys
from setuptools import setup
from setuptools import find_packages
version = '0.2.0.dev0'
install_requires = [
# load_pem_private/public_key (>=0.6)
# rsa_recover_prime_factors (>=0.8)
'cryptography>=0.8',
'ndg-httpsclient', # urllib3 InsecurePlatformWarning (#304)
'pyasn1', # urllib... | apache-2.0 | Python |
b7c1c4bca84031cdb115d38d30e86cded02f1fdd | Expand scope for pylint: disable=not-supported-yet. | deepmind/acme,deepmind/acme | acme/types.py | acme/types.py | # python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | # python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | apache-2.0 | Python |
e7a632718f379fb1ede70d1086f55279e4251e11 | fix geotag access - not an obj | spring-week-topos/cinder-week,spring-week-topos/cinder-week | cinder/scheduler/filters/geo_tags_filter.py | cinder/scheduler/filters/geo_tags_filter.py | # Copyright (c) 2014 Intel
# 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 required by app... | # Copyright (c) 2014 Intel
# 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 required by app... | apache-2.0 | Python |
16ab5dcf1f6e52f89435adccdfa7021ce24e29a8 | fix formatting via make fix | HazyResearch/metal,HazyResearch/metal | tests/metal/contrib/test_baselines.py | tests/metal/contrib/test_baselines.py | import numpy as np
import torch
from metal.end_model import SparseLogisticRegression
def test_sparselogreg(self):
"""Confirm sparse logreg can overfit, works on padded data"""
F = 1000 # total number of possible features
N = 50 # number of data points
S = [10, 100] # range of features per data poi... |
import numpy as np
import torch
from metal.end_model import SparseLogisticRegression
def test_sparselogreg(self):
"""Confirm sparse logreg can overfit, works on padded data"""
F = 1000 # total number of possible features
N = 50 # number of data points
S = [10, 100] # range of features per data po... | apache-2.0 | Python |
0341c38dff42ae5e86353c6d53c2d30aabca555e | update py-jupyter-client and new setuptools dependency (#13425) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-jupyter-client/package.py | var/spack/repos/builtin/packages/py-jupyter-client/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJupyterClient(PythonPackage):
"""Jupyter protocol client APIs"""
homepage = "https:... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJupyterClient(PythonPackage):
"""Jupyter protocol client APIs"""
homepage = "https:... | lgpl-2.1 | Python |
bbe835c8aa561d8db58e116f0e55a5b19c4f9ca4 | Fix sitemap memory consumption during generation | FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares | firecares/sitemaps.py | firecares/sitemaps.py | from django.contrib import sitemaps
from firecares.firestation.models import FireDepartment
from django.db.models import Max
from django.core.urlresolvers import reverse
class BaseSitemap(sitemaps.Sitemap):
protocol = 'https'
def items(self):
return ['media', 'models_performance_score', 'models_commu... | from django.contrib import sitemaps
from firecares.firestation.models import FireDepartment
from django.db.models import Max
from django.core.urlresolvers import reverse
class BaseSitemap(sitemaps.Sitemap):
protocol = 'https'
def items(self):
return ['media', 'models_performance_score', 'models_commu... | mit | Python |
9c7d1deba7dbde9285e49cb2966b1d242ac8ddc2 | Use sphinxapi if available | matchbox/flask-sphinxsearch | flask_sphinxsearch.py | flask_sphinxsearch.py | try:
import sphinxapi as sphinxsearch
except ImportError:
import sphinxsearch
from flask import current_app
# Find the stack on which we want to store the database connection.
# Starting with Flask 0.9, the _app_ctx_stack is the correct one,
# before that we need to use the _request_ctx_stack.
try:
from fl... | import sphinxsearch
from flask import current_app
# Find the stack on which we want to store the database connection.
# Starting with Flask 0.9, the _app_ctx_stack is the correct one,
# before that we need to use the _request_ctx_stack.
try:
from flask import _app_ctx_stack as stack
except ImportError:
from fl... | apache-2.0 | Python |
e959f849550fe4cfd2f2230c149a9bc0cb01bfe4 | bump version | mpdavis/python-jose | jose/__init__.py | jose/__init__.py |
__version__ = "2.0.1"
__author__ = 'Michael Davis'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016 Michael Davis'
from .exceptions import JOSEError
from .exceptions import JWSError
from .exceptions import ExpiredSignatureError
from .exceptions import JWTError
|
__version__ = "2.0.0"
__author__ = 'Michael Davis'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016 Michael Davis'
from .exceptions import JOSEError
from .exceptions import JWSError
from .exceptions import ExpiredSignatureError
from .exceptions import JWTError
| mit | Python |
7f38e297dcfc9a664af092f48a9dc596f5f6c27b | Fix PermissionError: [Errno 13] Permission denied on Windows | person142/scipy,perimosocordiae/scipy,mdhaber/scipy,jjhelmus/scipy,apbard/scipy,perimosocordiae/scipy,grlee77/scipy,tylerjereddy/scipy,rgommers/scipy,anntzer/scipy,pizzathief/scipy,ilayn/scipy,scipy/scipy,vigna/scipy,aarchiba/scipy,Eric89GXL/scipy,zerothi/scipy,vigna/scipy,jakevdp/scipy,josephcslater/scipy,Eric89GXL/sc... | scipy/sparse/tests/test_matrix_io.py | scipy/sparse/tests/test_matrix_io.py | import os
import numpy as np
import tempfile
from numpy.testing import assert_array_almost_equal, run_module_suite, assert_
from scipy.sparse import csc_matrix, csr_matrix, bsr_matrix, dia_matrix, coo_matrix, save_npz, load_npz
def _save_and_load(matrix):
fd, tmpfile = tempfile.mkstemp(suffix='.npz')
os.clo... | import numpy as np
import tempfile
from numpy.testing import assert_array_almost_equal, run_module_suite, assert_
from scipy.sparse import csc_matrix, csr_matrix, bsr_matrix, dia_matrix, coo_matrix, save_npz, load_npz
def _save_and_load(matrix):
with tempfile.NamedTemporaryFile(suffix='.npz') as file:
... | bsd-3-clause | Python |
b1277cd79102a30a894e370ab15773e6d86569ec | fix n/a causing issues for OT0010 ingest, sigh | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/ingestors/other/parse0010.py | scripts/ingestors/other/parse0010.py | """ISU Agronomy Hall Vantage Pro 2 OT0010"""
from __future__ import print_function
import datetime
import re
import os
import sys
import pytz
from pyiem.datatypes import speed, temperature, humidity
from pyiem.observation import Observation
from pyiem.meteorology import dewpoint
from pyiem.util import get_dbconn
def ... | """ISU Agronomy Hall Vantage Pro 2 OT0010"""
from __future__ import print_function
import datetime
import re
import os
import sys
import pytz
from pyiem.datatypes import speed, temperature, humidity
from pyiem.observation import Observation
from pyiem.meteorology import dewpoint
from pyiem.util import get_dbconn
def ... | mit | Python |
c7a79f81734f360a232b2f91630872ad56a1ffa4 | clean up audio init | algorithmic-music-exploration/amen,algorithmic-music-exploration/amen | amen/audio.py | amen/audio.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import librosa
from amen.timing_list import TimingList
class Audio(object):
"""
Audio object: should wrap the output from libRosa.
"""
def __init__(self, file_path, convert_to_mono=False, sample_rate=22050):
"""
Opens a file path, loads i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import librosa
from amen.timing_list import TimingList
class Audio(object):
"""
Audio object: should wrap the output from libRosa.
"""
def __init__(self, file_path, convert_to_mono=False, sample_rate=22050):
"""
Opens a file path, loads i... | bsd-2-clause | Python |
1c56aeb3d96dbb26da62203d690b4ff49b4b5c0e | bump version to 0.5.2 | briney/abstar | abstar/version.py | abstar/version.py | # Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.5.2' | # Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.5.1' | mit | Python |
609cffb674ba0494bbe450d8ce7839168a3d5a0a | remove unnecessary code from forms | mupi/timtec,mupi/escolamupi,mupi/tecsaladeaula,GustavoVS/timtec,virgilio/timtec,mupi/tecsaladeaula,mupi/timtec,virgilio/timtec,AllanNozomu/tecsaladeaula,mupi/escolamupi,hacklabr/timtec,hacklabr/timtec,AllanNozomu/tecsaladeaula,mupi/tecsaladeaula,virgilio/timtec,hacklabr/timtec,GustavoVS/timtec,hacklabr/timtec,GustavoVS... | accounts/forms.py | accounts/forms.py | # -*- coding: utf-8 -*-
from django.contrib.auth import get_user_model
from django import forms
from django.utils.translation import ugettext_lazy as _
User = get_user_model()
class ProfileEditForm(forms.ModelForm):
email = forms.RegexField(label=_("email"), max_length=75, regex=r"^[\w.@+-]+$")
password1 = f... | # -*- coding: utf-8 -*-
try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
else:
User = get_user_model()
from django import forms
from django.utils.translation import ugettext_lazy as _
class ProfileEditForm(forms.ModelForm):
email = for... | agpl-3.0 | Python |
67be76a3d65fa846c8888ef5415ec3df5ef9ab87 | Add test for expired tokens | randomic/aniauth-tdd,randomic/aniauth-tdd | accounts/tests.py | accounts/tests.py | """accounts app unittests
"""
import base64
from time import sleep
from django.contrib.auth import get_user_model
from django.test import TestCase
from accounts.token import LoginTokenGenerator
TEST_EMAIL = 'newvisitor@example.com'
class WelcomePageTest(TestCase):
"""Tests relating to the welcome_page view.
... | """accounts app unittests
"""
import base64
from time import sleep
from django.contrib.auth import get_user_model
from django.test import TestCase
from accounts.token import LoginTokenGenerator
TEST_EMAIL = 'newvisitor@example.com'
class WelcomePageTest(TestCase):
"""Tests relating to the welcome_page view.
... | mit | Python |
5a4f05cb0f3a00a2d4faf828bd7850085c302541 | Implement functionality to delete logs created by digital justice users | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/cla_eventlog/management/commands/find_and_delete_old_cases.py | cla_backend/apps/cla_eventlog/management/commands/find_and_delete_old_cases.py | import sys
from django.core.management.base import BaseCommand
from dateutil.relativedelta import relativedelta
from legalaid.models import Case
from cla_eventlog.models import Log
from cla_butler.tasks import DeleteOldData
class FindAndDeleteCasesUsingCreationTime(DeleteOldData):
def get_eligible_cases(self):
... | import sys
from django.core.management.base import BaseCommand
from dateutil.relativedelta import relativedelta
from legalaid.models import Case
from cla_butler.tasks import DeleteOldData
class FindAndDeleteCasesUsingCreationTime(DeleteOldData):
def get_eligible_cases(self):
two_years = self.now - relati... | mit | Python |
b9c953cffd0c9961c22c0c671648f5e5a3e4426c | Update server | colmcoughlan/alchemy-server | alchemy_server.py | alchemy_server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 30 01:14:12 2017
@author: colm
"""
from flask import Flask, jsonify
import os
from models import Charity, Logo, Description
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import pandas as pd
app = Flask(__name__)
app... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 30 01:14:12 2017
@author: colm
"""
from flask import Flask, jsonify
import os
from models import Charity, Logo, Description
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import pandas as pd
app = Flask(__name__)
app... | mit | Python |
434e459059bba2a1e52e953813caae532a3cb16b | Update test_consume_4 | lifan0127/2016-pycon-tutorial-project | test_wordcount.py | test_wordcount.py | import os.path
import tempfile
import wordcount_lib
def _make_testfile(filename, data):
"Make a temp file containing the given data; return full path to file."
tempdir = tempfile.mkdtemp(prefix='wordcounttest_')
testfile = os.path.join(tempdir, filename)
with open(testfile, 'wt') as fp:
... | import os.path
import tempfile
import wordcount_lib
def _make_testfile(filename, data):
"Make a temp file containing the given data; return full path to file."
tempdir = tempfile.mkdtemp(prefix='wordcounttest_')
testfile = os.path.join(tempdir, filename)
with open(testfile, 'wt') as fp:
... | bsd-3-clause | Python |
abd2ad6098cb0bc827a8bebf12f21f1131dc83fa | Change version number | flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost | fluxghost/__init__.py | fluxghost/__init__.py | __version__ = "0.8.1"
DEBUG = False
| __version__ = "0.8.0"
DEBUG = False
| agpl-3.0 | Python |
52eed6f6d771045b2c06a941db17665785e90b23 | return an error exit code if tests failed | tomkralidis/pywps,jonas-eberle/pywps,geopython/pywps,ricardogsilva/PyWPS,SiggyF/pywps-4,ldesousa/PyWPS,doclements/pywps-4,jachym/PyWPS,bird-house/PyWPS | tests/__init__.py | tests/__init__.py | import sys
import unittest
import parse
import extent
def load_tests():
return unittest.TestSuite([parse.load_tests(), extent.load_tests()])
if __name__ == "__main__":
result = unittest.TextTestRunner(verbosity=2).run(load_tests())
if not result.wasSuccessful():
sys.exit(1)
| import unittest
import parse
import extent
def load_tests():
return unittest.TestSuite([parse.load_tests(), extent.load_tests()])
if __name__ == "__main__":
unittest.TextTestRunner(verbosity=2).run(load_tests())
| mit | Python |
bb94d126ae9ff86efc00cfbda5f3fff375490e16 | Add missing import to tests/__init__.py. | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | tests/__init__.py | tests/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuake is distributed in the hope that it will be ... | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuake is distributed in the hope that it will be ... | agpl-3.0 | Python |
4bafa90acca39a3d3fa5df0303d885c810244700 | Add URL | bowen0701/algorithms_data_structures | lc034_find_first_and_last_position_of_element_in_sorted_array.py | lc034_find_first_and_last_position_of_element_in_sorted_array.py | """Leetcode 34. Find First and Last Position of Element in Sorted Array
Medium
URL: https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
Given an array of integers nums sorted in ascending order,
find the starting and ending position of a given target value.
Your algorithm's runtime... | """Leetcode 34. Find First and Last Position of Element in Sorted Array
Medium
Given an array of integers nums sorted in ascending order,
find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, retu... | bsd-2-clause | Python |
49c64731fab1de1fc08b61a70190930b829d70d3 | Remove import for random | markoshorro/gem5,markoshorro/gem5,briancoutinho0905/2dsampling,briancoutinho0905/2dsampling,Weil0ng/gem5,rallylee/gem5,rjschof/gem5,powerjg/gem5-ci-test,qizenguf/MLC-STT,austinharris/gem5-riscv,zlfben/gem5,rallylee/gem5,samueldotj/TeeRISC-Simulator,sobercoder/gem5,yb-kim/gemV,HwisooSo/gemV-update,gedare/gem5,SanchayanM... | src/python/m5/internal/__init__.py | src/python/m5/internal/__init__.py | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | bsd-3-clause | Python |
01c88b514c64f001fc7824a30b8609a425d646ef | Set defaults for CI and DETERMINISTIC_TESTS. (#653) | untitaker/vdirsyncer,untitaker/vdirsyncer,untitaker/vdirsyncer | tests/conftest.py | tests/conftest.py | # -*- coding: utf-8 -*-
'''
General-purpose fixtures for vdirsyncer's testsuite.
'''
import logging
import os
import click_log
from hypothesis import HealthCheck, Verbosity, settings
import pytest
@pytest.fixture(autouse=True)
def setup_logging():
click_log.basic_config('vdirsyncer').setLevel(logging.DEBUG)
... | # -*- coding: utf-8 -*-
'''
General-purpose fixtures for vdirsyncer's testsuite.
'''
import logging
import os
import click_log
from hypothesis import HealthCheck, Verbosity, settings
import pytest
@pytest.fixture(autouse=True)
def setup_logging():
click_log.basic_config('vdirsyncer').setLevel(logging.DEBUG)
... | mit | Python |
88bba8a6145f67fd65e4062123db295601c92000 | Fix lint errors | alexwlchan/hot-chocolate,alexwlchan/hot-chocolate | tests/conftest.py | tests/conftest.py | # -*- encoding: utf-8
import os
from hotchocolate import Site
# TODO: Tidy this up, and don't duplicate code from cli.py
curdir = os.path.abspath(os.curdir)
os.chdir('tests/examplesite')
site = Site.from_folder('content')
site.build()
os.chdir(curdir)
| # -*- encoding: utf-8
import os
from hotchocolate import Site
import hotchocolate.cli as hcli
# TODO: Tidy this up, and don't duplicate code from cli.py
curdir = os.path.abspath(os.curdir)
os.chdir('tests/examplesite')
site = Site.from_folder('content')
site.build()
os.chdir(curdir)
| mit | Python |
8dc79a0a1b99d1742ae297db7da26a0404e5ec33 | Fix pep8 | billvsme/videoSpider | tests/conftest.py | tests/conftest.py | import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Base
from config import create_new_sqla
from helpers import get_video_douban_ids
test_database_url = 'sqlite:///test.db'
@pytest.fixture(scope='session')
def session(request):
sqla = create_new_sqla(test... | import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Base
from config import create_new_sqla
from helpers import get_video_douban_ids
test_database_url = 'sqlite:///test.db'
@pytest.fixture(scope='session')
def session(request):
sqla = create_new_sqla(test... | mit | Python |
423ec9d9b38be990ab7dca027877e1c12f3d07fe | add in django-registration update media url | cewing/cfpydev-imagr | imagr_site/settings.py | imagr_site/settings.py | """
Django settings for imagr_site project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | """
Django settings for imagr_site project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | mit | Python |
ac754a6a711edc9b3628499ae18e74892efd7f98 | Add recording interaction print statements | julianghionoiu/tdl-client-python,julianghionoiu/tdl-client-python | src/tdl/runner/recording_system.py | src/tdl/runner/recording_system.py | import unirest
RECORDING_SYSTEM_ENDPOINT = "http://localhost:41375"
class RecordingEvent:
def __init__(self):
pass
ROUND_START = 'new'
ROUND_SOLUTION_DEPLOY = 'deploy'
ROUND_COMPLETED = 'done'
class RecordingSystem:
def __init__(self, recording_required):
self._recording_requi... | import unirest
RECORDING_SYSTEM_ENDPOINT = "http://localhost:41375"
class RecordingEvent:
def __init__(self):
pass
ROUND_START = 'new'
ROUND_SOLUTION_DEPLOY = 'deploy'
ROUND_COMPLETED = 'done'
class RecordingSystem:
def __init__(self, recording_required):
self._recording_requi... | apache-2.0 | Python |
0b3247c23d37c372d3f3984391b976fa904d00c6 | bump to v1.4.0 (#5975) | mfherbst/spack,skosukhin/spack,krafczyk/spack,skosukhin/spack,EmreAtes/spack,EmreAtes/spack,matthiasdiener/spack,mfherbst/spack,mfherbst/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,lgarren/spack,lgarren/spack,LLNL/spack,iulian787/spack,lgarren/spack,EmreAtes/spack,krafczyk/spack,tmerrick1/spack,LLNL/spack,tmerr... | var/spack/repos/builtin/packages/miniamr/package.py | var/spack/repos/builtin/packages/miniamr/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
779393e6c18539c97ff3bdaeb471253170645bc2 | Update group.py | enovance/numeter,enovance/numeter,redhat-cip/numeter,redhat-cip/numeter,enovance/numeter,redhat-cip/numeter,enovance/numeter,redhat-cip/numeter | web-app/numeter_webapp/configuration/forms/group.py | web-app/numeter_webapp/configuration/forms/group.py | """
Group Form module.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
from core.models import Group
class Group_Form(forms.ModelForm):
"""Simple Group Form"""
class Meta:
model = Group
widgets = {
'name': forms.TextInput({'placeholder':_('Name')... | """
Group Form module.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
from djangular.forms.angular_model import NgModelFormMixin
from core.models import Group
class Group_Form(forms.ModelForm):
"""Simple Group Form"""
class Meta:
model = Group
widgets = {... | agpl-3.0 | Python |
7ca6dd5cd84222845db331afd97fc2f314999cff | fix yaspin.compat module docstring | pavdmyt/yaspin | yaspin/compat.py | yaspin/compat.py | # -*- coding: utf-8 -*-
"""
yaspin.compat
~~~~~~~~~~~~~
Compatibility layer.
"""
import sys
PY2 = sys.version_info[0] == 2
if PY2:
builtin_str = str
bytes = str
str = unicode # noqa
def iteritems(dct):
return dct.iteritems()
else:
builtin_str = str
bytes = bytes
... | # -*- coding: utf-8 -*-
"""
tests.compat
~~~~~~~~~~~~~
Compatibility layer.
"""
import sys
PY2 = sys.version_info[0] == 2
if PY2:
builtin_str = str
bytes = str
str = unicode # noqa
def iteritems(dct):
return dct.iteritems()
else:
builtin_str = str
bytes = bytes
... | mit | Python |
b9fc0685b3adb05a5049cfa9b68676e00878d48a | Add .fillna(0) | yiori-s/fit_instagram_gender,yiori-s/fit_instagram_gender | instagram_collector.py | instagram_collector.py | import sys
from settings import instgram_access_token
from api import InstagramAPI, Alchemy
import pandas as pd
def following_users(api, user_name):
instgram_user_id = api.user_id(user_name=user_name)
following_users = api.follows_list(user_id=instgram_user_id)
return following_users
def userinfo_list(... | import sys
from settings import instgram_access_token
from api import InstagramAPI, Alchemy
import pandas as pd
def following_users(api, user_name):
instgram_user_id = api.user_id(user_name=user_name)
following_users = api.follows_list(user_id=instgram_user_id)
return following_users
def userinfo_list(... | mit | Python |
84cdde09d574d2a52446bd751445747407733b22 | Remove print statement | django-oscar/django-oscar-accounts,django-oscar/django-oscar-accounts | tests/settings.py | tests/settings.py | import uuid
import os.path
from django.conf import global_settings, settings
from oscar import OSCAR_MAIN_TEMPLATE_DIR, get_core_apps
from oscar.defaults import * # noqa
from accounts import TEMPLATE_DIR as ACCOUNTS_TEMPLATE_DIR
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
... | import uuid
import os.path
from django.conf import global_settings, settings
from oscar import OSCAR_MAIN_TEMPLATE_DIR, get_core_apps
from oscar.defaults import * # noqa
from accounts import TEMPLATE_DIR as ACCOUNTS_TEMPLATE_DIR
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
... | bsd-3-clause | Python |
26116bb984f7a970c67bcdc01ff026a3fc5f0905 | create secondary parses | riptano/cdm | tests/test_ddl.py | tests/test_ddl.py | from pytest import fixture
from cdm.ddl import parse_line, create_vertex, create_vertex_index,\
CreateVertex, \
CreateEdge, CreateProperty, CreateIndex, CreateGraph
def test_create_graph():
s = "CREATE GRAPH jon"
parsed = parse_line(s)
assert isinstance(parsed, Crea... | from pytest import fixture
from cdm.ddl import parse_line, create_vertex, create_vertex_index,\
CreateVertex, \
CreateEdge, CreateProperty, CreateIndex, CreateGraph
def test_create_graph():
s = "CREATE GRAPH jon"
parsed = parse_line(s)
assert isinstance(parsed, Crea... | apache-2.0 | Python |
581eb398360cff5de1488fa06890195c808f8d10 | fix make requests test | jadbin/xpaw | tests/test_run.py | tests/test_run.py | # coding=utf-8
from os.path import join
import pytest
from xpaw.spider import Spider
from xpaw.cmdline import main
from xpaw.run import run_crawler, run_spider, make_requests
from xpaw.http import HttpRequest, HttpResponse
from xpaw.errors import ClientError, HttpError
def test_run_crawler(tmpdir):
proj_name =... | # coding=utf-8
from os.path import join
import pytest
from xpaw.spider import Spider
from xpaw.cmdline import main
from xpaw.run import run_crawler, run_spider, make_requests
from xpaw.http import HttpRequest, HttpResponse
from xpaw.errors import ClientError, HttpError
def test_run_crawler(tmpdir):
proj_name =... | apache-2.0 | Python |
40c8bec919f2e04befb021d51706f39793eb77a2 | Fix typo | tobiajo/tfyarn | tfyarn/factory.py | tfyarn/factory.py | from __future__ import print_function
from tfyarn.clusterspecgen_client import ClusterSpecGenClient
import os
import socket
import tensorflow
import time
def createClusterSpec(job_name, task_index, application_id=None, container_id=None, am_address=None):
if application_id is None:
application_id = os.en... | from __future__ import print_function
from tfyarn.clusterspecgen_client import ClusterSpecGenClient
import os
import socket
import tensorflow
import time
def createClusterSpec(job_name, task_index, application_id=None, container_id=None, am_address=None):
if application_id is None:
application_id = os.en... | apache-2.0 | Python |
4663589ae44437344ec88dc96dc2ca9bdf55b581 | add metric AUC | wepe/tgboost,wepe/tgboost | tgboost/metric.py | tgboost/metric.py | import numpy as np
def accuracy(preds, labels):
return np.mean(labels == preds.round())
def error(preds, labels):
return 1.0 - accuracy(preds,labels)
def mean_square_error(preds, labels):
return np.mean(np.square(preds - labels))
def mean_absolute_error(preds, labels):
return np.mean(np.abs(pred... | import numpy as np
def accuracy(preds, labels):
return np.mean(labels == preds.round())
def error(preds, labels):
return 1.0 - accuracy(preds,labels)
def mean_square_error(preds, labels):
return np.mean(np.square(preds - labels))
def mean_absolute_error(preds, labels):
return np.mean(np.abs(pred... | mit | Python |
00140b48d7473c0f6738e5bc7894370baee9ef30 | Remove debugging | pwyf/data-quality-tester,pwyf/data-quality-tester,pwyf/data-quality-tester,pwyf/data-quality-tester | IATISimpleTester/lib/helpers.py | IATISimpleTester/lib/helpers.py | from collections import defaultdict
import re
from lxml import etree
from IATISimpleTester import app
# given an expression list and the name of an expression,
# select it,
def select_expression(expression_list, expression_name, default_expression_name=None):
expression_dicts = {x["id"]: x for x in expression_l... | from collections import defaultdict
import re
from lxml import etree
from IATISimpleTester import app
# given an expression list and the name of an expression,
# select it,
def select_expression(expression_list, expression_name, default_expression_name=None):
expression_dicts = {x["id"]: x for x in expression_l... | mit | Python |
303a8c149c30d4dd1d9c833c6716d5ab0da88e04 | Change version number to 1.2. | isrusin/cbcalc,isrusin/cbcalc | cbclib/version.py | cbclib/version.py | """a cbclib version storage module."""
version_tuple = (1, 2, 0)
full_version = "%d.%d.%d" % version_tuple
| """a cbclib version storage module."""
version_tuple = (1, 1, 1)
full_version = "%d.%d.%d" % version_tuple
| mit | Python |
994b50c3856e01d3cec712515efe11c0f286781e | Remove deprecated alias | ipython/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets | ipywidgets/__init__.py | ipywidgets/__init__.py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Interactive widgets for the Jupyter notebook.
Provide simple interactive controls in the notebook.
Each Widget corresponds to an object in Python and Javascript,
with controls on the page.
To put a Widget on the p... | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Interactive widgets for the Jupyter notebook.
Provide simple interactive controls in the notebook.
Each Widget corresponds to an object in Python and Javascript,
with controls on the page.
To put a Widget on the p... | bsd-3-clause | Python |
8d5d8cc8d61596a62513039d79abb57f274333ef | Set version as 0.9.0 | Alignak-monitoring-contrib/alignakbackend-api-client,Alignak-monitoring-contrib/alignak-backend-client,Alignak-monitoring-contrib/alignakbackend-api-client,Alignak-monitoring-contrib/alignak-backend-client | alignak_backend_client/__init__.py | alignak_backend_client/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend client library
This module is a Python library used for the REST API of the Alignak backend
"""
# Application version and manifest
VERSION = (0, 9, 0)
__application__ = u"Alignak Backend client"
__short_version__ = '.'.join((str(each) f... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend client library
This module is a Python library used for the REST API of the Alignak backend
"""
# Application version and manifest
VERSION = (0, 7, 0)
__application__ = u"Alignak Backend client"
__short_version__ = '.'.join((str(each) f... | agpl-3.0 | Python |
2c42b84a5ffd7ce42295488271781c08ab372bd3 | add website_multi_company_portal to demo addons | it-projects-llc/website-addons,it-projects-llc/website-addons,it-projects-llc/website-addons | website_multi_company/__manifest__.py | website_multi_company/__manifest__.py | # -*- coding: utf-8 -*-
{
"name": """Real Multi Website""",
"summary": """Yes, you can set up multi-company, multi-website, multi-theme, multi-eCommerce on a single database!""",
"category": "eCommerce",
"live_test_url": "http://apps.it-projects.info/shop/product/website-multi-company?version=10.0",
... | # -*- coding: utf-8 -*-
{
"name": """Real Multi Website""",
"summary": """Yes, you can set up multi-company, multi-website, multi-theme, multi-eCommerce on a single database!""",
"category": "eCommerce",
"live_test_url": "http://apps.it-projects.info/shop/product/website-multi-company?version=10.0",
... | mit | Python |
b671d67aaf80df9297213973659c59a4ebd72e08 | test file changed | DiCarloLab-Delft/PycQED_py3,DiCarloLab-Delft/PycQED_py3,DiCarloLab-Delft/PycQED_py3 | pycqed/tests/analysis_v2/test_Two_state_T1_analysis.py | pycqed/tests/analysis_v2/test_Two_state_T1_analysis.py | import unittest
import pycqed as pq
import os
from pycqed.analysis_v2 import measurement_analysis as ma
from pycqed.analysis_v2 import Two_state_T1_analysis as Ta
class Test_efT1_analysis(unittest.TestCase):
@classmethod
def setUpClass(self):
self.datadir = os.path.join(pq.__path__[0], 'tests', 'test... | import unittest
import pycqed as pq
import os
from pycqed.analysis_v2 import measurement_analysis as ma
from pycqed.analysis_v2 import Two_state_T1_analysis as Ta
class Test_efT1_analysis(unittest.TestCase):
@classmethod
def setUpClass(self):
self.datadir = os.path.join(pq.__path__[0], 'tests', 'test... | mit | Python |
196b9547b4dbcbfbf4891c7fd3ea3b9944018430 | Revert "Revert "Added script for cron job to load surveys to database."" | paepcke/json_to_relation,paepcke/json_to_relation,paepcke/json_to_relation,paepcke/json_to_relation | scripts/cronRefreshEdxQualtrics.py | scripts/cronRefreshEdxQualtrics.py | from surveyextractor import QualtricsExtractor
import getopt
import sys
### Script for scheduling regular EdxQualtrics updates
### Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"
# Append directory for dependencies to PYTHONPATH
sys.path.append("/home/dataman/Code/qualtrics_etl/src/qualtrics_etl/")
qe... | from surveyextractor import QualtricsExtractor
import getopt, sys
# Script for scheduling regular EdxQualtrics updates
# Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"
qe = QualtricsExtractor()
opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses... | bsd-3-clause | Python |
f1111b6d7eb387e7287497c1853addd003a81f39 | Add a length limit | thomasleese/chatterbox | chatterbox/irc.py | chatterbox/irc.py | import time
import random
import irc.bot
class Bot(irc.bot.SingleServerIRCBot):
def __init__(self, generator, channels, nickname, server, port=6667):
super().__init__([(server, port)], nickname, nickname)
self.generator = generator
self.channels_to_join = channels
self.nick = nick... | import time
import random
import irc.bot
class Bot(irc.bot.SingleServerIRCBot):
def __init__(self, generator, channels, nickname, server, port=6667):
super().__init__([(server, port)], nickname, nickname)
self.generator = generator
self.channels_to_join = channels
self.nick = nick... | mit | Python |
6f03120a57d40491e7d8245e10989a3e03b9481d | Set up task list for cook robot | swanndri/ROS-Healthcare-Simulator,swanndri/ROS-Healthcare-Simulator | se306/src/package1/scripts/cook.py | se306/src/package1/scripts/cook.py | #!/usr/bin/env python
import roslib
import rospy
import std_msgs.msg
import navigation
from std_msgs.msg import String
class Cook(navigation.Navigation):
''' When a message is passed out from the scheduler, determine whether it is
relevant to this object. If so, take the neccessary action
'''
def process_event(... | #!/usr/bin/env python
import roslib
import rospy
import std_msgs.msg
import navigation
from std_msgs.msg import String
class Cook(navigation.Navigation):
''' When a message is passed out from the scheduler, determine whether it is
relevant to this object. If so, take the neccessary action
'''
def process_event(... | mit | Python |
da55338b1bfc82bd303a3003fef881ceb3605b28 | Make views time-centric, not date-centric | mjschultz/django-tracking2,bruth/django-tracking2,bruth/django-tracking2 | tracking/views.py | tracking/views.py | import logging
from datetime import timedelta
from django import forms
from django.shortcuts import render
from django.contrib.auth.decorators import permission_required
from django.utils.timezone import now
from tracking.models import Visitor, Pageview
from tracking.settings import TRACK_PAGEVIEWS
log = logging.ge... | import logging
from datetime import timedelta
from django import forms
from django.shortcuts import render
from django.contrib.auth.decorators import permission_required
from django.utils.timezone import now
from tracking.models import Visitor, Pageview
from tracking.settings import TRACK_PAGEVIEWS
log = logging.ge... | bsd-2-clause | Python |
d19b72f42801dde328ae1e1d935c5df3a5797d4e | update manage.py for refactored appstate/config modules | omniscale/gbi-client,omniscale/gbi-client,omniscale/gbi-client,omniscale/gbi-client | app/manage.py | app/manage.py | import os
import sys
import scriptine
from scriptine.shell import sh
from geobox.web import create_app
def babel_init_lang_command(lang):
"Initialize new language."
sh('pybabel init -i geobox/web/translations/messages.pot -d geobox/web/translations -l %s' % (lang,))
def babel_refresh_command():
"Extract ... | import os
import sys
import scriptine
from scriptine.shell import sh
from geobox.web import create_app
def babel_init_lang_command(lang):
"Initialize new language."
sh('pybabel init -i geobox/web/translations/messages.pot -d geobox/web/translations -l %s' % (lang,))
def babel_refresh_command():
"Extract ... | apache-2.0 | Python |
0b77e09ac16006d1baa6a5f4093b51c1a13863e9 | Add as_dict method to Digit model | starcalibre/MNIST3D,starcalibre/MNIST3D,starcalibre/MNIST3D | app/models.py | app/models.py | from app import db
class Digit(db.Model):
__tablename__ = 'digits'
id = db.Column(db.INTEGER, primary_key=True)
label = db.Column(db.INTEGER)
tsne_x = db.Column(db.REAL)
tsne_y = db.Column(db.REAL)
tsne_z = db.Column(db.REAL)
array = db.Column(db.String)
def __repr__(self):
re... | from app import db
class Digit(db.Model):
id = db.Column(db.INTEGER, primary_key=True)
label = db.Column(db.INTEGER)
tsne_x = db.Column(db.REAL)
tsne_y = db.Column(db.REAL)
tsne_z = db.Column(db.REAL)
array = db.Column(db.String)
image = db.Column(db.BLOB)
def __repr__(self):
r... | mit | Python |
73f8895ae00f3d076c73bc49a03b870abb2a30cc | Fix typo | gmkou/FikaNote,gmkou/FikaNote,gmkou/FikaNote | app/models.py | app/models.py | from django.db import models
import mongoengine
from mongoengine import Document, EmbeddedDocument
from mongoengine.fields import *
import os
# Create your models here.
class Greeting(models.Model):
when = models.DateTimeField('date created', auto_now_add=True)
USER = os.getenv('DATABASE_USER')
PASSWORD = os.get... | from django.db import models
import mongoengine
from mongoengine import Document, EmbeddedDocument
from mongoengine.fields import *
import os
# Create your models here.
class Greeting(models.Model):
when = models.DateTimeField('date created', auto_now_add=True)
USER = os.getenv('DATABASE_USER')
PASWORD = os.gete... | mit | Python |
69d9a36eb9d4536d9999395016759ec0ba23ad82 | Fix playlist preview function | cgwire/zou | zou/app/services/playlists_service.py | zou/app/services/playlists_service.py | from zou.app.models.playlist import Playlist
from zou.app.models.preview_file import PreviewFile
from zou.app.utils import fields
from zou.app.services import shots_service, tasks_service
from zou.app.services.exception import PlaylistNotFoundException
def all_playlists_for_project(project_id):
return fields.s... | from zou.app.models.playlist import Playlist
from zou.app.models.preview_file import PreviewFile
from zou.app.utils import fields
from zou.app.services import shots_service, tasks_service
from zou.app.services.exception import PlaylistNotFoundException
def all_playlists_for_project(project_id):
return fields.s... | agpl-3.0 | Python |
75f28330cd5cf0eea2ec99d8c3f9bf53de18d46c | correct typo | arenaoftitans/arena-of-titans-api,arenaoftitans/arena-of-titans-api | aot/config.py | aot/config.py | import logging
import toml
from os.path import exists
class Config:
CONF_FILE_TEMPLATE = 'config/config.{type}.toml'
def __init__(self):
self._config = None
def __getitem__(self, key):
if self._config is None:
raise RuntimeError(
'Configuration is not loaded.... | import logging
import toml
from os.path import exists
class Config:
CONF_FILE_TEMPLATE = 'config/config.{type}.toml'
def __init__(self):
self._config = None
def __getitem__(self, key):
if self._config is None:
raise RuntimeError(
'Configuration is not loaded.... | agpl-3.0 | Python |
fa6c7b32284bc4159e95b7bc339dab7517b2c255 | add sql example | tangramor/Airnow,tangramor/Airnow,tangramor/Airnow | client/ReadAir.py | client/ReadAir.py | # -*- coding: utf-8 -*-
import serial, time, MySQLdb, re
from socketIO_client import SocketIO, LoggingNamespace
''' SQL to create database:
CREATE DATABASE IF NOT EXISTS `airnow` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
'''
''' SQL to create table:
CREATE TABLE IF NOT EXISTS `air_logs` (
`id` int(1... | # -*- coding: utf-8 -*-
import serial, time, MySQLdb, re
from socketIO_client import SocketIO, LoggingNamespace
# open a mysql connection
conn=MySQLdb.connect(host="localhost",user="airnow",passwd="password",db="airnow",charset="utf8")
''' SQL to create table:
CREATE TABLE IF NOT EXISTS `air_logs` (
`id` int(1... | mit | Python |
2f2861f153d0ba0d088ffe95b196b4154b59ce31 | Replace constants with literal value. | ssadedin/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/seqr,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/seqr,ssadedin/seqr | seqr/management/commands/check_bam_cram_paths_tests.py | seqr/management/commands/check_bam_cram_paths_tests.py | import mock
from io import BytesIO
from django.core.management import call_command
from django.test import TestCase
class CheckBamCramPathsTest(TestCase):
fixtures = ['users', '1kg_project']
@mock.patch('seqr.views.utils.dataset_utils.validate_alignment_dataset_path')
def test_normal_command(self, mock_... | import mock
from io import BytesIO
from django.core.management import call_command
from django.test import TestCase
EXPECTED_EXCEPTION_MSG = 'Error at /readviz/NA19675.cram (Individual: NA19675_1): Error accessing "/readviz/NA19675.cram" \n---- DONE ----\nChecked 1 samples\n1 failed samples: NA19675_1\n'
EXPECTED_NORM... | agpl-3.0 | Python |
a6ac3a7a0955fab9cce1d2866a064ff6d4943dd0 | bump version to 0.1.2 | dpranke/pyjson5 | json5/version.py | json5/version.py | # Copyright 2014 Google Inc. 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 required by applicable law or ag... | # Copyright 2014 Google Inc. 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 required by applicable law or ag... | apache-2.0 | Python |
8ba62b47d2d94eb56122f9061b8309e06cc62cdd | add .get() | kibitzr/kibitzr,kibitzr/kibitzr | kibitzr/stash.py | kibitzr/stash.py | import contextlib
import logging
logger = logging.getLogger(__name__)
class Stash(object):
FILENAME = 'stash.db'
@contextlib.contextmanager
def open(self):
import shelve
with contextlib.closing(shelve.open(self.FILENAME)) as db:
yield db
def read(self):
with se... | import contextlib
import logging
logger = logging.getLogger(__name__)
class Stash(object):
FILENAME = 'stash.db'
@contextlib.contextmanager
def open(self):
import shelve
with contextlib.closing(shelve.open(self.FILENAME)) as db:
yield db
def read(self):
with se... | mit | Python |
e2c92e8b6e8fb10addc73986914014b278598470 | Fix docstring in standardnormal example | bees4ever/spotpy,bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy,thouska/spotpy,thouska/spotpy | spotpy/examples/spot_setup_standardnormal.py | spotpy/examples/spot_setup_standardnormal.py | '''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This example implements the Standard Normal function into SPOT.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __futu... | '''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This example implements the Rosenbrock function into SPOT.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ ... | mit | Python |
d46368024ee89143bca15a2bdf23f8792970cf5c | add property 'external' to menu nodes | theherk/django-theherk-external-urls | menu_external_urls/menu.py | menu_external_urls/menu.py | from menus.base import Modifier
from menus.menu_pool import menu_pool
from menu_external_urls.models import MenuExternalUrl
class MenuExternalUrlMod(Modifier):
"""
Adds ability to link page to an external URL.
"""
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
if p... | from menus.base import Modifier
from menus.menu_pool import menu_pool
from menu_external_urls.models import MenuExternalUrl
class MenuExternalUrlMod(Modifier):
"""
Adds ability to link page to an external URL.
"""
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
if p... | bsd-3-clause | Python |
c973385f877d940231deb8d81e929647eadc280a | Use standard env var for DATABASE_URL | crossgovernmentservices/csd-notes,crossgovernmentservices/csd-notes,crossgovernmentservices/csd-notes | app/config.py | app/config.py | # -*- coding: utf-8 -*-
"""
Application configuration
"""
import os
from os.path import dirname, join
# get settings from environment, or credstash if running in AWS
env = os.environ
if env.get('SETTINGS') == 'AWS':
from lib.aws_env import env
ASSETS_DEBUG = False
DEBUG = bool(env.get('DEBUG', True))
HUMANIZ... | # -*- coding: utf-8 -*-
"""
Application configuration
"""
import os
from os.path import dirname, join
# get settings from environment, or credstash if running in AWS
env = os.environ
if env.get('SETTINGS') == 'AWS':
from lib.aws_env import env
ASSETS_DEBUG = False
DEBUG = bool(env.get('DEBUG', True))
HUMANIZ... | mit | Python |
172c7a3ee0c75462f08e726716bf906ad88eadab | add test of plugin registry options | ellisonbg/altair,altair-viz/altair,jakevdp/altair | altair/utils/tests/test_plugin_registry.py | altair/utils/tests/test_plugin_registry.py | from ..plugin_registry import PluginRegistry
from typing import Callable
class TypedCallableRegistry(PluginRegistry[Callable[[int], int]]):
pass
class GeneralCallableRegistry(PluginRegistry):
pass
def test_plugin_registry():
plugins = TypedCallableRegistry()
assert plugins.names() == []
asser... | from ..plugin_registry import PluginRegistry
class RegistryTest(PluginRegistry):
pass
def test_plugin_registry():
plugins = RegistryTest()
assert plugins.names() == []
assert plugins.active == ''
assert plugins.get() is None
assert repr(plugins) == "RegistryTest(active='', registered=[])"
... | bsd-3-clause | Python |
ebe5d80075ce818181a154b6ec772a08e335ae4a | fix test name | dalejung/trtools | trtools/core/tests/test_timeseries.py | trtools/core/tests/test_timeseries.py | from unittest import TestCase
import pandas as pd
from pandas.core.groupby import BinGrouper
import trtools.util.testing as tm
import numpy as np
import trtools.core.timeseries as ts
# start on friday, so second day is saturday
df = tm.fake_ohlc(1000000, freq="5min", start="2000-01-07")
# business days and trading h... | from unittest import TestCase
import pandas as pd
from pandas.core.groupby import BinGrouper
import trtools.util.testing as tm
import numpy as np
import trtools.core.timeseries as ts
# start on friday, so second day is saturday
df = tm.fake_ohlc(1000000, freq="5min", start="2000-01-07")
# business days and trading h... | mit | Python |
f386fce820fb60abfe1b18c141dfd8ce268c5f4f | Update queue_on_list.py (#851) | TheAlgorithms/Python | data_structures/queue/queue_on_list.py | data_structures/queue/queue_on_list.py | """Queue represented by a python list"""
class Queue():
def __init__(self):
self.entries = []
self.length = 0
self.front=0
def __str__(self):
printed = '<' + str(self.entries)[1:-1] + '>'
return printed
"""Enqueues {@code item}
@param item
i... | """Queue represented by a python list"""
class Queue():
def __init__(self):
self.entries = []
self.length = 0
self.front=0
def __str__(self):
printed = '<' + str(self.entries)[1:-1] + '>'
return printed
"""Enqueues {@code item}
@param item
i... | mit | Python |
50d3fcb1ad4326a55bb156fd641ce40bf52a9a51 | rework router | chronossc/django-ldapdb,UGentPortaal/django-ldapdb,UGentPortaal/django-ldapdb-archived | ldapdb/router.py | ldapdb/router.py | # -*- coding: utf-8 -*-
#
# django-ldapdb
# Copyright (c) 2009-2010, Bolloré telecom
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# ... | # -*- coding: utf-8 -*-
#
# django-ldapdb
# Copyright (c) 2009-2010, Bolloré telecom
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# ... | bsd-2-clause | Python |
9501ab023a51ca6f3e37fcad3c9c9ff04223986b | update version to 0.4 | oubiwann/txjsonrpc,oubiwann/txjsonrpc,aborilov/txjsonrpc,aborilov/txjsonrpc,wuan/txjsonrpc,wuan/txjsonrpc | txjsonrpc/meta.py | txjsonrpc/meta.py | display_name = "txJSON-RPC"
library_name = "txjsonrpc"
version = "0.4"
author = "Duncan McGreggor"
author_email = "oubiwann@adytum.us"
license = "BSD, GPL"
url = "http://launchpad.net/%s" % library_name
description = "Code for creatig Twisted JSON-RPC servers and clients."
| display_name = "txJSON-RPC"
library_name = "txjsonrpc"
version = "0.3.1"
author = "Duncan McGreggor"
author_email = "oubiwann@adytum.us"
license = "BSD, GPL"
url = "http://launchpad.net/%s" % library_name
description = "Code for creatig Twisted JSON-RPC servers and clients."
| mit | Python |
0dc29df1e97b8c5f36320b55c659c8290f021c69 | Fix parallelization of number of topics script | NLeSC/cptm,NLeSC/cptm | DilipadTopicModelling/experiment_number_of_topics.py | DilipadTopicModelling/experiment_number_of_topics.py | import logging
import glob
from multiprocessing import Pool
from CPTCorpus import CPTCorpus
from CPT_Gibbs import GibbsSampler
def run_sampler(corpus, nTopics, nIter, beta, out_dir):
alpha = 50.0/nTopics
logger.info('running Gibbs sampler (nTopics: {}, nIter: {}, alpha: {}, '
'beta: {})'.form... | import logging
import glob
from multiprocessing import Process
from CPTCorpus import CPTCorpus
from CPT_Gibbs import GibbsSampler
def run_sampler(corpus, nTopics, nIter, beta, out_dir):
alpha = 50.0/nTopics
logger.info('running Gibbs sampler (nTopics: {}, nIter: {}, alpha: {}, '
'beta: {})'.f... | apache-2.0 | Python |
0f10ec94a7a62968aeafe10c55913e08bb0c7ce6 | Fix Bug: Type Error | nday-dev/FbSpider | Scripts/Judge.py | Scripts/Judge.py | #--coding:utf-8--
import re
import json
import chardet
class Judge():
def __init__(self,
SurnameCharacter = 'Surname.Chinese.json', SurnamePinyin = 'Surname.Pinyin.json'):
# self.SurnameCharacter = json.load(open(SurnameCharacter, 'rb'))
self.SurnamePinyin = json.load(open(SurnamePiny... | #--coding:utf-8--
import re
import json
import chardet
class Judge():
def __init__(self,
SurnameCharacter = 'Surname.Chinese.json', SurnamePinyin = 'Surname.Pinyin.json'):
# self.SurnameCharacter = json.load(open(SurnameCharacter, 'rb'))
self.SurnamePinyin = json.load(open(SurnamePiny... | mit | Python |
16a54fc100874159da7212e35361e5c7110a7ab2 | Add /start route for expeditions | KanColleTool/kcsrv,KanColleTool/kcsrv,KanColleTool/kcsrv | kancolle/api/expedition.py | kancolle/api/expedition.py | """Expedition blueprint."""
import datetime
from flask import Blueprint, g
from flask import request, abort
import time
import util
from db import Expedition, Fleet, Admiral
from util import prepare_api_blueprint, svdata
api_mission = Blueprint("api_mission", __name__)
prepare_api_blueprint(api_mission)
@api_missi... | """Expedition blueprint."""
from flask import Blueprint
from util import prepare_api_blueprint
api_mission = Blueprint("api_mission", __name__)
prepare_api_blueprint(api_mission) | mit | Python |
49d7ba5c4ddf858129bbdd3dea1c968aff8345c1 | Update hackerland_radio_transmitters.py | vin0010/Hackerrank,vin0010/Hackerrank,vin0010/Hackerrank | python/hackerrank/practice/hackerland_radio_transmitters.py | python/hackerrank/practice/hackerland_radio_transmitters.py | n, k = map(int, input().split())
arr = list(map(int, input().split()))
# arr=[1,7,8,15,16,18,19,21,23]
# n=9
# k=2
# sorted_arr = sorted(arr)
sorted_arr = []
coverage = (2 * k)
my_set = set()
for i in arr:
my_set.add(i)
for i in my_set:
sorted_arr.append(i)
# 7 2 4 6 5 9 12 11 ... | n, k = map(int, input().split())
arr = list(map(int, input().split()))
# arr=[1,7,8,15,16,18,19,21,23]
# n=9
# k=2
# sorted_arr = sorted(arr)
sorted_arr = []
coverage = (2 * k)
my_set = set()
for i in arr:
my_set.add(i)
for i in my_set:
sorted_arr.append(i)
# 7 2 4 6 5 9 12 11 ... | apache-2.0 | Python |
7cee7de43fc77e362cf19a9484f243d66e034f59 | Refactor from_json | hanjae/upstream,Storj/upstream | upstream/chunk.py | upstream/chunk.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from upstream.exc import ChunkError
class Chunk(object):
def __init__(self, filehash=None, decryptkey=None, filename=None,
filepath=None):
""" Stores information about an encryted chunk. Allows for
format conversions.
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from upstream.exc import ChunkError
class Chunk(object):
def __init__(self, filehash=None, decryptkey=None, filename=None,
filepath=None):
""" Stores information about an encryted chunk. Allows for
format conversions.
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.