commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
6e2dae94239252f6b0338e609a838fa31e417842 | checks.d/veneur.py | checks.d/veneur.py | import datetime
from urlparse import urljoin
import requests
# project
from checks import AgentCheck
class Veneur(AgentCheck):
VERSION_METRIC_NAME = 'veneur.deployed_version'
BUILDAGE_METRIC_NAME = 'veneur.build_age'
ERROR_METRIC_NAME = 'veneur.agent_check.errors_total'
def check(self, instance):
... | import datetime
from urlparse import urljoin
import requests
# project
from checks import AgentCheck
class Veneur(AgentCheck):
VERSION_METRIC_NAME = 'veneur.deployed_version'
BUILDAGE_METRIC_NAME = 'veneur.build_age'
ERROR_METRIC_NAME = 'veneur.agent_check.errors_total'
def check(self, instance):
... | Add the sha to the tags in a way that won't cause an error | Add the sha to the tags in a way that won't cause an error
| Python | mit | stripe/stripe-datadog-checks,stripe/datadog-checks |
cc00cc1c2539eb7dbeed2656e1929c8c53c4dd98 | pyverdict/pyverdict/datatype_converters/impala_converter.py | pyverdict/pyverdict/datatype_converters/impala_converter.py | from .converter_base import DatatypeConverterBase
import dateutil
def _str_to_datetime(java_obj, idx):
return dateutil.parser.parse(java_obj.getString(idx))
_typename_to_converter_fxn = {'timestamp': _str_to_datetime}
class ImpalaConverter(DatatypeConverterBase):
@staticmethod
def read_value(result_set... | from .converter_base import DatatypeConverterBase
import dateutil
def _str_to_datetime(java_obj, idx):
return dateutil.parser.parse(java_obj.getString(idx))
_typename_to_converter_fxn = {'timestamp': _str_to_datetime}
class ImpalaConverter(DatatypeConverterBase):
'''
Type conversion rule:
BIGI... | Add type conversion rule comment | Add type conversion rule comment
| Python | apache-2.0 | mozafari/verdict,mozafari/verdict,mozafari/verdict,mozafari/verdict,mozafari/verdict |
f5f4397d026678570ad271e84099d2bcec541c72 | whacked4/whacked4/ui/dialogs/startdialog.py | whacked4/whacked4/ui/dialogs/startdialog.py | #!/usr/bin/env python
#coding=utf8
from whacked4 import config
from whacked4.ui import windows
class StartDialog(windows.StartDialogBase):
"""
This dialog is meant to be displayed on startup of the application. It allows the user to quickly
access some common functions without having to dig down into a m... | #!/usr/bin/env python
#coding=utf8
from whacked4 import config
from whacked4.ui import windows
class StartDialog(windows.StartDialogBase):
"""
This dialog is meant to be displayed on startup of the application. It allows the user to quickly
access some common functions without having to dig down into a m... | Clean the recent files list before displaying it in the startup dialog. | Clean the recent files list before displaying it in the startup dialog.
| Python | bsd-2-clause | GitExl/WhackEd4,GitExl/WhackEd4 |
84b27afce57232bc0c8170eaad1beb26fd96eef0 | tools/gyp/find_mac_gcc_version.py | tools/gyp/find_mac_gcc_version.py | #!/usr/bin/env python
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import re
import subprocess
import sys
def main():
job = subprocess.Popen(['xcode... | #!/usr/bin/env python
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import re
import subprocess
import sys
def main():
job = subprocess.Popen(['xcode... | Use clang on mac if XCode >= 4.5 | Use clang on mac if XCode >= 4.5
Review URL: https://codereview.chromium.org//14333010
git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@21950 260f80e4-7a28-3924-810f-c04153c831b5
| Python | bsd-3-clause | dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dar... |
16742262b6a37f34bf83b3b6d6bcfd72e69276b2 | imagersite/imager_profile/models.py | imagersite/imager_profile/models.py | import six
from django.db import models
from django.contrib.auth.models import User
@six.python_2_unicode_compatible
class ImagerProfile(models.Model):
user = models.OneToOneField(User)
fav_camera = models.CharField(max_length=30)
address = models.CharField(max_length=100)
web_url = models.URLField()... | import six
from django.db import models
from django.contrib.auth.models import ActiveProfileManager, User
@six.python_2_unicode_compatible
class ImagerProfile(models.Model):
user = models.OneToOneField(
User,
nullable=False
)
fav_camera = models.CharField(
max_length=30
)
... | Make sure a user has profile | Make sure a user has profile
| Python | mit | jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager |
1a089ec6f34ebf81b4437b6f541ee2b9f4b85966 | osf/migrations/0145_pagecounter_data.py | osf/migrations/0145_pagecounter_data.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-12 17:18
from __future__ import unicode_literals
from django.db import migrations, connection
def reverse_func(state, schema):
with connection.cursor() as cursor:
cursor.execute(
"""
UPDATE osf_pagecounter
... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-12 17:18
from __future__ import unicode_literals
from django.db import migrations
reverse_func = [
"""
UPDATE osf_pagecounter
SET (action, guid_id, file_id, version) = ('download', NULL, NULL, NULL);
"""
]
# Splits the data in pagecount... | Call RunSQL instead of RunPython in pagecounter data migration. | Call RunSQL instead of RunPython in pagecounter data migration.
| Python | apache-2.0 | cslzchen/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,saradbowman/osf.io,felliott/osf.io,baylee-d/osf.io,mattclark/osf.io,mfraezz/osf.io,aaxelb/osf.io,felliott/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,mattclark/osf.io,adlius/osf.io,saradbowman/osf.io,adlius/osf.i... |
050394cc0c228edf8ac9c3ea6f2001d36d874841 | spdypy/connection.py | spdypy/connection.py | # -*- coding: utf-8 -*-
"""
spdypy.connection
~~~~~~~~~~~~~~~~~
Contains the code necessary for working with SPDY connections.
"""
# Define some states for SPDYConnections.
NEW = 'NEW'
class SPDYConnection(object):
"""
A representation of a single SPDY connection to a remote server. This
object takes resp... | # -*- coding: utf-8 -*-
"""
spdypy.connection
~~~~~~~~~~~~~~~~~
Contains the code necessary for working with SPDY connections.
"""
# Define some states for SPDYConnections.
NEW = 'NEW'
class SPDYConnection(object):
"""
A representation of a single SPDY connection to a remote server. This
object takes res... | Define the shell of the request method. | Define the shell of the request method.
| Python | mit | Lukasa/spdypy |
e3a298bcbe0eac1d2a0ade13244b0f3650bd6c49 | pyinfra/pseudo_modules.py | pyinfra/pseudo_modules.py | # pyinfra
# File: pyinfra/pseudo_modules.py
# Desc: essentially a hack that provides dynamic imports for the current deploy (CLI only)
import sys
import pyinfra
class PseudoModule(object):
_module = None
def __getattr__(self, key):
return getattr(self._module, key)
def __setattr__(self, key, va... | # pyinfra
# File: pyinfra/pseudo_modules.py
# Desc: essentially a hack that provides dynamic imports for the current deploy (CLI only)
import sys
import pyinfra
class PseudoModule(object):
_module = None
def __getattr__(self, key):
return getattr(self._module, key)
def __setattr__(self, key, va... | Add getitem and len support for pseudo modules. | Add getitem and len support for pseudo modules.
| Python | mit | Fizzadar/pyinfra,Fizzadar/pyinfra |
e83019f67a3c93efac27566666bcff5eb0d2a0da | examples/autopost/auto_post.py | examples/autopost/auto_post.py | import time
import sys
import os
import glob
sys.path.append(os.path.join(sys.path[0], '../../'))
from instabot import Bot
posted_pic_list = []
try:
with open('pics.txt', 'r') as f:
posted_pic_list = f.read().splitlines()
except Exception:
posted_pic_list = []
timeout = 24 * 60 * 60 # pics will be p... | import glob
import os
import sys
import time
from io import open
sys.path.append(os.path.join(sys.path[0], '../../'))
from instabot import Bot
posted_pic_list = []
try:
with open('pics.txt', 'r', encoding='utf8') as f:
posted_pic_list = f.read().splitlines()
except Exception:
posted_pic_list = []
ti... | Add utf-8 in autopost example | Add utf-8 in autopost example
| Python | apache-2.0 | instagrambot/instabot,ohld/instabot,instagrambot/instabot |
91faf4fd5fa3d5878e2792bcd87f81c261ec5033 | wagtail/wagtailadmin/edit_bird.py | wagtail/wagtailadmin/edit_bird.py | from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.template.loader import render_to_string
class BaseItem(object):
template = 'wagtailadmin/edit_bird/base_item.html'
@property
def can_render(self):
return True
def render(self, request):
... | from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.template.loader import render_to_string
class BaseItem(object):
template = 'wagtailadmin/edit_bird/base_item.html'
def render(self, request):
return render_to_string(self.template, dict(self=self, requ... | Edit bird: Clean up render method of EditPageItem | Edit bird: Clean up render method of EditPageItem
| Python | bsd-3-clause | takeflight/wagtail,FlipperPA/wagtail,stevenewey/wagtail,jorge-marques/wagtail,kurtw/wagtail,Pennebaker/wagtail,janusnic/wagtail,gogobook/wagtail,hamsterbacke23/wagtail,m-sanders/wagtail,mayapurmedia/wagtail,zerolab/wagtail,bjesus/wagtail,Tivix/wagtail,JoshBarr/wagtail,takeshineshiro/wagtail,chimeno/wagtail,benemery/wag... |
fdfb2b1da5e7cea83bd4189bb9d998273c03a7cd | SlugifyCommand.py | SlugifyCommand.py | # encoding: utf-8
'''This adds a "slugify" command to be invoked by Sublime Text. It is made
available as "Slugify" in the command palette by Default.sublime-commands.
Parts of these commands are borrowed from the sublime-slug package:
https://github.com/madeingnecca/sublime-slug
'''
from __future__ import unicode_li... | # encoding: utf-8
'''This adds a "slugify" command to be invoked by Sublime Text. It is made
available as "Slugify" in the command palette by Default.sublime-commands.
Parts of these commands are borrowed from the sublime-slug package:
https://github.com/madeingnecca/sublime-slug
'''
from __future__ import unicode_li... | Fix broken import in Sublime Text 2. | Fix broken import in Sublime Text 2. | Python | mit | alimony/sublime-slugify |
1d486d8035e918a83dce5a70c83149a06d982a9f | Instanssi/admin_calendar/models.py | Instanssi/admin_calendar/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
from imagekit.models import ImageSpec
from imagekit.processors import resize
class CalendarEvent(models.Model):
user = models.ForeignKey(User, verbose_name=u'Käyttäjä')
start = mod... | # -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToFill
class CalendarEvent(models.Model):
user = models.ForeignKey(User, verbose_name=u'Käyttäjä')
... | Fix to work on the latest django-imagekit | admin_calendar: Fix to work on the latest django-imagekit
| Python | mit | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org |
ddcf3490990f9b78f0009937bc9ddc2df0331b8e | lib/booki/account/templatetags/profile.py | lib/booki/account/templatetags/profile.py | import os
from django.db.models import get_model
from django.template import Library, Node, TemplateSyntaxError, resolve_variable
from django.conf import settings
from booki.account.models import UserProfile
register = Library()
class ProfileImageNode(Node):
def __init__(self, user):
self.user = user
... | import os
from django.db.models import get_model
from django.template import Library, Node, TemplateSyntaxError, resolve_variable
from django.conf import settings
from booki.account.models import UserProfile
register = Library()
class ProfileImageNode(Node):
def __init__(self, user):
self.user = user
... | Fix image link to anonymous user. | Fix image link to anonymous user.
| Python | agpl-3.0 | kronoscode/Booktype,MiczFlor/Booktype,rob-hills/Booktype,ride90/Booktype,okffi/booktype,kronoscode/Booktype,danielhjames/Booktype,danielhjames/Booktype,eos87/Booktype,ride90/Booktype,MiczFlor/Booktype,danielhjames/Booktype,kronoscode/Booktype,btat/Booktype,ride90/Booktype,aerkalov/Booktype,danielhjames/Booktype,btat/Bo... |
7fb284ad29098a4397c7ac953e2d9acb89cf089e | notification/backends/email.py | notification/backends/email.py | from django.conf import settings
from django.core.mail import EmailMessage
from notification.backends.base import NotificationBackend
class EmailBackend(NotificationBackend):
slug = u'email'
display_name = u'E-mail'
formats = ['short.txt', 'full.txt']
def email_for_user(self, recipient):
ret... | from django.conf import settings
from django.core.mail import EmailMessage
from notification.backends.base import NotificationBackend
class EmailBackend(NotificationBackend):
sensitivity = 2
slug = u'email'
display_name = u'E-mail'
formats = ['short.txt', 'full.txt']
def email_for_user(self, rec... | Set sensitivity of e-mail backend to 2, so notifications with 1 aren't mailed. | Set sensitivity of e-mail backend to 2, so notifications with 1 aren't mailed.
| Python | mit | theatlantic/django-notification,theatlantic/django-notification |
b28ceb8631446b57abb48be6c76db843ec747221 | demo/set-sas-token.py | demo/set-sas-token.py | #!/usr/bin/env python
from __future__ import print_function
import os
from subprocess import check_output
from sys import argv, stdout
RSGRP = "travistestresourcegroup"
STACC = "travistestresourcegr3014"
def run(command):
command = command.replace('az ', '', 1)
cmd = 'python -m azure.cli {}'.format(command)... | #!/usr/bin/env python
from __future__ import print_function
import os
from subprocess import check_output
from sys import argv, stdout
RSGRP = "travistestresourcegroup"
STACC = "travistestresourcegr3014"
def cmd(command):
""" Accepts a command line command as a string and returns stdout in UTF-8 format """
... | Update python scripts to run on OSX. | Update python scripts to run on OSX.
| Python | mit | QingChenmsft/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,samedder/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,BurtBiel/azure-cli,BurtBiel/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure... |
5d65b35623d2dbdb518a6e4a7f95ec224bf879a1 | ros_start/scritps/service_client.py | ros_start/scritps/service_client.py | #!/usr/bin/env python
import rospy
from std_srvs.srv import Empty
def service_client():
rospy.loginfo('waiting service')
rospy.wait_for_service('call_me')
try:
service = rospy.ServiceProxy('call_me', Empty)
response = service()
except rospy.ServiceException, e:
print "Service c... | #!/usr/bin/env python
import rospy
from std_srvs.srv import Empty
def call_service():
rospy.loginfo('waiting service')
rospy.wait_for_service('call_me')
try:
service = rospy.ServiceProxy('call_me', Empty)
response = service()
except rospy.ServiceException, e:
print "Service ca... | Add initialization of the service client node. | Add initialization of the service client node.
| Python | bsd-2-clause | OTL/ros_book_programs,OTL/ros_book_programs |
3f7a9d900a1f2cd2f5522735815c999040a920e0 | pajbot/web/routes/api/users.py | pajbot/web/routes/api/users.py | from flask_restful import Resource
from pajbot.managers.redis import RedisManager
from pajbot.managers.user import UserManager
from pajbot.streamhelper import StreamHelper
class APIUser(Resource):
@staticmethod
def get(username):
user = UserManager.find_static(username)
if not user:
... | from flask_restful import Resource
from pajbot.managers.redis import RedisManager
from pajbot.managers.user import UserManager
from pajbot.streamhelper import StreamHelper
class APIUser(Resource):
@staticmethod
def get(username):
user = UserManager.find_static(username)
if not user:
... | Remove dead code in get user API endpoint | Remove dead code in get user API endpoint
| Python | mit | pajlada/tyggbot,pajlada/tyggbot,pajlada/pajbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot,pajlada/pajbot,pajlada/tyggbot |
ddfdddad65a96198d6949c138ad9980188250b92 | alembic/versions/35597d56e8d_add_ckan_boolean_to_mod_table.py | alembic/versions/35597d56e8d_add_ckan_boolean_to_mod_table.py | """Add ckan boolean to mod table
Revision ID: 35597d56e8d
Revises: 18af22fa9e4
Create Date: 2014-12-12 20:11:22.250080
"""
# revision identifiers, used by Alembic.
revision = '35597d56e8d'
down_revision = '18af22fa9e4'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated b... | """Add ckan boolean to mod table
Revision ID: 35597d56e8d
Revises: 18af22fa9e4
Create Date: 2014-12-12 20:11:22.250080
"""
# revision identifiers, used by Alembic.
revision = '35597d56e8d'
down_revision = '50b5a95300c'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated b... | Fix loop in alembic history | Fix loop in alembic history
| Python | mit | Kerbas-ad-astra/KerbalStuff,Kerbas-ad-astra/KerbalStuff,toadicus/KerbalStuff,KerbalStuff/KerbalStuff,EIREXE/SpaceDock,ModulousSmash/Modulous,KerbalStuff/KerbalStuff,ModulousSmash/Modulous,ModulousSmash/Modulous,toadicus/KerbalStuff,ModulousSmash/Modulous,EIREXE/SpaceDock,EIREXE/SpaceDock,toadicus/KerbalStuff,Kerbas-ad-... |
89112aa8e5ffda6763db2f49a2d32cff5f6b15fd | lib/storage/gcs.py | lib/storage/gcs.py |
import gevent.monkey
gevent.monkey.patch_all()
import logging
import boto.gs.connection
import boto.gs.key
import cache
from boto_base import BotoStorage
logger = logging.getLogger(__name__)
class GSStorage(BotoStorage):
def __init__(self, config):
BotoStorage.__init__(self, config)
def makeC... |
import gevent.monkey
gevent.monkey.patch_all()
import logging
import boto.gs.connection
import boto.gs.key
import cache
from boto_base import BotoStorage
logger = logging.getLogger(__name__)
class GSStorage(BotoStorage):
def __init__(self, config):
BotoStorage.__init__(self, config)
def makeC... | Fix up some key construction. | Fix up some key construction.
| Python | apache-2.0 | depay/docker-registry,alephcloud/docker-registry,HubSpot/docker-registry,dhiltgen/docker-registry,catalyst-zero/docker-registry,ewindisch/docker-registry,hex108/docker-registry,scrapinghub/docker-registry,ewindisch/docker-registry,shipyard/docker-registry,mdshuai/docker-registry,OnePaaS/docker-registry,nunogt/docker-re... |
293b1d492cfd3c5542c78acffbbdebf4933b6d85 | django_db_geventpool/backends/postgresql_psycopg2/creation.py | django_db_geventpool/backends/postgresql_psycopg2/creation.py | # coding=utf-8
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation as OriginalDatabaseCreation
class DatabaseCreation(OriginalDatabaseCreation):
def _destroy_test_db(self, test_database_name, verbosity):
self.connection.closeall()
return super(DatabaseCreation, self)._des... | # coding=utf-8
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation as OriginalDatabaseCreation
class DatabaseCreation(OriginalDatabaseCreation):
def _destroy_test_db(self, test_database_name, verbosity):
self.connection.closeall()
return super(DatabaseCreation, self)._des... | Handle open connections when creating the test database | Handle open connections when creating the test database
| Python | apache-2.0 | jneight/django-db-geventpool,PreppyLLC-opensource/django-db-geventpool |
0aff137a210debd9ea18793a98c043a5151d9524 | src/Compiler/VM/arithmetic_exprs.py | src/Compiler/VM/arithmetic_exprs.py | from Helpers.string import *
def binop_aexp(commands, env, op, left, right):
left.compile_vm(commands, env)
right.compile_vm(commands, env)
if op == '+':
value = assemble(Add)
elif op == '-':
value = assemble(Sub)
elif op == '*':
value = assemble(Mul)
elif op == '/':
... | from Helpers.string import *
def binop_aexp(commands, env, op, left, right):
left.compile_vm(commands, env)
right.compile_vm(commands, env)
if op == '+':
value = assemble(Add)
elif op == '-':
value = assemble(Sub)
elif op == '*':
value = assemble(Mul)
elif op == '/':
... | Fix compiling problem for runtime variables | Fix compiling problem for runtime variables
| Python | mit | PetukhovVictor/compiler,PetukhovVictor/compiler |
c3bac71b19842d9010390996c094119ed25566ab | class_namespaces/scope_proxy.py | class_namespaces/scope_proxy.py | """Base class for Namespace proxies in class creation."""
import weakref
from . import ops
from .proxy import _Proxy
_PROXY_INFOS = weakref.WeakKeyDictionary()
class _ScopeProxy(_Proxy):
"""Proxy object for manipulating namespaces during class creation."""
__slots__ = '__weakref__',
def __init__(sel... | """Base class for Namespace proxies in class creation."""
import weakref
from . import ops
from .proxy import _Proxy
_PROXY_INFOS = weakref.WeakKeyDictionary()
class _ScopeProxy(_Proxy):
"""Proxy object for manipulating namespaces during class creation."""
__slots__ = '__weakref__',
def __init__(sel... | Fix for bug. Overall somewhat unfortunate. | Fix for bug. Overall somewhat unfortunate.
| Python | mit | mwchase/class-namespaces,mwchase/class-namespaces |
2e95901ee37100f855a5f30e6143920ef2b56904 | odinweb/_compat.py | odinweb/_compat.py | # -*- coding: utf-8 -*-
"""
Py27 Support
~~~~~~~~~~~~
Like odin this library will support Python 2.7 through to version 2.0.
From this point onwards Python 3.5+ will be required.
"""
from __future__ import unicode_literals
import sys
__all__ = (
'PY2', 'PY3',
'string_types', 'integer_types', 'text_type', '... | # -*- coding: utf-8 -*-
"""
Py27 Support
~~~~~~~~~~~~
Like odin this library will support Python 2.7 through to version 2.0.
From this point onwards Python 3.5+ will be required.
"""
import sys
__all__ = (
'PY2', 'PY3',
'string_types', 'integer_types', 'text_type', 'binary_type',
'range', 'with_metaclas... | Remove unicode literals to fix with_metaclass method | Remove unicode literals to fix with_metaclass method
| Python | bsd-3-clause | python-odin/odinweb,python-odin/odinweb |
da59d4334eb1a6f77bd0a9599614a6289ef843e4 | pytest-server-fixtures/tests/integration/test_mongo_server.py | pytest-server-fixtures/tests/integration/test_mongo_server.py | import pytest
def test_mongo_server(mongo_server):
assert mongo_server.check_server_up()
assert mongo_server.delete
mongo_server.api.db.test.insert_one({'a': 'b', 'c': 'd'})
assert mongo_server.api.db.test.find_one({'a': 'b'}, {'_id': False}) == {'a': 'b', 'c': 'd'}
@pytest.mark.parametrize('count',... | import pytest
def test_mongo_server(mongo_server):
assert mongo_server.check_server_up()
assert mongo_server.delete
mongo_server.api.db.test.insert({'a': 'b', 'c': 'd'})
assert mongo_server.api.db.test.find_one({'a': 'b'}, {'_id': False}) == {'a': 'b', 'c': 'd'}
@pytest.mark.parametrize('count', ran... | Revert "fix deprecation warnings in mongo" | Revert "fix deprecation warnings in mongo"
This reverts commit 5d449ff9376e7c0a3c78f2b2d631ab0ecd08fe81.
| Python | mit | manahl/pytest-plugins,manahl/pytest-plugins |
38365839856658bcf870e286a27f0de784a255a2 | test/tools/lldb-mi/TestMiLibraryLoaded.py | test/tools/lldb-mi/TestMiLibraryLoaded.py | """
Test lldb-mi =library-loaded notifications.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
class MiLibraryLoadedTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement fo... | """
Test lldb-mi =library-loaded notifications.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
class MiLibraryLoadedTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement fo... | Fix MiLibraryLoadedTestCase.test_lldbmi_library_loaded test on Linux (MI) | Fix MiLibraryLoadedTestCase.test_lldbmi_library_loaded test on Linux (MI)
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@236229 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb |
abe1727600eb1c83c196f9b7bd72e58e4df89c57 | feincms/views/base.py | feincms/views/base.py | from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils import translation
from feincms.module.page.models import Page
def handler(request, path=None):
if path is None:
path = request.path
page = Page.o... |
from django.shortcuts import get_object_or_404
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.template import RequestContext
from feincms.module.page.models import Page
def build_page_response(page, request):
response = page.setup_request(req... | Add a handler for previewing content (ignores active, publication dates, etc). | Add a handler for previewing content (ignores active, publication dates, etc).
| Python | bsd-3-clause | feincms/feincms,nickburlett/feincms,matthiask/django-content-editor,feincms/feincms,nickburlett/feincms,mjl/feincms,matthiask/feincms2-content,joshuajonah/feincms,joshuajonah/feincms,michaelkuty/feincms,hgrimelid/feincms,pjdelport/feincms,matthiask/feincms2-content,joshuajonah/feincms,nickburlett/feincms,feincms/feincm... |
16c71ce44836a3cea877475340cae7f96241fd5d | tests/test_person.py | tests/test_person.py | from copy import copy
from unittest import TestCase
from address_book import Person
class PersonTestCase(TestCase):
def test_get_groups(self):
pass
def test_add_address(self):
basic_address = ['Russian Federation, Kemerovo region, Kemerovo, Kirova street 23, apt. 42']
person = Pers... | from copy import copy
from unittest import TestCase
from address_book import Person
class PersonTestCase(TestCase):
def test_get_groups(self):
pass
def test_add_address(self):
basic_address = ['Russian Federation, Kemerovo region, Kemerovo, Kirova street 23, apt. 42']
person = Pers... | Test the ability to append new email address to the person | Test the ability to append new email address to the person
| Python | mit | dizpers/python-address-book-assignment |
2811edf8908c680b80e6534444cdc48feba9af12 | base/components/social/youtube/factories.py | base/components/social/youtube/factories.py | import factory
from . import models
class ChannelFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = models.Channel
class VideoFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = models.Video
| import factory
from . import models
class ChannelFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = models.Channel
class VideoFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = models.Video
channel = factory.SubFactory(ChannelFactory)
class ThumbnailFactory(factory.django.DjangoModelFa... | Create a factory for Thumbnails. | Create a factory for Thumbnails.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web |
c92d9c6da02dacdd91a21c3c5675940154c0e21a | cla_backend/apps/reports/db/backend/base.py | cla_backend/apps/reports/db/backend/base.py | from django.db.backends.postgresql_psycopg2.base import * # noqa
class DynamicTimezoneDatabaseWrapper(DatabaseWrapper):
'''
This exists to allow report generation SQL to set the time zone of the
connection without interference from Django, which normally tries to
ensure that all connections are UTC i... | from django.db.backends.postgresql_psycopg2.base import * # noqa
import pytz
def local_tzinfo_factory(offset):
'''
Create a tzinfo object using the offset of the db connection. This ensures
that the datetimes returned are timezone aware and will be printed in the
reports with timezone information.
... | Add a tzinfo factory method to replica connection to create local tzinfos | Add a tzinfo factory method to replica connection to create local tzinfos
This is to ensure that the datetimes returned for report generation
are timezone aware and will thus be printed in the reports with
timezone information.
| Python | mit | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend |
b72c7dedc1200d95310fb07bfeb6de8cc1663ffb | src/wirecloudcommons/utils/transaction.py | src/wirecloudcommons/utils/transaction.py | from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed
from django.db import DEFAULT_DB_ALIAS
from django.http import HttpResponse
def commit_on_http_success(func, using=None):
"""
This decorator activates db commit on HTTP success res... | from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed
from django.db import DEFAULT_DB_ALIAS
from django.http import HttpResponse
def commit_on_http_success(func, using=None):
"""
This decorator activates db commit on HTTP success res... | Fix commit_on_http_success when an exception is raised | Fix commit_on_http_success when an exception is raised
| Python | agpl-3.0 | jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud |
8225105cf2e72560d8c53ec58c1b98683a613381 | util/versioncheck.py | util/versioncheck.py | #!/usr/bin/python
from subprocess import check_output as co
from sys import exit
# Actually run bin/mn rather than importing via python path
version = 'Mininet ' + co( 'PYTHONPATH=. bin/mn --version', shell=True )
version = version.strip()
# Find all Mininet path references
lines = co( "grep -or 'Mininet \w\+\.\w\+\... | #!/usr/bin/python
from subprocess import check_output as co
from sys import exit
# Actually run bin/mn rather than importing via python path
version = 'Mininet ' + co( 'PYTHONPATH=. bin/mn --version', shell=True )
version = version.strip()
# Find all Mininet path references
lines = co( "egrep -or 'Mininet [0-9\.]+\w... | Fix to allow more flexible version numbers | Fix to allow more flexible version numbers
| Python | bsd-3-clause | mininet/mininet,mininet/mininet,mininet/mininet |
895d51105cd51387e3ac5db595333ff794f3e2a7 | yotta/lib/ordered_json.py | yotta/lib/ordered_json.py | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import json
import os
import stat
from collections import OrderedDict
# provide read & write methods for json files that maintain the order of
# dictionary keys, and indent c... | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import json
import os
import stat
from collections import OrderedDict
# provide read & write methods for json files that maintain the order of
# dictionary keys, and indent c... | Add a newline at the end of json files when writing them. | Add a newline at the end of json files when writing them.
This fixes the really irritating ping-pong of newline/nonewline when editing
json files with an editor, and with `yotta version` commands.
| Python | apache-2.0 | BlackstoneEngineering/yotta,autopulated/yotta,ARMmbed/yotta,stevenewey/yotta,ARMmbed/yotta,autopulated/yotta,ntoll/yotta,BlackstoneEngineering/yotta,stevenewey/yotta,eyeye/yotta,ntoll/yotta,eyeye/yotta |
3750bc289685fc243788ee3330676ef7e4387234 | apps/accounts/tests/test_user_landing.py | apps/accounts/tests/test_user_landing.py | # (c) Crown Owned Copyright, 2016. Dstl.
from django.core.urlresolvers import reverse
from django_webtest import WebTest
class KeycloakHeaderLandAtHome(WebTest):
def test_auto_login_on_landing(self):
headers = { 'KEYCLOAK_USERNAME' : 'user@0001.com' }
response = self.app.get(reverse('home'), head... | # (c) Crown Owned Copyright, 2016. Dstl.
from django.core.urlresolvers import reverse
from django_webtest import WebTest
class KeycloakHeaderLandAtHome(WebTest):
def test_auto_login_on_landing(self):
headers = { 'KEYCLOAK_USERNAME' : 'user@0001.com' }
response = self.app.get(reverse('home'), head... | Test for landing login now asserts against the correct path. | Test for landing login now asserts against the correct path.
| Python | mit | dstl/lighthouse,dstl/lighthouse,dstl/lighthouse,dstl/lighthouse,dstl/lighthouse |
65f069c82beea8e96bce780add4f6c3637a0d549 | challenge_3/python/ning/challenge_3.py | challenge_3/python/ning/challenge_3.py | def find_majority(sequence):
item_counter = dict()
for item in sequence:
if item not in item_counter:
item_counter[item] = 1
else:
item_counter[item] += 1
for item, item_count in item_counter.items():
if item_count > len(sequence) / 2:
return ite... | def find_majority(sequence):
item_counter = dict()
for item in sequence:
if item not in item_counter:
item_counter[item] = 1
else:
item_counter[item] += 1
if item_counter[item] > len(sequence) / 2:
return item
test_sequence_list = [2,2,3,7,5,... | Include check majority in first loop rather than separate loop | Include check majority in first loop rather than separate loop
| Python | mit | mindm/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,popcornanachr... |
fb027f075c3745c5b14a5c611063d161a47f60e4 | oidc_apis/id_token.py | oidc_apis/id_token.py | import inspect
from .scopes import get_userinfo_by_scopes
def process_id_token(payload, user, scope=None):
if scope is None:
# HACK: Steal the scope argument from the locals dictionary of
# the caller, since it was not passed to us
scope = inspect.stack()[1][0].f_locals.get('scope', [])
... | import inspect
from .scopes import get_userinfo_by_scopes
def process_id_token(payload, user, scope=None):
if scope is None:
# HACK: Steal the scope argument from the locals dictionary of
# the caller, since it was not passed to us
scope = inspect.stack()[1][0].f_locals.get('scope', [])
... | Revert "Add username to ID Token" | Revert "Add username to ID Token"
This reverts commit 6e1126fe9a8269ff4489ee338000afc852bce922.
| Python | mit | mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo |
91fa1a8eec10b83aa5142d9519a3759b4e310cff | bluebottle/test/factory_models/accounts.py | bluebottle/test/factory_models/accounts.py | from builtins import object
import factory
from django.contrib.auth.models import Group
from bluebottle.members.models import Member
class BlueBottleUserFactory(factory.DjangoModelFactory):
class Meta(object):
model = Member
username = factory.Faker('email')
email = factory.Faker('email')
f... | from builtins import object
import factory
from django.contrib.auth.models import Group
from bluebottle.members.models import Member
class BlueBottleUserFactory(factory.DjangoModelFactory):
class Meta(object):
model = Member
username = factory.Sequence(lambda n: u'user_{0}'.format(n))
email = f... | Fix duplicate users during tests | Fix duplicate users during tests
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle |
4b6c27e02667fe6f5208b5b5dfa1f5dafe112c30 | luigi/tasks/export/search/chunk.py | luigi/tasks/export/search/chunk.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | Use new psql based export | Use new psql based export
This changes the function arguments to use.
| Python | apache-2.0 | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline |
6d6b43ef861451e4d94acc5d7821b19734e60673 | apps/local_apps/account/context_processors.py | apps/local_apps/account/context_processors.py |
from account.models import Account, AnonymousAccount
def openid(request):
return {'openid': request.openid}
def account(request):
account = AnonymousAccount(request)
if request.user.is_authenticated():
try:
account = Account._default_manager.get(user=request.user)
except (Acco... |
from account.models import Account, AnonymousAccount
def openid(request):
return {'openid': request.openid}
def account(request):
if request.user.is_authenticated():
try:
account = Account._default_manager.get(user=request.user)
except (Account.DoesNotExist, Account.MultipleObject... | Handle the exception case in the account context_processor. | Handle the exception case in the account context_processor.
| Python | mit | ingenieroariel/pinax,ingenieroariel/pinax |
581285a6d887ab9beef3e2014db7f259109d1b5a | exercises/ex20.py | exercises/ex20.py | #!/usr/bin/python
def translate(translation_list):
trans_dict = {"merry":"god", "christmas":"jul", "and":"och",
"happy":"gott", "new":"nytt", "year":"år"}
final_translation_list = []
for word in translation_list:
if word in trans_dict:
final_translation_list.append... | # -*- coding: utf-8 -*-
#!/usr/bin/python
def translate(translation_list):
trans_dict = {"merry":"god", "christmas":"jul", "and":"och",
"happy":"gott", "new":"nytt", "year":"år"}
final_translation_list = []
for word in translation_list:
if word in trans_dict:
final... | Add some utf-8 encoding due to special chars. | Add some utf-8 encoding due to special chars.
| Python | mit | gravyboat/python-exercises |
cf0850e23b07c656bd2bc56c88f9119dc4142931 | mooch/banktransfer.py | mooch/banktransfer.py | from django import http
from django.conf.urls import url
from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from mooch.base import BaseMoocher, require_POST_m
from mooch.signals imp... | from django import http
from django.conf.urls import url
from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from mooch.base import BaseMoocher, require_POST_m
from mooch.signals imp... | Allow disabling the autocharging behavior of the bank transfer moocher | Allow disabling the autocharging behavior of the bank transfer moocher
| Python | mit | matthiask/django-mooch,matthiask/django-mooch,matthiask/django-mooch |
b569ce0ae444e43cf6a64dd034186877cc259e2d | luigi/tasks/export/ftp/fasta/__init__.py | luigi/tasks/export/ftp/fasta/__init__.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | Clean up main fasta tasks | Clean up main fasta tasks
This removes the unneeded compress tasks as well as makes it easier to
know what task to run.
| Python | apache-2.0 | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline |
1ffff2738c4ced2aedb8b63f5c729860aab1bac7 | marshmallow_jsonapi/__init__.py | marshmallow_jsonapi/__init__.py | from .schema import Schema, SchemaOpts
__version__ = "0.21.2"
__author__ = "Steven Loria"
__license__ = "MIT"
__all__ = ("Schema", "SchemaOpts")
| from .schema import Schema, SchemaOpts
__version__ = "0.21.2"
__all__ = ("Schema", "SchemaOpts")
| Remove unnecessary `__author__` and `__license__` | Remove unnecessary `__author__` and `__license__`
| Python | mit | marshmallow-code/marshmallow-jsonapi |
fc7323ddb0b2700ad459a8016fe4e56d9ac8e352 | morepath/tests/test_template.py | morepath/tests/test_template.py | import os
import morepath
from webtest import TestApp as Client
import pytest
from .fixtures import template
def setup_module(module):
morepath.disable_implicit()
def test_template():
config = morepath.setup()
config.scan(template)
config.commit()
c = Client(template.App())
response = c.get... | import os
import morepath
from webtest import TestApp as Client
import pytest
from .fixtures import template
def setup_module(module):
morepath.disable_implicit()
def test_template_fixture():
config = morepath.setup()
config.scan(template)
config.commit()
c = Client(template.App())
response... | Rename one test so it actually gets run. | Rename one test so it actually gets run.
| Python | bsd-3-clause | morepath/morepath,faassen/morepath,taschini/morepath |
63130e4e438c34815bcd669d0088235140a62ced | readthedocs/core/utils/tasks/__init__.py | readthedocs/core/utils/tasks/__init__.py | from .permission_checks import *
from .public import *
from .retrieve import *
| from .permission_checks import user_id_matches
from .public import permission_check
from .public import get_public_task_data
from .retrieve import TaskNotFound
from .retrieve import get_task_data
| Remove star imports to remove pyflakes errors | Remove star imports to remove pyflakes errors
| Python | mit | safwanrahman/readthedocs.org,pombredanne/readthedocs.org,rtfd/readthedocs.org,tddv/readthedocs.org,safwanrahman/readthedocs.org,davidfischer/readthedocs.org,davidfischer/readthedocs.org,davidfischer/readthedocs.org,tddv/readthedocs.org,pombredanne/readthedocs.org,tddv/readthedocs.org,rtfd/readthedocs.org,safwanrahman/r... |
cecea26672d74a026383c08ebf26bc72ab2ee66c | pingparsing/_pingtransmitter.py | pingparsing/_pingtransmitter.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import platform
import dataproperty
class PingTransmitter(object):
def __init__(self):
self.destination_host = ""
self.waittime = 1
... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
import platform
import dataproperty
PingResult = namedtuple("PingResult", "stdout stderr returncode")
class PingTrans... | Change ping result error handling to return values instead of raise exception | Change ping result error handling to return values instead of raise exception
| Python | mit | thombashi/pingparsing,thombashi/pingparsing |
9db0f0430466b9d4d70c7803f7d39ecdeb85e375 | src/puzzle/problems/image/image_problem.py | src/puzzle/problems/image/image_problem.py | import numpy as np
from puzzle.problems import problem
class ImageProblem(problem.Problem):
def __init__(self, name: str, data: np.ndarray, *args, **kwargs) -> None:
super(ImageProblem, self).__init__(name, data, *args, **kwargs)
@staticmethod
def score(data: problem.ProblemData) -> float:
if not isin... | import numpy as np
from data.image import image
from puzzle.constraints.image import prepare_image_constraints
from puzzle.problems import problem
from puzzle.steps.image import prepare_image
class ImageProblem(problem.Problem):
_source_image: image.Image
_prepare_image: prepare_image.PrepareImage
def __init_... | Update ImageProblem to use PrepareImage step. | Update ImageProblem to use PrepareImage step.
| Python | mit | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge |
20c77152d1b81fd3ab42d9e563bb7170ef96906c | tools/misc/python/test-phenodata-output.py | tools/misc/python/test-phenodata-output.py | # TOOL test-phenodata-output.py: "Test phenodata output in Python" ()
# OUTPUT phenodata.tsv
# OUTPUT output.tsv
with open('output.tsv', 'w') as f:
f.write('test output\n')
f.write('test output\n')
with open('phenodata.tsv', 'w') as f:
f.write('sample original_name chiptype group\n')
f.write('microarray001.cel c... | # TOOL test-phenodata-output.py: "Test phenodata output in Python" ()
# INPUT input{...}.tsv TYPE GENERIC
# OUTPUT phenodata.tsv
# OUTPUT output.tsv
with open('output.tsv', 'w') as f:
f.write('identifier chip.sample1\n')
f.write('test output\n')
with open('phenodata.tsv', 'w') as f:
f.write('dataset column sample ... | Make output similar to Define NGS experiment tool | Make output similar to Define NGS experiment tool | Python | mit | chipster/chipster-tools,chipster/chipster-tools,chipster/chipster-tools,chipster/chipster-tools |
f96d2ceef6b15e397e82e310a3f369f61879a6d0 | ptpython/validator.py | ptpython/validator.py | from __future__ import unicode_literals
from prompt_toolkit.validation import Validator, ValidationError
__all__ = (
'PythonValidator',
)
class PythonValidator(Validator):
"""
Validation of Python input.
:param get_compiler_flags: Callable that returns the currently
active compiler flags.
... | from __future__ import unicode_literals
from prompt_toolkit.validation import Validator, ValidationError
__all__ = (
'PythonValidator',
)
class PythonValidator(Validator):
"""
Validation of Python input.
:param get_compiler_flags: Callable that returns the currently
active compiler flags.
... | Make get_compiler_flags optional for PythonValidator. (Fixes ptipython.) | Make get_compiler_flags optional for PythonValidator. (Fixes ptipython.)
| Python | bsd-3-clause | jonathanslenders/ptpython |
91a9da3bb1dda73add2a3040d35c9c58f7b5b4a5 | alg_lonely_integer.py | alg_lonely_integer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def lonely_integer():
pass
def main():
pass
if __name__ == '__main__':
main()
| from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def lonely_integer_naive(a_list):
"""Lonely integer by naive dictionary.
Time complexity: O(n).
Space complexity: O(n).
"""
integer_count_d = {}
for x in a_list:
if x in i... | Complete lonely int by naive dict & bit op | Complete lonely int by naive dict & bit op
| Python | bsd-2-clause | bowen0701/algorithms_data_structures |
5455a7796ece5a8987ef99f70d469ed3770f6a76 | server/src/weblab/db/gateway.py | server/src/weblab/db/gateway.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | Fix cfg_manager not existing in AbstractDatabaseGateway | Fix cfg_manager not existing in AbstractDatabaseGateway
| Python | bsd-2-clause | morelab/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,zstars/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,weblabdeusto/webla... |
7e97a1d060dc903f1e6a0c3f9f777edebabb99f7 | indra/tests/test_rlimsp.py | indra/tests/test_rlimsp.py | from indra.sources import rlimsp
def test_simple_usage():
rp = rlimsp.process_from_webservice('PMC3717945')
stmts = rp.statements
assert len(stmts) == 6, len(stmts)
for s in stmts:
assert len(s.evidence) == 1, "Wrong amount of evidence."
ev = s.evidence[0]
assert ev.annotations... | from indra.sources import rlimsp
def test_simple_usage():
rp = rlimsp.process_from_webservice('PMC3717945')
stmts = rp.statements
assert len(stmts) == 6, len(stmts)
for s in stmts:
assert len(s.evidence) == 1, "Wrong amount of evidence."
ev = s.evidence[0]
assert ev.annotations... | Check final count of statements. | Check final count of statements.
| Python | bsd-2-clause | pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,johnbachman/indra,bgyori/indra,sorgerlab/indra,bgyori/indra,johnbachman/belpy,johnbachman/belpy,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/belpy,johnbachman/indra |
127a6d65b46e94f7698ae9739c1770903068351a | bempy/django/views.py | bempy/django/views.py | # -*- coding: utf-8 -*-
import os.path
from django.http import HttpResponse
from django.conf import settings
from functools import wraps
from bempy import ImmediateResponse
def returns_blocks(func):
@wraps(func)
def wrapper(request):
page = func(request)
try:
if isinstanc... | # -*- coding: utf-8 -*-
import os.path
from django.http import HttpResponse
from django.conf import settings
from functools import wraps
from bempy import ImmediateResponse
def returns_blocks(func):
@wraps(func)
def wrapper(request, *args, **kwargs):
page = func(request, *args, **kwargs)
try... | Make wrapper returned by `returns_blocks` decorator, understand additional `args` and `kwargs` arguments. | Make wrapper returned by `returns_blocks` decorator, understand additional `args` and `kwargs` arguments.
| Python | bsd-3-clause | svetlyak40wt/bempy,svetlyak40wt/bempy,svetlyak40wt/bempy |
6ed4aa25d5e7113df75a622f6e86e83e9ace1390 | djangoautoconf/cmd_handler_base/database_connection_maintainer.py | djangoautoconf/cmd_handler_base/database_connection_maintainer.py | import thread
import time
from django.db import close_old_connections
class DatabaseConnectionMaintainer(object):
def __init__(self):
self.clients = set()
# self.device_to_protocol = {}
self.is_recent_db_change_occurred = False
self.delay_and_execute(3600, self.close_db_connection... | import thread
import time
from django.db import close_old_connections
class DatabaseConnectionMaintainer(object):
DB_TIMEOUT_SECONDS = 5*60
def __init__(self):
self.clients = set()
# self.device_to_protocol = {}
self.is_recent_db_change_occurred = False
self.delay_and_execute... | Update database close timeout value. | Update database close timeout value.
| Python | bsd-3-clause | weijia/djangoautoconf,weijia/djangoautoconf |
2c502a77ad18d34470e2be89ed1c7a38e6f3799d | tests/test_drogher.py | tests/test_drogher.py | import pytest
import drogher
from drogher.exceptions import InvalidBarcode
class TestDrogher:
def test_barcode(self):
shipper = drogher.barcode('1Z999AA10123456784')
assert shipper.shipper == 'UPS'
def test_invalid_barcode(self):
with pytest.raises(InvalidBarcode):
droghe... | import pytest
import drogher
from drogher.exceptions import InvalidBarcode
class TestDrogher:
def test_dhl_barcode(self):
shipper = drogher.barcode('1656740256')
assert shipper.shipper == 'DHL'
def test_fedex_express_barcode(self):
shipper = drogher.barcode('9632001960000000000400152... | Test barcode function with all shippers | Test barcode function with all shippers
| Python | bsd-3-clause | jbittel/drogher |
cca4f761ed39bd970c76c3b4ca581511bfe0130d | web/app/djrq/templates/letterscountsbar.py | web/app/djrq/templates/letterscountsbar.py | # encoding: cinje
: from cinje.std.html import link, div, span
: from urllib.parse import urlencode, quote_plus
: def letterscountsbar ctx, letterscountslist
: try
: selected_letter = ctx.selected_letter
: except AttributeError
: selected_letter = None
: end
<div class="col-sm-1 list-grou... | # encoding: cinje
: from cinje.std.html import link, div, span
: from urllib.parse import urlencode, quote_plus
: def letterscountsbar ctx, letterscountslist
: try
: selected_letter = ctx.selected_letter
: except AttributeError
: selected_letter = None
: end
<div class="col-sm-1 list-grou... | Fix problem on letter list display when the letter is a <space> | Fix problem on letter list display when the letter is a <space>
Work around for now for issue #10. And will need to be permanant, since
the real fix to the database import would make removing the space
optional.
| Python | mit | bmillham/djrq2,bmillham/djrq2,bmillham/djrq2 |
d80c726fcf36a2dc439ce12717f9e88161501358 | gather/node/models.py | gather/node/models.py | # -*- coding:utf-8 -*-
from flask.ext.sqlalchemy import models_committed
from gather.extensions import db, cache
class Node(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False, unique=True, index=True)
slug = db.Column(db.String(100), nullable=False, un... | # -*- coding:utf-8 -*-
from flask.ext.sqlalchemy import models_committed
from gather.extensions import db, cache
class Node(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False, unique=True, index=True)
slug = db.Column(db.String(100), nullable=False, un... | Add order in nodes in topic creation form | Add order in nodes in topic creation form
| Python | mit | whtsky/Gather,whtsky/Gather |
5d70735ab4254509e1efed73be4eecf77629063e | github_hook_server.py | github_hook_server.py | #! /usr/bin/env python
""" Our github hook receiving server. """
import os
from flask import Flask
from flask_hookserver import Hooks
from github import validate_review_request
from slack import notify_reviewer
app = Flask(__name__)
app.config['GITHUB_WEBHOOKS_KEY'] = os.environ.get('GITHUB_WEBHOOKS_KEY')
app.confi... | #! /usr/bin/env python
""" Our github hook receiving server. """
import os
from flask import Flask
from flask_hookserver import Hooks
from github import validate_review_request
from slack import notify_reviewer
app = Flask(__name__)
app.config['GITHUB_WEBHOOKS_KEY'] = os.environ.get('GITHUB_WEBHOOKS_KEY')
if os.env... | Fix env vars always evaluating as true | Fix env vars always evaluating as true
Env vars come through as strings. Which are true. The default on our
values is also true. Meaning it would never change. So we have to do
special string checking to get it to actually change. Yay.
| Python | mit | DobaTech/github-review-slack-notifier |
93081d423a73a6b16e5adfb94247ffec23ef667c | api/base/authentication/backends.py | api/base/authentication/backends.py | from osf.models.user import OSFUser
from framework.auth.core import get_user
from django.contrib.auth.backends import ModelBackend
# https://docs.djangoproject.com/en/1.8/topics/auth/customizing/
class ODMBackend(ModelBackend):
def authenticate(self, username=None, password=None):
return get_user(email=us... | from osf.models.user import OSFUser
from framework.auth.core import get_user
from django.contrib.auth.backends import ModelBackend
# https://docs.djangoproject.com/en/3.2/topics/auth/customizing/
class ODMBackend(ModelBackend):
def authenticate(self, request, username=None, password=None, **kwargs):
retu... | Fix admin login failure for django upgrade | Fix admin login failure for django upgrade
| Python | apache-2.0 | Johnetordoff/osf.io,Johnetordoff/osf.io,Johnetordoff/osf.io,Johnetordoff/osf.io |
db4355ce0345df9dd23b937370f5f0d4cb2164e9 | zc_common/remote_resource/filters.py | zc_common/remote_resource/filters.py | import re
from django.db.models.fields.related import ManyToManyField
from rest_framework import filters
class JSONAPIFilterBackend(filters.DjangoFilterBackend):
def filter_queryset(self, request, queryset, view):
filter_class = self.get_filter_class(view, queryset)
primary_key = queryset.model._... | import re
from distutils.util import strtobool
from django.db.models import BooleanField, FieldDoesNotExist
from django.db.models.fields.related import ManyToManyField
from rest_framework import filters
class JSONAPIFilterBackend(filters.DjangoFilterBackend):
def filter_queryset(self, request, queryset, view):
... | Use 'true' while filtering a boolean as opposed to 'True' | Use 'true' while filtering a boolean as opposed to 'True'
| Python | mit | ZeroCater/zc_common,ZeroCater/zc_common |
583ea6c1a234ab9d484b1e80e7f567d9a5d2fb71 | shopify/resources/image.py | shopify/resources/image.py | from ..base import ShopifyResource
import base64
import re
class Image(ShopifyResource):
_prefix_source = "/admin/products/$product_id/"
def __getattr__(self, name):
if name in ["pico", "icon", "thumb", "small", "compact", "medium", "large", "grande", "original"]:
return re.sub(r"/(.*)\.(... | from ..base import ShopifyResource
from ..resources import Metafield
from six.moves import urllib
import base64
import re
class Image(ShopifyResource):
_prefix_source = "/admin/products/$product_id/"
def __getattr__(self, name):
if name in ["pico", "icon", "thumb", "small", "compact", "medium", "larg... | Add `metafields()` method to `Image` resource. | Add `metafields()` method to `Image` resource. | Python | mit | asiviero/shopify_python_api,SmileyJames/shopify_python_api,Shopify/shopify_python_api,metric-collective/shopify_python_api,gavinballard/shopify_python_api,ifnull/shopify_python_api |
b771fd2a463266e1c80b1b4cccfe78d822c391a2 | byceps/blueprints/admin/shop/order/forms.py | byceps/blueprints/admin/shop/order/forms.py | """
byceps.blueprints.admin.shop.order.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask_babel import lazy_gettext
from wtforms import BooleanField, RadioField, StringField, TextAreaField
from wtforms.validat... | """
byceps.blueprints.admin.shop.order.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask_babel import lazy_gettext
from wtforms import BooleanField, RadioField, StringField, TextAreaField
from wtforms.validat... | Stabilize order of payment methods in mark-as-paid form | Stabilize order of payment methods in mark-as-paid form
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps |
216a52d52fdbfca959946434a81f4d42270bfd95 | bluebottle/organizations/serializers.py | bluebottle/organizations/serializers.py | from rest_framework import serializers
from bluebottle.organizations.models import Organization
from bluebottle.utils.serializers import URLField
class OrganizationSerializer(serializers.ModelSerializer):
class Meta:
model = Organization
fields = ('id', 'name', 'slug', 'address_line1', 'address_l... | from rest_framework import serializers
from bluebottle.organizations.models import Organization
from bluebottle.utils.serializers import URLField
class OrganizationSerializer(serializers.ModelSerializer):
class Meta:
model = Organization
fields = ('id', 'name', 'slug', 'address_line1', 'address_l... | Make the name of an organization required | Make the name of an organization required
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle |
bf5518f2f181879141279d9322fe75f3163d438d | byceps/services/news/transfer/models.py | byceps/services/news/transfer/models.py | """
byceps.services.news.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from dataclasses import dataclass
from datetime import datetime
from typing import List, NewType
from uuid import UUID
from ....typing import B... | """
byceps.services.news.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from dataclasses import dataclass
from datetime import datetime
from typing import List, NewType, Optional
from uuid import UUID
from ....typin... | Mark optional news image and item fields as such | Mark optional news image and item fields as such
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps |
c2a0b4c99f515a6fafae85d72be9d54b3c92c0b3 | databench/__init__.py | databench/__init__.py | """Databench module."""
__version__ = "0.3.0"
# Need to make sure monkey.patch_all() is applied before any
# 'import threading', but cannot raise error because building the Sphinx
# documentation also suffers from this problem, but there it can be ignored.
import sys
if 'threading' in sys.modules:
print 'WARNING:... | """Databench module."""
__version__ = "0.3.0"
# Need to make sure monkey.patch_all() is applied before any
# 'import threading', but cannot raise error because building the Sphinx
# documentation also suffers from this problem, but there it can be ignored.
import sys
if 'threading' in sys.modules:
print 'WARNING:... | Change all instances list of Meta from a global to a class variable. | Change all instances list of Meta from a global to a class variable.
| Python | mit | svenkreiss/databench,svenkreiss/databench,svenkreiss/databench,svenkreiss/databench |
e16960eaaf38513e80fb18580c3e4320978407e4 | chainer/training/triggers/__init__.py | chainer/training/triggers/__init__.py | from chainer.training.triggers import interval_trigger # NOQA
from chainer.training.triggers import minmax_value_trigger # NOQA
# import class and function
from chainer.training.triggers.early_stopping_trigger import EarlyStoppingTrigger # NOQA
from chainer.training.triggers.interval_trigger import IntervalTrigger... | from chainer.training.triggers import interval_trigger # NOQA
from chainer.training.triggers import minmax_value_trigger # NOQA
# import class and function
from chainer.training.triggers.early_stopping_trigger import EarlyStoppingTrigger # NOQA
from chainer.training.triggers.interval_trigger import IntervalTrigger... | Fix the order of importing | Fix the order of importing
| Python | mit | wkentaro/chainer,ktnyt/chainer,chainer/chainer,ktnyt/chainer,jnishi/chainer,jnishi/chainer,wkentaro/chainer,chainer/chainer,ktnyt/chainer,ktnyt/chainer,niboshi/chainer,jnishi/chainer,hvy/chainer,chainer/chainer,pfnet/chainer,niboshi/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,hvy/chainer,keisuke-umezawa/cha... |
b60fbc21271a7efa09d256debb17f583ec83fdf2 | MMCorePy_wrap/setup.py | MMCorePy_wrap/setup.py | #!/usr/bin/env python
"""
setup.py file for SWIG example
"""
from distutils.core import setup, Extension
import numpy.distutils.misc_util
import os
os.environ['CC'] = 'g++'
#os.environ['CXX'] = 'g++'
#os.environ['CPP'] = 'g++'
#os.environ['LDSHARED'] = 'g++'
mmcorepy_module = Extension('_MMCorePy',
... | #!/usr/bin/env python
"""
This setup.py is intended for use from the Autoconf/Automake build system.
It makes a number of assumtions, including that the SWIG sources have already
been generated.
"""
from distutils.core import setup, Extension
import numpy.distutils.misc_util
import os
os.environ['CC'] = 'g++'
#os.en... | Add MMCore/Host.cpp to Unix build. | MMCorePy: Add MMCore/Host.cpp to Unix build.
Was missing. Note that build is still broken (even though it does not
explicitly fail), at least on Mac OS X, because of missing libraries
(IOKit, CoreFoundation, and boost.system, I think).
Also removed MMDevice/Property.cpp, which is not needed here.
git-svn-id: 03a8048... | Python | mit | kmdouglass/Micro-Manager,kmdouglass/Micro-Manager |
8ae6cfd75d5dc6b775aa80dcc91874c3a9ee7758 | WebSphere/changeUID.py | WebSphere/changeUID.py | # Script to change the UID of Users
#
# Author: Christoph Stoettner
# E-Mail: christoph.stoettner@stoeps.de
#
# example: wsadmin.sh -lang jython -f changeUID.py file.csv
#
# Format of CSV-File:
# uid;mailaddress
#
import sys
import os
# Check OS on windows .strip('\n') is not required
# Import Connections Admin Comma... | # Script to change the UID of Users
#
# Author: Christoph Stoettner
# E-Mail: christoph.stoettner@stoeps.de
#
# example: wsadmin.sh -lang jython -f changeUID.py file.csv
#
# Format of CSV-File:
# uid;mailaddress
# don't mask strings with "
#
import sys
import os
# Check OS on windows .strip('\n') is not required
# I... | Change some comments as documentation | Change some comments as documentation | Python | apache-2.0 | stoeps13/ibmcnxscripting,stoeps13/ibmcnxscripting,stoeps13/ibmcnxscripting |
010444e37787582788268ccea860ae6bb97bd4b1 | enthought/traits/ui/editors/date_editor.py | enthought/traits/ui/editors/date_editor.py | #------------------------------------------------------------------------------
#
# Copyright (c) 2008, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions... | #------------------------------------------------------------------------------
#
# Copyright (c) 2008, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions... | Allow shift to be required using a factory trait. | Allow shift to be required using a factory trait.
| Python | bsd-3-clause | burnpanck/traits,burnpanck/traits |
d3cb08d45af60aaf06757ad230a2a33bc3615543 | apps/organizations/middleware.py | apps/organizations/middleware.py | from django.http import Http404
from .models import Organization
class OrganizationMiddleware(object):
def process_request(self, request):
try:
request.organization = Organization.objects.get(
slug__iexact=request.subdomain
)
except Organization.DoesNotExi... | from django.http import Http404
from .models import Organization
class OrganizationMiddleware(object):
def process_request(self, request):
if request.subdomain is None:
return
try:
request.organization = Organization.objects.get(
slug__iexact=request.subdo... | Remove subdomain check on pages where subdomain is none | Remove subdomain check on pages where subdomain is none
| Python | mit | xobb1t/ddash2013,xobb1t/ddash2013 |
cbf4d85092232051cd7643d74e003b86f24ba571 | feincms/templatetags/feincms_admin_tags.py | feincms/templatetags/feincms_admin_tags.py | from django import template
register = template.Library()
@register.filter
def post_process_fieldsets(fieldset):
"""
Removes a few fields from FeinCMS admin inlines, those being
``id``, ``DELETE`` and ``ORDER`` currently.
"""
process = fieldset.model_admin.verbose_name_plural.startswith('Feincm... | from django import template
register = template.Library()
@register.filter
def post_process_fieldsets(fieldset):
"""
Removes a few fields from FeinCMS admin inlines, those being
``id``, ``DELETE`` and ``ORDER`` currently.
"""
excluded_fields = ('id', 'DELETE', 'ORDER')
fieldset.fields = [f ... | Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway | Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway
Thanks to mjl for the report and help in fixing the issue.
| Python | bsd-3-clause | matthiask/django-content-editor,matthiask/feincms2-content,joshuajonah/feincms,matthiask/feincms2-content,matthiask/django-content-editor,mjl/feincms,feincms/feincms,nickburlett/feincms,mjl/feincms,nickburlett/feincms,feincms/feincms,pjdelport/feincms,pjdelport/feincms,mjl/feincms,nickburlett/feincms,michaelkuty/feincm... |
42592f3f990ccd111244a8be90513aa4cf35f678 | fireplace/cards/classic/neutral_epic.py | fireplace/cards/classic/neutral_epic.py | from ..utils import *
# Big Game Hunter
class EX1_005:
action = [Destroy(TARGET)]
# Mountain Giant
class EX1_105:
def cost(self, value):
return value - (len(self.controller.hand) - 1)
# Sea Giant
class EX1_586:
def cost(self, value):
return value - len(self.game.board)
# Blood Knight
class EX1_590:
def ... | from ..utils import *
# Big Game Hunter
class EX1_005:
action = [Destroy(TARGET)]
# Mountain Giant
class EX1_105:
def cost(self, value):
return value - (len(self.controller.hand) - 1)
# Sea Giant
class EX1_586:
def cost(self, value):
return value - len(self.game.board)
# Blood Knight
class EX1_590:
acti... | Use Count() in Blood Knight | Use Count() in Blood Knight
| Python | agpl-3.0 | liujimj/fireplace,Ragowit/fireplace,jleclanche/fireplace,butozerca/fireplace,oftc-ftw/fireplace,Meerkov/fireplace,liujimj/fireplace,Meerkov/fireplace,smallnamespace/fireplace,butozerca/fireplace,NightKev/fireplace,smallnamespace/fireplace,amw2104/fireplace,oftc-ftw/fireplace,amw2104/fireplace,beheh/fireplace,Ragowit/fi... |
64d6a44ecbbaa7d8ac2c79bd95827ced66254bcf | fireplace/carddata/minions/warlock.py | fireplace/carddata/minions/warlock.py | import random
from ..card import *
# Blood Imp
class CS2_059(Card):
def endTurn(self):
if self.game.currentPlayer is self.owner:
if self.owner.field:
random.choice(self.owner.field).buff("CS2_059o")
class CS2_059o(Card):
health = 1
# Felguard
class EX1_301(Card):
def activate(self):
self.owner.loseMa... | import random
from ..card import *
# Blood Imp
class CS2_059(Card):
def endTurn(self):
if self.game.currentPlayer is self.owner:
if self.owner.field:
random.choice(self.owner.field).buff("CS2_059o")
class CS2_059o(Card):
health = 1
# Felguard
class EX1_301(Card):
def activate(self):
self.owner.loseMa... | IMPLEMENT JARAXXUS, EREDAR LORD OF THE BURNING LEGION | IMPLEMENT JARAXXUS, EREDAR LORD OF THE BURNING LEGION
| Python | agpl-3.0 | butozerca/fireplace,jleclanche/fireplace,amw2104/fireplace,NightKev/fireplace,liujimj/fireplace,amw2104/fireplace,smallnamespace/fireplace,butozerca/fireplace,oftc-ftw/fireplace,beheh/fireplace,Ragowit/fireplace,Meerkov/fireplace,Meerkov/fireplace,oftc-ftw/fireplace,liujimj/fireplace,smallnamespace/fireplace,Ragowit/fi... |
49dc93d0fd2ab58815d91aba8afc6796cf45ce98 | migrations/versions/0093_data_gov_uk.py | migrations/versions/0093_data_gov_uk.py | """empty message
Revision ID: 0093_data_gov_uk
Revises: 0092_add_inbound_provider
Create Date: 2017-06-05 16:15:17.744908
"""
# revision identifiers, used by Alembic.
revision = '0093_data_gov_uk'
down_revision = '0092_add_inbound_provider'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects imp... | """empty message
Revision ID: 0093_data_gov_uk
Revises: 0092_add_inbound_provider
Create Date: 2017-06-05 16:15:17.744908
"""
# revision identifiers, used by Alembic.
revision = '0093_data_gov_uk'
down_revision = '0092_add_inbound_provider'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects imp... | Revert "Remove name from organisation" | Revert "Remove name from organisation"
| Python | mit | alphagov/notifications-api,alphagov/notifications-api |
4e135d1e40499f06b81d4ec3b427462c9b4ba2ee | test/cli/test_cmd_piper.py | test/cli/test_cmd_piper.py | from piper import build
from piper.db import core as db
from piper.cli import cmd_piper
from piper.cli.cli import CLIBase
import mock
class TestEntry(object):
@mock.patch('piper.cli.cmd_piper.CLIBase')
def test_calls(self, clibase):
self.mock = mock.Mock()
cmd_piper.entry(self.mock)
c... | from piper import build
from piper.db import core as db
from piper.cli import cmd_piper
from piper.cli.cli import CLIBase
import mock
class TestEntry(object):
@mock.patch('piper.cli.cmd_piper.CLIBase')
def test_calls(self, clibase):
self.mock = mock.Mock()
cmd_piper.entry(self.mock)
c... | Add short integration test for ExecCLI.build | Add short integration test for ExecCLI.build
| Python | mit | thiderman/piper |
cfd2312ae81dd79832d4b03717278a79bc8705d1 | brte/converters/btf.py | brte/converters/btf.py | if 'imported' in locals():
import imp
import bpy
imp.reload(blendergltf)
else:
imported = True
from . import blendergltf
import json
import math
import bpy
class BTFConverter:
def convert(self, add_delta, update_delta, remove_delta, view_delta):
for key, value in update_delta.items(... | if 'imported' in locals():
import imp
import bpy
imp.reload(blendergltf)
else:
imported = True
from . import blendergltf
import json
import math
import bpy
def togl(matrix):
return [i for col in matrix.col for i in col]
class BTFConverter:
def convert(self, add_delta, update_delta, re... | Fix JSON serialization issue with view and projection matrices | Fix JSON serialization issue with view and projection matrices
| Python | mit | Kupoman/BlenderRealtimeEngineAddon |
097d2b7b3de6593a0aac8e82418c0dcadc299542 | tests/unit/test_context.py | tests/unit/test_context.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# 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.apac... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# 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.apac... | Replace using tests.utils with openstack.common.test | Replace using tests.utils with openstack.common.test
It is the first step to replace using tests.utils with openstack.common.test.
All these tests don't use mock objects, stubs, config files and use only
BaseTestCase class.
Change-Id: I511816b5c9e6c5c34ebff199296ee4fc8b84c672
bp: common-unit-tests
| Python | apache-2.0 | openstack/oslo.context,dims/oslo.context,varunarya10/oslo.context,yanheven/oslo.middleware,JioCloud/oslo.context,citrix-openstack-build/oslo.context |
2057b76908c8875fd58d3027a89e43584ee57025 | service/opencv.py | service/opencv.py | __author__ = 'paulo'
import cv2
class OpenCVIntegration(object):
@staticmethod
def adaptive_threshold(filename_in, filename_out):
img = cv2.imread(filename_in)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
th = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_B... | __author__ = 'paulo'
import cv2
class OpenCVIntegration(object):
@staticmethod
def adaptive_threshold(filename_in, filename_out):
img = cv2.imread(filename_in)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
th = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_B... | Fix IMWRITE_JPEG_QUALITY ref for the newest OpenCV | Fix IMWRITE_JPEG_QUALITY ref for the newest OpenCV | Python | mit | nfscan/ocr-process-service,nfscan/ocr-process-service,PauloMigAlmeida/ocr-process-service,PauloMigAlmeida/ocr-process-service |
e230837f473808b3c136862feefdd6660ebb77e8 | scripts/examples/14-WiFi-Shield/mqtt.py | scripts/examples/14-WiFi-Shield/mqtt.py | # MQTT Example.
# This example shows how to use the MQTT library.
#
# 1) Copy the mqtt.py library to OpenMV storage.
# 2) Install the mosquitto client on PC and run the following command:
# mosquitto_sub -h test.mosquitto.org -t "openmv/test" -v
#
import time, network
from mqtt import MQTTClient
SSID='mux' # Networ... | # MQTT Example.
# This example shows how to use the MQTT library.
#
# 1) Copy the mqtt.py library to OpenMV storage.
# 2) Install the mosquitto client on PC and run the following command:
# mosquitto_sub -h test.mosquitto.org -t "openmv/test" -v
#
import time, network
from mqtt import MQTTClient
SSID='' # Network S... | Remove ssid/key from example script. | Remove ssid/key from example script.
| Python | mit | kwagyeman/openmv,iabdalkader/openmv,iabdalkader/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,openmv/openmv,openmv/openmv,kwagyeman/openmv |
e0c3fe2b1ecb4caf33b9ba3dafabe4eedae97c5e | spiralgalaxygame/tests/test_sentinel.py | spiralgalaxygame/tests/test_sentinel.py | import unittest
from spiralgalaxygame.sentinel import Sentinel, Enum
class SentinelTests (unittest.TestCase):
def setUp(self):
self.s = Sentinel('thingy')
def test_name(self):
self.assertIs(self.s.name, 'thingy')
def test_repr(self):
self.assertEqual(repr(self.s), '<Sentinel thi... | import unittest
from spiralgalaxygame.sentinel import Sentinel, Enum
class SentinelTests (unittest.TestCase):
def setUp(self):
self.s = Sentinel('thingy')
def test_name(self):
self.assertIs(self.s.name, 'thingy')
def test_repr(self):
self.assertEqual(repr(self.s), '<Sentinel thi... | Add a test for ``Enum.__repr__``; ``spiralgalaxygame.sentinel`` now has full coverage. | Add a test for ``Enum.__repr__``; ``spiralgalaxygame.sentinel`` now has full coverage.
| Python | agpl-3.0 | nejucomo/sgg,nejucomo/sgg,nejucomo/sgg |
56c3a5e4b29fb5f198f133e06e92ab5af72d62dd | conda_tools/package.py | conda_tools/package.py | import tarfile
import os
import json
class Package(object):
def __init__(self, path, mode='r'):
self.path = path
self.mode = mode
self._tarfile = tarfile.open(path, mode=mode)
| import tarfile
import json
from pathlib import PurePath, PureWindowsPat
from os.path import realpath, abspath, join
from hashlib import md5
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from .common import lazyproperty
class BadLinkError(Exception):
pass
... | Add pacakge object for working with conda compressed archives. | Add pacakge object for working with conda compressed archives.
| Python | bsd-3-clause | groutr/conda-tools,groutr/conda-tools |
afdfcef3cf7f390dd0fc7eac0806272742ffa479 | core/models/payment.py | core/models/payment.py | from django.db import models
from django.db.models import signals
from django.utils.translation import ugettext_lazy as _
from core.mixins import AuditableMixin
from .invoice import Invoice
class Payment(AuditableMixin, models.Model):
invoice = models.ForeignKey(
Invoice, editable=False, on_delete=models... | from django.db import models
from django.db.models import signals
from django.utils.translation import ugettext_lazy as _
from core.mixins import AuditableMixin
class Payment(AuditableMixin, models.Model):
invoice = models.ForeignKey(
'core.Invoice', editable=False, on_delete=models.CASCADE,
verb... | Use string instead of class | Use string instead of class
| Python | bsd-3-clause | ikcam/django-skeleton,ikcam/django-skeleton,ikcam/django-skeleton,ikcam/django-skeleton |
55a330149a05c456012f2570c2151a82ac8435b2 | images/singleuser/user-config.py | images/singleuser/user-config.py | import os
mylang = 'test'
family = 'wikipedia'
custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
with open(custom_path, 'rb') as f:
exec(compile(f.read(), custom_path, 'exec'), globals())
del f
# Clean up temp variables, since pwb issues a warning otherwise
# to he... | import os
mylang = 'test'
family = 'wikipedia'
custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
with open(custom_path, 'rb') as f:
exec(compile(f.read(), custom_path, 'exec'), globals())
del f
# Clean up temp variables, since pwb issues a warning otherwise
# to he... | Revert to previous way of setting 'authenticate' | Revert to previous way of setting 'authenticate'
This reverts commit a055f97a342f670171f30095cabfd4ba1bfdad17.
This reverts commit 4cec5250a3f9058fea5af5ef432a5b230ca94963.
| Python | mit | yuvipanda/paws,yuvipanda/paws |
208c4d9e18301a85bca5d64a1e2abb95a6865fe9 | students/psbriant/session08/circle.py | students/psbriant/session08/circle.py | """
Name: Paul Briant
Date: 11/29/16
Class: Introduction to Python
Session: 08
Assignment: Circle Lab
Description:
Classes for Circle Lab
"""
import math
class Circle:
def __init__(self, radius):
"""
"""
self.radius = radius
self.diameter = radius * 2
@classmethod
... | """
Name: Paul Briant
Date: 11/29/16
Class: Introduction to Python
Session: 08
Assignment: Circle Lab
Description:
Classes for Circle Lab
"""
import math
class Circle:
def __init__(self, radius):
""" Initialize circle attributes radius and diameter"""
self.radius = radius
self.diameter ... | Add Docstrings for class methods. | Add Docstrings for class methods.
| Python | unlicense | weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016 |
4dd488634aa030a8e9a1404e5fe026265dd07a75 | tailor/tests/utils/charformat_test.py | tailor/tests/utils/charformat_test.py | import unittest
from tailor.utils import charformat
class MyTestCase(unittest.TestCase):
def is_upper_camel_case_test_upper_camel_case_name(self):
self.assertTrue(charformat.is_upper_camel_case('HelloWorld'))
def is_upper_camel_case_test_lower_camel_case_name(self):
self.assertFalse(charform... | import unittest
from tailor.utils import charformat
class MyTestCase(unittest.TestCase):
def is_upper_camel_case_test_upper_camel_case_name(self):
self.assertTrue(charformat.is_upper_camel_case('HelloWorld'))
def is_upper_camel_case_test_lower_camel_case_name(self):
self.assertFalse(charform... | Add numeric name test case | Add numeric name test case
| Python | mit | sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor |
cc3b82a943baf42f78b131d3218ad5eb748a11ce | test_proj/urls.py | test_proj/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
url(r'^admin_tools/', include('admin_tools.urls')),
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'do... | try:
from django.conf.urls import patterns, url, include
except ImportError: # django < 1.4
from django.conf.urls.defaults import patterns, url, include
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),... | Support for Django > 1.4 for test proj | Support for Django > 1.4 for test proj
| Python | mit | husbas/django-admin-tools,husbas/django-admin-tools,husbas/django-admin-tools |
0ba616bbd037a1c84f20221a95a623d853da9db9 | garfield/sims/tests.py | garfield/sims/tests.py | from mock import patch
from sms.tests.test_sms import GarfieldTwilioTestCase
from sms.tests.test_sms import GarfieldTwilioTestClient
class GarfieldTestSimSmsCaseNewJohn(GarfieldTwilioTestCase):
@patch('sms.tasks.save_sms_message.apply_async')
def test_sim_receive_sms(self, mock_save_sms_message):
res... | from django.test import override_settings
from mock import patch
from sms.tests.test_sms import GarfieldTwilioTestCase
from sms.tests.test_sms import GarfieldTwilioTestClient
@override_settings(TWILIO_PHONE_NUMBER="+15558675309")
class GarfieldTestSimSmsCaseNewJohn(GarfieldTwilioTestCase):
@patch('sms.tasks.sav... | Add override settings for CI without local settings. | Add override settings for CI without local settings.
| Python | mit | RobSpectre/garfield,RobSpectre/garfield |
f5faf9c90b2671f7d09e1a4f21c036737bd039ef | echo/tests/test_response.py | echo/tests/test_response.py | import json
from echo.response import EchoResponse, EchoSimplePlainTextResponse
from echo.tests import BaseEchoTestCase
class TestEchoSimplePlainTextResponse(BaseEchoTestCase):
def test_populates_text_in_response(self):
"""The Plain text response should populate the outputSpeech"""
expected = "Th... | import json
from echo.response import EchoResponse, EchoSimplePlainTextResponse
from echo.tests import BaseEchoTestCase
class TestEchoSimplePlainTextResponse(BaseEchoTestCase):
def test_populates_text_in_response(self):
"""The Plain text response should populate the outputSpeech"""
expected = "Th... | Fix response tests in py3 | Fix response tests in py3
| Python | mit | bunchesofdonald/django-echo |
32388a96b848629bf8f4b7d7ea832fca8c3dccd9 | fabfile/templates/collector_haproxy.py | fabfile/templates/collector_haproxy.py | import string
template = string.Template("""#contrail-collector-marker-start
listen contrail-collector-stats :5938
mode http
stats enable
stats uri /
stats auth $__contrail_hap_user__:$__contrail_hap_passwd__
frontend contrail-analytics-api *:8081
default_backend contrail-analytics-api
backend co... | import string
template = string.Template("""#contrail-collector-marker-start
listen contrail-collector-stats :5938
mode http
stats enable
stats uri /
stats auth $__contrail_hap_user__:$__contrail_hap_passwd__
frontend contrail-analytics-api *:8081
default_backend contrail-analytics-api
backend co... | Remove tcp-check connect option for redis on haproxy | Remove tcp-check connect option for redis on haproxy
tcp-check connect option for redis on haproxy.cfg causes the client
connections in the redis-server to grow continuously and reaches the max
limit resulting in connection failure/response error for requests from
collector and other analytics services to redis.
Chan... | Python | apache-2.0 | Juniper/contrail-fabric-utils,Juniper/contrail-fabric-utils |
d792f82ea6e59b0e998d023fdbc24b0829e2d0e7 | pythran/tests/openmp/omp_parallel_copyin.py | pythran/tests/openmp/omp_parallel_copyin.py | #threadprivate supprimé, est ce que c'est grave?
def omp_parallel_copyin():
sum = 0
sum1 = 7
num_threads = 0
if 'omp parallel copyin(sum1) private(i)':
'omp for'
for i in xrange(1, 1000):
sum1 += i
if 'omp critical':
sum += sum1
num_threads +=... | #unittest.skip threadprivate not supported
def omp_parallel_copyin():
sum = 0
sum1 = 7
num_threads = 0
if 'omp parallel copyin(sum1) private(i)':
'omp for'
for i in xrange(1, 1000):
sum1 += i
if 'omp critical':
sum += sum1
num_threads += 1
... | Disable an OpenMP test that requires threadprivate | Disable an OpenMP test that requires threadprivate
| Python | bsd-3-clause | pbrunet/pythran,artas360/pythran,pbrunet/pythran,pombredanne/pythran,hainm/pythran,artas360/pythran,hainm/pythran,serge-sans-paille/pythran,hainm/pythran,pombredanne/pythran,artas360/pythran,serge-sans-paille/pythran,pombredanne/pythran,pbrunet/pythran |
83908d3d8d3de0db5f8af26155137bf382afa24a | lettuce_webdriver/django.py | lettuce_webdriver/django.py | """
Django-specific extensions
"""
def site_url(url):
"""
Determine the server URL.
"""
base_url = 'http://%s' % socket.gethostname()
if server.port is not 80:
base_url += ':%d' % server.port
return urlparse.urljoin(base_url, url)
@step(r'I visit site page "([^"]*)"')
def visit_pag... | """
Django-specific extensions
"""
import socket
import urlparse
from lettuce import step
from lettuce.django import server
# make sure the steps are loaded
import lettuce_webdriver.webdriver # pylint:disable=unused-import
def site_url(url):
"""
Determine the server URL.
"""
base_url = 'http://%s'... | Fix bugs with lettuce-webdriver Django steps | Fix bugs with lettuce-webdriver Django steps
| Python | mit | infoxchange/lettuce_webdriver,infoxchange/lettuce_webdriver,aloetesting/aloe_webdriver,infoxchange/aloe_webdriver,koterpillar/aloe_webdriver,macndesign/lettuce_webdriver,ponsfrilus/lettuce_webdriver,aloetesting/aloe_webdriver,ponsfrilus/lettuce_webdriver,bbangert/lettuce_webdriver,aloetesting/aloe_webdriver,bbangert/le... |
39ea336297b0479abb29a70f831b2a02a01fcc18 | portas/portas/utils.py | portas/portas/utils.py | import contextlib
import functools
import logging
import sys
import webob.exc
LOG = logging.getLogger(__name__)
def http_success_code(code):
"""Attaches response code to a method.
This decorator associates a response code with a method. Note
that the function attributes are directly manipulated; the m... | import logging
LOG = logging.getLogger(__name__)
# def verify_tenant(func):
# @functools.wraps(func)
# def __inner(self, req, tenant_id, *args, **kwargs):
# if hasattr(req, 'context') and tenant_id != req.context.tenant:
# LOG.info('User is not authorized to access this tenant.')
# ... | Remove unnecessary blocks of code | Remove unnecessary blocks of code
| Python | apache-2.0 | Bloomie/murano-agent,openstack/python-muranoclient,ativelkov/murano-api,sajuptpm/murano,NeCTAR-RC/murano,satish-avninetworks/murano,satish-avninetworks/murano,openstack/murano,openstack/murano-agent,openstack/murano-agent,telefonicaid/murano,satish-avninetworks/murano,DavidPurcell/murano_temp,openstack/murano-agent,ser... |
6eff6622457b619f36404957968f30e3b1944362 | openfisca_country_template/__init__.py | openfisca_country_template/__init__.py | # -*- coding: utf-8 -*-
import os
from openfisca_core.taxbenefitsystems import TaxBenefitSystem
from . import entities
COUNTRY_DIR = os.path.dirname(os.path.abspath(__file__))
# Our country tax and benefit class inherits from the general TaxBenefitSystem class.
# The name CountryTaxBenefitSystem must not be chan... | # -*- coding: utf-8 -*-
import os
from openfisca_core.taxbenefitsystems import TaxBenefitSystem
from openfisca_country_template import entities
from openfisca_country_template.situation_examples import couple
COUNTRY_DIR = os.path.dirname(os.path.abspath(__file__))
# Our country tax and benefit class inherits fr... | Define which examples to use in OpenAPI | Define which examples to use in OpenAPI
| Python | agpl-3.0 | openfisca/country-template,openfisca/country-template |
edd096abfa3c304b49fe94155a64fc2371a3084a | py/linhomy/matrices.py | py/linhomy/matrices.py | '''
>>> IC_FLAG[2]
array([[1, 3],
[1, 4]])
>>> IC_FLAG[3]
array([[1, 4, 6],
[1, 5, 8],
[1, 6, 9]])
'''
# For Python2 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__metaclass__... | '''
>>> FLAG_from_IC[2]
array([[1, 1],
[3, 4]])
The flag vector of ICC is [1, 6, 9].
>>> numpy.dot(FLAG_from_IC[3], [0, 0, 1])
array([1, 6, 9])
>>> FLAG_from_IC[3]
array([[1, 1, 1],
[4, 5, 6],
[6, 8, 9]])
'''
# For Python2 compatibility
from __future__ import absolute_import
from __future__ i... | Rewrite to replace IC_FLAG by FLAG_from_IC. | Rewrite to replace IC_FLAG by FLAG_from_IC.
| Python | mit | jfine2358/py-linhomy |
3e3e4b88692922fe3182e4db1db60e8a60ced8e4 | apps/user/admin.py | apps/user/admin.py | # -*- coding: utf-8 -*-
#
# defivelo-intranet -- Outil métier pour la gestion du Défi Vélo
# Copyright (C) 2015 Didier Raboud <me+defivelo@odyx.org>
#
# 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 ... | # -*- coding: utf-8 -*-
#
# defivelo-intranet -- Outil métier pour la gestion du Défi Vélo
# Copyright (C) 2015 Didier Raboud <me+defivelo@odyx.org>
#
# 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 ... | Drop the hurtinq username patching of username that also affects edition | Drop the hurtinq username patching of username that also affects edition
| Python | agpl-3.0 | defivelo/db,defivelo/db,defivelo/db |
8c64757759e69f7aff84065db8da604dd43faded | pyrsss/usarray/info.py | pyrsss/usarray/info.py | import pandas as PD
INFO_LINK = 'http://ds.iris.edu/files/earthscope/usarray/_US-MT-StationList.txt'
"""Full URL link to USArray MT site information text file."""
HEADER = 'VNET NET STA SITE DESCRIPTION LAT LON ELEV START END STATUS INSTALL CERT'
"""Header line of data file."""
def get_info_map(info_link=INFO_LIN... | import pandas as PD
INFO_LINK = 'http://ds.iris.edu/files/earthscope/usarray/_US-MT-StationList.txt'
"""Full URL link to USArray MT site information text file."""
HEADER = 'VNET NET STA SITE DESCRIPTION LAT LON ELEV START END STATUS INSTALL CERT'
"""Header line of data file."""
def get_info_map(info_link=INFO_LIN... | Change of function name due to deprecation. | Change of function name due to deprecation.
| Python | mit | butala/pyrsss |
fba4801ce64853db37af01b08e1533719425118d | repovisor/repovisor.py | repovisor/repovisor.py | from git import Repo
from git.exc import InvalidGitRepositoryError
import os
def reposearch(*folders):
for folder in folders:
for dir, subdirs, files in os.walk(folder):
try:
yield dict(vcs='git', pntr=Repo(dir), folder=dir)
subdirs[:] = []
contin... | from git import Repo
from git.exc import InvalidGitRepositoryError
import os
import warnings
vcs_statechecker = {'git': None}
def reposearch(*folders):
for folder in folders:
for dir, subdirs, files in os.walk(folder):
try:
yield dict(vcs='git', pntr=Repo(dir), folder=dir)
... | Add repocheck looper, git checker | Add repocheck looper, git checker
| Python | bsd-3-clause | gjcooper/repovisor,gjcooper/repovisor |
57376590aec0db20a8046deaee86d035c8963a40 | readthedocs/builds/admin.py | readthedocs/builds/admin.py | """Django admin interface for `~builds.models.Build` and related models.
"""
from django.contrib import admin
from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult
from guardian.admin import GuardedModelAdmin
class BuildCommandResultInline(admin.TabularInline):
model = BuildComm... | """Django admin interface for `~builds.models.Build` and related models.
"""
from django.contrib import admin
from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult
from guardian.admin import GuardedModelAdmin
class BuildCommandResultInline(admin.TabularInline):
model = BuildComm... | Include output in result inline | Include output in result inline
| Python | mit | tddv/readthedocs.org,espdev/readthedocs.org,espdev/readthedocs.org,davidfischer/readthedocs.org,safwanrahman/readthedocs.org,tddv/readthedocs.org,safwanrahman/readthedocs.org,tddv/readthedocs.org,espdev/readthedocs.org,davidfischer/readthedocs.org,espdev/readthedocs.org,rtfd/readthedocs.org,espdev/readthedocs.org,david... |
47269f733427fef34e4f43c2652eda79aa3e5e0d | test/test_util/test_StopWatch.py | test/test_util/test_StopWatch.py | # -*- encoding: utf-8 -*-
"""Created on Dec 16, 2014.
@author: Katharina Eggensperger
@projekt: AutoML2015
"""
from __future__ import print_function
import time
import unittest
from autosklearn.util import StopWatch
class Test(unittest.TestCase):
_multiprocess_can_split_ = True
def test_stopwatch_overhea... | # -*- encoding: utf-8 -*-
"""Created on Dec 16, 2014.
@author: Katharina Eggensperger
@projekt: AutoML2015
"""
from __future__ import print_function
import time
import unittest
import unittest.mock
from autosklearn.util import StopWatch
class Test(unittest.TestCase):
_multiprocess_can_split_ = True
def t... | TEST potentially fix brittle stopwatch test | TEST potentially fix brittle stopwatch test
| Python | bsd-3-clause | automl/auto-sklearn,automl/auto-sklearn |
2a3a5fba536877c0ba735244a986e49605ce3fc0 | tests/test_schematics_adapter.py | tests/test_schematics_adapter.py | from schematics.models import Model
from schematics.types import IntType
from hyp.adapters.schematics import SchematicsSerializerAdapter
class Post(object):
def __init__(self):
self.id = 1
class Simple(Model):
id = IntType()
def test_object_conversion():
adapter = SchematicsSerializerAdapter(... | import pytest
from schematics.models import Model
from schematics.types import IntType
from hyp.adapters.schematics import SchematicsSerializerAdapter
class Post(object):
def __init__(self):
self.id = 1
class Simple(Model):
id = IntType()
@pytest.fixture
def adapter():
return SchematicsSerial... | Convert the adapter into a pytest fixture | Convert the adapter into a pytest fixture
| Python | mit | kalasjocke/hyp |
a8c7a6d6cd87f057fbd03c41cec41dba35e6bdf6 | unittesting/test_color_scheme.py | unittesting/test_color_scheme.py | import sublime
from sublime_plugin import ApplicationCommand
from .mixin import UnitTestingMixin
from .const import DONE_MESSAGE
try:
from ColorSchemeUnit.lib.runner import ColorSchemeUnit
except Exception:
print('ColorSchemeUnit runner could not be imported')
class UnitTestingColorSchemeCommand(ApplicationC... | import sublime
from sublime_plugin import ApplicationCommand
from .mixin import UnitTestingMixin
from .const import DONE_MESSAGE
try:
from ColorSchemeUnit.lib.runner import ColorSchemeUnit
except Exception:
print('ColorSchemeUnit runner could not be imported')
class UnitTestingColorSchemeCommand(ApplicationC... | Use ColorSchemeunit new run with package API | Use ColorSchemeunit new run with package API
Re: https://github.com/gerardroche/sublime-color-scheme-unit/issues/18
The new API allows to run with package name so Unittesting doesn't need
to open any files before running the tests.
I also added an async parameter which allows to run the tests in non
async mode and g... | Python | mit | randy3k/UnitTesting,randy3k/UnitTesting,randy3k/UnitTesting,randy3k/UnitTesting |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.