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 |
|---|---|---|---|---|---|---|---|---|---|
90d3f00cd8fea8fab9274069ac06ea461f8e4dfd | channels/ooo_b_r/app.py | channels/ooo_b_r/app.py | #encoding:utf-8
from utils import get_url, weighted_random_subreddit
# Group chat https://yal.sh/dvdahoy
t_channel = '-1001065558871'
subreddit = weighted_random_subreddit({
'ANormalDayInRussia': 1.0,
'ANormalDayInAmerica': 0.1,
'ANormalDayInJapan': 0.01
})
def send_post(submission, r2t):
what, url... | #encoding:utf-8
from utils import get_url, weighted_random_subreddit
# Group chat https://yal.sh/dvdahoy
t_channel = '-1001065558871'
subreddit = weighted_random_subreddit({
'ANormalDayInRussia': 1.0,
'ANormalDayInAmerica': 0.1,
'ANormalDayInJapan': 0.01
})
def send_post(submission, r2t):
what, url... | Send only pics and gifs to OOO_B_R. | Send only pics and gifs to OOO_B_R. | Python | mit | nsiregar/reddit2telegram,Fillll/reddit2telegram,nsiregar/reddit2telegram,Fillll/reddit2telegram |
d966b0973da71f5c883697ddd12c2728b2a04cce | ci/cleanup-binary-tags.py | ci/cleanup-binary-tags.py | #!/usr/bin/env python3
import os
import subprocess
import re
import semver
def tag_to_version(tag):
version = re.sub(r'binary-', '', tag)
version = re.sub(r'-[x86|i686].*', '', version)
return version
subprocess.check_call('git pull --tags', shell=True)
tags = subprocess.check_output(
'git tag --li... | #!/usr/bin/env python3
import os
import subprocess
import re
import semver
def tag_to_version(tag):
return tag.split('-')[1].lstrip('v')
subprocess.check_call('git pull --tags', shell=True)
tags = subprocess.check_output(
'git tag --list | grep binary', shell=True).decode('UTF-8').splitlines()
versions = s... | Improve git tag to version conversion | Improve git tag to version conversion
There is also aarch64 arch.
| Python | mit | autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/L... |
e660953c1df2dc9de6b3038e4ddb1d77768b2b51 | tools/pyhande/setup.py | tools/pyhande/setup.py | from distutils.core import setup
setup(
name='pyhande',
version='0.1',
author='HANDE developers',
packages=('pyhande',),
license='Modified BSD license',
description='Analysis framework for HANDE calculations',
long_description=open('README.rst').read(),
requires=['numpy', 'pandas (>= 0.... | from distutils.core import setup
setup(
name='pyhande',
version='0.1',
author='HANDE developers',
packages=('pyhande',),
license='Modified BSD license',
description='Analysis framework for HANDE calculations',
long_description=open('README.rst').read(),
install_requires=['numpy', 'scipy... | Correct pyhande dependencies (broken for some time) | Correct pyhande dependencies (broken for some time)
This allows pyhande to be installed in a virtualenv again...
| Python | lgpl-2.1 | hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,hande-qmc/hande |
72941398fd2e78cbf5d994b4bf8683c4bdefaab9 | utils/travis_runner.py | utils/travis_runner.py | #!/usr/bin/env python
"""This script manages all tasks for the TRAVIS build server."""
import os
import subprocess
if __name__ == "__main__":
os.chdir("promotion/grmpy_tutorial_notebook")
cmd = [
"jupyter",
"nbconvert",
"--execute",
"grmpy_tutorial_notebook.ipynb",
"--Ex... | #!/usr/bin/env python
"""This script manages all tasks for the TRAVIS build server."""
import os
import subprocess
if __name__ == "__main__":
os.chdir("promotion/grmpy_tutorial_notebook")
cmd = [
"jupyter",
"nbconvert",
"--execute",
"grmpy_tutorial_notebook.ipynb",
"--Ex... | Comment out semipar notebook in travis runner until pip build us updated. | Comment out semipar notebook in travis runner until pip build us updated.
| Python | mit | grmToolbox/grmpy |
be929d518ff320ed8e16f57da55f0855800f7408 | src/engine/file_loader.py | src/engine/file_loader.py | import os
import json
from lib import contract
data_dir = os.path.join(os.environ['PORTER'], 'data')
@contract.accepts(str)
@contract.returns(list)
def read_and_parse_json(data_type):
sub_dir = os.path.join(data_dir, data_type)
def full_path(file_name):
return os.path.join(sub_dir, file_name)
... | import os
import json
from lib import contract, functional
data_dir = os.path.join(os.environ['PORTER'], 'data')
@contract.accepts(str)
@contract.returns(list)
def read_and_parse_json(data_type):
sub_dir = os.path.join(data_dir, data_type)
def full_path(file_name):
return os.path.join(sub_dir, file... | Use mutli_reduce instead of reduce in enum file loading | Use mutli_reduce instead of reduce in enum file loading
| Python | mit | Tactique/game_engine,Tactique/game_engine |
1b726978e1604269c8c4d2728a6f7ce774e5d16d | src/ggrc/models/control_assessment.py | src/ggrc/models/control_assessment.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
from ggrc import db
from .mixins import (
deferred, BusinessObject, Timeboxe... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
from ggrc import db
from .mixins import (
deferred, BusinessObject, Timeboxe... | Fix edit control assessment modal | Fix edit control assessment modal
This works, because our client side verification checks only if the
audit attr exists.
ref: core-1643
| Python | apache-2.0 | kr41/ggrc-core,kr41/ggrc-core,vladan-m/ggrc-core,vladan-m/ggrc-core,vladan-m/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,prasannav7/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,jmakov/ggrc-core,AleksNeStu/ggrc-core,uskudnik/ggrc-core,uskudnik/ggrc-core,selahssea/ggrc-cor... |
52239a9b6cd017127d52c29ac0e2a0d3818e7d9e | cms_lab_members/admin.py | cms_lab_members/admin.py | from django.contrib import admin
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from lab_members.models import Scientist
from lab_members.admin import ScientistAdmin
class CMSScientistAdmin(PlaceholderAdminMixin, ScientistAdmin):
fieldsets = [
ScientistAdmin.fieldset_basic,
Scientist... | from django.contrib import admin
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from lab_members.models import Scientist
from lab_members.admin import ScientistAdmin
class CMSScientistAdmin(PlaceholderAdminMixin, ScientistAdmin):
fieldsets = [
ScientistAdmin.fieldset_basic,
Scientist... | Add new lab_members fieldset_website to fieldsets for cms_lab_members | Add new lab_members fieldset_website to fieldsets for cms_lab_members
| Python | bsd-3-clause | mfcovington/djangocms-lab-members,mfcovington/djangocms-lab-members |
3026d78dc6e2a0f6f391819370f2369df94e77eb | ckanext/nhm/settings.py | ckanext/nhm/settings.py | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
from collections import OrderedDict
# the order here matters as the default option should always be first in the dict so that it is
# automatically selected in combo boxes that use this li... | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
from collections import OrderedDict
# the order here matters as the default option should always be first in the dict so that it is
# automatically selected in combo boxes that use this li... | Move Data Portal / Other to bottom of contact select | Move Data Portal / Other to bottom of contact select
| Python | mit | NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm |
34fa7433ea6f04089a420e0392605147669801d1 | dummy.py | dummy.py | import os
def foo():
"""
This is crappy function. should be removed using git checkout
"""
if True == True:
return True
else:
return False
def main():
pass
if __name__ == '__main__':
main()
| import os
def foo():
"""
This is crappy function. should be removed using git checkout
"""
return None
def main():
pass
if __name__ == '__main__':
main()
| Revert "added more crappy codes" | Revert "added more crappy codes"
This reverts commit 6f10d506bf36572b53f0325fef6dc8a1bac5f4fd.
| Python | apache-2.0 | kp89/do-git |
178bde1703bbb044f8af8c70a57517af4490a3c0 | databot/handlers/download.py | databot/handlers/download.py | import time
import requests
import bs4
from databot.recursive import call
class DownloadErrror(Exception):
pass
def dump_response(response):
return {
'headers': dict(response.headers),
'cookies': dict(response.cookies),
'status_code': response.status_code,
'encoding': respon... | import time
import requests
import bs4
import cgi
from databot.recursive import call
class DownloadErrror(Exception):
pass
def dump_response(response):
return {
'headers': dict(response.headers),
'cookies': response.cookies.get_dict(),
'status_code': response.status_code,
'e... | Fix duplicate cookie issue and header parsing | Fix duplicate cookie issue and header parsing
| Python | agpl-3.0 | sirex/databot,sirex/databot |
cbae828ee9eb91a2373a415f1a1521fb5dee3100 | datac/main.py | datac/main.py | # -*- coding: utf-8 -*-
import copy
| # -*- coding: utf-8 -*-
import copy
def init_abscissa(params, abscissae, abscissa_name):
"""
List of dicts to initialize object w/ calc method
This method generates a list of dicts; each dict is sufficient to initialize an object featuring a calculator method of interest. This list can be thought of as th... | Add method to generate list of abscissa dicts | Add method to generate list of abscissa dicts
This method will generate a list of dicts which can initialize an
object which features a method to calculate the ordinates the user
wants.
| Python | mit | jrsmith3/datac,jrsmith3/datac |
cd5053ac36e13b57e95eeb1241032c97b48a4a85 | planetstack/openstack_observer/backend.py | planetstack/openstack_observer/backend.py | import threading
import time
from observer.event_loop import PlanetStackObserver
from observer.event_manager import EventListener
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
class Backend:
def run(self):
try:
# start the openstack observer
obser... | import threading
import time
from observer.event_loop import PlanetStackObserver
from observer.event_manager import EventListener
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
class Backend:
def run(self):
# start the openstack observer
observer = PlanetS... | Drop try/catch that causes uncaught errors in the Observer to be silently ignored | Drop try/catch that causes uncaught errors in the Observer to be silently ignored
| Python | apache-2.0 | wathsalav/xos,wathsalav/xos,wathsalav/xos,wathsalav/xos |
37fa40a9b5260f8090adaa8c15d3767c0867574f | python/fusion_engine_client/messages/__init__.py | python/fusion_engine_client/messages/__init__.py | from .core import *
from . import ros
message_type_to_class = {
# Navigation solution messages.
PoseMessage.MESSAGE_TYPE: PoseMessage,
PoseAuxMessage.MESSAGE_TYPE: PoseAuxMessage,
GNSSInfoMessage.MESSAGE_TYPE: GNSSInfoMessage,
GNSSSatelliteMessage.MESSAGE_TYPE: GNSSSatelliteMessage,
# Sensor m... | from .core import *
from . import ros
message_type_to_class = {
# Navigation solution messages.
PoseMessage.MESSAGE_TYPE: PoseMessage,
PoseAuxMessage.MESSAGE_TYPE: PoseAuxMessage,
GNSSInfoMessage.MESSAGE_TYPE: GNSSInfoMessage,
GNSSSatelliteMessage.MESSAGE_TYPE: GNSSSatelliteMessage,
# Sensor m... | Create a list of messages that contain system time. | Create a list of messages that contain system time.
| Python | mit | PointOneNav/fusion-engine-client,PointOneNav/fusion-engine-client,PointOneNav/fusion-engine-client |
05939b0b797780ac1d265c8415f72f1ca44be53d | coco/dashboard/views.py | coco/dashboard/views.py | # -*- coding: utf-8 -*-
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from posts.models import Post, Tag
@login_required
def index(request):
context = {'posts': Post.objects.all()}
return render(request, 'dashboard/index.html', context)
@login_required
def tagg... | # -*- coding: utf-8 -*-
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from posts.models import Post, Tag
@login_required
def index(request):
context = {'posts': Post.objects.all()}
return render(request, 'dashboard/index.html', context)
@login_required
def tagg... | Modify return tag search data with tag_name | Modify return tag search data with tag_name
| Python | mit | NA5G/coco-server-was,NA5G/coco-server-was,NA5G/coco-server-was |
c81393a8de27595f61cffc09fa6fa8352bb54b9c | palindrome-products/palindrome_products.py | palindrome-products/palindrome_products.py | from collections import defaultdict
def largest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, max)
def smallest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, min)
def _palindromes(max_factor, min_factor, minmax):
pals = defaultdic... | import random
from collections import defaultdict
def largest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, max)
def smallest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, min)
def _palindromes(max_factor, min_factor, minmax):
pal... | Return a random set of factors | Return a random set of factors
| Python | agpl-3.0 | CubicComet/exercism-python-solutions |
9de0a05d28c83742224c0e708e80b8add198a8a8 | froide/comments/apps.py | froide/comments/apps.py | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CommentConfig(AppConfig):
name = 'froide.comments'
verbose_name = _('Comments')
def ready(self):
from froide.account import account_canceled
account_canceled.connect(cancel_user)
def cancel_... | import json
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CommentConfig(AppConfig):
name = 'froide.comments'
verbose_name = _('Comments')
def ready(self):
from froide.account import account_canceled
from froide.account.export import regis... | Add user data export for comments | Add user data export for comments | Python | mit | stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide |
7e45a26f86095ee2f6972e08697aa132e642636e | csympy/tests/test_arit.py | csympy/tests/test_arit.py | from csympy import Symbol, Integer
def test_arit1():
x = Symbol("x")
y = Symbol("y")
e = x + y
e = x * y
e = Integer(2)*x
e = 2*x
def test_arit2():
x = Symbol("x")
y = Symbol("y")
assert x+x == Integer(2) * x
assert x+x != Integer(3) * x
assert x+x == 2 * x
| from nose.tools import raises
from csympy import Symbol, Integer
def test_arit1():
x = Symbol("x")
y = Symbol("y")
e = x + y
e = x * y
e = Integer(2)*x
e = 2*x
def test_arit2():
x = Symbol("x")
y = Symbol("y")
assert x+x == Integer(2) * x
assert x+x != Integer(3) * x
asser... | Test for types in __mul__ | Test for types in __mul__
| Python | mit | bjodah/symengine.py,bjodah/symengine.py,symengine/symengine.py,bjodah/symengine.py,symengine/symengine.py,symengine/symengine.py |
34db4460aa67fc9abfaaaf2c48a6ea7c5b801ff0 | examples/libtest/imports/__init__.py | examples/libtest/imports/__init__.py |
exec_order = []
class Imports(object):
exec_order = exec_order
def __init__(self):
self.v = 1
imports = Imports()
overrideme = "not overridden"
from . import cls as loccls
from .imports import cls as upcls
def conditional_func():
return "not overridden"
if True:
def conditional_func():
... |
exec_order = []
class Imports(object):
exec_order = exec_order
def __init__(self):
self.v = 1
imports = Imports()
overrideme = "not overridden"
from . import cls as loccls
# This is not valid since Python 2.6!
try:
from .imports import cls as upcls
except ImportError:
upcls = loccls
def c... | Fix for libtest for cpython 2.6 / jython / pypy | Fix for libtest for cpython 2.6 / jython / pypy
| Python | apache-2.0 | spaceone/pyjs,minghuascode/pyj,pombredanne/pyjs,lancezlin/pyjs,Hasimir/pyjs,gpitel/pyjs,pyjs/pyjs,anandology/pyjamas,gpitel/pyjs,pombredanne/pyjs,minghuascode/pyj,minghuascode/pyj,lancezlin/pyjs,pyjs/pyjs,pyjs/pyjs,pyjs/pyjs,minghuascode/pyj,spaceone/pyjs,spaceone/pyjs,anandology/pyjamas,Hasimir/pyjs,pombredanne/pyjs,p... |
586418860c0441eaebadd0fe79989d6d9f90fa28 | src/bda/plone/productshop/vocabularies.py | src/bda/plone/productshop/vocabularies.py | from zope.interface import directlyProvides
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import (
SimpleVocabulary,
SimpleTerm,
)
from zope.i18nmessageid import MessageFactory
from .utils import (
dotted_name,
available_variant_aspects,
)
#added by espen
from zope.c... | from zope.interface import directlyProvides
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import (
SimpleVocabulary,
SimpleTerm,
)
from zope.i18nmessageid import MessageFactory
from .utils import (
dotted_name,
available_variant_aspects,
)
#added by espen
from zope.c... | Fix for the component lookup error in vocabulary | Fix for the component lookup error in vocabulary
| Python | bsd-3-clause | espenmn/bda.plone.productshop,espenmn/bda.plone.productshop,espenmn/bda.plone.productshop |
a364196814c3b33e7fd51a42b4c3a48a3aaeaee8 | volaparrot/constants.py | volaparrot/constants.py | ADMINFAG = ["RealDolos"]
PARROTFAG = "Parrot"
BLACKFAGS = [i.casefold() for i in (
"kalyx", "merc", "loliq", "annoying", "bot", "RootBeats", "JEW2FORU", "quag", "mire", "perici")]
OBAMAS = [i.casefold() for i in (
"counselor", "briseis", "apha", "bread", "ark3", "jizzbomb", "acid", "elkoalemos", "tarta")]
BLA... | ADMINFAG = ["RealDolos"]
PARROTFAG = "Parrot"
BLACKFAGS = [i.casefold() for i in (
"kalyx", "merc", "loliq", "annoying", "RootBeats", "JEW2FORU", "quag", "mire", "perici", "Voldemort", "briseis", "brisis", "GNUsuks", "rhooes", "n1sm4n", "honeyhole", "Printer", "yume1")]
OBAMAS = [i.casefold() for i in (
"couns... | Update list of extraordinary gentlemen | Update list of extraordinary gentlemen
| Python | mit | RealDolos/volaparrot |
72b3642953d0e14d4b4c9ec03560a96d259f7d16 | contones/srs.py | contones/srs.py | """Spatial reference systems"""
from osgeo import osr
# Monkey patch SpatialReference since inheriting from SWIG classes is a hack
def srid(self):
"""Returns the EPSG ID as int if it exists."""
epsg_id = (self.GetAuthorityCode('PROJCS') or
self.GetAuthorityCode('GEOGCS'))
try:
retu... | """Spatial reference systems"""
from osgeo import osr
class BaseSpatialReference(osr.SpatialReference):
"""Base class for extending osr.SpatialReference."""
def __repr__(self):
return self.wkt
@property
def srid(self):
"""Returns the EPSG ID as int if it exists."""
epsg_id = ... | Remove monkey patching in favor of inheritance for SpatialReference | Remove monkey patching in favor of inheritance for SpatialReference
| Python | bsd-3-clause | bkg/greenwich |
6fae23c1d442880256ed2d4298844a50d6a7968e | fabfile.py | fabfile.py | import fabric.api as fab
def generate_type_hierarchy():
"""
Generate a document containing the available variable types.
"""
fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')
@fab.task
def doc():
generate_type_hierarchy()
fab.local('sphinx-apidoc '
'-o docs/de... | import fabric.api as fab
def generate_type_hierarchy():
"""
Generate a document containing the available variable types.
"""
fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')
@fab.task
def doc():
generate_type_hierarchy()
fab.local('sphinx-apidoc '
'-o docs/de... | Make sure "fab publish" cleans the dist folder | Make sure "fab publish" cleans the dist folder
This avoids accidentally uploading a package twice
| Python | mit | exhuma/puresnmp,exhuma/puresnmp |
825eb37e15e2fb08ac205b7495e93a91acb79c26 | app/utils.py | app/utils.py | import re
from flask import url_for
def register_template_utils(app):
"""Register Jinja 2 helpers (called from __init__.py)."""
@app.template_test()
def equalto(value, other):
return value == other
@app.template_global()
def is_hidden_field(field):
from wtforms.fields import Hidd... | import re
from flask import url_for, flash
def register_template_utils(app):
"""Register Jinja 2 helpers (called from __init__.py)."""
@app.template_test()
def equalto(value, other):
return value == other
@app.template_global()
def is_hidden_field(field):
from wtforms.fields impo... | Add function for flashing all form errors | Add function for flashing all form errors
| Python | mit | hack4impact/clean-air-council,hack4impact/clean-air-council,hack4impact/clean-air-council |
c8fa72a130d84d921b23f5973dafb8fa91367381 | cyder/cydns/ptr/forms.py | cyder/cydns/ptr/forms.py | from django import forms
from cyder.cydns.forms import DNSForm
from cyder.cydns.ptr.models import PTR
class PTRForm(DNSForm):
def delete_instance(self, instance):
instance.delete()
class Meta:
model = PTR
exclude = ('ip', 'reverse_domain', 'ip_upper',
'ip_lower')
... | from django import forms
from cyder.cydns.forms import DNSForm
from cyder.cydns.ptr.models import PTR
class PTRForm(DNSForm):
def delete_instance(self, instance):
instance.delete()
class Meta:
model = PTR
exclude = ('ip', 'reverse_domain', 'ip_upper',
'ip_lower')
... | Make ip_type a RadioSelect in the PTR form | Make ip_type a RadioSelect in the PTR form
| Python | bsd-3-clause | drkitty/cyder,murrown/cyder,zeeman/cyder,murrown/cyder,OSU-Net/cyder,murrown/cyder,OSU-Net/cyder,akeym/cyder,akeym/cyder,zeeman/cyder,akeym/cyder,murrown/cyder,akeym/cyder,drkitty/cyder,zeeman/cyder,OSU-Net/cyder,zeeman/cyder,drkitty/cyder,OSU-Net/cyder,drkitty/cyder |
5cda63163acec59a43c3975f1320b7268dcf337b | devito/parameters.py | devito/parameters.py | """The parameters dictionary contains global parameter settings."""
__all__ = ['Parameters', 'parameters']
# Be EXTREMELY careful when writing to a Parameters dictionary
# Read here for reference: http://wiki.c2.com/?GlobalVariablesAreBad
# If any issues related to global state arise, the following class should
# be ... | """The parameters dictionary contains global parameter settings."""
__all__ = ['Parameters', 'parameters']
# Be EXTREMELY careful when writing to a Parameters dictionary
# Read here for reference: http://wiki.c2.com/?GlobalVariablesAreBad
# https://softwareengineering.stackexchange.com/questions/148108/why-is-global-... | Add parameter for log level | Add parameter for log level
| Python | mit | opesci/devito,opesci/devito |
f96989d067f6fd073d04f96bdf2ae314c9b02d49 | uoftscrapers/scrapers/utils/layers.py | uoftscrapers/scrapers/utils/layers.py | import requests
import json
from . import Scraper
class LayersScraper:
"""A superclass for scraping Layers of the UofT Map.
Map is located at http://map.utoronto.ca
"""
host = 'http://map.utoronto.ca/'
s = requests.Session()
@staticmethod
def get_layers_json(campus):
"""Retrieve... | import requests
import json
from . import Scraper
class LayersScraper:
"""A superclass for scraping Layers of the UofT Map.
Map is located at http://map.utoronto.ca
"""
host = 'http://map.utoronto.ca/'
@staticmethod
def get_layers_json(campus):
"""Retrieve the JSON structure from ho... | Use request helper function in LayersScraper | Use request helper function in LayersScraper
| Python | mit | kshvmdn/uoft-scrapers,cobalt-uoft/uoft-scrapers,arkon/uoft-scrapers,g3wanghc/uoft-scrapers |
377aef17394b2dabd6db7439d3cfcd4e0d54a3c2 | scipy/constants/tests/test_codata.py | scipy/constants/tests/test_codata.py |
import warnings
from scipy.constants import find
from numpy.testing import assert_equal
def test_find():
warnings.simplefilter('ignore', DeprecationWarning)
keys = find('weak mixing', disp=False)
assert_equal(keys, ['weak mixing angle'])
keys = find('qwertyuiop', disp=False)
assert_equal(keys,... |
import warnings
from scipy.constants import find
from numpy.testing import assert_equal, run_module_suite
def test_find():
warnings.simplefilter('ignore', DeprecationWarning)
keys = find('weak mixing', disp=False)
assert_equal(keys, ['weak mixing angle'])
keys = find('qwertyuiop', disp=False)
... | Allow codata tests to be run as script. | ENH: Allow codata tests to be run as script.
git-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@6562 d6536bca-fef9-0310-8506-e4c0a848fbcf
| Python | bsd-3-clause | jasonmccampbell/scipy-refactor,scipy/scipy-svn,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,scipy/scipy-svn,scipy/scipy-svn,scipy/scipy-svn |
c8fdcf888f6c34e8396f11b3e7ab3088af59abb6 | distarray/tests/test_utils.py | distarray/tests/test_utils.py | import unittest
from distarray import utils
class TestMultPartitions(unittest.TestCase):
"""
Test the multiplicative parition code.
"""
def test_both_methods(self):
"""
Do the two methods of computing the multiplicative partitions agree?
"""
for s in [2, 3]:
... | import unittest
from distarray import utils
from numpy import arange
from numpy.testing import assert_array_equal
class TestMultPartitions(unittest.TestCase):
"""
Test the multiplicative parition code.
"""
def test_both_methods(self):
"""
Do the two methods of computing the multiplic... | Add tests for slice intersection and sanitization. | Add tests for slice intersection and sanitization. | Python | bsd-3-clause | RaoUmer/distarray,enthought/distarray,enthought/distarray,RaoUmer/distarray |
a8cb15b1983c48547edfeb53bfb63245f7e7c892 | dbaas_zabbix/__init__.py | dbaas_zabbix/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
from dbaas_zabbix.dbaas_api import DatabaseAsAServiceApi
from dbaas_zabbix.provider_factory import ProviderFactory
from pyzabbix import ZabbixAPI
stream = logging.StreamHandler(sys.stdout)
stream.setLevel(logging.DEBUG)
log = logging.getLogger('p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from dbaas_zabbix.dbaas_api import DatabaseAsAServiceApi
from dbaas_zabbix.provider_factory import ProviderFactory
from pyzabbix import ZabbixAPI
def factory_for(**kwargs):
databaseinfra = kwargs['databaseinfra']
credentials = kwargs['credentials']
del kwargs[... | Revert "log integrations with zabbix through pyzabbix" | Revert "log integrations with zabbix through pyzabbix"
This reverts commit 1506b6ad3e35e4a10ca36d42a75f3a572add06b7.
| Python | bsd-3-clause | globocom/dbaas-zabbix,globocom/dbaas-zabbix |
6c11b9cc9b213928e32d883d4f557f7421da6802 | document/api.py | document/api.py | from rest_framework import serializers, viewsets
from document.models import Document, Kamerstuk, Dossier
class DossierSerializer(serializers.HyperlinkedModelSerializer):
documents = serializers.HyperlinkedRelatedField(read_only=True,
view_name='document-detail... | from rest_framework import serializers, viewsets
from document.models import Document, Kamerstuk, Dossier
class DossierSerializer(serializers.HyperlinkedModelSerializer):
documents = serializers.HyperlinkedRelatedField(read_only=True,
view_name='document-detail... | Add kamerstukken to dossier API | Add kamerstukken to dossier API
| Python | mit | openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer |
788cc159e4d734b972e22ccf06dbcd8ed8f94885 | distutils/_collections.py | distutils/_collections.py | import collections
import itertools
# from jaraco.collections 3.5
class DictStack(list, collections.abc.Mapping):
"""
A stack of dictionaries that behaves as a view on those dictionaries,
giving preference to the last.
>>> stack = DictStack([dict(a=1, c=2), dict(b=2, a=2)])
>>> stack['a']
2
... | import collections
import itertools
# from jaraco.collections 3.5.1
class DictStack(list, collections.abc.Mapping):
"""
A stack of dictionaries that behaves as a view on those dictionaries,
giving preference to the last.
>>> stack = DictStack([dict(a=1, c=2), dict(b=2, a=2)])
>>> stack['a']
2... | Update DictStack implementation from jaraco.collections 3.5.1 | Update DictStack implementation from jaraco.collections 3.5.1
| Python | mit | pypa/setuptools,pypa/setuptools,pypa/setuptools |
3ddddbd24bb37c30df80233ec4c70c38b6c29e82 | emstrack/forms.py | emstrack/forms.py | from django.contrib.gis.forms import widgets
class LeafletPointWidget(widgets.BaseGeometryWidget):
template_name = 'leaflet/leaflet.html'
class Media:
css = {
'all': ('https://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css',
'leaflet/css/location_form.css',
... | from django.contrib.gis.forms import widgets
class LeafletPointWidget(widgets.BaseGeometryWidget):
template_name = 'leaflet/leaflet.html'
class Media:
css = {
'all': ('https://cdnjs.cloudflare.com/ajax/libs/leaflet/v0.7.7/leaflet.css',
'leaflet/css/location_form.css',
... | Update leaflet request to be over https | Update leaflet request to be over https
| Python | bsd-3-clause | EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient |
9674a0869c2a333f74178e305677259e7ac379c3 | examples/ignore_websocket.py | examples/ignore_websocket.py | # This script makes mitmproxy switch to passthrough mode for all HTTP
# responses with "Connection: Upgrade" header. This is useful to make
# WebSockets work in untrusted environments.
#
# Note: Chrome (and possibly other browsers), when explicitly configured
# to use a proxy (i.e. mitmproxy's regular mode), send a CON... | # This script makes mitmproxy switch to passthrough mode for all HTTP
# responses with "Connection: Upgrade" header. This is useful to make
# WebSockets work in untrusted environments.
#
# Note: Chrome (and possibly other browsers), when explicitly configured
# to use a proxy (i.e. mitmproxy's regular mode), send a CON... | Make the Websocket's connection header value case-insensitive | Make the Websocket's connection header value case-insensitive
| Python | mit | liorvh/mitmproxy,ccccccccccc/mitmproxy,dwfreed/mitmproxy,mhils/mitmproxy,ryoqun/mitmproxy,Kriechi/mitmproxy,azureplus/mitmproxy,dufferzafar/mitmproxy,ikoz/mitmproxy,jpic/mitmproxy,tfeagle/mitmproxy,rauburtin/mitmproxy,MatthewShao/mitmproxy,pombredanne/mitmproxy,pombredanne/mitmproxy,laurmurclar/mitmproxy,StevenVanAcker... |
6d83f2150f7c6177385b9f2d8abbe48cd2979130 | events/admin.py | events/admin.py | from django.contrib import admin
from .models import Calendar,MonthCache
# Register your models here.
@admin.register(Calendar)
class CalendarAdmin(admin.ModelAdmin):
list_display = ('name','remote_id','css_class')
@admin.register(MonthCache)
class MonthCacheAdmin(admin.ModelAdmin):
list_display = ('calend... | from django.contrib import admin
from .models import Calendar,MonthCache
# Register your models here.
@admin.register(Calendar)
class CalendarAdmin(admin.ModelAdmin):
list_display = ('name','remote_id','css_class')
@admin.register(MonthCache)
class MonthCacheAdmin(admin.ModelAdmin):
list_display = ('calend... | Add staleness to MonthCache Admin display | Add staleness to MonthCache Admin display
| Python | mit | Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters |
dbce79102efa8fee233af95939f1ff0b9d060b00 | examples/basic.py | examples/basic.py | import time
from simpleflow import (
activity,
Workflow,
futures,
)
@activity.with_attributes(task_list='quickstart', version='example')
def increment(x):
return x + 1
@activity.with_attributes(task_list='quickstart', version='example')
def double(x):
return x * 2
@activity.with_attributes(ta... | import time
from simpleflow import (
activity,
Workflow,
futures,
)
@activity.with_attributes(task_list='quickstart', version='example')
def increment(x):
return x + 1
@activity.with_attributes(task_list='quickstart', version='example')
def double(x):
return x * 2
# A simpleflow activity can b... | Update example workflow to show you can use classes | Update example workflow to show you can use classes
| Python | mit | botify-labs/simpleflow,botify-labs/simpleflow |
ba1186c47e5f3466faeea9f2d5bf96948d5f7183 | confuzzle.py | confuzzle.py | import sys
import argparse
import yaml
from jinja2 import Template
def render(template_string, context_dict):
template = Template(template_string)
return template.render(**context_dict)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('template', nargs='?', type=argparse.FileType(... | import sys
import argparse
import yaml
import jinja2
def render(template_string, context_dict, strict=False):
template = jinja2.Template(template_string)
if strict:
template.environment.undefined = jinja2.StrictUndefined
return template.render(**context_dict)
def main():
parser = argparse.A... | Add --strict flag to raise exception on undefined variables | Add --strict flag to raise exception on undefined variables
| Python | unlicense | j4mie/confuzzle |
b336e83a63722b3a3e4d3f1779686149d5cef8d1 | setuptools/tests/test_setopt.py | setuptools/tests/test_setopt.py | # coding: utf-8
from __future__ import unicode_literals
import io
import six
from setuptools.command import setopt
from setuptools.extern.six.moves import configparser
class TestEdit:
@staticmethod
def parse_config(filename):
parser = configparser.ConfigParser()
with io.open(filename, enco... | # coding: utf-8
from __future__ import unicode_literals
import io
import six
from setuptools.command import setopt
from setuptools.extern.six.moves import configparser
class TestEdit:
@staticmethod
def parse_config(filename):
parser = configparser.ConfigParser()
with io.open(filename, enco... | Add compatibility for Python 2 | Add compatibility for Python 2
| Python | mit | pypa/setuptools,pypa/setuptools,pypa/setuptools |
c2df896183f80fe3ca0eab259874bc4385d399e9 | tests/test_parallel.py | tests/test_parallel.py | from __future__ import with_statement
from datetime import datetime
import copy
import getpass
import sys
import paramiko
from nose.tools import with_setup
from fudge import (Fake, clear_calls, clear_expectations, patch_object, verify,
with_patched_object, patched_context, with_fakes)
from fabric.context_manager... | from __future__ import with_statement
from fabric.api import run, parallel, env, hide
from utils import FabricTest, eq_
from server import server, RESPONSES
class TestParallel(FabricTest):
@server()
@parallel
def test_parallel(self):
"""
Want to do a simple call and respond
"""
... | Clean up detrius in parallel test file | Clean up detrius in parallel test file
| Python | bsd-2-clause | bitprophet/fabric,MjAbuz/fabric,likesxuqiang/fabric,sdelements/fabric,opavader/fabric,TarasRudnyk/fabric,tekapo/fabric,haridsv/fabric,SamuelMarks/fabric,bspink/fabric,tolbkni/fabric,rane-hs/fabric-py3,mathiasertl/fabric,askulkarni2/fabric,fernandezcuesta/fabric,elijah513/fabric,xLegoz/fabric,raimon49/fabric,amaniak/fab... |
0138eacf0d518b86e819a70000b7b527434a6b35 | libretto/signals.py | libretto/signals.py | # coding: utf-8
from __future__ import unicode_literals
from celery_haystack.signals import CelerySignalProcessor
from django.contrib.admin.models import LogEntry
from reversion.models import Version, Revision
from .tasks import auto_invalidate
class CeleryAutoInvalidator(CelerySignalProcessor):
def enqueue(self... | # coding: utf-8
from __future__ import unicode_literals
from celery_haystack.signals import CelerySignalProcessor
from django.contrib.admin.models import LogEntry
from django.contrib.sessions.models import Session
from reversion.models import Version, Revision
from .tasks import auto_invalidate
class CeleryAutoInval... | Change les arguments passés à celery pour gérer la sérialisation JSON. | Change les arguments passés à celery pour gérer la sérialisation JSON.
| Python | bsd-3-clause | dezede/dezede,dezede/dezede,dezede/dezede,dezede/dezede |
eb102bb8550d59b34373f1806633a6079f7064a8 | devserver/utils/http.py | devserver/utils/http.py | from django.conf import settings
from django.core.servers.basehttp import WSGIRequestHandler
from django.db import connection
from devserver.utils.time import ms_from_timedelta
from datetime import datetime
class SlimWSGIRequestHandler(WSGIRequestHandler):
"""
Hides all requests that originate from ```MEDIA_... | from django.conf import settings
from django.core.servers.basehttp import WSGIRequestHandler
from django.db import connection
from devserver.utils.time import ms_from_timedelta
from datetime import datetime
class SlimWSGIRequestHandler(WSGIRequestHandler):
"""
Hides all requests that originate from either ``... | Make sure that all requests for static files are correctly hidden from output | Make sure that all requests for static files are correctly hidden from output
| Python | bsd-3-clause | caffodian/django-devserver,madgeekfiend/django-devserver,jimmyye/django-devserver,takeshineshiro/django-devserver,pjdelport/django-devserver,bastianh/django-devserver,Stackdriver/django-devserver,dcramer/django-devserver,chriscauley/django-devserver,coagulant/django-devserver,mathspace/django-devserver |
9df0c21bcefdeda4ca65ee4126ed965a6d099416 | website/website/wagtail_hooks.py | website/website/wagtail_hooks.py | from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register, \
ThumbnailMixin
from website.models import Logo
class LogoAdmin(ThumbnailMixin, ModelAdmin):
model = Logo
menu_icon = 'picture'
menu_order = 1000
list_display = ('admin_thumb', 'category', 'link')
add_to_settings... | from wagtail.contrib.modeladmin.options import ModelAdmin,\
modeladmin_register, ThumbnailMixin
from website.models import Logo
class LogoAdmin(ThumbnailMixin, ModelAdmin):
model = Logo
menu_icon = 'picture'
menu_order = 1000
list_display = ('admin_thumb', 'category', 'link')
add_to_settings_... | Fix line length on import statement | :green_heart: Fix line length on import statement
| Python | agpl-3.0 | Dekker1/moore,UTNkar/moore,UTNkar/moore,UTNkar/moore,Dekker1/moore,UTNkar/moore,Dekker1/moore,Dekker1/moore |
2a08d3154992b5f0633d7cd2ca1bbfc7ecd63f69 | email_extras/__init__.py | email_extras/__init__.py |
from django.core.exceptions import ImproperlyConfigured
from email_extras.settings import USE_GNUPG
__version__ = "0.1.0"
if USE_GNUPG:
try:
import gnupg
except ImportError:
raise ImproperlyConfigured, "Could not import gnupg"
|
from email_extras.settings import USE_GNUPG
__version__ = "0.1.0"
if USE_GNUPG:
try:
import gnupg
except ImportError:
try:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured, "Could not import gnupg"
except ImportError:
... | Fix to allow version number to be imported without dependencies being installed. | Fix to allow version number to be imported without dependencies being installed.
| Python | bsd-2-clause | dreipol/django-email-extras,blag/django-email-extras,stephenmcd/django-email-extras,blag/django-email-extras,dreipol/django-email-extras,stephenmcd/django-email-extras |
b39518482da1d3e064cdbc34490e4a9924f6d5f1 | quantecon/tests/test_ecdf.py | quantecon/tests/test_ecdf.py | """
Tests for ecdf.py
"""
import unittest
import numpy as np
from quantecon import ECDF
class TestECDF(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.obs = np.random.rand(40) # observations defining dist
cls.ecdf = ECDF(cls.obs)
def test_call_high(self):
"ecdf: x abo... | """
Tests for ecdf.py
"""
import unittest
import numpy as np
from quantecon import ECDF
class TestECDF(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.obs = np.random.rand(40) # observations defining dist
cls.ecdf = ECDF(cls.obs)
def test_call_high(self):
"ecdf: x abo... | Add a test for vectorized call | TST: Add a test for vectorized call
| Python | bsd-3-clause | oyamad/QuantEcon.py,QuantEcon/QuantEcon.py,oyamad/QuantEcon.py,QuantEcon/QuantEcon.py |
8d56c42dd3a721a477fa1333c1d979f4002e7cc1 | labonneboite/importer/conf/lbbdev.py | labonneboite/importer/conf/lbbdev.py | import os
# --- importer input directory of DPAE and ETABLISSEMENT exports
INPUT_SOURCE_FOLDER = '/srv/lbb/data'
# --- job 1/8 & 2/8 : check_etablissements & extract_etablissements
JENKINS_ETAB_PROPERTIES_FILENAME = os.path.join(os.environ["WORKSPACE"], "properties.jenkins")
MINIMUM_OFFICES_TO_BE_EXTRACTED_PER_DEPART... | import os
# --- importer input directory of DPAE and ETABLISSEMENT exports
INPUT_SOURCE_FOLDER = '/srv/lbb/data'
# --- job 1/8 & 2/8 : check_etablissements & extract_etablissements
JENKINS_ETAB_PROPERTIES_FILENAME = os.path.join(os.environ["WORKSPACE"], "properties.jenkins")
MINIMUM_OFFICES_TO_BE_EXTRACTED_PER_DEPART... | Simplify importer paths after dockerization | Simplify importer paths after dockerization
| Python | agpl-3.0 | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite |
f1c270f2145cf1f48a0207696cb4f6e9592af357 | NTHU_Course/settings/testing_sqlite.py | NTHU_Course/settings/testing_sqlite.py | '''
A configuration for testing in travis CI with sqlite3
'''
from .default import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
# https://docs.djangoproject.com/en/1.10/topics/testing/overview/#the-test-database
# django uses in memory database for testing
... | '''
A configuration for testing in travis CI with sqlite3
'''
from .default import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
# https://docs.djangoproject.com/en/1.10/topics/testing/overview/#the-test-database
# django uses in memory database for testing
... | Correct db `NAME`, use in-memory database for testing | Correct db `NAME`, use in-memory database for testing
| Python | mit | henryyang42/NTHU_Course,henryyang42/NTHU_Course,henryyang42/NTHU_Course,henryyang42/NTHU_Course |
c5b00edd9b8acbe594e43ecce093cd1c695b8b01 | getalltextfromuser.py | getalltextfromuser.py | #!/usr/bin/env python3
"""
A program to extract all text sent by a particular user from a Telegram chat log which is in json form
"""
import argparse
from json import loads
def main():
parser = argparse.ArgumentParser(
description="Extract raw text sent by a user from a json telegram chat log")
parser... | #!/usr/bin/env python3
"""
A program to extract all text sent by a particular user from a Telegram chat log which is in json form
"""
import argparse
from json import loads
def main():
parser = argparse.ArgumentParser(
description="Extract raw text sent by a user from a json telegram chat log")
parser... | Use user ID instead of username to get messages even with username changes | Use user ID instead of username to get messages even with username changes
| Python | mit | expectocode/telegram-analysis,expectocode/telegramAnalysis |
82bc502cf7bb64236feba6e140d98bb9e555f4ca | tests/backport_assert_raises.py | tests/backport_assert_raises.py | from __future__ import unicode_literals
"""
Patch courtesy of:
https://marmida.com/blog/index.php/2012/08/08/monkey-patching-assert_raises/
"""
# code for monkey-patching
import nose.tools
# let's fix nose.tools.assert_raises (which is really unittest.assertRaises)
# so that it always supports context management
# i... | from __future__ import unicode_literals
"""
Patch courtesy of:
https://marmida.com/blog/index.php/2012/08/08/monkey-patching-assert_raises/
"""
# code for monkey-patching
import nose.tools
# let's fix nose.tools.assert_raises (which is really unittest.assertRaises)
# so that it always supports context management
# i... | Fix assert_raises for catching parents of exceptions. | Fix assert_raises for catching parents of exceptions.
| Python | apache-2.0 | rocky4570/moto,ZuluPro/moto,Affirm/moto,Affirm/moto,kefo/moto,botify-labs/moto,okomestudio/moto,spulec/moto,Affirm/moto,dbfr3qs/moto,okomestudio/moto,kefo/moto,heddle317/moto,whummer/moto,2rs2ts/moto,Brett55/moto,dbfr3qs/moto,ZuluPro/moto,kefo/moto,william-richard/moto,spulec/moto,spulec/moto,ZuluPro/moto,gjtempleton/m... |
8998d0f617791f95b1ed6b4a1fffa0f71752b801 | pybo/bayesopt/inits.py | pybo/bayesopt/inits.py | """
Implementation of methods for sampling initial points.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# global imports
import numpy as np
# local imports
from ..utils import ldsample
# exported symbols
__all__ = ['init_middle', '... | """
Implementation of methods for sampling initial points.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# global imports
import numpy as np
# local imports
from ..utils import ldsample
# exported symbols
__all__ = ['init_middle', '... | Update docs/params for initialization methods. | Update docs/params for initialization methods.
| Python | bsd-2-clause | mwhoffman/pybo,jhartford/pybo |
9729c3aecccfa8130db7b5942c423c0807726f81 | python/gbdt/_forest.py | python/gbdt/_forest.py | from libgbdt import Forest as _Forest
class Forest:
def __init__(self, forest):
if type(forest) is str or type(forest) is unicode:
self._forest = _Forest(forest)
elif type(forest) is _Forest:
self._forest = forest
else:
raise TypeError, 'Unsupported fores... | from libgbdt import Forest as _Forest
class Forest:
def __init__(self, forest):
if type(forest) is str or type(forest) is unicode:
self._forest = _Forest(forest)
elif type(forest) is _Forest:
self._forest = forest
else:
raise TypeError, 'Unsupported fores... | Add feature importance bar chart. | Add feature importance bar chart.
| Python | apache-2.0 | yarny/gbdt,yarny/gbdt,yarny/gbdt,yarny/gbdt |
872a96b52061bd9ab3a3178aacf3e3d0be2cc498 | nap/dataviews/fields.py | nap/dataviews/fields.py |
from django.db.models.fields import NOT_PROVIDED
from nap.utils import digattr
class field(property):
'''A base class to compare against.'''
def __get__(self, instance, cls=None):
if instance is None:
return self
return self.fget(instance._obj)
def __set__(self, instance, va... |
from django.db.models.fields import NOT_PROVIDED
from django.forms import ValidationError
from nap.utils import digattr
class field(property):
'''A base class to compare against.'''
def __get__(self, instance, cls=None):
if instance is None:
return self
return self.fget(instance.... | Make field filter errors ValidationErrors | Make field filter errors ValidationErrors
| Python | bsd-3-clause | limbera/django-nap,MarkusH/django-nap |
c170765132d6f24b08a4e40274df589813cebf85 | neutron/cmd/__init__.py | neutron/cmd/__init__.py | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Fix logging error for Guru Meditation Report | Fix logging error for Guru Meditation Report
Currently, invoking any of the commands under neutron/cmd will trigger a
"No handlers could be found" error for Guru Meditation Report. This is
interupting the notify.sh script that is called by dibbler-client during the
IPv6 Prefix Delegation workflow.
This patch adds a l... | Python | apache-2.0 | mahak/neutron,klmitch/neutron,openstack/neutron,openstack/neutron,huntxu/neutron,openstack/neutron,noironetworks/neutron,wolverineav/neutron,mahak/neutron,wolverineav/neutron,bigswitch/neutron,cloudbase/neutron,dims/neutron,MaximNevrov/neutron,klmitch/neutron,eayunstack/neutron,sebrandon1/neutron,noironetworks/neutron,... |
170dce0afe013dee6721237219b9dfa5f2813780 | falafel/__init__.py | falafel/__init__.py | import os
from .core import LogFileOutput, Mapper, IniConfigFile, LegacyItemAccess # noqa: F401
from .core.plugins import mapper, reducer, make_response, make_metadata # noqa: F401
from .mappers import get_active_lines # noqa: F401
from .util import defaults, parse_table # noqa: F401
__here__ = os.path.dirname(os.... | import os
from .core import LogFileOutput, Mapper, IniConfigFile, LegacyItemAccess # noqa: F401
from .core import FileListing # noqa: F401
from .core.plugins import mapper, reducer, make_response, make_metadata # noqa: F401
from .mappers import get_active_lines # noqa: F401
from .util import defaults, parse_table ... | Add FileListing to objects we export | Add FileListing to objects we export
| Python | apache-2.0 | RedHatInsights/insights-core,RedHatInsights/insights-core |
cc184c3e4a911bab38ec5feb62a3fbef3c81ff08 | main/management/commands/poll_rss.py | main/management/commands/poll_rss.py |
from datetime import datetime
from time import mktime
from django.core.management.base import BaseCommand
from django.utils.timezone import get_default_timezone, make_aware
from feedparser import parse
from ...models import Link
class Command(BaseCommand):
def handle(self, *urls, **options):
for url i... |
from datetime import datetime
from time import mktime
from django.core.management.base import BaseCommand
from django.utils.timezone import get_default_timezone, make_aware
from feedparser import parse
from ...models import Link
class Command(BaseCommand):
def handle(self, *urls, **options):
for url i... | Set correct gen_description in rss importer. | Set correct gen_description in rss importer.
| Python | bsd-2-clause | abendig/drum,abendig/drum,yodermk/drum,renyi/drum,baturay/ne-istiyoruz,stephenmcd/drum,yodermk/drum,skybluejamie/wikipeace,skybluejamie/wikipeace,renyi/drum,tsybulevskij/drum,sing1ee/drum,tsybulevskij/drum,baturay/ne-istiyoruz,stephenmcd/drum,renyi/drum,yodermk/drum,j00bar/drum,j00bar/drum,sing1ee/drum,j00bar/drum,tsyb... |
b02e2fb19224edebf28ceddbbe4b41ab9140b5d0 | inthe_am/taskmanager/admin.py | inthe_am/taskmanager/admin.py | from django.contrib import admin
from .models import TaskStore, TaskStoreActivityLog, UserMetadata
class TaskStoreAdmin(admin.ModelAdmin):
search_fields = ('user__username', 'local_path', 'taskrc_extras', )
list_display = ('user', 'local_path', 'configured', )
list_filter = ('configured', )
admin.site.... | from django.contrib import admin
from .models import TaskStore, TaskStoreActivityLog, UserMetadata
class TaskStoreAdmin(admin.ModelAdmin):
search_fields = ('user__username', 'local_path', 'taskrc_extras', )
list_display = ('user', 'local_path', 'configured', )
list_filter = ('configured', )
admin.site.... | Order by last seen, descending. | Order by last seen, descending.
| Python | agpl-3.0 | coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am |
29521ac7b540c2f255b163f9139453103b76b38f | jsonsempai.py | jsonsempai.py | import imp
import json
import os
import sys
class Dot(dict):
def __init__(self, d):
super(dict, self).__init__()
for k, v in d.iteritems():
if isinstance(v, dict):
self[k] = Dot(v)
else:
self[k] = v
def __getattr__(self, attr):
... | import imp
import json
import os
import sys
class Dot(dict):
def __init__(self, d):
super(dict, self).__init__()
for k, v in d.iteritems():
if isinstance(v, dict):
self[k] = Dot(v)
else:
self[k] = v
def __getattr__(self, attr):
... | Add better exception handling on invalid json | Add better exception handling on invalid json
| Python | mit | kragniz/json-sempai |
f4275a930410e71cd3b505c8be279d5e9ca8c92e | mozillians/graphql_profiles/views.py | mozillians/graphql_profiles/views.py | from django.http import Http404
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
import waffle
from csp.decorators import csp_exempt
from graphene_django.views import GraphQLView
class MozilliansGraphQLView(GraphQLView):
"""Class Based View to handle Graph... | from django.conf import settings
from django.http import Http404
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from csp.decorators import csp_exempt
from graphene_django.views import GraphQLView
class MozilliansGraphQLView(GraphQLView):
"""Class Based V... | Use the same setting for DinoPark. | Use the same setting for DinoPark.
| Python | bsd-3-clause | mozilla/mozillians,mozilla/mozillians,akatsoulas/mozillians,mozilla/mozillians,akatsoulas/mozillians,mozilla/mozillians,akatsoulas/mozillians,akatsoulas/mozillians |
7f3d76bdec3731ae50b9487556b1b2750cd3108e | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
import versioneer
setup(
name='iterm2-tools',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='''iTerm2 tools.''',
author='Aaron Meurer',
author_email='asmeurer@gmail.com',
url='https://github.com/asme... | #!/usr/bin/env python
from distutils.core import setup
import versioneer
setup(
name='iterm2-tools',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='''iTerm2 tools.''',
author='Aaron Meurer',
author_email='asmeurer@gmail.com',
url='https://github.com/asme... | Include the tests in the dist | Include the tests in the dist
| Python | mit | asmeurer/iterm2-tools |
7a00ff49799afc50da74a748d07c52fef57ebc84 | setup.py | setup.py | import tungsten
from distutils.core import setup
setup(
name='Tungsten',
version=tungsten.__version__,
author='Seena Burns',
packages={'tungsten': 'tungsten'},
license=open('LICENSE.txt').read(),
description='Wolfram Alpha API built for Python.',
long_description=open('README.md').read(),
... | import tungsten
from distutils.core import setup
setup(
name='Tungsten',
version=tungsten.__version__,
author='Seena Burns',
author_email='hello@ethanbird.com',
url='https://github.com/seenaburns/Tungsten',
packages={'tungsten': 'tungsten'},
license=open('LICENSE.txt').read(),
descripti... | Add url / author email for PyPI regs | Add url / author email for PyPI regs
| Python | bsd-3-clause | seenaburns/Tungsten |
e3aea0f6edbb477b22ebed1f769ff684fddd31a1 | setup.py | setup.py | from distutils.core import setup
setup(
name='wunderclient',
packages=['wunderclient'],
version='0.0.1',
description='A Wunderlist API client',
author='Kevin LaFlamme',
author_email='k@lamfl.am',
url='https://github.com/lamflam/wunderclient',
download_url='https://github.com/lamflam/wun... | import os
from distutils.core import setup
here = os.path.abspath(os.path.dirname(__file__))
requires = []
with open(os.path.join(here, 'requirements.txt')) as f:
for line in f.read().splitlines():
if line.find('--extra-index-url') == -1:
requires.append(line)
setup(
name='wunderclient',... | Make sure the dependencies get installed | Make sure the dependencies get installed
| Python | mit | lamflam/wunderclient |
7c88ecf10c3197c337990c7f92c7ace6a85d316e | setup.py | setup.py | from distutils.core import setup
from distutils.core import Extension
setup(name = 'wrapt',
version = '0.9.0',
description = 'Module for decorators, wrappers and monkey patching.',
author = 'Graham Dumpleton',
author_email = 'Graham.Dumpleton@gmail.com',
license = 'BSD',
url = 'http... | import os
from distutils.core import setup
from distutils.core import Extension
with_extensions = os.environ.get('WRAPT_EXTENSIONS', 'true')
with_extensions = (with_extensions.lower() != 'false')
setup_kwargs = dict(
name = 'wrapt',
version = '0.9.0',
description = 'Module for decorators, wrappers ... | Make compilation of extensions optional through an environment variable. | Make compilation of extensions optional through an environment variable.
| Python | bsd-2-clause | akash1808/wrapt,github4ry/wrapt,wujuguang/wrapt,akash1808/wrapt,wujuguang/wrapt,pombredanne/wrapt,pombredanne/wrapt,GrahamDumpleton/wrapt,pombredanne/python-lazy-object-proxy,ionelmc/python-lazy-object-proxy,linglaiyao1314/wrapt,GrahamDumpleton/wrapt,linglaiyao1314/wrapt,pombredanne/python-lazy-object-proxy,ionelmc/pyt... |
a55f5c1229e67808560b3b55c65d524a737294fa | experiment/consumers.py | experiment/consumers.py | import datetime
import json
from channels.generic.websocket import JsonWebsocketConsumer
from auth_API.helpers import get_or_create_user_information
from experiment.models import ExperimentAction
class ExperimentConsumer(JsonWebsocketConsumer):
##### WebSocket event handlers
def connect(self):
"""
... | import datetime
import json
from channels.generic.websocket import JsonWebsocketConsumer
from auth_API.helpers import get_or_create_user_information
from experiment.models import ExperimentAction
class ExperimentConsumer(JsonWebsocketConsumer):
##### WebSocket event handlers
def connect(self):
"""
... | Send what state is saved | Send what state is saved
| Python | mit | seakers/daphne_brain,seakers/daphne_brain |
0901477d231091e72b4e47e0f5a59a49cb31414d | paystackapi/tests/test_subaccount.py | paystackapi/tests/test_subaccount.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.subaccount import SubAccount
class TestSubAccount(BaseTestCase):
@httpretty.activate
def test_subaccount_create(self):
pass
| import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.subaccount import SubAccount
class TestSubAccount(BaseTestCase):
@httpretty.activate
def test_subaccount_create(self):
pass
"""Method defined to test subaccount creation."""
httpretty.registe... | Add test subaccount test creation | Add test subaccount test creation
| Python | mit | andela-sjames/paystack-python |
0ca502644e66c40089382d13a780a6edc78ddafc | lib/py/src/metrics.py | lib/py/src/metrics.py | import os
import datetime
import tornado.gen
import statsd
if os.environ.get("STATSD_URL", None):
ip, port = os.environ.get("STATSD_URL").split(':')
statsd_client = statsd.StatsClient(host=ip, port=int(port),
prefix=os.environ.get('STATSD_PREFIX',
... | import os
import datetime
import tornado.gen
import statsd
if os.environ.get("STATSD_URL", None):
ip, port = os.environ.get("STATSD_URL").split(':')
statsd_client = statsd.StatsClient(host=ip, port=int(port),
prefix=os.environ.get('STATSD_PREFIX',
... | Create a statsd_client anyway, even if there is no STATSD_URL env variable set | Create a statsd_client anyway, even if there is no STATSD_URL env variable set
| Python | apache-2.0 | upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift |
0670b48b74dddd05a67f63983f7208f1c0c5efed | fskintra.py | fskintra.py | #! /usr/bin/env python
#
#
#
import skoleintra.config
import skoleintra.pgContactLists
import skoleintra.pgDialogue
import skoleintra.pgDocuments
import skoleintra.pgFrontpage
import skoleintra.pgWeekplans
import skoleintra.schildren
SKOLEBESTYELSE_NAME = 'Skolebestyrelsen'
cnames = skoleintra.schildren.skoleGetChil... | #! /usr/bin/env python
#
#
#
import skoleintra.config
import skoleintra.pgContactLists
import skoleintra.pgDialogue
import skoleintra.pgDocuments
import skoleintra.pgFrontpage
import skoleintra.pgWeekplans
import skoleintra.schildren
SKOLEBESTYELSE_NAME = 'Skolebestyrelsen'
cnames = skoleintra.schildren.skoleGetChil... | Fix last commit: use config.log() | Fix last commit: use config.log()
| Python | bsd-2-clause | bennyslbs/fskintra |
a45fa05bc1f8c5f8c72db54484f8a18d2c53dadc | ibmcnx/doc/DataSources.py | ibmcnx/doc/DataSources.py | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | Create documentation of DataSource Settings | : Create documentation of DataSource Settings
Task-Url: | Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 |
4559acc15b009be5d853dfdad0fdc9d3184370df | ibmcnx/doc/DataSources.py | ibmcnx/doc/DataSources.py | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | Create documentation of DataSource Settings | : Create documentation of DataSource Settings
Task-Url: | Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 |
6cd2a721d90c991b7c7dde221affd6ebecf70e95 | setup.py | setup.py | from distutils.core import setup, Extension
setup(name="fastcache", version="0.1",
packages = ["fastcache", "fastcache.tests"],
ext_modules= [Extension("fastcache._lrucache",
["src/_lrucache.c"],
),
]
)
| from distutils.core import setup, Extension
setup(name="fastcache", version="0.1",
packages = ["fastcache", "fastcache.tests"],
ext_modules= [Extension("fastcache._lrucache",
["src/_lrucache.c"],
extra_compile_args=['-std=c99']),
]
)
| Fix travis build error by specifying compiler arg -std=c99 | Fix travis build error by specifying compiler arg -std=c99
| Python | mit | pbrady/fastcache,pbrady/fastcache,pbrady/fastcache |
6eff80bcf12357e943d705b8812822b1c0c0e409 | tests/sentry/metrics/test_datadog.py | tests/sentry/metrics/test_datadog.py | from __future__ import absolute_import
import socket
from mock import patch
from sentry.metrics.datadog import DatadogMetricsBackend
from sentry.testutils import TestCase
class DatadogMetricsBackendTest(TestCase):
def setUp(self):
self.backend = DatadogMetricsBackend(prefix='sentrytest.')
@patch('... | from __future__ import absolute_import
import socket
from mock import patch
from sentry.metrics.datadog import DatadogMetricsBackend
from sentry.testutils import TestCase
class DatadogMetricsBackendTest(TestCase):
def setUp(self):
self.backend = DatadogMetricsBackend(prefix='sentrytest.')
@patch('... | Remove no longer valid test | Remove no longer valid test
| Python | bsd-3-clause | pauloschilling/sentry,pauloschilling/sentry,pauloschilling/sentry |
1a9c9b60d8e0b69b5d196ff8323befd6d9e330aa | make_mozilla/events/models.py | make_mozilla/events/models.py | from django.contrib.gis.db import models
from django.contrib.gis import geos
from datetime import datetime
class Venue(models.Model):
name = models.CharField(max_length=255)
street_address = models.TextField()
country = models.CharField(max_length=255)
location = models.PointField(blank=True)
obj... | from django.contrib.gis.db import models
from django.contrib.gis import geos
from datetime import datetime
class Venue(models.Model):
name = models.CharField(max_length=255)
street_address = models.TextField()
country = models.CharField(max_length=255)
location = models.PointField(blank=True)
obj... | Allow blank source_id in event, tweak formatting of the code | Allow blank source_id in event, tweak formatting of the code
| Python | bsd-3-clause | mozilla/make.mozilla.org,mozilla/make.mozilla.org,mozilla/make.mozilla.org,mozilla/make.mozilla.org |
5eb67411a44366ed90a6078f29f1977013c1a39c | awx/main/migrations/0017_v300_prompting_migrations.py | awx/main/migrations/0017_v300_prompting_migrations.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from awx.main.migrations import _ask_for_variables as ask_for_variables
from awx.main.migrations import _migration_utils as migration_utils
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from awx.main.migrations import _rbac as rbac
from awx.main.migrations import _ask_for_variables as ask_for_variables
from awx.main.migrations import _migration_utils as migration_utils
from django.db import migrations
class Migration(migrations.Migrati... | Rebuild role hierarchy after making changes in migrations | Rebuild role hierarchy after making changes in migrations
Signals don't fire in migrations, so gotta do this step manually
| Python | apache-2.0 | snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx |
bb90fe7c59435d1bef361b64d4083710ffadcf7f | common/apps.py | common/apps.py | from django.apps import AppConfig
from django.conf import settings
from common.helpers.db import db_is_initialized
class CommonConfig(AppConfig):
name = 'common'
def ready(self):
self.display_missing_environment_variables()
from common.helpers.tags import import_tags_from_csv
if db_is... | from django.apps import AppConfig
from django.conf import settings
from common.helpers.db import db_is_initialized
class CommonConfig(AppConfig):
name = 'common'
def ready(self):
self.display_missing_environment_variables()
from common.helpers.tags import import_tags_from_csv
if db_is... | Stop server startup when required environment variables are missing | Stop server startup when required environment variables are missing
| Python | mit | DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange |
8cadb30e1c1f4d8e6302a3960408823179a263c8 | account_invoice_partner/__openerp__.py | account_invoice_partner/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012-2013 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012-2013 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | Add OCA as author of OCA addons | Add OCA as author of OCA addons
In order to get visibility on https://www.odoo.com/apps the OCA board has
decided to add the OCA as author of all the addons maintained as part of the
association.
| Python | agpl-3.0 | OCA/account-invoicing,OCA/account-invoicing |
442b083e9d1618569aa96a653ed2c0e4dfc27e59 | saleor/search/forms.py | saleor/search/forms.py | from django import forms
from .backends import get_search_backend
class SearchForm(forms.Form):
q = forms.CharField(label='Query', required=True)
def search(self, model_or_queryset):
backend = get_search_backend('default')
query = self.cleaned_data['q']
results = backend.search(query... | from django import forms
from django.utils.translation import pgettext
from .backends import get_search_backend
class SearchForm(forms.Form):
q = forms.CharField(label=pgettext('Search form label', 'Query'), required=True)
def search(self, model_or_queryset):
backend = get_search_backend('default')
... | Add contextual marker for search app | Add contextual marker for search app
| Python | bsd-3-clause | jreigel/saleor,car3oon/saleor,KenMutemi/saleor,HyperManTT/ECommerceSaleor,itbabu/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,maferelo/saleor,tfroehlich82/saleor,mociepka/saleor,mociepka/saleor,UITools/saleor,maferelo/saleor,UITools/saleor,tfroehlich82/saleor,UITools/saleor,jreigel/saleor,itbabu/sale... |
1c9feb7b2d9a4ac1a1d3bef42139ec5a7f26b95e | jsonrpcclient/__init__.py | jsonrpcclient/__init__.py | """__init__.py"""
import logging
logger = logging.getLogger('jsonrpcclient')
logger.addHandler(logging.StreamHandler())
from jsonrpcclient.server import Server
| """__init__.py"""
import logging
logger = logging.getLogger('jsonrpcclient')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.WARNING)
from jsonrpcclient.server import Server
| Set the loglevel again, seems like in certain situations, the default log level is 0 | Set the loglevel again, seems like in certain situations, the default log level is 0
| Python | mit | bcb/jsonrpcclient |
1d729ada6c81cdf75c6f76b996337e46d7b679a0 | setup.py | setup.py | #!/usr/bin/env python
# encoding: utf8
import platform
import os
system = platform.system()
from distutils.core import setup
setup(
name='matlab2cpp',
version='0.2',
packages=['matlab2cpp', 'matlab2cpp.translations',
'matlab2cpp.testsuite', 'matlab2cpp.inlines'],
package_dir={'': 'src'... | #!/usr/bin/env python
# encoding: utf8
import platform
import os
system = platform.system()
from distutils.core import setup
setup(
name='matlab2cpp',
version='0.2',
packages=['matlab2cpp', 'matlab2cpp.translations',
'matlab2cpp.testsuite', 'matlab2cpp.inlines'],
package_dir={'': 'src'... | Change mode of mconvert to be globaly executable | Change mode of mconvert to be globaly executable
| Python | bsd-3-clause | jonathf/matlab2cpp,jonathf/matlab2cpp,jonathf/matlab2cpp |
428ce0c6d1d90eea1fb6e5fea192b92f2cd4ea36 | setup.py | setup.py | from distutils.core import setup
setup(
name='PAWS',
version='0.1.0',
description='Python AWS Tools for Serverless',
author='Curtis Maloney',
author_email='curtis@tinbrain.net',
url='https://github.com/funkybob/paws',
packages=['paws', 'paws.contrib', 'paws.views'],
)
| from distutils.core import setup
with open('README.md') as fin:
readme = fin.read()
setup(
name='PAWS',
version='0.1.0',
description='Python AWS Tools for Serverless',
long_description=readme,
author='Curtis Maloney',
author_email='curtis@tinbrain.net',
url='https://github.com/funkybob... | Include readme as long description | Include readme as long description
| Python | bsd-3-clause | funkybob/paws |
2756239ccb9976a93d8c19a1ff071c64f211980c | setup.py | setup.py | #!/usr/bin/env python
"""
Erply-API
---------
Python wrapper for Erply API
"""
from distutils.core import setup
setup(
name='ErplyAPI',
version='0.2015.01.16-dev',
description='Python wrapper for Erply API',
license='BSD',
author='Priit Laes',
author_email='plaes@plaes.org',
long_descripti... | #!/usr/bin/env python
"""
Erply-API
---------
Python wrapper for Erply API
"""
from distutils.core import setup
setup(
name='ErplyAPI',
version='0.2015.01.16-dev',
description='Python wrapper for Erply API',
license='BSD',
author='Priit Laes',
author_email='plaes@plaes.org',
long_descripti... | Add Python 3.x versions to classifiers | Add Python 3.x versions to classifiers
Things seem to be working with 3.x too.
| Python | bsd-3-clause | tteearu/python-erply-api |
a04a8c7d8e1087df39025d6e798d83438ac35f77 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='hpswitch',
version='0.1',
description="A library for interacting with HP Networking switches",
packages=['hpswitch', ],
url='https://github.com/leonhandreke/hpswitch',
license="MIT License",
)
| #!/usr/bin/env python
from distutils.core import setup
setup(name='hpswitch',
version='0.1',
description="A library for interacting with HP Networking switches",
packages=['hpswitch', ],
url='https://github.com/leonhandreke/hpswitch',
license="MIT License",
requires=['p... | Add pysnmp as a dependency | Add pysnmp as a dependency
| Python | mit | leonhandreke/hpswitch,thechristschn/hpswitch |
2b74737db827a4ddc6e4ba678c31304d6f857b47 | setup.py | setup.py | from distutils.core import setup, Extension
setup(name="java_random", version="1.0.1",
description="Provides a fast implementation of the Java random number generator",
author="Matthew Bradbury",
license="MIT",
url="https://github.com/MBradbury/python_java_random",
ext_modules=[Extension("... | from distutils.core import setup, Extension
setup(name="java_random", version="1.0.1",
description="Provides a fast implementation of the Java random number generator",
author="Matthew Bradbury",
license="MIT",
url="https://github.com/MBradbury/python_java_random",
ext_modules=[Extension("... | Mark as for CPython only | Mark as for CPython only
| Python | mit | MBradbury/python_java_random,MBradbury/python_java_random,MBradbury/python_java_random |
83598d24c46683b7d2eb3e99d39cbd5babba5073 | tests/api/views/clubs/create_test.py | tests/api/views/clubs/create_test.py | from skylines.model import Club
from tests.api import basic_auth
def test_create(db_session, client, test_user):
headers = basic_auth(test_user.email_address, test_user.original_password)
res = client.put('/clubs', headers=headers, json={
'name': 'LV Aachen',
})
assert res.status_code == 200
... | from skylines.model import Club
from tests.api import basic_auth
from tests.data import add_fixtures, clubs
def test_create(db_session, client, test_user):
headers = basic_auth(test_user.email_address, test_user.original_password)
res = client.put('/clubs', headers=headers, json={
'name': 'LV Aachen'... | Add more "PUT /clubs" tests | tests/api: Add more "PUT /clubs" tests
| Python | agpl-3.0 | RBE-Avionik/skylines,Harry-R/skylines,shadowoneau/skylines,skylines-project/skylines,Harry-R/skylines,shadowoneau/skylines,Turbo87/skylines,Turbo87/skylines,RBE-Avionik/skylines,Harry-R/skylines,Turbo87/skylines,skylines-project/skylines,skylines-project/skylines,Turbo87/skylines,shadowoneau/skylines,RBE-Avionik/skylin... |
a1e18385c2c5df9db8390b2da4d5baa2465f150e | webcomix/tests/test_comic_availability.py | webcomix/tests/test_comic_availability.py | import pytest
from webcomix.comic import Comic
from webcomix.supported_comics import supported_comics
from webcomix.util import check_first_pages
@pytest.mark.slow
def test_supported_comics():
for comic_name, comic_info in supported_comics.items():
comic = Comic(comic_name, *comic_info)
first_pag... | import pytest
from webcomix.comic import Comic
from webcomix.supported_comics import supported_comics
from webcomix.util import check_first_pages
@pytest.mark.slow
@pytest.mark.parametrize("comic_name", list(supported_comics.keys()))
def test_supported_comics(comic_name):
comic = Comic(comic_name, *supported_com... | Test comic availability of all supported comics independently through parametrization | Test comic availability of all supported comics independently through parametrization
| Python | mit | J-CPelletier/webcomix,J-CPelletier/WebComicToCBZ,J-CPelletier/webcomix |
b4ea08a378bd12c823b6e68f4b72f3a6b327f8e1 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
import os
def get_build():
path = "./.build"
if os.path.exists(path):
fp = open(path, "r")
build = eval(fp.read())
if os.path.exists("./.increase_build"):
build += 1
fp.close()
else:
build = 1
... | #!/usr/bin/env python
from distutils.core import setup
import os
def get_build():
path = "./.build"
if os.path.exists(path):
fp = open(path, "r")
build = eval(fp.read())
if os.path.exists("./.increase_build"):
build += 1
fp.close()
else:
build = 1
... | Change URL, add classifiers and keywords | Change URL, add classifiers and keywords
| Python | apache-2.0 | knockoutMice/pylast,yanggao1119/pylast,knockoutMice/pylast,hugovk/pylast,pylast/pylast,yanggao1119/pylast |
2029256cda7e3bc752d30361357932053cb98744 | shell.py | shell.py | from person import Person
def go(db):
global status
while status == 1:
inputText = input("command>")
for i in commands:
if inputText == i:
commands[i](db)
def helpMe(db):
print("help:")
for i in commandsHelp:
print(i, ":", commandsHelp[i])
def add... | from person import Person
def go(db):
global status
while status == 1:
inputText = input("command> ")
for i in commands:
if inputText == i:
commands[i](db)
def helpMe(db):
print("help:")
for i in commandsHelp:
print("\t", i, ":", commandsHelp[i])
... | Add whitespaces to print it better. | Add whitespaces to print it better.
Signed-off-by: Matej Dujava <03ce64f61b3ea1fda633fb2a103b989e3272d16b@gmail.com>
| Python | mit | matejd11/birthdayNotify |
a612e39f2395aa04bb3fd063188c4a1038324b04 | stock.py | stock.py | class Stock:
def __init__(self, symbol):
self.symbol = symbol
self.price = None
def update(self, timestamp, price):
self.price = price
| class Stock:
def __init__(self, symbol):
self.symbol = symbol
self.price = None
def update(self, timestamp, price):
if price < 0:
raise ValueError("price should not be negative")
self.price = price
| Update update method for negative price exception. | Update update method for negative price exception.
| Python | mit | bsmukasa/stock_alerter |
0b7c0c727b3b56cc20b90da90732fae28aaaf479 | iis/jobs/__init__.py | iis/jobs/__init__.py | from flask import Blueprint
jobs = Blueprint('jobs', __name__, template_folder='./templates')
from . import views, models # noqa: E402, F401
| from flask import Blueprint
jobs = Blueprint('jobs', __name__,
template_folder='./templates') # type: Blueprint
from . import views, models # noqa: E402, F401
| Fix mypy complaint about unknown type | Fix mypy complaint about unknown type
| Python | agpl-3.0 | interactomix/iis,interactomix/iis |
a8ccc99aa0923be9a102bb6d42590d3214d4d229 | tests.py | tests.py | import json
import unittest
from pyunio import pyunio
pyunio.use('httpbin')
params = {
'body': {
'name': 'James Bond'
}
}
def test_get():
response = json.loads(pyunio.get('get', params).text)
assert(response['args']['name'] == 'James Bond')
... | import json
import unittest
from pyunio import pyunio
pyunio.use('httpbin')
params = {
'body': {
'name': 'James Bond'
}
}
class pyuniotTest(unittest.TestCase):
def test_get(self):
response = json.loads(pyunio.get('get', params).text)
... | Add pyuniotest class for unittest, but still lake mock server for test. | Add pyuniotest class for unittest, but still lake mock server for test.
| Python | mit | citruspi/PyUnio |
1aaa261af71d8f8a57f360b9525a38fb537858d1 | sites/us/apps/shipping/repository.py | sites/us/apps/shipping/repository.py | from decimal import Decimal as D
from oscar.apps.shipping import repository, methods, models
class Standard(methods.FixedPrice):
code = "standard"
name = "Standard"
charge_excl_tax = D('10.00')
class Express(methods.FixedPrice):
code = "express"
name = "Express"
charge_excl_tax = D('20.00')... | from decimal import Decimal as D
from oscar.apps.shipping import repository, methods, models
class Standard(methods.FixedPrice):
code = "standard"
name = "Standard"
charge_excl_tax = D('10.00')
class Express(methods.FixedPrice):
code = "express"
name = "Express"
charge_excl_tax = D('20.00')... | Bring US site shipping repo up-to-date | Bring US site shipping repo up-to-date
The repo internals had changed since the US site was born.
| Python | bsd-3-clause | jinnykoo/wuyisj,john-parton/django-oscar,rocopartners/django-oscar,QLGu/django-oscar,michaelkuty/django-oscar,WillisXChen/django-oscar,eddiep1101/django-oscar,kapari/django-oscar,sonofatailor/django-oscar,jinnykoo/wuyisj,faratro/django-oscar,django-oscar/django-oscar,WadeYuChen/django-oscar,WillisXChen/django-oscar,jmt... |
c2c9efed928b1414cb906cb23356e4af2baaf6e4 | LanguageServerClient.py | LanguageServerClient.py | import neovim
import os, subprocess
import json
@neovim.plugin
class LanguageServerClient:
def __init__(self, nvim):
self.nvim = nvim
self.server = subprocess.Popen(
["cargo", "run", "--manifest-path=/opt/rls/Cargo.toml"],
# ['langserver-go', '-trace', '-logfile', '/tmp/lan... | import neovim
import os, subprocess
import json
@neovim.plugin
class LanguageServerClient:
def __init__(self, nvim):
self.nvim = nvim
self.server = subprocess.Popen(
["/bin/bash", "/opt/rls/wrapper.sh"],
# ["cargo", "run", "--manifest-path=/opt/rls/Cargo.toml"],
... | Use inout proxy script for log. | Use inout proxy script for log.
| Python | mit | autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/L... |
4c0ad1cbf346c6d34a924c77081f2dd37e7f86ac | mochi/utils/pycloader.py | mochi/utils/pycloader.py | """Import a Python object made by compiling a Mochi file.
"""
import os
from mochi.core import pyc_compile_monkeypatch
def get_function(name, file_path):
"""Python function from Mochi.
Compiles a Mochi file to Python bytecode and returns the
imported function.
"""
return getattr(get_module(name... | """Import a Python object made by compiling a Mochi file.
"""
import os
from mochi.core import init, pyc_compile_monkeypatch
def get_function(name, file_path):
"""Python function from Mochi.
Compiles a Mochi file to Python bytecode and returns the
imported function.
"""
return getattr(get_modul... | Fix a bug introduced by fixing a bug that always execute eventlet's monkey_patch | Fix a bug introduced by fixing a bug that always execute eventlet's monkey_patch
| Python | mit | slideclick/mochi,i2y/mochi,pya/mochi,slideclick/mochi,i2y/mochi,pya/mochi |
33198314eb70b079b2fdb918abd66d7296f65219 | website/addons/forward/tests/test_models.py | website/addons/forward/tests/test_models.py | # -*- coding: utf-8 -*-
from nose.tools import * # PEP8 asserts
from modularodm.exceptions import ValidationError
from tests.base import OsfTestCase
from website.addons.forward.tests.factories import ForwardSettingsFactory
class TestSettingsValidation(OsfTestCase):
def setUp(self):
super(TestSettings... | # -*- coding: utf-8 -*-
from nose.tools import * # PEP8 asserts
from modularodm.exceptions import ValidationError
from tests.base import OsfTestCase
from tests.factories import ProjectFactory, RegistrationFactory
from website.addons.forward.tests.factories import ForwardSettingsFactory
class TestNodeSettings(OsfT... | Add test for forward registering | Add test for forward registering
| Python | apache-2.0 | alexschiller/osf.io,mluo613/osf.io,emetsger/osf.io,chrisseto/osf.io,cslzchen/osf.io,DanielSBrown/osf.io,TomBaxter/osf.io,monikagrabowska/osf.io,mluo613/osf.io,caneruguz/osf.io,laurenrevere/osf.io,adlius/osf.io,aaxelb/osf.io,SSJohns/osf.io,SSJohns/osf.io,felliott/osf.io,saradbowman/osf.io,laurenrevere/osf.io,monikagrabo... |
6413ce937fbdfdf1acc5cffab4f01f0b40fb2cfc | views.py | views.py | #!/usr/bin/python3.4
from flask import Flask, render_template, url_for, Markup
from flask.ext.libsass import *
import pkg_resources
import markdown
app=Flask(__name__)
Sass(
{'app': 'scss/app.scss'},
app,
url_path='/static/css',
include_paths=[pkg_resources.resource_filename('views', 'scss')],
output_style='comp... | #!/usr/bin/python3.4
from flask import Flask, render_template, url_for, Markup, abort
from flask.ext.libsass import *
import pkg_resources
import markdown
app=Flask(__name__)
Sass(
{'app': 'scss/app.scss'},
app,
url_path='/static/css',
include_paths=[pkg_resources.resource_filename('views', 'scss')],
output_styl... | Add basic page request exception handling | Add basic page request exception handling
| Python | mpl-2.0 | vishwin/vishwin.info-http,vishwin/vishwin.info-http,vishwin/vishwin.info-http |
066d2db105e4ac1cc5f52c0987c6c6832054bd78 | pygraphc/clustering/ConnectedComponents.py | pygraphc/clustering/ConnectedComponents.py | import networkx as nx
class ConnectedComponents:
def __init__(self, g):
self.g = g
def get_connected_components(self):
clusters = []
for components in nx.connected_components(self.g):
clusters.append(components)
cluster_id = 0
for cluster in clusters:
... | import networkx as nx
class ConnectedComponents:
def __init__(self, g):
self.g = g
def get_clusters(self):
clusters = []
for components in nx.connected_components(self.g):
clusters.append(components)
cluster_id = 0
for cluster in clusters:
for ... | Rename method get_cluster and revise self.g.node when accessing a node | Rename method get_cluster and revise self.g.node when accessing a node
| Python | mit | studiawan/pygraphc |
ef323ee8d607b8b9e6a2ee8107324e62297e14ea | nesCart.py | nesCart.py | # http://fms.komkon.org/EMUL8/NES.html#LABM
import struct
class Rom(object):
def __init__(self, romPath, cpu):
self.path = romPath
self.romData = open(romPath, 'rb').read()
if "NES" not in self.romData[0:3]:
print "Unrecognized format!"
return None
... | # http://fms.komkon.org/EMUL8/NES.html#LABM
import struct
class Rom(object):
def __init__(self, romPath, cpu):
self.path = romPath
romData = open(romPath, 'rb').read()
headerSize = 0x10
bankSize = 0x4000
vromBankSize = 0x2000
if "NES" not in romData[0:4]:
... | Add the rest of the basic parsing code | Add the rest of the basic parsing code
| Python | bsd-2-clause | pusscat/refNes |
e40f44cf090428eea3cab01913bef614d5dae121 | pnrg/filters.py | pnrg/filters.py | from jinja2._compat import text_type
from datetime import datetime
import re
def do_right(value, width=80):
"""Right-justifies the value in a field of a given width."""
return text_type(value).rjust(width)
_LATEX_SUBS = (
(re.compile(r'\\'), r'\\textbackslash'),
(re.compile(r'([{}_#%&$])'), r'\\\1'),
... | from jinja2._compat import text_type
import datetime
import re
def do_right(value, width=80):
"""Right-justifies the value in a field of a given width."""
return text_type(value).rjust(width)
_LATEX_SUBS = (
(re.compile(r'\\'), r'\\textbackslash'),
(re.compile(r'([{}_#%&$])'), r'\\\1'),
(re.compil... | Make strftime filter safe for non-date types | Make strftime filter safe for non-date types
It should probably also support datetime.datetime, but since I only have
datetime.date right now, that's not a pressing concern.
| Python | mit | sjbarag/poorly-named-resume-generator,sjbarag/poorly-named-resume-generator |
5b712a639b2de9015e5d1a25b4edf8482254e064 | mangopay/tasks.py | mangopay/tasks.py | from celery.task import task
from .models import MangoPayNaturalUser, MangoPayBankAccount
@task
def create_mangopay_natural_user(id):
MangoPayNaturalUser.objects.get(id=id, mangopay_id__isnull=True).create()
@task
def update_mangopay_natural_user(id):
MangoPayNaturalUser.objects.get(id=id, mangopay_id__isn... | from celery.task import task
from .models import MangoPayNaturalUser, MangoPayBankAccount, MangoPayDocument
@task
def create_mangopay_natural_user(id):
MangoPayNaturalUser.objects.get(id=id, mangopay_id__isnull=True).create()
@task
def update_mangopay_natural_user(id):
MangoPayNaturalUser.objects.get(id=id... | Add mangopay document creation task | Add mangopay document creation task
| Python | mit | FundedByMe/django-mangopay,webu/django-mangopay,DylannCordel/django-mangopay,charlietjhin/django-mangopay |
27fa3be6b7dd55637ad2b683f4027f32578ee04a | utils.py | utils.py | import sqlite3
import shelve
def connect_db(name):
"""
Open a connection to the database used to store quotes.
:param name: (str) Name of database file
:return: (shelve.DbfilenameShelf)
"""
try:
return shelve.open(name)
except Exception:
raise Exception('Unable to connect... | import sqlite3
import shelve
def connect_db(name):
"""
Open a connection to the database used to store quotes.
:param name: (str) Name of database file
:return: (shelve.DbfilenameShelf)
"""
try:
return shelve.open(name)
except Exception:
raise Exception('Unable to connect... | Add id field to quotes table | Add id field to quotes table
Specify names for insert fields
| Python | mit | nickdibari/Get-Quote |
25fc6aa427769e0d75e90e1ae0fbe41e2ca24931 | manager/__init__.py | manager/__init__.py | import os
from flask import Flask
from flask.ext.assets import Bundle, Environment
app = Flask(__name__)
# Load the app config
app.config.from_object("config.Config")
assets = Environment(app)
assets.load_path = [
os.path.join(os.path.dirname(__file__), 'static'),
os.path.join(os.path.dirname(__file__), 's... | import os
from flask import Flask
from flask.ext.assets import Bundle, Environment
app = Flask(__name__)
# Load the app config
app.config.from_object("config.Config")
assets = Environment(app)
assets.load_path = [
os.path.join(os.path.dirname(__file__), 'static'),
os.path.join(os.path.dirname(__file__), 's... | Add Core Views import to the application | Add Core Views import to the application
| Python | mit | hreeder/ignition,hreeder/ignition,hreeder/ignition |
d45e40e9093b88d204335e6e0bae5dac30595d66 | pyface/qt/__init__.py | pyface/qt/__init__.py | #------------------------------------------------------------------------------
# Copyright (c) 2010, Enthought Inc
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
#
# Author: Enthought Inc
# Description: Qt API selector. Can be used to switch between pyQt and ... | #------------------------------------------------------------------------------
# Copyright (c) 2010, Enthought Inc
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
#
# Author: Enthought Inc
# Description: Qt API selector. Can be used to switch between pyQt and ... | Set the sip QDate API for enaml interop. | Set the sip QDate API for enaml interop.
| Python | bsd-3-clause | geggo/pyface,geggo/pyface |
d833d3f1ae0305466b691d37f3a5560821b24490 | easy/beautiful_strings/beautiful_strings.py | easy/beautiful_strings/beautiful_strings.py | from collections import Counter
import string
import sys
def beautiful_strings(line):
line = line.rstrip()
if line:
beauty = 0
count = Counter(''.join(letter for letter in line.lower()
if letter in string.lowercase))
for value in xrange(26, 26 - len(coun... | from collections import Counter
import string
import sys
def beautiful_strings(line):
line = line.rstrip()
if line:
beauty = 0
count = Counter(''.join(letter for letter in line.lower()
if letter in string.lowercase))
for value in xrange(26, 26 - len(coun... | Update solution to handle numbers | Update solution to handle numbers
| Python | mit | MikeDelaney/CodeEval |
13ba4fba90f6ff654c26daf4a44d77bda3992b1f | model/__init__.py | model/__init__.py | import model.wu.user
from model.wu.user import User
def init_context(app):
model.wu.user.init_context(app)
# todo evaluate a parameter and decide which package to use (wu, hss, test(?))
| import os
model_name = os.getenv('SIPA_MODEL', 'sample')
module = __import__('{}.{}.user'.format(__name__, model_name),
fromlist='{}.{}'.format(__name__, model_name))
init_context = module.init_context
User = module.User
query_gauge_data = module.query_gauge_data
| Load model dynamically via envvar 'SIPA_MODEL' | Load model dynamically via envvar 'SIPA_MODEL'
| Python | mit | lukasjuhrich/sipa,agdsn/sipa,agdsn/sipa,fgrsnau/sipa,agdsn/sipa,agdsn/sipa,MarauderXtreme/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,fgrsnau/sipa,fgrsnau/sipa,MarauderXtreme/sipa,MarauderXtreme/sipa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.