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 |
|---|---|---|---|---|---|---|---|---|---|
96fac3babb22386fd94eccc86abb5bd15c917c53 | rpyc/core/__init__.py | rpyc/core/__init__.py | from rpyc.core.stream import SocketStream, PipeStream
from rpyc.core.channel import Channel
from rpyc.core.protocol import Connection
from rpyc.core.netref import BaseNetref
from rpyc.core.async import AsyncResult, AsyncResultTimeout
from rpyc.core.service import Service, VoidService, SlaveService
from rpyc.core.vinega... | from rpyc.core.stream import SocketStream, PipeStream
from rpyc.core.channel import Channel
from rpyc.core.protocol import Connection
from rpyc.core.netref import BaseNetref
from rpyc.core.async import AsyncResult, AsyncResultTimeout
from rpyc.core.service import Service, VoidService, SlaveService
from rpyc.core.vinega... | Remove Code specific for IronPython - useless with 2.7 | Remove Code specific for IronPython - useless with 2.7
| Python | mit | glpatcern/rpyc,sponce/rpyc,pyq881120/rpyc,pombredanne/rpyc,geromueller/rpyc,kwlzn/rpyc,siemens/rpyc,eplaut/rpyc,gleon99/rpyc |
82cb6d190ce1e805914cc791518c97e063ecdc96 | tests/test_individual.py | tests/test_individual.py | import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
print(myPath)
sys.path.insert(0, myPath + '/../SATSolver')
from unittest import TestCase
from individual import Individual
from BitVector import BitVector
from bitarray import bitarray
class TestIndividual(TestCase):
"""
Testing class for Ind... | import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
print(myPath)
sys.path.insert(0, myPath + '/../SATSolver')
from unittest import TestCase
from individual import Individual
from bitarray import bitarray
class TestIndividual(TestCase):
"""
Testing class for Individual.
"""
def test_g... | Remove BitVector import - Build fails | Remove BitVector import - Build fails | Python | mit | Imperium-Software/resolver,Imperium-Software/resolver,Imperium-Software/resolver,Imperium-Software/resolver |
b2764b9ada2ca3bec548ceb82e71697f7515f14f | citrination_client/__init__.py | citrination_client/__init__.py | import os
import re
from citrination_client.base import *
from citrination_client.search import *
from citrination_client.data import *
from citrination_client.models import *
from citrination_client.views.descriptors import *
from .client import CitrinationClient
from pkg_resources import get_distribution, Distributi... | import os
import re
from citrination_client.base import *
from citrination_client.search import *
from citrination_client.data import *
from citrination_client.models import *
from citrination_client.views.descriptors import *
from .client import CitrinationClient
from pkg_resources import get_distribution, Distributi... | Remove debug print on getVersion | Remove debug print on getVersion
| Python | apache-2.0 | CitrineInformatics/python-citrination-client |
2f140327c24a8efab5482a975793dddedd0ebfc4 | nucleus/wsgi.py | nucleus/wsgi.py | # flake8: noqa
"""
WSGI config for nucleus project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
# newrelic.agent must be imported and initialized first
# https://docs.newrelic.com... | # flake8: noqa
# newrelic.agent must be imported and initialized first
# https://docs.newrelic.com/docs/agents/python-agent/installation/python-agent-advanced-integration#manual-integration
import newrelic.agent
newrelic.agent.initialize('newrelic.ini')
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'nucleu... | Remove old docstring with link to old django docs | Remove old docstring with link to old django docs
| Python | mpl-2.0 | mozilla/nucleus,mozilla/nucleus,mozilla/nucleus,mozilla/nucleus |
18bf9dd5e1e054d0c260959a8379f331940e167f | online_status/__init__.py | online_status/__init__.py | VERSION = (0, 1, 0)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
version = "%s %s" % (versio... | VERSION = (0, 1, 0)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
return version
| Fix 'index out of bound' issue | Fix 'index out of bound' issue
| Python | unlicense | hovel/django-online-status,hovel/django-online-status |
6d8f79d32194f5b956785a021ee6fad6093a03f1 | insanity/layers.py | insanity/layers.py | import numpy as np
import theano
import theano.tensor as T
from theano.tensor.nnet import conv
from theano.tensor.nnet import softmax
from theano.tensor import shared_randomstreams
from theano.tensor.signal import downsample
class Layer(object):
def __init__(self, numInputs, numNeurons, activation):
self.numInpu... | import numpy as np
import theano
import theano.tensor as T
from theano.tensor.nnet import conv
from theano.tensor.nnet import softmax
from theano.tensor import shared_randomstreams
from theano.tensor.signal import downsample
class Layer(object):
def __init__(self, numInputs, numNeurons, activation, miniBatchSize):... | Add proper use of property setter. | Add proper use of property setter.
| Python | cc0-1.0 | cn04/insanity |
b064d8dbc4be13c12c1c87491ebcb484ab71ac52 | geopy/__init__.py | geopy/__init__.py | """
geopy is a Python 2 and 3 client for several popular geocoding web services.
geopy makes it easy for Python developers to locate the coordinates of
addresses, cities, countries, and landmarks across the globe using third-party
geocoders and other data sources.
geopy is tested against CPython (versions 2.7, 3.4, 3... | """
geopy is a Python 2 and 3 client for several popular geocoding web services.
geopy makes it easy for Python developers to locate the coordinates of
addresses, cities, countries, and landmarks across the globe using third-party
geocoders and other data sources.
geopy is tested against CPython (versions 2.7, 3.4, 3... | Fix geocoder.options being also exported as `geopy.options` | Fix geocoder.options being also exported as `geopy.options`
| Python | mit | geopy/geopy,jmb/geopy |
1a3fb78b32fbb95e3efc0f06ef62690834e820e3 | libraries/vytree/__init__.py | libraries/vytree/__init__.py | # vytree.__init__: package init file.
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# ver... | # vytree.__init__: package init file.
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# ver... | Remove referencetree-related imports from the top level vytree package. | Remove referencetree-related imports from the top level vytree package.
| Python | lgpl-2.1 | vyos-legacy/vyconfd,vyos-legacy/vyconfd |
75fd4aadedb4bcdcfe41f9ae61bf62282ffdadea | test/__init__.py | test/__init__.py | import glob, os.path, sys
version = sys.version.split(" ")[0]
majorminor = version[0:3]
# Add path to hiredis.so load path
path = glob.glob("build/lib*-%s/hiredis/*.so" % majorminor)[0]
sys.path.insert(0, os.path.dirname(path))
from unittest import *
from . import reader
def tests():
suite = TestSuite()
suite.a... | import glob, os.path, sys
version = sys.version.split(" ")[0]
majorminor = version[0:3]
# Add path to hiredis.so load path
path = glob.glob("build/lib*-%s/hiredis" % majorminor)[0]
sys.path.insert(0, path)
from unittest import *
from . import reader
def tests():
suite = TestSuite()
suite.addTest(makeSuite(reade... | Fix build path detection on SunOS | Fix build path detection on SunOS
Inside the hiredis directory there is another directory that contains the
shared object. This is specific to the platform so we shouldn't care where the
shared object itself is placed.
| Python | bsd-3-clause | redis/hiredis-py,charsyam/hiredis-py,badboy/hiredis-py-win,badboy/hiredis-py-win,badboy/hiredis-py-win,redis/hiredis-py,charsyam/hiredis-py |
a6e6e6bf18c48638d4c6c7d97f894edd3fc3c1ad | ipython_config.py | ipython_config.py | c.InteractiveShellApp.exec_lines = []
# ipython-autoimport - Automatically import modules
c.InteractiveShellApp.exec_lines.append(
"try:\n %load_ext ipython_autoimport\nexcept ImportError: pass")
# Automatically reload modules
c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
c.InteractiveShellApp.... | c.InteractiveShellApp.exec_lines = []
# ipython-autoimport - Automatically import modules
c.InteractiveShellApp.exec_lines.append(
"try:\n %load_ext ipython_autoimport\nexcept ImportError: pass")
# Automatically reload modules
c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
c.InteractiveShellApp.... | Set default shell editor for ipython to gvim | Set default shell editor for ipython to gvim
| Python | mit | brycepg/dotfiles,brycepg/dotfiles |
bf694ffdf1fd61f6e108f3076ed975d538af5224 | wlauto/common/android/resources.py | wlauto/common/android/resources.py | # Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | # Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | Revert "AndroidResource: Add a UiautoApk resource type." | Revert "AndroidResource: Add a UiautoApk resource type."
This reverts commit bc6af25366aacf394f96b5a93008109904a89e93.
| Python | apache-2.0 | bjackman/workload-automation,bjackman/workload-automation,jimboatarm/workload-automation,jimboatarm/workload-automation,jimboatarm/workload-automation,jimboatarm/workload-automation,bjackman/workload-automation,bjackman/workload-automation,jimboatarm/workload-automation,bjackman/workload-automation,jimboatarm/workload-... |
78ca9c6b8393b1b4f4bddf41febc87696796d28a | openpassword/openssl_utils.py | openpassword/openssl_utils.py | from Crypto.Hash import MD5
def derive_openssl_key(key, salt, hash=MD5):
key = key[0:-16]
openssl_key = bytes()
prev = bytes()
while len(openssl_key) < 32:
prev = hash.new(prev + key + salt).digest()
openssl_key += prev
return openssl_key
| from Crypto.Hash import MD5
def derive_openssl_key(key, salt, hashing_function=MD5):
key = key[0:-16]
openssl_key = bytes()
prev = bytes()
while len(openssl_key) < 32:
prev = hashing_function.new(prev + key + salt).digest()
openssl_key += prev
return openssl_key
| Rename hash variable to prevent colision with native method | Rename hash variable to prevent colision with native method
| Python | mit | openpassword/blimey,openpassword/blimey |
2c6dd79d419699e61970719dbb369aefe359ea6e | tests/test_db.py | tests/test_db.py | from pypinfo import db
CREDS_FILE = '/path/to/creds_file.json'
def test_get_credentials(tmp_path):
# Arrange
db.DB_FILE = str(tmp_path / 'db.json') # Mock
# Assert
assert db.get_credentials() is None
def test_set_credentials(tmp_path):
# Arrange
db.DB_FILE = str(tmp_path / 'db.json') # M... | from pypinfo import db
CREDS_FILE = '/path/to/creds_file.json'
def test_get_credentials(tmp_path):
# Arrange
db.DB_FILE = str(tmp_path / 'db.json') # Mock
# Assert
assert db.get_credentials() is None
def test_set_credentials(tmp_path):
# Arrange
db.DB_FILE = str(tmp_path / 'db.json') # M... | Fix tests for updated TinyDB/Tinyrecord | Fix tests for updated TinyDB/Tinyrecord
| Python | mit | ofek/pypinfo |
3f909cdfba61719dfa0a860aeba1e418fe740f33 | indra/__init__.py | indra/__init__.py | from __future__ import print_function, unicode_literals
import logging
import os
import sys
__version__ = '1.10.0'
__all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature',
'mechlinker', 'preassembler', 'sources', 'tools', 'util']
logging.basicConfig(format='%(levelname)s: [%(asctime)s] ... | from __future__ import print_function, unicode_literals
import logging
import os
import sys
__version__ = '1.10.0'
__all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature',
'mechlinker', 'preassembler', 'sources', 'tools', 'util']
logging.basicConfig(format=('%(levelname)s: [%(asctime)s]... | Remove indra prefix from logger | Remove indra prefix from logger
| Python | bsd-2-clause | bgyori/indra,bgyori/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/indra,bgyori/indra,pvtodorov/indra,johnbachman/belpy,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,johnbachman/belpy,pvtodorov/indra |
a4dc298a487fcf6f1975346ab421cca705c025dc | storage/test_driver.py | storage/test_driver.py | #!/usr/bin/env python
from storage import Storage
NEW_REPORT = {'foo': 'bar', 'boo': 'baz'}
def main():
db_store = Storage.get_storage()
for key, value in db_store.__dict__.iteritems():
print '%s: %s' % (key, value)
print '\n'
# report_id = db_store.store(NEW_REPORT)
report_id = 'AVM0dGO... | #!/usr/bin/env python
from storage import Storage
NEW_REPORT = {'foo': 'bar', 'boo': 'baz'}
REPORTS = [
{'report_id': 1, 'report': {"/tmp/example": {"MD5": "53f43f9591749b8cae536ff13e48d6de", "SHA256": "815d310bdbc8684c1163b62f583dbaffb2df74b9104e2aadabf8f8491bafab66", "libmagic": "ASCII text"}}},
{'report_id... | Add populate es function to test driver | Add populate es function to test driver
| Python | mpl-2.0 | awest1339/multiscanner,mitre/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner |
64c2a9ec42fba89225af07a3d0cf84dd9de98e4b | legislators/urls.py | legislators/urls.py | from . import views
from django.conf.urls import url
urlpatterns = [
url(r'^find_legislator/', views.find_legislator),
url(r'^get_latlon/', views.get_latlon)
]
| from . import views
from django.conf.urls import url
urlpatterns = [
url(r'^find_legislator/', views.find_legislator),
url(r'^get_latlon/', views.get_latlon, name="get_latlon"),
url(r'^latest_latlon/', views.latest_latlon, name="latest_latlon")
]
| Add url for latest latlon url | Add url for latest latlon url
| Python | mit | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot |
70b7090a438f7962f28acc23fa78cdb6f5d084a0 | docs/sphinxext/configtraits.py | docs/sphinxext/configtraits.py | """Directives and roles for documenting traitlets config options.
::
.. configtrait:: Application.log_datefmt
Description goes here.
Cross reference like this: :configtrait:`Application.log_datefmt`.
"""
from sphinx.locale import l_
from sphinx.util.docfields import Field
def setup(app):
app.ad... | """Directives and roles for documenting traitlets config options.
::
.. configtrait:: Application.log_datefmt
Description goes here.
Cross reference like this: :configtrait:`Application.log_datefmt`.
"""
def setup(app):
app.add_object_type('configtrait', 'configtrait', objname='Config option')... | Fix compatibility with the latest release of Sphinx | Fix compatibility with the latest release of Sphinx
`l_` from sphinx.locale has been deprecated for a long time.
`_` is the new name for the same function but it seems that the
imports there are useless.
https://github.com/sphinx-doc/sphinx/commit/8d653a406dc0dc6c2632176ab4757ca15474b10f
| Python | bsd-3-clause | ipython/ipython,ipython/ipython |
02c2551b2760fc225bb4851c560f1881c7d674a4 | txircd/modules/extra/listmodules.py | txircd/modules/extra/listmodules.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ModulesCommand(ModuleData):
implements(IPlugin, IModuleData)
name = "ModulesCommand"
def actions(self):
return [ ("statsruntype-modules", 1, self.listModules) ]
def lis... | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ModulesCommand(ModuleData):
implements(IPlugin, IModuleData)
name = "ModulesCommand"
def actions(self):
return [ ("statsruntype-modules", 1, self.listModules) ]
def lis... | Return the correct thing for modules | Return the correct thing for modules
| Python | bsd-3-clause | Heufneutje/txircd |
ea39c4ebba3d5ab42dfa202f88f7d76386e505fe | plugins/MeshView/MeshView.py | plugins/MeshView/MeshView.py | from Cura.View.View import View
class MeshView(View):
def __init__(self):
super(MeshView, self).__init__()
def render(self):
scene = self.getController().getScene()
renderer = self.getRenderer()
self._renderObject(scene.getRoot(), renderer)
def _renderObject(self, object,... | from Cura.View.View import View
class MeshView(View):
def __init__(self):
super(MeshView, self).__init__()
def render(self):
scene = self.getController().getScene()
renderer = self.getRenderer()
self._renderObject(scene.getRoot(), renderer)
def _renderObject(self, object,... | Allow SceneObjects to render themselves | Allow SceneObjects to render themselves
| Python | agpl-3.0 | onitake/Uranium,onitake/Uranium |
e733b0d5192437a95c4eafd1babc02385fb4fcf7 | cms/sitemaps/cms_sitemap.py | cms/sitemaps/cms_sitemap.py | # -*- coding: utf-8 -*-
from django.contrib.sitemaps import Sitemap
from django.utils import translation
from cms.models import Title
def from_iterable(iterables):
"""
Backport of itertools.chain.from_iterable
"""
for it in iterables:
for element in it:
yield element
class CMSSit... | # -*- coding: utf-8 -*-
from django.contrib.sitemaps import Sitemap
from django.db.models import Q
from django.utils import translation
from cms.models import Title
def from_iterable(iterables):
"""
Backport of itertools.chain.from_iterable
"""
for it in iterables:
for element in it:
... | Remove redirected pages from the sitemap | Remove redirected pages from the sitemap
| Python | bsd-3-clause | ScholzVolkmer/django-cms,wyg3958/django-cms,donce/django-cms,robmagee/django-cms,DylannCordel/django-cms,frnhr/django-cms,jrief/django-cms,wuzhihui1123/django-cms,Livefyre/django-cms,dhorelik/django-cms,netzkolchose/django-cms,intip/django-cms,chkir/django-cms,jproffitt/django-cms,selecsosi/django-cms,czpython/django-c... |
f48eb543c3ae2222a71080592ae8932c227dc605 | roche/scripts/xml-load.py | roche/scripts/xml-load.py | # coding=utf-8
import sys
sys.path.append('../../')
import roche.settings
from eulexistdb.db import ExistDB
from roche.settings import EXISTDB_SERVER_URL
#
# Timeout higher?
#
xmldb = ExistDB(timeout=30)
xmldb.createCollection('docker', True)
xmldb.createCollection(u'docker/浙江大學圖書館', True)
with open('../../../dubl... | # coding=utf-8
#
# Must be called in roche root dir
#
import sys
sys.path.append('.')
import roche.settings
from eulexistdb.db import ExistDB
from roche.settings import EXISTDB_SERVER_URL
#
# Timeout higher?
#
xmldb = ExistDB(timeout=30)
xmldb.createCollection('docker', True)
xmldb.createCollection(u'docker/浙江大學圖書... | Fix relative path in relation to app root dir | Fix relative path in relation to app root dir
| Python | mit | beijingren/roche-website,beijingren/roche-website,beijingren/roche-website,beijingren/roche-website |
eccedb9f938bd74574e4dcdd9ea63f71ac269f20 | nydus/db/routers/__init__.py | nydus/db/routers/__init__.py | """
nydus.db.routers
~~~~~~~~~~~~~~~~
:copyright: (c) 2011 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from .base import BaseRouter, RoundRobinRouter
| """
nydus.db.routers
~~~~~~~~~~~~~~~~
:copyright: (c) 2011 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from .base import BaseRouter, RoundRobinRouter, PartitionRouter
| Add partition router to base | Add partition router to base
| Python | apache-2.0 | disqus/nydus |
d4dd408e671d14518b3fabb964027cd006366fca | testfixtures/compat.py | testfixtures/compat.py | # compatibility module for different python versions
import sys
if sys.version_info[:2] > (3, 0):
PY2 = False
PY3 = True
Bytes = bytes
Unicode = str
basestring = str
class_type_name = 'class'
ClassType = type
exception_module = 'builtins'
new_class = type
self_name = '__self_... | # compatibility module for different python versions
import sys
if sys.version_info[:2] > (3, 0):
PY2 = False
PY3 = True
Bytes = bytes
Unicode = str
basestring = str
BytesLiteral = lambda x: x.encode('latin1')
UnicodeLiteral = lambda x: x
class_type_name = 'class'
ClassType = typ... | Add Python version agnostic helpers for creating byte and unicode literals. | Add Python version agnostic helpers for creating byte and unicode literals. | Python | mit | Simplistix/testfixtures,nebulans/testfixtures |
bb3d9ec2d9932da2abb50f5cb6bceffae5112abb | mrbelvedereci/trigger/admin.py | mrbelvedereci/trigger/admin.py | from django.contrib import admin
from mrbelvedereci.trigger.models import Trigger
class TriggerAdmin(admin.ModelAdmin):
list_display = ('repo', 'type', 'flows', 'org', 'regex', 'active', 'public')
list_filter = ('active', 'public', 'repo', 'org', 'type')
admin.site.register(Trigger, TriggerAdmin)
| from django.contrib import admin
from mrbelvedereci.trigger.models import Trigger
class TriggerAdmin(admin.ModelAdmin):
list_display = ('name', 'repo', 'type', 'flows', 'org', 'regex', 'active', 'public')
list_filter = ('active', 'public', 'type', 'org', 'repo')
admin.site.register(Trigger, TriggerAdmin)
| Add name to trigger list view | Add name to trigger list view
| Python | bsd-3-clause | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci |
437eb8432fe91865d3cb24109e1b99818de8ce4e | pysc2/bin/battle_net_maps.py | pysc2/bin/battle_net_maps.py | #!/usr/bin/python
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | #!/usr/bin/python
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | Sort and indent the map lists. | Sort and indent the map lists.
PiperOrigin-RevId: 249276696
| Python | apache-2.0 | deepmind/pysc2 |
73eb3c7c52c2a5c58cad0e1d4dbe09c1e713beeb | conductor/vendor/_stripe.py | conductor/vendor/_stripe.py | from django.conf import settings
import stripe
stripe.api_key = settings.STRIPE_API_KEY
stripe.api_version = "2018-10-31"
class StripeGateway:
"""A gateway to Stripe
This insulates the rest of the system from Stripe errors
and configures the Stripe module with the API key.
"""
def create_custom... | from django.conf import settings
import stripe
stripe.api_key = settings.STRIPE_API_KEY
class StripeGateway:
"""A gateway to Stripe
This insulates the rest of the system from Stripe errors
and configures the Stripe module with the API key.
"""
def create_customer(self, user: settings.AUTH_USER_... | Remove pinned Stripe API version. | Remove pinned Stripe API version.
| Python | bsd-2-clause | mblayman/lcp,mblayman/lcp,mblayman/lcp |
9d7f2626294fbf25934e7dda4892b7ac13bd5555 | fireplace/cards/tgt/warlock.py | fireplace/cards/tgt/warlock.py | from ..utils import *
##
# Minions
# Dreadsteed
class AT_019:
deathrattle = Summon(CONTROLLER, "AT_019")
# Tiny Knight of Evil
class AT_021:
events = Discard(FRIENDLY).on(Buff(SELF, "AT_021e"))
# Wrathguard
class AT_026:
events = Damage(SELF).on(Hit(FRIENDLY_HERO, Damage.Args.AMOUNT))
# Wilfred Fizzlebang
cl... | from ..utils import *
##
# Minions
# Dreadsteed
class AT_019:
deathrattle = Summon(CONTROLLER, "AT_019")
# Tiny Knight of Evil
class AT_021:
events = Discard(FRIENDLY).on(Buff(SELF, "AT_021e"))
# Void Crusher
class AT_023:
inspire = Destroy(RANDOM_ENEMY_MINION | RANDOM_FRIENDLY_MINION)
# Wrathguard
class AT... | Implement more TGT Warlock cards | Implement more TGT Warlock cards
| Python | agpl-3.0 | liujimj/fireplace,beheh/fireplace,Ragowit/fireplace,Ragowit/fireplace,amw2104/fireplace,amw2104/fireplace,smallnamespace/fireplace,smallnamespace/fireplace,oftc-ftw/fireplace,liujimj/fireplace,oftc-ftw/fireplace,Meerkov/fireplace,jleclanche/fireplace,Meerkov/fireplace,NightKev/fireplace |
27c115ba875136ced13023999fe13fcf0d798f0e | lux_udp_bridge.py | lux_udp_bridge.py | #!/usr/bin/env python
import select
import serial
import socket
def run_lux_udp(host, port, dev):
with serial.Serial(dev, baudrate=3000000, xonxoff=False) as ser:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((host, port))
last_addr = None
serial_buffer = ""
... | #!/usr/bin/env python
import select
import serial
import socket
def run_lux_udp(host, port, dev):
with serial.Serial(dev, baudrate=3000000, xonxoff=False) as ser:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((host, port))
last_addr = None
serial_buffer = ""
... | Fix buffering issue in udp bridge | Fix buffering issue in udp bridge
| Python | mit | zbanks/radiance,zbanks/radiance,zbanks/radiance,zbanks/radiance |
4c3e92c8847b35c4afa53a90dd823c89d1d534d1 | mamba/__init__.py | mamba/__init__.py | __version__ = '0.8.6'
| __version__ = '0.8.6'
def description(message):
pass
def _description(message):
pass
def it(message):
pass
def _it(message):
pass
def context(message):
pass
def _context(message):
pass
def before():
pass
def after():
pass
| Make mamba more friendly to linters and IDE's | Make mamba more friendly to linters and IDE's
Some empty functions are added and we are able to optionally import them
| Python | mit | nestorsalceda/mamba |
21bf18a03c485304aa00dc2af86aa91930e4b1ac | tests/test_grammar.py | tests/test_grammar.py | import pytest
from parglare import Grammar
from parglare.exceptions import GrammarError
def test_terminal_nonterminal_conflict():
# Production A is a terminal ("a") and non-terminal at the same time.
g = """
A = "a" | B;
B = "b";
"""
try:
Grammar.from_string(g)
assert False
... | import pytest
from parglare import Grammar
def test_terminal_nonterminal():
# Production A is a terminal ("a") and non-terminal at the same time.
# Thus, it must be recognized as non-terminal.
g = """
S = A B;
A = "a" | B;
B = "b";
"""
Grammar.from_string(g)
# Here A shoud be non... | Fix in tests for terminal definitions. | Fix in tests for terminal definitions.
| Python | mit | igordejanovic/parglare,igordejanovic/parglare |
eacbc67cdaa7016d1098e9f63a50ae7ca6b4924a | app/auth/views.py | app/auth/views.py | # Copyright (C) 2016 University of Zurich. All rights reserved.
#
# This file is part of MSRegistry Backend.
#
# MSRegistry Backend is free software: you can redistribute it and/or
# modify it under the terms of the version 3 of the GNU Affero General
# Public License as published by the Free Software Foundation, or a... | # Copyright (C) 2016 University of Zurich. All rights reserved.
#
# This file is part of MSRegistry Backend.
#
# MSRegistry Backend is free software: you can redistribute it and/or
# modify it under the terms of the version 3 of the GNU Affero General
# Public License as published by the Free Software Foundation, or a... | Use JSON for API GET /auth/test response | Use JSON for API GET /auth/test response
| Python | agpl-3.0 | uzh/msregistry |
e8b1d0aff6333d6f8cfb4c81262550c670ea7e86 | factory/tools/cat_StartdLog.py | factory/tools/cat_StartdLog.py | #!/bin/env python
#
# cat_StartdLog.py
#
# Print out the StartdLog for a glidein output file
#
# Usage: cat_StartdLog.py logname
#
import sys
STARTUP_DIR=sys.path[0]
sys.path.append(os.path.join(STARTUP_DIR,"lib"))
import gWftLogParser
USAGE="Usage: cat_StartdLog.py <logname>"
def main():
try:
print gWft... | #!/bin/env python
#
# cat_StartdLog.py
#
# Print out the StartdLog for a glidein output file
#
# Usage: cat_StartdLog.py logname
#
import os.path
import sys
STARTUP_DIR=sys.path[0]
sys.path.append(os.path.join(STARTUP_DIR,"lib"))
import gWftLogParser
USAGE="Usage: cat_StartdLog.py <logname>"
def main():
try:
... | Allow for startup in a different dir | Allow for startup in a different dir
| Python | bsd-3-clause | bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old,holzman/glideinwms-old,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS |
7bf4083ef44585116f0eff86753080612a26b374 | src/__init__.py | src/__init__.py | from bayeslite.api import barplot
from bayeslite.api import cardinality
from bayeslite.api import draw_crosscat
from bayeslite.api import estimate_log_likelihood
from bayeslite.api import heatmap
from bayeslite.api import histogram
from bayeslite.api import mi_hist
from bayeslite.api import nullify
from bayeslite.api i... | from bdbcontrib.api import barplot
from bdbcontrib.api import cardinality
from bdbcontrib.api import draw_crosscat
from bdbcontrib.api import estimate_log_likelihood
from bdbcontrib.api import heatmap
from bdbcontrib.api import histogram
from bdbcontrib.api import mi_hist
from bdbcontrib.api import nullify
from bdbcont... | Fix big from bayeslite to bdbcontrib. | Fix big from bayeslite to bdbcontrib.
| Python | apache-2.0 | probcomp/bdbcontrib,probcomp/bdbcontrib |
27f503ef57a1582f7cc792d61f537bec71a4b02c | dhcp2nest/util.py | dhcp2nest/util.py | """
Utility functions for dhcp2nest
"""
from queue import Queue
from subprocess import Popen, PIPE
from threading import Thread
def follow_file(fn, max_lines=100):
"""
Return a Queue that is fed lines (up to max_lines) from the given file (fn)
continuously
The implementation given here was inspired b... | """
Utility functions for dhcp2nest
"""
from queue import Queue
from subprocess import Popen, PIPE
from threading import Thread
def follow_file(fn, max_lines=100):
"""
Return a Queue that is fed lines (up to max_lines) from the given file (fn)
continuously
The implementation given here was inspired b... | Use daemon threads for follow_file() | Use daemon threads for follow_file()
Signed-off-by: Jason Bernardino Alonso <f71c42a1353bbcdbe07e24c2a1c893f8ea1d05ee@hackorp.com>
| Python | mit | jbalonso/dhcp2nest |
af0ec29ce0c830f096ab809fd2d69affd887ce16 | feincms/module/page/admin.py | feincms/module/page/admin.py | # ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
from __future__ import absolute_import
from django.contrib import admin
from .models import Page
from .modeladmins import PageAdmin
# -----------------... | # ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
from __future__ import absolute_import
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.db.models imp... | Abort when the page model does not have a template_key field | Abort when the page model does not have a template_key field
| Python | bsd-3-clause | joshuajonah/feincms,mjl/feincms,matthiask/django-content-editor,matthiask/feincms2-content,feincms/feincms,feincms/feincms,pjdelport/feincms,pjdelport/feincms,mjl/feincms,michaelkuty/feincms,matthiask/django-content-editor,joshuajonah/feincms,nickburlett/feincms,matthiask/feincms2-content,matthiask/django-content-edito... |
2c5650ef41aaf8c116f3922be02e7c5e7a79524b | pychecker/pychecker2/File.py | pychecker/pychecker2/File.py | from pychecker2.util import type_filter
from compiler import ast
class File:
def __init__(self, name):
self.name = name
self.parseTree = None
self.scopes = {}
self.root_scope = None
self.warnings = []
def __cmp__(self, other):
return cmp(self.name, other.name)
... | from pychecker2.util import parents
from compiler import ast
class File:
def __init__(self, name):
self.name = name
self.parseTree = None
self.scopes = {}
self.root_scope = None
self.warnings = []
def __cmp__(self, other):
return cmp(self.name, other.name)
... | Add more ways to suck line numbers from nodes | Add more ways to suck line numbers from nodes
| Python | bsd-3-clause | smspillaz/pychecker,smspillaz/pychecker,smspillaz/pychecker |
2fb27cf8f4399ec6aba36b86d2993e6c3b81d0ee | coalib/bearlib/languages/__init__.py | coalib/bearlib/languages/__init__.py | """
This directory holds means to get generic information for specific languages.
"""
# Start ignoring PyUnusedCodeBear
from .Language import Language
from .Language import Languages
from .definitions.Unknown import Unknown
from .definitions.C import C
from .definitions.CPP import CPP
from .definitions.CSharp import ... | """
This directory holds means to get generic information for specific languages.
"""
# Start ignoring PyUnusedCodeBear
from .Language import Language
from .Language import Languages
from .definitions.Unknown import Unknown
from .definitions.C import C
from .definitions.CPP import CPP
from .definitions.CSharp import ... | Add definition into default import | Language: Add definition into default import
Fixes https://github.com/coala/coala/issues/4688 | Python | agpl-3.0 | coala/coala,SanketDG/coala,shreyans800755/coala,karansingh1559/coala,kartikeys98/coala,kartikeys98/coala,jayvdb/coala,CruiseDevice/coala,Nosferatul/coala,shreyans800755/coala,aptrishu/coala,nemaniarjun/coala,aptrishu/coala,karansingh1559/coala,jayvdb/coala,rimacone/testing2,Asalle/coala,CruiseDevice/coala,shreyans80075... |
ac25dd0b2bf3188e1f4325ccdab78e79e7f0a937 | spiceminer/kernel/__init__.py | spiceminer/kernel/__init__.py | #!/usr/bin/env python
#-*- coding:utf-8 -*-
from .highlevel import Kernel
# Legacy support (DEPRECATED)
from .legacy_support import *
from ..bodies import get
def load(path='.', recursive=True, followlinks=False):
return Kernel.load(**locals())
def unload(path='.', recursive=True, followlinks=False):
retur... | #!/usr/bin/env python
#-*- coding:utf-8 -*-
from .highlevel import Kernel
def load(path='.', recursive=True, followlinks=False, force_reload=False):
return Kernel.load(**locals())
def load_single(cls, path, extension=None, force_reload=False):
return Kernel.load_single(**locals())
def unload(path='.', recu... | Change the interface of the kernel submodule to prepare for the API change. * Remove legacy support * Add load_single() * Fix missing keyword argument in load() | Change the interface of the kernel submodule to prepare for the API change.
* Remove legacy support
* Add load_single()
* Fix missing keyword argument in load()
| Python | mit | DaRasch/spiceminer,DaRasch/spiceminer |
7ea0e2d8387b622f671638613a476dcbff6438e1 | rest_framework_swagger/urls.py | rest_framework_swagger/urls.py | from django.conf.urls import patterns
from django.conf.urls import url
from rest_framework_swagger.views import SwaggerResourcesView, SwaggerApiView, SwaggerUIView
urlpatterns = patterns(
'',
url(r'^$', SwaggerUIView.as_view(), name="django.swagger.base.view"),
url(r'^api-docs/$', SwaggerResourcesView.as_... | from django.conf.urls import url
from rest_framework_swagger.views import SwaggerResourcesView, SwaggerApiView, SwaggerUIView
urlpatterns = [
url(r'^$', SwaggerUIView.as_view(), name="django.swagger.base.view"),
url(r'^api-docs/$', SwaggerResourcesView.as_view(), name="django.swagger.resources.view"),
url... | Use the new style urlpatterns syntax to fix Django deprecation warnings | Use the new style urlpatterns syntax to fix Django deprecation warnings
The `patterns()` syntax is now deprecated:
https://docs.djangoproject.com/en/1.8/releases/1.8/#django-conf-urls-patterns
And so under Django 1.8 results in warnings:
rest_framework_swagger/urls.py:10: RemovedInDjango110Warning:
django.conf.urls.p... | Python | bsd-2-clause | pombredanne/django-rest-swagger,aioTV/django-rest-swagger,cancan101/django-rest-swagger,visasq/django-rest-swagger,aioTV/django-rest-swagger,marcgibbons/django-rest-swagger,marcgibbons/django-rest-swagger,aioTV/django-rest-swagger,cancan101/django-rest-swagger,pombredanne/django-rest-swagger,arc6373/django-rest-swagger... |
3724f2895c704df595b083ecc56c56c351b6e32f | runbot_pylint/__openerp__.py | runbot_pylint/__openerp__.py | {
'name': 'Runbot Pylint',
'category': 'Website',
'summary': 'Runbot',
'version': '1.0',
'description': "Runbot",
'author': 'OpenERP SA',
'depends': ['runbot'],
'external_dependencies': {
},
'data': [
"view/runbot_pylint_view.xml"
],
'installable': True,
}
| {
'name': 'Runbot Pylint',
'category': 'Website',
'summary': 'Runbot',
'version': '1.0',
'description': "Runbot",
'author': 'OpenERP SA',
'depends': ['runbot'],
'external_dependencies': {
'bin': ['pylint'],
},
'data': [
"view/runbot_pylint_view.xml"
],
'in... | Add external depedencies to pylint bin | Add external depedencies to pylint bin
| Python | agpl-3.0 | amoya-dx/runbot-addons |
d4722298a0fc03fca6ef17e246e3ffd74efc4d60 | src/isomorphic_strings.py | src/isomorphic_strings.py | class Solution:
# @param {string} s
# @param {string} t
# @return {boolean}
def isIsomorphic(self, s, t):
if len(s) != len(t):
return False
charDict = {}
for i, c in enumerate(s):
if c not in charDict.keys() and t[i] not in charDict.values():
... | class Solution:
# @param {string} s
# @param {string} t
# @return {boolean}
def isIsomorphic(self, s, t):
if len(s) != len(t):
return False
charDict = {}
for i, c in enumerate(s):
if c not in charDict.keys() and t[i] not in charDict.values():
... | Add solution for the isomorphic strings | Add solution for the isomorphic strings
| Python | mit | chancyWu/leetcode |
b19746badd83190b4e908144d6bc830178445dc2 | cc/license/tests/test_cc_license.py | cc/license/tests/test_cc_license.py | """Tests for functionality within the cc.license module.
This file is a catch-all for tests with no place else to go."""
import cc.license
def test_locales():
locales = cc.license.locales()
for l in locales:
assert type(l) == unicode
for c in ('en', 'de', 'he', 'ja', 'fr'):
assert c in ... | """Tests for functionality within the cc.license module.
This file is a catch-all for tests with no place else to go."""
import cc.license
def test_locales():
locales = cc.license.locales()
for l in locales:
assert type(l) == unicode
for c in ('en', 'de', 'he', 'ja', 'fr'):
assert c in ... | Add test to make sure certain classes are always found in cc.license, no matter where they are internally. | Add test to make sure certain classes are always found in cc.license,
no matter where they are internally.
| Python | mit | creativecommons/cc.license,creativecommons/cc.license |
0ed7e87a6eeaab56d5c59a7e6874b5a5b0bab314 | tests/test_pointcloud.py | tests/test_pointcloud.py | from simulocloud import PointCloud
import json
import numpy as np
_TEST_XYZ = """[[10.0, 12.2, 14.4, 16.6, 18.8],
[11.1, 13.3, 15.5, 17.7, 19.9],
[0.1, 2.1, 4.5, 6.7, 8.9]]"""
_EXPECTED_POINTS = np.array([( 10. , 11.1, 0.1),
( 12.2, 13.3, 2.1),
... | from simulocloud import PointCloud
import json
import numpy as np
_TEST_XYZ = [[10.0, 12.2, 14.4, 16.6, 18.8],
[11.1, 13.3, 15.5, 17.7, 19.9],
[0.1, 2.1, 4.5, 6.7, 8.9]]
_EXPECTED_POINTS = np.array([( 10. , 11.1, 0.1),
( 12.2, 13.3, 2.1),
... | Write test data as list unless otherwise needed | Write test data as list unless otherwise needed
| Python | mit | stainbank/simulocloud |
8ce14cfb0044d90f2503a7bd940a7f6401c15db2 | wagtail/admin/rich_text/editors/draftail.py | wagtail/admin/rich_text/editors/draftail.py | from django.forms import widgets
from wagtail.admin.edit_handlers import RichTextFieldPanel
from wagtail.admin.rich_text.converters.contentstate import ContentstateConverter
from wagtail.core.rich_text import features
class DraftailRichTextArea(widgets.Textarea):
# this class's constructor accepts a 'features' k... | import json
from django.forms import Media, widgets
from wagtail.admin.edit_handlers import RichTextFieldPanel
from wagtail.admin.rich_text.converters.contentstate import ContentstateConverter
from wagtail.core.rich_text import features
class DraftailRichTextArea(widgets.Textarea):
# this class's constructor ac... | Integrate Draftail-related assets with Django widget | Integrate Draftail-related assets with Django widget
| Python | bsd-3-clause | mikedingjan/wagtail,kaedroho/wagtail,timorieber/wagtail,mixxorz/wagtail,torchbox/wagtail,gasman/wagtail,gasman/wagtail,wagtail/wagtail,timorieber/wagtail,mixxorz/wagtail,nealtodd/wagtail,nimasmi/wagtail,kaedroho/wagtail,mikedingjan/wagtail,takeflight/wagtail,thenewguy/wagtail,zerolab/wagtail,timorieber/wagtail,thenewgu... |
3db4d306c779ef3a84133dbbfc5614d514d72411 | pi_gpio/handlers.py | pi_gpio/handlers.py | from flask.ext.restful import fields
from meta import BasicResource
from config.pins import PinHttpManager
from pi_gpio import app
HTTP_MANAGER = PinHttpManager()
class Pin(BasicResource):
def __init__(self):
super(Pin, self).__init__()
self.fields = {
"num": fields.Integer,
... | from flask.ext.restful import fields
from meta import BasicResource
from config.pins import PinHttpManager
from pi_gpio import app
HTTP_MANAGER = PinHttpManager()
class Pin(BasicResource):
def __init__(self):
super(Pin, self).__init__()
self.fields = {
"num": fields.Integer,
... | Add new fields to response | Add new fields to response
| Python | mit | projectweekend/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,thijstriemstra/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,thijstriemstra/Pi-GPIO-Server,thijstriemstra/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,thijstriemstra/Pi-GPIO-Server |
23bbb5737602408ba553b77810103d7b32140c89 | test.py | test.py | #!/usr/bin/env python
import neukrill_net.utils as utils
import neukrill_net.image_processing as image_processing
import csv
import pickle
from sklearn.externals import joblib
import numpy as np
import glob
import os
def main():
settings = utils.Settings('settings.json')
image_fname_dict = settings.image_fn... | #!/usr/bin/env python
import neukrill_net.utils as utils
import neukrill_net.image_processing as image_processing
import csv
import pickle
from sklearn.externals import joblib
import numpy as np
import glob
import os
def main():
settings = utils.Settings('settings.json')
image_fname_dict = settings.image_fn... | Swap to using submission prediction writer function | Swap to using submission prediction writer function
| Python | mit | Neuroglycerin/neukrill-net-work,Neuroglycerin/neukrill-net-work,Neuroglycerin/neukrill-net-work |
9a19da30a933bc2872b9fc5b5966823c43e1982f | website/pages/tests.py | website/pages/tests.py | # -*- coding: utf-8 -*-
"""
File: tests.py
Creator: MazeFX
Date: 12-7-2016
Tests written for testing main website pages (home, about, contact, etc)
"""
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.template.loader import render_to_string... | # -*- coding: utf-8 -*-
"""
File: tests.py
Creator: MazeFX
Date: 12-7-2016
Tests written for testing main website pages (home, about, contact, etc)
Contact page has the ability to send emails through anymail/mailgun.
"""
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http ... | Change send email to contact namespace | Change send email to contact namespace | Python | mit | MazeFX/cookiecutter_website_project,MazeFX/cookiecutter_website_project,MazeFX/cookiecutter_website_project,MazeFX/cookiecutter_website_project |
f185f04f6efdabe161ae29ba72f7208b8adccc41 | bulletin/tools/plugins/models.py | bulletin/tools/plugins/models.py | from django.db import models
from bulletin.models import Post
class Event(Post):
start_date = models.DateTimeField()
end_date = models.DateTimeField(null=True, blank=True)
time = models.CharField(max_length=255,
null=True, blank=True)
organization = models.CharField(max_l... | from django.db import models
from bulletin.models import Post
class Event(Post):
start_date = models.DateTimeField()
end_date = models.DateTimeField(null=True, blank=True)
time = models.CharField(max_length=255,
null=True, blank=True)
organization = models.CharField(max_l... | Set verbose name of NewResource. | Set verbose name of NewResource.
| Python | mit | AASHE/django-bulletin,AASHE/django-bulletin,AASHE/django-bulletin |
4641b9a1b9a79fdeb0aaa3264de7bd1703b1d1fa | alexandria/web.py | alexandria/web.py | from alexandria import app, mongo
from decorators import *
from flask import render_template, request, jsonify, g, send_from_directory, redirect, url_for, session, flash
import os
import shutil
import requests
from pymongo import MongoClient
from functools import wraps
import bcrypt
from bson.objectid import ObjectId
... | from alexandria import app, mongo
from decorators import *
from flask import render_template, request, jsonify, g, send_from_directory, redirect, url_for, session, flash
import os
import shutil
import requests
from pymongo import MongoClient
from functools import wraps
import bcrypt
from bson.objectid import ObjectId
... | Fix return on active user accessing the portal | Fix return on active user accessing the portal
| Python | mit | citruspi/Alexandria,citruspi/Alexandria |
e3928f489f481c9e44c634d7ee98afc5425b4432 | tests/test_yaml_utils.py | tests/test_yaml_utils.py | import pytest
from apispec import yaml_utils
def test_load_yaml_from_docstring():
def f():
"""
Foo
bar
baz quux
---
herp: 1
derp: 2
"""
result = yaml_utils.load_yaml_from_docstring(f.__doc__)
assert result == {"herp": 1, "derp": 2}
... | import pytest
from apispec import yaml_utils
def test_load_yaml_from_docstring():
def f():
"""
Foo
bar
baz quux
---
herp: 1
derp: 2
"""
result = yaml_utils.load_yaml_from_docstring(f.__doc__)
assert result == {"herp": 1, "derp": 2}
... | Add regression test for generating yaml with unicode | Add regression test for generating yaml with unicode
| Python | mit | marshmallow-code/smore,marshmallow-code/apispec |
baf09f8b308626abb81431ddca4498409fc9d5ce | campaigns/tests/test_views.py | campaigns/tests/test_views.py | from django.test import TestCase
from django.http import HttpRequest
from campaigns.views import create_campaign
from campaigns.models import Campaign
from campaigns.forms import CampaignForm
class HomePageTest(TestCase):
def test_does_root_url_resolves_the_home_page(self):
called = self.client.get('/')
self.ass... | from django.test import TestCase
from django.http import HttpRequest
from campaigns.views import create_campaign
from campaigns.models import Campaign
from campaigns.forms import CampaignForm
def make_POST_request(titleValue, descriptionValue):
request = HttpRequest()
request.method = 'POST'
request.POST['title'] =... | Refactor some redundancy in the views tests | Refactor some redundancy in the views tests
| Python | apache-2.0 | Springsteen/tues_admission,Springsteen/tues_admission,Springsteen/tues_admission,Springsteen/tues_admission |
2ca6f765a3bd1eca6bd255f9c679c9fbea78484a | run_maya_tests.py | run_maya_tests.py | """Use Mayapy for testing
Usage:
$ mayapy run_maya_tests.py
"""
import sys
import nose
import warnings
from nose_exclude import NoseExclude
warnings.filterwarnings("ignore", category=DeprecationWarning)
if __name__ == "__main__":
from maya import standalone
standalone.initialize()
argv = sys.argv... | """Use Mayapy for testing
Usage:
$ mayapy run_maya_tests.py
"""
import sys
import nose
import logging
import warnings
from nose_exclude import NoseExclude
warnings.filterwarnings("ignore", category=DeprecationWarning)
if __name__ == "__main__":
from maya import standalone
standalone.initialize()
... | Enhance readability of test output | Enhance readability of test output
| Python | mit | MoonShineVFX/core,mindbender-studio/core,MoonShineVFX/core,mindbender-studio/core,getavalon/core,getavalon/core |
6578b6d2dfca38940be278d82e4f8d8248ae3c79 | convert_codecs.py | convert_codecs.py | #!/usr/env python
# -*- coding: utf-8 -*-
"""Convert file codecs
Usage:
convert_codecs.py <sourceFile> <targetFile> <sourceEncoding> <targetEncoding>
convert_codecs.py (-h | --help)
"""
import codecs
from docopt import docopt
__version__ = '0.1'
__author__ = 'Honghe'
BLOCKSIZE = 1024**2 # size in bytes
d... | #!/usr/env python
# -*- coding: utf-8 -*-
"""Convert file codecs
Usage:
convert_codecs.py <sourceFile> <targetFile> <sourceEncoding> <targetEncoding>
convert_codecs.py (-h | --help)
"""
import codecs
from docopt import docopt
__version__ = '0.1'
__author__ = 'Honghe'
BLOCKSIZE = 1024 # number of character... | Correct the comment of BLOCKSIZE | Correct the comment of BLOCKSIZE
| Python | apache-2.0 | Honghe/convert_codecs |
e0b2ac4b71859708f4b35ae8ef7227b630a6e2d9 | ctypeslib/test/test_toolchain.py | ctypeslib/test/test_toolchain.py | import unittest
import sys
from ctypeslib import h2xml, xml2py
class ToolchainTest(unittest.TestCase):
if sys.platform == "win32":
def test(self):
h2xml.main(["h2xml", "-q",
"-D WIN32_LEAN_AND_MEAN",
"-D _UNICODE", "-D UNICODE",
... | import unittest
import sys
from ctypeslib import h2xml, xml2py
class ToolchainTest(unittest.TestCase):
if sys.platform == "win32":
def test_windows(self):
h2xml.main(["h2xml", "-q",
"-D WIN32_LEAN_AND_MEAN",
"-D _UNICODE", "-D UNICODE",
... | Add a test for stdio.h. | Add a test for stdio.h. | Python | mit | sugarmanz/ctypeslib |
649bea9ce3ebaf4ba44919097b731ba915703852 | alembic/versions/30d0a626888_add_username.py | alembic/versions/30d0a626888_add_username.py | """Add username
Revision ID: 30d0a626888
Revises: 51375067b45
Create Date: 2015-10-29 10:32:03.077400
"""
# revision identifiers, used by Alembic.
revision = '30d0a626888'
down_revision = '51375067b45'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_... | """Add username
Revision ID: 30d0a626888
Revises: 51375067b45
Create Date: 2015-10-29 10:32:03.077400
"""
# revision identifiers, used by Alembic.
revision = '30d0a626888'
down_revision = '51375067b45'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
"""
... | Add generate sql example as comment | Add generate sql example as comment
| Python | apache-2.0 | SkygearIO/skygear-server,rickmak/skygear-server,rickmak/skygear-server,SkygearIO/skygear-server,rickmak/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server |
281a096cea735845bdb74d60abf14f1422f2c624 | test_runner/executable.py | test_runner/executable.py | import argh
from .environments import Environment
from .frameworks import Tempest
from .utils import cleanup, Reporter
LOG = Reporter(__name__).setup()
def main(endpoint, username='admin', password='secrete', test_path='api'):
environment = Environment(username, password, endpoint)
with cleanup(environment... | import argh
from .environments import Environment
from .frameworks import Tempest
from .utils import cleanup, Reporter
LOG = Reporter(__name__).setup()
def main(endpoint, username='admin', password='secrete', test_path='api'):
environment = Environment(username, password, endpoint)
with cleanup(environment... | Move command dispatch into full module | Move command dispatch into full module
| Python | mit | rcbops-qa/test_runner |
0dd935a383d4b8d066dc091226b61119d245a7f9 | threeOhOne.py | threeOhOne.py | #!/usr/bin/env python
# -*- Coding: utf-8 -*-
"""
" In its present form, it simply takes a comma delimited .csv file and outputs a .txt file containing valid 301 redirect statements for an .htaccess file
"
" author: Claude Müller
" wbsite: http://mediarocket.co.za
"
"""
import csv
class ThreeOhOne:
def __ini__(s... | #!/usr/bin/env python
# -*- Coding: utf-8 -*-
"""
" In its present form, it simply takes a comma delimited .csv file and outputs a .txt file containing valid 301 redirect statements for an .htaccess file
"
" author: Claude Müller
" wbsite: http://mediarocket.co.za
"
"""
import sys
import csv
class ThreeOhOne:
ou... | Add command line argument capability | [py] Add command line argument capability
| Python | mit | claudemuller/301csv2htaccess |
52c7321c78c8a81b6b557d67fe5af44b8b32df4c | src/octoprint/__main__.py | src/octoprint/__main__.py | #!/usr/bin/env python2
# coding=utf-8
from __future__ import absolute_import, division, print_function
if __name__ == "__main__":
import octoprint
octoprint.main()
| #!/usr/bin/env python2
# coding=utf-8
from __future__ import absolute_import, division, print_function
import sys
if sys.version_info[0] >= 3:
raise Exception("Octoprint does not support Python 3")
if __name__ == "__main__":
import octoprint
octoprint.main()
| Handle unsupported version at runtime. | Handle unsupported version at runtime.
If you have an ancient setuptools, 4a36ddb3aa77b8d1b1a64c197607fa652705856c
won't successfully prevent installing. These changes will at least give a sane error,
rather then just barfing on random syntax errors due to the `unicode` type not
being present in py3k.
Cherry picked ... | Python | agpl-3.0 | Jaesin/OctoPrint,foosel/OctoPrint,Jaesin/OctoPrint,Jaesin/OctoPrint,foosel/OctoPrint,Jaesin/OctoPrint,foosel/OctoPrint,foosel/OctoPrint |
ca7fb88d36b386defab610388761609539e0a9cf | conary/build/capsulerecipe.py | conary/build/capsulerecipe.py | #
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | #
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | Enable building hybrid capsule/non-capsule packages (CNY-3271) | Enable building hybrid capsule/non-capsule packages (CNY-3271)
| Python | apache-2.0 | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary |
d54e5f25601fe2f57a2c6be5524430f0068e05c4 | image_translate/frames_rendering.py | image_translate/frames_rendering.py | # need to install python-opencv, pygame, numpy, scipy, PIL
import sys
import pygame
from pygame.locals import *
import opencv
#this is important for capturing/displaying images
from opencv import highgui
def get_image(camera):
img = highgui.cvQueryFrame(camera)
# Add the line below if you need it (Ubuntu 8.... | # need to install python-opencv, pygame, numpy, scipy, PIL
import sys
import pygame
from pygame.locals import QUIT, KEYDOWN
import opencv
#this is important for capturing/displaying images
from opencv import highgui
def get_image(camera):
img = highgui.cvQueryFrame(camera)
# Add the line below if you need i... | Remove brute and inconvinient star import | Remove brute and inconvinient star import | Python | mit | duboviy/study_languages |
1d53f6dc8346a655a86e670d0d4de56f7dc93d04 | gala/sparselol.py | gala/sparselol.py | import numpy as np
from scipy import sparse
from .sparselol_cy import extents_count
def extents(labels):
"""Compute the extents of every integer value in ``arr``.
Parameters
----------
labels : array of ints
The array of values to be mapped.
Returns
-------
locs : sparse.csr_matri... | import numpy as np
from scipy import sparse
from .sparselol_cy import extents_count
def extents(labels):
"""Compute the extents of every integer value in ``arr``.
Parameters
----------
labels : array of ints
The array of values to be mapped.
Returns
-------
locs : sparse.csr_matri... | Use stride tricks to save data memory | Use stride tricks to save data memory
| Python | bsd-3-clause | janelia-flyem/gala,jni/gala |
7ebc9a4511d52707ce88a1b8bc2d3fa638e1fb91 | c2rst.py | c2rst.py | import sphinx.parsers
import docutils.parsers.rst as rst
class CStrip(sphinx.parsers.Parser):
def __init__(self):
self.rst_parser = rst.Parser()
def parse(self, inputstring, document):
stripped = []
for line in inputstring.split("\n"):
line = line.strip()
if line == "//|":
stripped... | import docutils.parsers
import docutils.parsers.rst as rst
class CStrip(docutils.parsers.Parser):
def __init__(self):
self.rst_parser = rst.Parser()
def parse(self, inputstring, document):
stripped = []
for line in inputstring.split("\n"):
line = line.strip()
if line == "//|":
stri... | Switch away from sphinx.parsers which isn't available in sphinx 1.3.5 on Read The Docs. | Switch away from sphinx.parsers which isn't available in sphinx 1.3.5 on Read The Docs.
| Python | mit | adafruit/circuitpython,adafruit/circuitpython,adafruit/circuitpython,adafruit/micropython,adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/micropython,adafruit/circuitpython |
e37c7cace441e837120b820936c6f4ae8de78996 | sts/controller_manager.py | sts/controller_manager.py | from sts.util.console import msg
class ControllerManager(object):
''' Encapsulate a list of controllers objects '''
def __init__(self, controllers):
self.uuid2controller = {
controller.uuid : controller
for controller in controllers
}
@property
def controllers(self):
return self.uuid2c... | from sts.util.console import msg
class ControllerManager(object):
''' Encapsulate a list of controllers objects '''
def __init__(self, controllers):
self.uuid2controller = {
controller.uuid : controller
for controller in controllers
}
@property
def controllers(self):
cs = self.uuid2co... | Make .contollers() deterministic (was using hash.values()) | Make .contollers() deterministic (was using hash.values())
| Python | apache-2.0 | ucb-sts/sts,jmiserez/sts,ucb-sts/sts,jmiserez/sts |
34b57742801f888af7597378bd00f9d06c2d3b66 | packages/Python/lldbsuite/test/repl/quicklookobject/TestREPLQuickLookObject.py | packages/Python/lldbsuite/test/repl/quicklookobject/TestREPLQuickLookObject.py | # TestREPLQuickLookObject.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CO... | # TestREPLQuickLookObject.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CO... | Use the PlaygroundQuickLook(reflecting:) constructor in this test case | Use the PlaygroundQuickLook(reflecting:) constructor in this test case
| Python | apache-2.0 | apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb |
58c13375f7ea4acaf21ccf1151460d79e59bfdf1 | spotify/__init__.py | spotify/__init__.py | from __future__ import unicode_literals
import os
import cffi
__version__ = '2.0.0a1'
_header_file = os.path.join(os.path.dirname(__file__), 'api.processed.h')
_header = open(_header_file).read()
_header += '#define SPOTIFY_API_VERSION ...\n'
ffi = cffi.FFI()
ffi.cdef(_header)
lib = ffi.verify('#include "libspoti... | from __future__ import unicode_literals
import os
import weakref
import cffi
__version__ = '2.0.0a1'
_header_file = os.path.join(os.path.dirname(__file__), 'api.processed.h')
_header = open(_header_file).read()
_header += '#define SPOTIFY_API_VERSION ...\n'
ffi = cffi.FFI()
ffi.cdef(_header)
lib = ffi.verify('#in... | Add global_weakrefs dict to keep strings in structs, etc alive | Add global_weakrefs dict to keep strings in structs, etc alive
| Python | apache-2.0 | kotamat/pyspotify,felix1m/pyspotify,jodal/pyspotify,mopidy/pyspotify,jodal/pyspotify,kotamat/pyspotify,mopidy/pyspotify,jodal/pyspotify,felix1m/pyspotify,felix1m/pyspotify,kotamat/pyspotify |
723f59d43cce9d7a09386447389e8df33b5d323e | tests/base/base.py | tests/base/base.py | import steel
import unittest
class NameAwareOrderedDictTests(unittest.TestCase):
def setUp(self):
self.d = steel.NameAwareOrderedDict()
def test_ignore_object(self):
# Objects without a set_name() method should be ignored
self.d['example'] = object()
self.assertFalse(hasattr(s... | import steel
import unittest
class NameAwareOrderedDictTests(unittest.TestCase):
def setUp(self):
self.d = steel.NameAwareOrderedDict()
def test_ignore_object(self):
# Objects without a set_name() method should be ignored
self.d['example'] = object()
self.assertFalse(hasattr(s... | Add a simple test for calculating the size of a structure | Add a simple test for calculating the size of a structure
| Python | bsd-3-clause | gulopine/steel-experiment |
73af60749ea7b031473bc5f0c3ddd60d39ec6fa6 | docs/examples/customer_fetch/get_customer.py | docs/examples/customer_fetch/get_customer.py | from sharpy.product import CheddarProduct
# Get a product instance to work with
product = CheddarProduct(
username = CHEDDAR_USERNAME,
password = CHEDDAR_PASSWORD,
product_code = CHEDDAR_PRODUCT,
)
# Get the customer from Cheddar Getter
customer = product.get_customer(code='1BDI') | from sharpy.product import CheddarProduct
from sharpy import exceptions
# Get a product instance to work with
product = CheddarProduct(
username = CHEDDAR_USERNAME,
password = CHEDDAR_PASSWORD,
product_code = CHEDDAR_PRODUCT,
)
try:
# Get the customer from Cheddar Getter
customer = product.get_cus... | Add a bit to the get customer to show handling not-found and testing for canceled status | Add a bit to the get customer to show handling not-found and testing for canceled status
| Python | bsd-3-clause | SeanOC/sharpy,smartfile/sharpy |
7f9ea07f2ee55ff36009bc67068c36bc1180c909 | tests/test_credentials.py | tests/test_credentials.py | import json
import keyring
from pyutrack import Credentials
from tests import PyutrackTest
class CredentialsTests(PyutrackTest):
def test_empty(self):
c = Credentials('root')
self.assertIsNone(c.password)
self.assertIsNone(c.cookies)
def test_persistence(self):
c = Credentia... | import json
import keyring
from pyutrack import Credentials
from tests import PyutrackTest
class CredentialsTests(PyutrackTest):
def test_empty(self):
c = Credentials('root')
self.assertIsNone(c.password)
self.assertIsNone(c.cookies)
def test_persistence(self):
c = Credentia... | Add test for credentials reload | Add test for credentials reload
| Python | mit | alisaifee/pyutrack,alisaifee/pyutrack |
82b7e46ebdeb154963520fec1d41cc624ceb806d | tests/test_vendcrawler.py | tests/test_vendcrawler.py | import unittest
from vendcrawler.scripts.vendcrawler import VendCrawler
class TestVendCrawlerMethods(unittest.TestCase):
def test_get_links(self):
links = VendCrawler().get_links(2)
self.assertEqual(links,
['https://sarahserver.net/?module=vendor&p=1',
... | import unittest
from vendcrawler.scripts.vendcrawler import VendCrawler
class TestVendCrawlerMethods(unittest.TestCase):
def test_get_links(self):
links = VendCrawler('a', 'b', 'c').get_links(2)
self.assertEqual(links,
['https://sarahserver.net/?module=vendor&p=1',
... | Fix test by passing placeholder variables. | Fix test by passing placeholder variables.
| Python | mit | josetaas/vendcrawler,josetaas/vendcrawler,josetaas/vendcrawler |
56fca00d992c84e46e60fa8b9ea66eb9eadc7508 | mgsv_names.py | mgsv_names.py | from __future__ import unicode_literals, print_function
import sqlite3, os, random
_select = 'select {0} from {1} limit 1 offset abs(random()) % (select count({0}) from {1});'
_uncommon_select = 'select value from uncommons where key=?;'
def generate_name():
conn = sqlite3.connect(os.path.join(os.path.dirname(__f... | from __future__ import unicode_literals, print_function
import sqlite3, os, random
_select_random = 'select {0} from {1} limit 1 offset abs(random()) % (select count({0}) from {1});'
_select_uncommon = 'select value from uncommons where key=?;'
def generate_name():
conn = sqlite3.connect(os.path.join(os.path.dirn... | Rename the SQL module vars for consistency. | Rename the SQL module vars for consistency.
| Python | unlicense | rotated8/mgsv_names |
c26fc5da048bb1751bb6401dbdb8839f89d82c1e | nova/policies/server_diagnostics.py | nova/policies/server_diagnostics.py | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | Introduce scope_types in server diagnostics | Introduce scope_types in server diagnostics
oslo.policy introduced the scope_type feature which can
control the access level at system-level and project-level.
- https://docs.openstack.org/oslo.policy/latest/user/usage.html#setting-scope
- http://specs.openstack.org/openstack/keystone-specs/specs/keystone/queens/sys... | Python | apache-2.0 | mahak/nova,klmitch/nova,openstack/nova,klmitch/nova,klmitch/nova,mahak/nova,mahak/nova,klmitch/nova,openstack/nova,openstack/nova |
f25dde13d04e9c6eda28ac76444682e53accbdb3 | src/webapp/tasks.py | src/webapp/tasks.py | import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import MapPoint
try:
from uwsgidecorators import spool
except ImportError as e:
def spool(fn):
def nufun(*args, **kwargs):
raise e
return nufun
@spool
def get_aqua_dist... | import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import MapPoint
from cfg import config
try:
from uwsgidecorators import spool
except ImportError as e:
def spool(fn):
def nufun(*args, **kwargs):
raise e
return nufun
@... | Read center point from config | Read center point from config
Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
| Python | bsd-3-clause | eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system |
638f52f59135d151a3c7ed4f84fc0716c6c0d69d | mcbench/xpath.py | mcbench/xpath.py | import sys
import lxml.etree
class XPathError(Exception):
pass
def parse_xml_filename(filename):
return lxml.etree.parse(filename)
def compile_xpath(query):
try:
return lxml.etree.XPath(query)
except lxml.etree.XPathSyntaxError as e:
raise XPathError(e.msg), None, sys.exc_info()[2... | import sys
import lxml.etree
class XPathError(Exception):
pass
def parse_xml_filename(filename):
return lxml.etree.parse(filename)
def compile_xpath(query):
try:
return lxml.etree.XPath(query)
except lxml.etree.XPathSyntaxError as e:
raise XPathError(e.msg), None, sys.exc_info()[2... | Make is_call handle multiple arguments. | Make is_call handle multiple arguments.
Can now be called with a sequence, as in
is_call(ancestor::Function/@name)
or just several literals, as in is_call('eval', 'feval').
In both cases, it does an or.
| Python | mit | isbadawi/mcbench,isbadawi/mcbench |
b482eb5c8ff7dc346a3c7037c2218a4b2f2d61c4 | setup/create_player_seasons.py | setup/create_player_seasons.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import concurrent.futures
from db.common import session_scope
from db.player import Player
from utils.player_data_retriever import PlayerDataRetriever
def create_player_seasons(simulation=False):
data_retriever = PlayerDataRetriever()
with session_scope() as s... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import concurrent.futures
from db.common import session_scope
from db.player import Player
from utils.player_data_retriever import PlayerDataRetriever
logger = logging.getLogger(__name__)
def create_player_seasons(simulation=False):
data_retriever =... | Add logging to player season creation script | Add logging to player season creation script
| Python | mit | leaffan/pynhldb |
36cc1ecc2b64d5c31ea590dddbf9e12c71542c7d | sphinxcontrib/openstreetmap.py | sphinxcontrib/openstreetmap.py | # -*- coding: utf-8 -*-
"""
sphinxcontrib.openstreetmap
===========================
Embed OpenStreetMap on your documentation.
:copyright: Copyright 2015 HAYASHI Kentaro <kenhys@gmail.com>
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from docutils.parsers.rst import directives
from sphi... | # -*- coding: utf-8 -*-
"""
sphinxcontrib.openstreetmap
===========================
Embed OpenStreetMap on your documentation.
:copyright: Copyright 2015 HAYASHI Kentaro <kenhys@gmail.com>
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from docutils.parsers.rst import directives
from sphi... | Remove marker from option spec | Remove marker from option spec
| Python | bsd-2-clause | kenhys/sphinxcontrib-openstreetmap,kenhys/sphinxcontrib-openstreetmap |
8ce1def3020570c8a3e370261fc9c7f027202bdf | owapi/util.py | owapi/util.py | """
Useful utilities.
"""
import json
from kyokai import Request
from kyokai.context import HTTPRequestContext
def jsonify(func):
"""
JSON-ify the response from a function.
"""
async def res(ctx: HTTPRequestContext):
result = await func(ctx)
assert isinstance(ctx.request, Request)
... | """
Useful utilities.
"""
import json
import aioredis
from kyokai import Request
from kyokai.context import HTTPRequestContext
async def with_cache(ctx: HTTPRequestContext, func, *args, expires=300):
"""
Run a coroutine with cache.
Stores the result in redis.
"""
assert isinstance(ctx.redis, aio... | Add with_cache function for storing cached data | Add with_cache function for storing cached data
| Python | mit | azah/OWAPI,SunDwarf/OWAPI |
106ea580471387a3645877f52018ff2880db34f3 | live_studio/config/forms.py | live_studio/config/forms.py | from django import forms
from .models import Config
class ConfigForm(forms.ModelForm):
class Meta:
model = Config
exclude = ('created', 'user')
PAGES = (
('base',),
('distribution',),
('media_type',),
('architecture',),
('installer',),
('locale', 'keyboard_layout'),
)
WIZ... | from django import forms
from .models import Config
class ConfigForm(forms.ModelForm):
class Meta:
model = Config
exclude = ('created', 'user')
PAGES = (
('base',),
('distribution',),
('media_type',),
('architecture',),
('installer',),
('locale', 'keyboard_layout'),
)
WIZ... | Use radio buttons for most of the interface. | Use radio buttons for most of the interface.
Signed-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>
| Python | agpl-3.0 | lamby/live-studio,lamby/live-studio,lamby/live-studio,debian-live/live-studio,debian-live/live-studio,debian-live/live-studio |
6b01cdc18fce9277991fc5628f1d6c904ad47ee6 | BuildAndRun.py | BuildAndRun.py | import os
import subprocess
name = "gobuildmaster"
current_hash = ""
if os.path.isfile('hash'):
current_hash = open('hash').readlines()[0]
new_hash = os.popen('git rev-parse HEAD').readlines()[0]
open('hash','w').write(new_hash)
# Move the old version over
for line in os.popen('cp ' + name + ' old' + name).r... | import os
import subprocess
name = "gobuildmaster"
current_hash = ""
if os.path.isfile('hash'):
current_hash = open('hash').readlines()[0]
new_hash = os.popen('git rev-parse HEAD').readlines()[0]
open('hash','w').write(new_hash)
# Move the old version over
for line in os.popen('cp ' + name + ' old' + name).r... | Fix running detection for master | Fix running detection for master
| Python | apache-2.0 | brotherlogic/gobuildmaster,brotherlogic/gobuildmaster,brotherlogic/gobuildmaster |
3ca46f1407d8984ca5cbd1eb0581765386533d71 | observatory/rcos/tests/test_rcos.py | observatory/rcos/tests/test_rcos.py | import pytest
from django.core.urlresolvers import reverse
@pytest.mark.django_db
def test_homepage(client):
for url in (
"/donor",
"/students",
"/courses",
"/talks",
"/programming-competition",
"/achievements",
"/urp-application"... | import pytest
from django.core.urlresolvers import reverse
@pytest.mark.django_db
def test_homepage(client):
for url in (
"/",
"/donor",
"/students",
"/courses",
"/talks",
"/programming-competition",
"/achievements",
"... | Add / to rcos tests | rcos: Add / to rcos tests
| Python | isc | rcos/Observatory,rcos/Observatory,rcos/Observatory,rcos/Observatory,rcos/Observatory,rcos/Observatory |
5e3c6d6ab892a87ca27c05c01b39646bd339b3f2 | tests/test_event.py | tests/test_event.py | import unittest
from event import Event
class EventTest(unittest.TestCase):
def test_a_listener_is_notified_when_event_is_raised(self):
called = False
def listener():
nonlocal called
called = True
event = Event()
event.connect(listener)
event.fire(... | import unittest
from event import Event
class Mock:
def __init__(self):
self.called = False
self.params = ()
def __call__(self, *args, **kwargs):
self.called = True
self.params = (args, kwargs)
class EventTest(unittest.TestCase):
def test_a_listener_is_notified_when_even... | Refactor a lightweight Mock class. | Refactor a lightweight Mock class.
| Python | mit | bsmukasa/stock_alerter |
291923f4ad1fc0041284a73d6edad43e6047fafc | workspace/commands/status.py | workspace/commands/status.py | from __future__ import absolute_import
import os
import logging
from workspace.commands import AbstractCommand
from workspace.commands.helpers import ProductPager
from workspace.scm import stat_repo, repos, product_name, all_branches, is_repo
log = logging.getLogger(__name__)
class Status(AbstractCommand):
""" ... | from __future__ import absolute_import
import os
import logging
from workspace.commands import AbstractCommand
from workspace.commands.helpers import ProductPager
from workspace.scm import stat_repo, repos, product_name, all_branches, is_repo
log = logging.getLogger(__name__)
class Status(AbstractCommand):
""" ... | Fix bug to display all branches when there is only 1 repo | Fix bug to display all branches when there is only 1 repo
| Python | mit | maxzheng/workspace-tools |
b18bdf11141cf47319eed9ba2b861ebc287cf5ff | pyqs/utils.py | pyqs/utils.py | import base64
import json
import pickle
def decode_message(message):
message_body = message.get_body()
json_body = json.loads(message_body)
if 'task' in message_body:
return json_body
else:
# Fallback to processing celery messages
return decode_celery_message(json_body)
def d... | import base64
import json
import pickle
def decode_message(message):
message_body = message.get_body()
json_body = json.loads(message_body)
if 'task' in message_body:
return json_body
else:
# Fallback to processing celery messages
return decode_celery_message(json_body)
def d... | Add fallback for loading json encoded celery messages | Add fallback for loading json encoded celery messages
| Python | mit | spulec/PyQS |
77b87f5657583a5418d57f712b52bbcd6e9421aa | puzzle.py | puzzle.py | #!/usr/bin/python3
class Puzzle:
def get_all_exits(self, graph):
exits = []
for key, value in graph.items():
for item in value:
if 'Exit' in item:
exits += item
return exits
def find_all_paths(self, graph, start, end, path=None):
... | #!/usr/bin/python3
class Puzzle:
def get_all_exits(self, graph):
exits = []
for root_node, connected_nodes in graph.items():
for node in connected_nodes:
if 'Exit' in node:
exits += node
return exits
def find_all_paths(self, graph, start... | Rename vars in get_all_exits to make it more clear | Rename vars in get_all_exits to make it more clear
| Python | mit | aaronshaver/graph-unique-paths |
f7e2bcf941e2a15a3bc28ebf3f15244df6f0d758 | posts/versatileimagefield.py | posts/versatileimagefield.py | from django.conf import settings
from versatileimagefield.datastructures.filteredimage import FilteredImage
from versatileimagefield.registry import versatileimagefield_registry
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
class Watermark(FilteredImage):
def process_image(self, image, image_... | import os.path
from django.conf import settings
from versatileimagefield.datastructures.filteredimage import FilteredImage
from versatileimagefield.registry import versatileimagefield_registry
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
class Watermark(FilteredImage):
def process_image(self... | Use custom font for watermark | Use custom font for watermark
Signed-off-by: Michal Čihař <a2df1e659c9fd2578de0a26565357cb273292eeb@cihar.com>
| Python | agpl-3.0 | nijel/photoblog,nijel/photoblog |
01e62119750d0737e396358dbf45727dcbb5732f | tests/__init__.py | tests/__init__.py | import sys
import unittest
def main():
if sys.version_info[0] >= 3:
from unittest.main import main
main(module=None)
else:
unittest.main()
if __name__ == '__main__':
main()
| from unittest.main import main
if __name__ == '__main__':
main(module=None, verbosity=2)
| Drop Python 2 support in tests | Drop Python 2 support in tests
| Python | bsd-3-clause | retext-project/pymarkups,mitya57/pymarkups |
2b74c8714b659ccf5faa615e9b5c4c4559f8d9c8 | artbot_website/views.py | artbot_website/views.py | from django.shortcuts import render
from datetime import date, datetime, timedelta
from .models import Event
def index(request):
if date.today().isoweekday() in [5,6,7]:
weekend_start = date.today()
else:
weekend_start = date.today() + timedelta((5 - date.today().isoweekday()) ... | from django.shortcuts import render
from datetime import date, datetime, timedelta
from .models import Event
def index(request):
if date.today().isoweekday() in [5,6,7]:
weekend_start = date.today()
else:
weekend_start = date.today() + timedelta((5 - date.today().isoweekday()) ... | Index now only displays published articles. | Index now only displays published articles.
| Python | mit | coreymcdermott/artbot,coreymcdermott/artbot |
285eeb1c7565f8fa9fb6ba38ed843601f81cdf4e | tmc/models/document_topic.py | tmc/models/document_topic.py | # -*- coding: utf-8 -*-
from odoo import api, fields, models
class DocumentTopic(models.Model):
_name = 'tmc.document_topic'
_description = 'document_topic'
_inherit = 'tmc.category'
first_parent_id = fields.Many2one(
comodel_name='tmc.document_topic',
compute='_compute_first_parent... | # -*- coding: utf-8 -*-
from odoo import api, fields, models
class DocumentTopic(models.Model):
_name = 'tmc.document_topic'
_description = 'document_topic'
_inherit = 'tmc.category'
_order = 'name'
first_parent_id = fields.Many2one(
comodel_name='tmc.document_topic',
compute='_... | Order document topics by name | [IMP] Order document topics by name
| Python | agpl-3.0 | tmcrosario/odoo-tmc |
ee9f1058107f675f7f12f822ead3feb78ec10d9b | wagtail/utils/urlpatterns.py | wagtail/utils/urlpatterns.py | from __future__ import absolute_import, unicode_literals
from functools import update_wrapper
def decorate_urlpatterns(urlpatterns, decorator):
for pattern in urlpatterns:
if hasattr(pattern, 'url_patterns'):
decorate_urlpatterns(pattern.url_patterns, decorator)
if hasattr(pattern, '... | from __future__ import absolute_import, unicode_literals
from functools import update_wrapper
from django import VERSION as DJANGO_VERSION
def decorate_urlpatterns(urlpatterns, decorator):
"""Decorate all the views in the passed urlpatterns list with the given decorator"""
for pattern in urlpatterns:
... | Test for RegexURLPattern.callback on Django 1.10 | Test for RegexURLPattern.callback on Django 1.10
Thanks Paul J Stevens for the initial patch, Tim Graham for review
and Matt Westcott for tweak of initial patch
| Python | bsd-3-clause | nealtodd/wagtail,torchbox/wagtail,nutztherookie/wagtail,nealtodd/wagtail,kurtw/wagtail,mixxorz/wagtail,rsalmaso/wagtail,kurtw/wagtail,jnns/wagtail,kurtw/wagtail,nutztherookie/wagtail,wagtail/wagtail,Toshakins/wagtail,mixxorz/wagtail,gasman/wagtail,iansprice/wagtail,rsalmaso/wagtail,thenewguy/wagtail,kaedroho/wagtail,th... |
558a25b6f3b77d6a1b087819dc40f1aa7584e7fb | sky/tools/release_packages.py | sky/tools/release_packages.py | #!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# See https://github.com/domokit/sky_engine/wiki/Release-process
import os
import subprocess
import sys
def main():
engine_root ... | #!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# See https://github.com/domokit/sky_engine/wiki/Release-process
import os
import subprocess
import sys
def main():
engine_root ... | Add FLX to the release train | Add FLX to the release train
| Python | bsd-3-clause | krisgiesing/sky_engine,devoncarew/engine,abarth/sky_engine,tvolkert/engine,Hixie/sky_engine,devoncarew/engine,mpcomplete/flutter_engine,mpcomplete/engine,devoncarew/sky_engine,chinmaygarde/sky_engine,jamesr/sky_engine,flutter/engine,chinmaygarde/sky_engine,mpcomplete/engine,lyceel/engine,devoncarew/engine,Hixie/sky_eng... |
d2c2208b39c5715deebf8d24d5fa9096a945bdcd | script.py | script.py | import ast
import click
from parsing.parser import FileVisitor
@click.command()
@click.argument('code', type=click.File('rb'))
@click.option('--printed', default=False, is_flag=True, help='Pretty prints the call tree for each class in the file')
def cli(code, printed):
"""
Parses a file.
codegrapher [fi... | import ast
import click
from parsing.parser import FileVisitor
@click.command()
@click.argument('code', type=click.File('rb'))
@click.option('--printed', default=False, is_flag=True, help='Pretty prints the call tree for each class in the file')
@click.option('--remove-builtins', default=False, is_flag=True, help='... | Add builtin removal as an option to cli | Add builtin removal as an option to cli
| Python | mit | LaurEars/codegrapher |
1e8ecd09ce6dc44c4955f8bb2f81aa65232ad9a0 | multi_schema/management/commands/loaddata.py | multi_schema/management/commands/loaddata.py | from django.core.management.commands import loaddata
from django.core.management.base import CommandError
from django.db import DatabaseError
from optparse import make_option
from ...models import Schema, template_schema
class Command(loaddata.Command):
option_list = loaddata.Command.option_list + (
make... | from django.core.management.commands import loaddata
from django.core.management.base import CommandError
from django.db import DatabaseError
from optparse import make_option
from ...models import Schema, template_schema
class Command(loaddata.Command):
option_list = loaddata.Command.option_list + (
make... | Fix indenting. Create any schemas that were just loaded. | Fix indenting.
Create any schemas that were just loaded.
| Python | bsd-3-clause | luzfcb/django-boardinghouse,luzfcb/django-boardinghouse,luzfcb/django-boardinghouse |
c5d22fd143f952ce5e0c86b9e8bce4a06fe47063 | bigsi/storage/__init__.py | bigsi/storage/__init__.py | from bigsi.storage.berkeleydb import BerkeleyDBStorage
from bigsi.storage.redis import RedisStorage
from bigsi.storage.rocksdb import RocksDBStorage
def get_storage(config):
return {
"rocksdb": RocksDBStorage,
"berkeleydb": BerkeleyDBStorage,
"redis": RedisStorage,
}[config["storage-en... | from bigsi.storage.redis import RedisStorage
try:
from bigsi.storage.berkeleydb import BerkeleyDBStorage
except ModuleNotFoundError:
pass
try:
from bigsi.storage.rocksdb import RocksDBStorage
except ModuleNotFoundError:
pass
def get_storage(config):
return {
"rocksdb": RocksDBStorage,
... | Allow import without optional requirements | Allow import without optional requirements
| Python | mit | Phelimb/cbg,Phelimb/cbg,Phelimb/cbg,Phelimb/cbg |
33505f9b4dfeead0b01ee1b8cf3f8f228476e866 | openpassword/crypt_utils.py | openpassword/crypt_utils.py | from Crypto.Cipher import AES
def decrypt(data, key_iv):
key = key_iv[0:16]
iv = key_iv[16:]
print(data)
cipher = AES.new(key, AES.MODE_CBC, iv)
return cipher.decrypt(data)
def encrypt(data, key_iv):
key = key_iv[0:16]
iv = key_iv[16:]
cipher = AES.new(key, AES.MODE_CBC, iv)
retu... | from Crypto.Cipher import AES
def decrypt(data, key_iv):
key = key_iv[0:16]
iv = key_iv[16:]
cipher = AES.new(key, AES.MODE_CBC, iv)
return cipher.decrypt(data)
def encrypt(data, key_iv):
key = key_iv[0:16]
iv = key_iv[16:]
cipher = AES.new(key, AES.MODE_CBC, iv)
return cipher.encryp... | Remove print statement from crypto utils... | Remove print statement from crypto utils...
| Python | mit | openpassword/blimey,openpassword/blimey |
f2fc7f1015fc24fdbb69069ac74a21437e94657b | xmantissa/plugins/sineoff.py | xmantissa/plugins/sineoff.py | from axiom import iaxiom, userbase
from xmantissa import website, offering, provisioning
from sine import sipserver, sinetheme
sineproxy = provisioning.BenefactorFactory(
name = u'sineproxy',
description = u'Sine SIP Proxy',
benefactorClass = sipserver.SineBenefactor)
plugin = offering.Offering(
nam... | from axiom import iaxiom, userbase
from xmantissa import website, offering, provisioning
from sine import sipserver, sinetheme
sineproxy = provisioning.BenefactorFactory(
name = u'sineproxy',
description = u'Sine SIP Proxy',
benefactorClass = sipserver.SineBenefactor)
plugin = offering.Offering(
nam... | Revert 5505 - introduced numerous regressions into the test suite | Revert 5505 - introduced numerous regressions into the test suite | Python | mit | habnabit/divmod-sine,twisted/sine |
8bfd49c7aef03f6d2ad541f466e9661b6acc5262 | staticassets/compilers/sass.py | staticassets/compilers/sass.py | from .base import CommandCompiler
class SassCompiler(CommandCompiler):
content_type = 'text/css'
options = {'compass': True}
command = 'sass'
params = ['--trace']
def compile(self, asset):
if self.compass:
self.params.append('--compass')
if '.scss' in asset.attributes.... | from .base import CommandCompiler
class SassCompiler(CommandCompiler):
content_type = 'text/css'
options = {'compass': True, 'scss': False}
command = 'sass'
params = ['--trace']
def get_args(self):
args = super(SassCompiler, self).get_args()
if self.compass:
args.appen... | Fix args being appended continuously to SassCompiler | Fix args being appended continuously to SassCompiler
| Python | mit | davidelias/django-staticassets,davidelias/django-staticassets,davidelias/django-staticassets |
f522a464e3f58a9f2ed235b48382c9db15f66029 | eva/layers/residual_block.py | eva/layers/residual_block.py | from keras.layers import Convolution2D, Merge
from keras.layers.advanced_activations import PReLU
from keras.engine.topology import merge
from eva.layers.masked_convolution2d import MaskedConvolution2D
def ResidualBlock(model, filters):
# 2h -> h
block = Convolution2D(filters//2, 1, 1)(model)
block = PReL... | from keras.layers import Convolution2D, Merge
from keras.layers.advanced_activations import PReLU
from keras.engine.topology import merge
from eva.layers.masked_convolution2d import MaskedConvolution2D
def ResidualBlock(model, filters):
# 2h -> h
block = Convolution2D(filters//2, 1, 1)(model)
block = PReL... | Use the functional merge; just for formatting | Use the functional merge; just for formatting
| Python | apache-2.0 | israelg99/eva |
8a7a8c3589b1e3bd3a4d8b0dc832178be26117d3 | mozaik_membership/wizards/base_partner_merge_automatic_wizard.py | mozaik_membership/wizards/base_partner_merge_automatic_wizard.py | # Copyright 2022 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard"
def _merge(self, partner_ids, dst_partner=None, extra_checks=True):
... | # Copyright 2022 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard"
def _merge(self, partner_ids, dst_partner=None, extra_checks=True):
... | Fix the security for the merge after closing memberships | Fix the security for the merge after closing memberships
| Python | agpl-3.0 | mozaik-association/mozaik,mozaik-association/mozaik |
16fe23b18f69e475858a975f3a2e3f743f4b4c57 | zipline/__init__.py | zipline/__init__.py | """
Zipline
"""
# This is *not* a place to dump arbitrary classes/modules for convenience,
# it is a place to expose the public interfaces.
__version__ = "0.5.11.dev"
from . import data
from . import finance
from . import gens
from . import utils
from . algorithm import TradingAlgorithm
__all__ = [
'data',
... | #
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | Add license to module init file. | REL: Add license to module init file.
| Python | apache-2.0 | iamkingmaker/zipline,ChinaQuants/zipline,chrjxj/zipline,michaeljohnbennett/zipline,ronalcc/zipline,nborggren/zipline,sketchytechky/zipline,joequant/zipline,grundgruen/zipline,zhoulingjun/zipline,alphaBenj/zipline,CDSFinance/zipline,alphaBenj/zipline,umuzungu/zipline,dhruvparamhans/zipline,cmorgan/zipline,otmaneJai/Zipl... |
0e36a49d6a53f87cbe71fd5ec9dce524dd638122 | fireplace/deck.py | fireplace/deck.py | import logging
import random
from .card import Card
from .enums import GameTag, Zone
from .utils import CardList
class Deck(CardList):
MAX_CARDS = 30
MAX_UNIQUE_CARDS = 2
MAX_UNIQUE_LEGENDARIES = 1
@classmethod
def fromList(cls, cards, hero):
return cls([Card(card) for card in cards], Card(hero))
def __init... | import logging
import random
from .card import Card
from .enums import GameTag, Zone
from .utils import CardList
class Deck(CardList):
MAX_CARDS = 30
MAX_UNIQUE_CARDS = 2
MAX_UNIQUE_LEGENDARIES = 1
@classmethod
def fromList(cls, cards, hero):
return cls([Card(card) for card in cards], Card(hero))
def __init... | Drop support for naming Deck objects | Drop support for naming Deck objects
| Python | agpl-3.0 | smallnamespace/fireplace,Meerkov/fireplace,amw2104/fireplace,Ragowit/fireplace,beheh/fireplace,butozerca/fireplace,Ragowit/fireplace,amw2104/fireplace,liujimj/fireplace,smallnamespace/fireplace,jleclanche/fireplace,oftc-ftw/fireplace,oftc-ftw/fireplace,butozerca/fireplace,NightKev/fireplace,Meerkov/fireplace,liujimj/fi... |
d6a6fc478d9aaea69ff6c1f5be3ebe0c1b34f180 | fixlib/channel.py | fixlib/channel.py | import asyncore
import util
try:
import simplejson as json
except ImportError:
import json
class ChannelServer(asyncore.dispatcher):
def __init__(self, sock, dest):
asyncore.dispatcher.__init__(self, sock)
self.dest = dest
dest.register('close', self.closehook)
def handle_accept(self):
client = self.... | import asyncore
import util
try:
import simplejson as json
except ImportError:
import json
class ChannelServer(asyncore.dispatcher):
def __init__(self, sock, dest):
asyncore.dispatcher.__init__(self, sock)
self.dest = dest
dest.register('close', lambda x, y: self.close())
def handle_accept(self):
clie... | Use a lambda as a proxy. | Use a lambda as a proxy.
| Python | bsd-3-clause | jvirtanen/fixlib |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.