commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
41bf63eec63358334fe5889a5e3d4f6fd4caa308 | comment correction | Proteogenomics/trackhub-creator,Proteogenomics/trackhub-creator | pipelines/run_pogo_for_file.py | pipelines/run_pogo_for_file.py | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 01-07-2017 23:20
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
This module runs PoGo for a file, using the given GTF and FA reference files, it will produce the results in the same
folder whe... | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 01-07-2017 23:20
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
This module runs PoGo for a file, using the given GTF and FA reference files, it will produce the results in the same
folder whe... | apache-2.0 | Python |
b3b217b645962209f41a202984a864ee2ef83a36 | Remove redundant CommonReadOnlyFieldsAdmin | teamtaverna/core | app/timetables/admin.py | app/timetables/admin.py | from django.contrib import admin
from .models import (
Event, Weekday, MealOption, Course, Meal, Timetable, Dish, Admin, MenuItem
)
@admin.register(Weekday, MealOption, Course)
class DefaultAdmin(admin.ModelAdmin):
"""Default admin for models with just name and slug fields."""
readonly_fields = ('slug',)... | from django.contrib import admin
from .models import (
Event, Weekday, MealOption, Course, Meal, Timetable, Dish, Admin, MenuItem
)
@admin.register(Weekday, MealOption, Course)
class DefaultAdmin(admin.ModelAdmin):
"""Default admin for models with just name and slug fields."""
readonly_fields = ('slug',)... | mit | Python |
518c447fef64b1adb0387ff3a56d9c061e6e90d3 | standardize distance.py to int.from_bytes | lbryio/lbry,lbryio/lbry,lbryio/lbry | lbrynet/dht/distance.py | lbrynet/dht/distance.py | from lbrynet.dht import constants
class Distance:
"""Calculate the XOR result between two string variables.
Frequently we re-use one of the points so as an optimization
we pre-calculate the value of that point.
"""
def __init__(self, key):
if len(key) != constants.key_bits // 8:
... | from binascii import hexlify
from lbrynet.dht import constants
class Distance:
"""Calculate the XOR result between two string variables.
Frequently we re-use one of the points so as an optimization
we pre-calculate the value of that point.
"""
def __init__(self, key):
if len(key) != con... | mit | Python |
ee553d9b4e5a08a53eccb304fad96edfbb0f3b7d | bump version to 20210605 | AOSC-Dev/acbs,AOSC-Dev/acbs,AOSC-Dev/acbs,AOSC-Dev/acbs | acbs/__init__.py | acbs/__init__.py | __version__ = '20210605'
| __version__ = '20210604'
| lgpl-2.1 | Python |
c1aa35892f168b92eb44f9fcd61deb2cbe812a85 | bump version to 20200707.2 | AOSC-Dev/acbs,AOSC-Dev/acbs,AOSC-Dev/acbs,AOSC-Dev/acbs | acbs/__init__.py | acbs/__init__.py | __version__ = '20200707.2'
| __version__ = '20200707.1'
| lgpl-2.1 | Python |
792c5c9e64cc75ef2e24cad80a8ea7503bbf0564 | Refactor urls file on account app | Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org | accounts/urls.py | accounts/urls.py | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from .views import registration, validation, profile
app_name = "accounts"
urlpatterns = [
url('^login/$', auth_views.login, name='login'),
url('^logout/$', auth_views.logout, name='logout'),
url('^register/$', registratio... | from django.conf.urls import include, url
from .views import registration, validation, profile
app_name = "accounts"
urlpatterns = [
url('^', include('django.contrib.auth.urls')),
url('^register/$', registration.RegisterView.as_view(), name='register'),
url('^register/complete/$',
registration.Regi... | mit | Python |
59b7885a4abc2081e2234c4fb90de248f399dfd1 | Add a test period. | charanpald/APGL | exp/viroscopy/model/GenerateToyGraphs.py | exp/viroscopy/model/GenerateToyGraphs.py |
import logging
import sys
import numpy
from apgl.graph import *
from apgl.util import *
from exp.viroscopy.model.HIVGraph import HIVGraph
from exp.viroscopy.model.HIVEpidemicModel import HIVEpidemicModel
from exp.viroscopy.model.HIVRates import HIVRates
from exp.viroscopy.model.HIVModelUtils import HIVModelUtils
"""
... |
import logging
import sys
import numpy
from apgl.graph import *
from apgl.util import *
from exp.viroscopy.model.HIVGraph import HIVGraph
from exp.viroscopy.model.HIVEpidemicModel import HIVEpidemicModel
from exp.viroscopy.model.HIVRates import HIVRates
from exp.viroscopy.model.HIVModelUtils import HIVModelUtils
"""
... | bsd-3-clause | Python |
9477478f81315edcc0e5859b2325ea70694ea2be | Remove language filtration in sitemap.xml | trilan/lemon,trilan/lemon,trilan/lemon | lemon/sitemaps/views.py | lemon/sitemaps/views.py | from django.shortcuts import render
from lemon.sitemaps.models import Item
def sitemap_xml(request):
qs = Item.objects.filter(sites=request.site, enabled=True)
return render(request, 'sitemaps/sitemap.xml',
{'object_list': qs}, content_type='application/xml')
| from django.shortcuts import render
from django.utils.translation import get_language
from lemon.sitemaps.models import Item
def sitemap_xml(request):
qs = Item.objects.filter(sites=request.site, enabled=True, language=get_language())
return render(request, 'sitemaps/sitemap.xml',
{'object_... | bsd-3-clause | Python |
75e55f1805cbe7d40e340629bf32ac889131d260 | Add minimum_version decorators on NetworkApi methods | uggla/docker-py,vitalyisaev2/docker-py,kpavel/docker-py,dlorenc/docker-py,kaiyou/docker-py,minzhang28/docker-py,schu/docker-py,bfirsh/docker-py,ColinHuang/docker-py,vdemeester/docker-py,aiden0z/docker-py,vpetersson/docker-py,rhatdan/docker-py,tbeadle/docker-py,olsaki/docker-py,mnowster/docker-py,youhong316/docker-py,do... | docker/api/network.py | docker/api/network.py | import json
from ..utils import check_resource, minimum_version
class NetworkApiMixin(object):
@minimum_version('1.21')
def networks(self, names=None, ids=None):
filters = {}
if names:
filters['name'] = names
if ids:
filters['id'] = ids
params = {'filt... | import json
from ..utils import check_resource
class NetworkApiMixin(object):
def networks(self, names=None, ids=None):
filters = {}
if names:
filters['name'] = names
if ids:
filters['id'] = ids
params = {'filters': json.dumps(filters)}
url = self... | apache-2.0 | Python |
76db9e46527da5160de9356de9f92ad60dcc4323 | Update indent for pep8 | Wiredcraft/pipelines,Wiredcraft/pipelines,Wiredcraft/pipelines,Wiredcraft/pipelines | pipelines/plugins/file_logger.py | pipelines/plugins/file_logger.py | import json
import logging
from pipelines.plugins.stdout_logger import StdoutLogger
from pipelines.plugins.status_logger import StatusLogger
from pipelines.plugin.exceptions import PluginError
RETRY_COUNT = 2
log = logging.getLogger('pipelines')
class FileLogger(StdoutLogger):
def __init__(self, file_path):
... | import json
import logging
from pipelines.plugins.stdout_logger import StdoutLogger
from pipelines.plugins.status_logger import StatusLogger
from pipelines.plugin.exceptions import PluginError
RETRY_COUNT = 2
log = logging.getLogger('pipelines')
class FileLogger(StdoutLogger):
def __init__(self, file_path):
... | mit | Python |
353694edb4921e09303d9ddbafa28b202553a445 | bump version to v10.0.0b3 | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | cupy/_version.py | cupy/_version.py | __version__ = '10.0.0b3'
| __version__ = '10.0.0b2'
| mit | Python |
910fbd112c058da04e27114f35ce53156bbec5b8 | Mark oq dbserver restart as broken | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/commands/dbserver.py | openquake/commands/dbserver.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2016-2019 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2016-2019 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | agpl-3.0 | Python |
685b3e3a962b9ee6a58df43b29f7b73cb0d76ee6 | Change formats to match new API | OpenSourceOrg/python-opensource | opensource/licenses/wrapper.py | opensource/licenses/wrapper.py | # Copyright (c) 2015, Paul R. Tagliamonte <paultag@opensource.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | # Copyright (c) 2015, Paul R. Tagliamonte <paultag@opensource.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | mit | Python |
1d682539ede4a9e361790cc31e77f1a22a6db7fa | Fix some logic issues | Hackfmi/Diaphanum,Hackfmi/Diaphanum | members/views.py | members/views.py | # -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .forms import LoginForm
from django.contrib import auth
from hackfmi.utils import json_view
from .models import User
def homepage(request):
return render(request, "index.html", {})
@json_view
def sea... | # -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .forms import LoginForm
from django.contrib import auth
from hackfmi.utils import json_view
from .models import User
def homepage(request):
return render(request, "index.html", {})
@json_view
def sea... | mit | Python |
6bf26f15855ee6e13e11a2b026ee90b9302a68a7 | Add a better name for the coordinate functions. Eventually, ll2utm will be deprecated. | pwcazenave/PyFVCOM | PyFVCOM/__init__.py | PyFVCOM/__init__.py | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '1.6.1'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import buoy_tools
from PyFV... | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '1.6.1'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import buoy_tools
from PyFV... | mit | Python |
85c53ba4d76f573b04f43d29739eeea2178fb751 | Bump to version 0.40.0 | reubano/meza,reubano/meza,reubano/meza,reubano/tabutils,reubano/tabutils,reubano/tabutils | meza/__init__.py | meza/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | mit | Python |
38962e5a8c25c2243654aaace69fd949670de46f | Add help screen | mes32/mfnd | mfnd/commands.py | mfnd/commands.py | #!/usr/bin/env python3
"""
Module for input commands
"""
#from database import TodoDatabase
def _printHelp():
print("mfnd commands:")
print(" exit Exit from the program")
print(" help Display this help screen")
print(" todo <description> Add a new task with <... | #!/usr/bin/env python3
"""
Module for input commands
"""
#from database import TodoDatabase
def exitApplication():
"""
Exit from the application
"""
print("MFND exiting ...")
quit()
def _printHelp():
print(" # _printHelp() - doing nothing")
def displayHelp():
"""
Display progr... | mit | Python |
2cc9ccf563ab768e5a8ec60a1890aea2f8560c8d | Update __about__.py | jason-neal/nod_combination | optimal_nod_combo/__about__.py | optimal_nod_combo/__about__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Licensed under the MIT Licence
# About spectrum_overload
# Based off of the warehouse project (pip's replacement)
import os.path
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__commit__",
"__author__", "__email__", "__license__", "__copyri... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Licensed under the MIT Licence
# About spectrum_overload
# Based off of the warehouse project (pip's replacement)
import os.path
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__commit__",
"__author__", "__email__", "__license__", "__copyri... | mit | Python |
751c38ebe052a689b7962491ffd5f54b593da397 | Fix datathub DCT uris to DC | liderproject/linghub,liderproject/linghub,liderproject/linghub,liderproject/linghub | harvesting/datahub.io/fix-urls.py | harvesting/datahub.io/fix-urls.py | import sys
fix_url = sys.argv[1]
dct = "<http://purl.org/dc/terms/"
dcelems = ["contributor", "coverage>", "creator>", "date>", "description>",
"format>", "identifier>", "language>", "publisher>", "relation>",
"rights>", "source>", "subject>", "title>", "type>"]
for line in sys.stdin:
e = ... | import sys
fix_url = sys.argv[1]
for line in sys.stdin:
e = line.strip().split(" ")
if e[0].startswith("_:"):
e[0] = "<%s>" % e[0].replace("_:",fix_url)
if e[2].startswith("_:"):
e[2] = "<%s>" % e[2].replace("_:",fix_url)
print(" ".join(e))
| apache-2.0 | Python |
6a53479ef2a3f8e89901eb58fd31f3a0607f8a8d | adjust to lt_clang_cxx wrapper | PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild | pprof/projects/pprof/lulesh.py | pprof/projects/pprof/lulesh.py | #!/usr/bin/evn python
# encoding: utf-8
from pprof.project import ProjectFactory
from group import PprofGroup
from plumbum import FG, local
class Lulesh(PprofGroup):
""" Lulesh """
class Factory:
def create(self, exp):
return Lulesh(exp, "lulesh", "scientific")
ProjectFactory.addF... | #!/usr/bin/evn python
# encoding: utf-8
from pprof.project import ProjectFactory
from group import PprofGroup
from plumbum import FG, local
class Lulesh(PprofGroup):
""" Lulesh """
class Factory:
def create(self, exp):
return Lulesh(exp, "lulesh", "scientific")
ProjectFactory.addF... | mit | Python |
e8d321c35d6e0a8294e0766c3836efe192ae2df0 | Print items that are bad *or* missing | ludios/greader-warc-checker | print_items_needing_requeue.py | print_items_needing_requeue.py | """
Walks through your greader-logs directory (or directory containing them)
and prints every item_name that has been finished but has no valid .warc.gz
(as determined by greader-warc-checker's .verification logs)
"""
import os
import sys
try:
import simplejson as json
except ImportError:
import json
basename = os.... | """
Walks through your greader-logs directory (or directory containing them)
and prints every item_name that has been finished but has no valid .warc.gz
(as determined by greader-warc-checker's .verification logs)
"""
import os
import sys
try:
import simplejson as json
except ImportError:
import json
basename = os.... | mit | Python |
f0329395bc32c150992458b2a9ddcc3f4df31044 | Use `deferral` at TracingSampler | sublee/profiling,JeanPaulShapo/profiling,what-studio/profiling,sublee/profiling,JeanPaulShapo/profiling,what-studio/profiling | profiling/sampling/samplers.py | profiling/sampling/samplers.py | # -*- coding: utf-8 -*-
"""
profiling.sampling.samplers
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
import functools
import signal
import sys
import threading
import time
import weakref
import six.moves._thread as _thread
from ..utils import Runnable, deferral
__all__ = ['Sampler'... | # -*- coding: utf-8 -*-
"""
profiling.sampling.samplers
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
import functools
import signal
import sys
import threading
import time
import weakref
import six.moves._thread as _thread
from ..utils import Runnable, deferral
__all__ = ['Sampler'... | bsd-3-clause | Python |
40fac35c4bd6075a84f63516a234a66396c1a91f | Fix package_deb_replace_version.py break dpkg | paulkramme/btsoot | package_deb_replace_version.py | package_deb_replace_version.py | import sys
fullversion = sys.argv[1]
path = f"btsoot_{fullversion}/DEBIAN/control"
version = fullversion[1:]
control_content = f"""Package: btsoot
Version: {version}
Section: base
Priority: optional
Architecture: amd64
Maintainer: Paul Kramme <pjkramme@gmail.com>
Description: BTSOOT
Folder redundancy offsite-backup u... | import sys
fullversion = sys.argv[1]
path = f"btsoot_{fullversion}/DEBIAN/control"
version = fullversion[1:]
control_content = f"""Package: btsoot
Version: {version}
Section: base
Priority: optional
Architecture: amd64
Depends: build-essential
Maintainer: Paul Kramme <pjkramme@gmail.com>
Description: BTSOOT
Folder re... | bsd-3-clause | Python |
da5b3633bb27bc323e41459d8a321b62612c3eb4 | Add printing usage type dependant units | ifosch/accloudtant | accloudtant/__main__.py | accloudtant/__main__.py | import csv
def area(entry):
if entry[" UsageType"].startswith("EUC1-"):
return "EU (Frankfurt)"
def is_data_transfer(entry):
if "DataTransfer" in entry[" UsageType"] or "CloudFront" in entry[" UsageType"]:
return True
return False
def omit(entry):
if is_data_transfer(entry) or entr... | import csv
def area(entry):
if entry[" UsageType"].startswith("EUC1-"):
return "EU (Frankfurt)"
def is_data_transfer(entry):
if "DataTransfer" in entry[" UsageType"] or "CloudFront" in entry[" UsageType"]:
return True
return False
def omit(entry):
if is_data_transfer(entry) or entr... | apache-2.0 | Python |
04c47f694310a9f6bf42f9835b4253ad9c494d6c | check if X is numpy array | rushter/MLAlgorithms | mla/base/base.py | mla/base/base.py | import numpy as np
class BaseEstimator(object):
X = None
y = None
y_required = True
def _setup_input(self, X, y=None):
"""Ensure inputs to an estimator are in the expected format.
Ensures X and y are stored as numpy ndarrays by converting from an
array-like object if necessar... | import numpy as np
class BaseEstimator(object):
X = None
y = None
y_required = True
def _setup_input(self, X, y=None):
"""Ensure inputs to an estimator are in the expected format.
Ensures X and y are stored as numpy ndarrays by converting from an
array-like object if necessar... | mit | Python |
7c7ff87d790eaa40a61c6c94920e44b482393240 | remove debug from webapp2 | p22co/edaemon,p22co/edaemon,paulsnar/edaemon,paulsnar/edaemon,paulsnar/edaemon,p22co/edaemon | application/__init__.py | application/__init__.py | # coding: utf-8
import os
from google.appengine.api import users
import webapp2
import logging
from .environment import env
from .routes import main, admin
def handle_401(request, response, exception):
template = env.get_template('errors/401.htm')
response.write(template.render())
response.set_status(401... | # coding: utf-8
import os
from google.appengine.api import users
import webapp2
import logging
from .environment import env
from .routes import main, admin
def handle_401(request, response, exception):
template = env.get_template('errors/401.htm')
response.write(template.render())
response.set_status(401... | bsd-3-clause | Python |
2eca21d74bd19f9315c9e8ec3d0212f3913ec5be | Fix Hungry Dragon to summon for the opponent | butozerca/fireplace,oftc-ftw/fireplace,liujimj/fireplace,smallnamespace/fireplace,butozerca/fireplace,beheh/fireplace,smallnamespace/fireplace,liujimj/fireplace,oftc-ftw/fireplace,Ragowit/fireplace,amw2104/fireplace,NightKev/fireplace,Meerkov/fireplace,amw2104/fireplace,Ragowit/fireplace,Meerkov/fireplace,jleclanche/fi... | fireplace/cards/blackrock/collectible.py | fireplace/cards/blackrock/collectible.py | from ..utils import *
##
# Minions
# Flamewaker
class BRM_002:
events = [
OWN_SPELL_PLAY.after(Hit(RANDOM_ENEMY_MINION, 1) * 2)
]
# Imp Gang Boss
class BRM_006:
events = [
SELF_DAMAGE.on(Summon(CONTROLLER, "BRM_006t"))
]
# Dark Iron Skulker
class BRM_008:
action = [Hit(ENEMY_MINIONS - DAMAGED, 2)]
# V... | from ..utils import *
##
# Minions
# Flamewaker
class BRM_002:
events = [
OWN_SPELL_PLAY.after(Hit(RANDOM_ENEMY_MINION, 1) * 2)
]
# Imp Gang Boss
class BRM_006:
events = [
SELF_DAMAGE.on(Summon(CONTROLLER, "BRM_006t"))
]
# Dark Iron Skulker
class BRM_008:
action = [Hit(ENEMY_MINIONS - DAMAGED, 2)]
# V... | agpl-3.0 | Python |
daab0f95dd6755153eceb082f2f3c2ae05112360 | Fix Blingtron 3000 | oftc-ftw/fireplace,oftc-ftw/fireplace,smallnamespace/fireplace,Meerkov/fireplace,NightKev/fireplace,Ragowit/fireplace,liujimj/fireplace,butozerca/fireplace,liujimj/fireplace,beheh/fireplace,amw2104/fireplace,butozerca/fireplace,smallnamespace/fireplace,Ragowit/fireplace,amw2104/fireplace,jleclanche/fireplace,Meerkov/fi... | fireplace/cards/gvg/neutral_legendary.py | fireplace/cards/gvg/neutral_legendary.py | from ..utils import *
##
# Minions
# Dr. Boom
class GVG_110:
action = [Summon(CONTROLLER, "GVG_110t") * 2]
# Boom Bot
class GVG_110t:
def deathrattle(self):
return [Hit(RANDOM_ENEMY_CHARACTER, random.randint(1, 4))]
# Sneed's Old Shredder
class GVG_114:
def deathrattle(self):
legendary = randomCollectible(... | from ..utils import *
##
# Minions
# Dr. Boom
class GVG_110:
action = [Summon(CONTROLLER, "GVG_110t") * 2]
# Boom Bot
class GVG_110t:
def deathrattle(self):
return [Hit(RANDOM_ENEMY_CHARACTER, random.randint(1, 4))]
# Sneed's Old Shredder
class GVG_114:
def deathrattle(self):
legendary = randomCollectible(... | agpl-3.0 | Python |
5461975cbaad6e4cd112bc010ac763757eaf669f | Debug message was added into java-script console showing data going to NJS when app runs. | msneddon/narrative,msneddon/narrative,briehl/narrative,psnovichkov/narrative,kbase/narrative,psnovichkov/narrative,scanon/narrative,msneddon/narrative,mlhenderson/narrative,nlharris/narrative,aekazakov/narrative,jmchandonia/narrative,aekazakov/narrative,pranjan77/narrative,briehl/narrative,msneddon/narrative,briehl/nar... | src/biokbase/narrative/services/app_service.py | src/biokbase/narrative/services/app_service.py | """
Generic App service calls.
This generates and runs the KBase App call based on an App Spec from the
Narrative Method Store, and a set of parameters.
"""
__author__ = 'Bill Riehl <wjriehl@lbl.gov>, Roman Sutormin <rsutormin@lbl.gov>'
__date__ = '10/28/14'
## Imports
import json
# Third-party
import IPython.utils.t... | """
Generic App service calls.
This generates and runs the KBase App call based on an App Spec from the
Narrative Method Store, and a set of parameters.
"""
__author__ = 'Bill Riehl <wjriehl@lbl.gov>, Roman Sutormin <rsutormin@lbl.gov>'
__date__ = '10/28/14'
## Imports
import json
# Third-party
import IPython.utils.t... | mit | Python |
400c8de8a3a714da21c0e2b175c6e4adad3677b9 | Check for the name of the submodule we'd like to ignore in a more general way. | aradhyamathur/PySyft,sajalsubodh22/PySyft,OpenMined/PySyft,dipanshunagar/PySyft,sajalsubodh22/PySyft,dipanshunagar/PySyft,joewie/PySyft,cypherai/PySyft,cypherai/PySyft,joewie/PySyft,aradhyamathur/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | syft/__init__.py | syft/__init__.py | import importlib
import pkgutil
ignore_packages = set(['test'])
def import_submodules(package, recursive=True):
""" Import all submodules of a module, recursively, including subpackages
:param package: package (name or actual module)
:type package: str | module
:rtype: dict[str, types.ModuleType]
... | import importlib
import pkgutil
ignore_packages = set(['test'])
def import_submodules(package, recursive=True):
""" Import all submodules of a module, recursively, including subpackages
:param package: package (name or actual module)
:type package: str | module
:rtype: dict[str, types.ModuleType]
... | apache-2.0 | Python |
bbdbe71a69da9f0281f0ac0afd8b729f6a4dc09d | fix missing import | Nic30/hwtHls,Nic30/hwtHls,Nic30/hwtHls | hwtHls/platform/interpolations.py | hwtHls/platform/interpolations.py | # https://stackoverflow.com/questions/46040382/spline-interpolation-in-3d-in-python
from itertools import islice
from pprint import pformat
from typing import Tuple, Optional
from hwtHls.scheduler.errors import TimeConstraintError
from scipy.interpolate._interpolate import interp1d
class Spline(interp1d):
def _... | # https://stackoverflow.com/questions/46040382/spline-interpolation-in-3d-in-python
from itertools import islice
from pprint import pformat
from typing import Tuple
from hwtHls.scheduler.errors import TimeConstraintError
from scipy.interpolate._interpolate import interp1d
class Spline(interp1d):
def __init__(se... | mit | Python |
14ae3d5936b20abba46e41afd1ea7d16a273ad0d | normalize version number | Stvad/anki | anki/__init__.py | anki/__init__.py | # -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sys
if sys.version_info[0] < 3:
raise Exception("Anki should be run with Python 3")
elif sys.version_info[1] < 4:
raise Exception("Anki requires Python 3.4+"... | # -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sys
if sys.version_info[0] < 3:
raise Exception("Anki should be run with Python 3")
elif sys.version_info[1] < 4:
raise Exception("Anki requires Python 3.4+"... | agpl-3.0 | Python |
0a75f6aad8696dad0df4cc58f26f326439465738 | Move the image code into a single function and wrap it in a try/except block | kfdm/gntp-regrowl | gntp_bridge.py | gntp_bridge.py | from gntp import *
import urllib
import Growl
def register_send(self):
'''
Resend a GNTP Register message to Growl running on a local OSX Machine
'''
print 'Sending Local Registration'
#Local growls only need a list of strings
notifications=[]
defaultNotifications = []
for notice in self.notifications:
not... | from gntp import *
import urllib
import Growl
def register_send(self):
'''
Resend a GNTP Register message to Growl running on a local OSX Machine
'''
print 'Sending Local Registration'
#Local growls only need a list of strings
notifications=[]
defaultNotifications = []
for notice in self.notifications:
not... | mit | Python |
5d463aafa34f956feb58d178c990f013fcf7f48a | Add wild parsing for access token | durden/dash,durden/dash | apps/codrspace/views.py | apps/codrspace/views.py | """Main codrspace views"""
from django.shortcuts import render, redirect
from settings import GITHUB_CLIENT_ID
import requests
def index(request, slug=None, template_name="base.html"):
return render(request, template_name)
def edit(request, slug=None, template_name="edit.html"):
"""Edit Your Post"""
r... | """Main codrspace views"""
from django.shortcuts import render, redirect
from settings import GITHUB_CLIENT_ID
import requests
def index(request, slug=None, template_name="base.html"):
return render(request, template_name)
def edit(request, slug=None, template_name="edit.html"):
"""Edit Your Post"""
r... | mit | Python |
2481363d6fbc61fa65d49a5f44109cebb4d17aa8 | Fix flake8 | defivelo/db,defivelo/db,defivelo/db | apps/common/__init__.py | apps/common/__init__.py | # -*- coding: utf-8 -*-
#
# defivelo-intranet -- Outil métier pour la gestion du Défi Vélo
# Copyright (C) 2015 Didier Raboud <me+defivelo@odyx.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software ... | # -*- coding: utf-8 -*-
#
# defivelo-intranet -- Outil métier pour la gestion du Défi Vélo
# Copyright (C) 2015 Didier Raboud <me+defivelo@odyx.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software ... | agpl-3.0 | Python |
d63b3e73983f60fd133a2e023f69b0a6ea42c9bb | Add perf-tools to get_config_dir.py | euanh/planex-cleanhistory,simonjbeaumont/planex,djs55/planex,simonjbeaumont/planex,euanh/planex-cleanhistory,euanh/planex-cleanhistory,simonjbeaumont/planex,djs55/planex,djs55/planex | mk/get_config_dir.py | mk/get_config_dir.py | #!/usr/bin/env python
import os
component = os.getenv("COMPONENT")
if component == "ocaml":
print "/repos/xen-dist-ocaml.hg"
if component == "api-libs":
print "/repos/xen-api-libs-specs"
if component == "perf-tools":
print "/repos/perf-tools"
| #!/usr/bin/env python
import os
component = os.getenv("COMPONENT")
if component == "ocaml":
print "/repos/xen-dist-ocaml.hg"
if component == "api-libs":
print "/repos/xen-api-libs-specs"
| lgpl-2.1 | Python |
08142e4f5a9b39966bbd34ba1b34c1a6c89c14e6 | fix formatting | shacknetisp/vepybot | plugins/misc/chatbot/__init__.py | plugins/misc/chatbot/__init__.py | # -*- coding: utf-8 -*-
import bot
import time
from . import ailib
bot.reload(ailib)
class Module(bot.Module):
index = "chatbot"
def register(self):
self.lastphrase = {}
self.lasttime = {}
if self.server.index in ['irc']:
self.server.rget('addchannelrights')({
... | # -*- coding: utf-8 -*-
import bot
import time
from . import ailib
bot.reload(ailib)
class Module(bot.Module):
index = "chatbot"
def register(self):
self.lastphrase = {}
self.lasttime = {}
if self.server.index in ['irc']:
self.server.rget('addchannelrights')({
... | mit | Python |
59d320d836d6bb63943e347e005dc6cd4f78fe0b | Update __init__.py (#409) | ui/django-post_office,ui/django-post_office | post_office/template/__init__.py | post_office/template/__init__.py | from django.template.loader import get_template, select_template
def render_to_string(template_name, context=None, request=None, using=None):
"""
Loads a template and renders it with a context. Returns a tuple containing the rendered template string
and a list of attached images.
template_name may be... | from django.template.loader import get_template, select_template
def render_to_string(template_name, context=None, request=None, using=None):
"""
Loads a template and renders it with a context. Returns a tuple containing the rendered template string
and a list of attached images.
template_name may be... | mit | Python |
ab719fd8eaa9080daa628dbddf445318d0d4f41d | change definition to list to match cloudformation | Yipit/troposphere,dmm92/troposphere,ikben/troposphere,horacio3/troposphere,pas256/troposphere,cloudtools/troposphere,pas256/troposphere,cloudtools/troposphere,dmm92/troposphere,7digital/troposphere,horacio3/troposphere,alonsodomin/troposphere,7digital/troposphere,ikben/troposphere,alonsodomin/troposphere,WeAreCloudar/t... | troposphere/codedeploy.py | troposphere/codedeploy.py | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .validators import positive_integer
KEY_ONLY = "KEY_ONLY"
VALUE_ONLY = "VALUE_ONLY"
KEY_AND_VALUE = "KEY_AND_VALUE"
class GitHubLocation(AWSProperty):
props = ... | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .validators import positive_integer
KEY_ONLY = "KEY_ONLY"
VALUE_ONLY = "VALUE_ONLY"
KEY_AND_VALUE = "KEY_AND_VALUE"
class GitHubLocation(AWSProperty):
props = ... | bsd-2-clause | Python |
967c2f688cbeff88f8876e25e7409593e04d32d6 | use non timeout mode for all streams in the sample tester | tytek2012/twitter,jessamynsmith/twitter,hugovk/twitter,Adai0808/twitter,miragshin/twitter,sixohsix/twitter | twitter/stream_example.py | twitter/stream_example.py | """
Example program for the Stream API. This prints public status messages
from the "sample" stream as fast as possible.
USAGE
stream-example -t <token> -ts <token_secret> -ck <consumer_key> -cs <consumer_secret>
"""
from __future__ import print_function
import argparse
from twitter.stream import TwitterStream
... | """
Example program for the Stream API. This prints public status messages
from the "sample" stream as fast as possible.
USAGE
stream-example -t <token> -ts <token_secret> -ck <consumer_key> -cs <consumer_secret>
"""
from __future__ import print_function
import argparse
from twitter.stream import TwitterStream
... | mit | Python |
1f4dc86af3437886c1f5ef9612e205058954ac09 | add base handler to handle sessions | abau171/helpmio,abau171/helpmio,abau171/helpmio | helpmio/web.py | helpmio/web.py | import helpmio.session
import os
import tornado.httpserver
import tornado.web
def init(port):
template_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"..", "assets", "templates")
static_files_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
".... | import os
import tornado.httpserver
import tornado.web
def init(port):
template_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"..", "assets", "templates")
static_files_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"..", "assets", "web")
... | mit | Python |
a86361e408943ccadccecabca9a12bf5b67ee3ad | Fix default value factories | plone/plone.server,plone/plone.server | src/plone.server/plone/server/registry.py | src/plone.server/plone/server/registry.py | # -*- coding: utf-8 -*-
from plone.registry import field
from plone.server import _
from zope.interface import Interface
ACTIVE_AUTH_EXTRACTION_KEY = \
'plone.server.registry.IAuthExtractionPlugins.active_plugins'
class IAuthExtractionPlugins(Interface):
active_plugins = field.List(
title=_('Active... | # -*- coding: utf-8 -*-
from plone.registry import field
from plone.server import _
from zope.interface import Interface
ACTIVE_AUTH_EXTRACTION_KEY = \
'plone.server.registry.IAuthExtractionPlugins.active_plugins'
class IAuthExtractionPlugins(Interface):
active_plugins = field.List(
title=_('Active... | bsd-2-clause | Python |
cd3b5612c98f3065fd7c4c928c97f101b73d5cc1 | Add DEBUG_TOOLBAR_PATCH_SETTINGS | ryu22e/django_template,ryu22e/django_template | project_name/settings/local.py | project_name/settings/local.py | from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'd... | from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'd... | mit | Python |
96df9e15c0eff98afa3ac28af68dce41dc9146a4 | Fix to be runnable no config | attakei/ananta | ananta/scripts/build.py | ananta/scripts/build.py | # -*- coding:utf8 -*-
"""
"""
from __future__ import unicode_literals
import sys
import os
import glob
import shutil
import importlib
import tempfile
__author__ = 'attakei'
def build_packages(registry, config, args):
import pip
if args.path is None:
args.path = tempfile.mkdtemp()
pip_args = 'ins... | # -*- coding:utf8 -*-
"""
"""
from __future__ import unicode_literals
import sys
import os
import glob
import shutil
import importlib
import tempfile
__author__ = 'attakei'
def build_packages(registry, config, args):
import pip
if args.path is None:
args.path = tempfile.mkdtemp()
pip_args = 'ins... | mit | Python |
8596db004b8010a46772cb28c319adb62e4161f1 | Implement SerializerMethodField | anditakaesar/aoms | aomswork/serializers.py | aomswork/serializers.py | from rest_framework import serializers
from aomswork.models import Product, Color, ProductColor, Stock
class ProductSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Product
fields = ('id','url', 'product_name','product_desc')
class ColorSerializer(serializers.HyperlinkedMod... | from rest_framework import serializers
from aomswork.models import Product, Color, ProductColor, Stock
class ProductSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Product
fields = ('id','url', 'product_name','product_desc')
class ColorSerializer(serializers.HyperlinkedMod... | mit | Python |
cd495cb2cf288115b88d39feeffea3dd474f1e8b | Refactor URI into more methods | mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation | falcom/api/uri/uri.py | falcom/api/uri/uri.py | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from urllib.parse import urlencode
from .fake_mapping import FakeMappingThatRecordsAccessions
class URI:
class MissingRequiredArg (Runt... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from urllib.parse import urlencode
from .fake_mapping import FakeMappingThatRecordsAccessions
class URI:
class MissingRequiredArg (Runt... | bsd-3-clause | Python |
904b3d17dd066fdb9eb301fd0a7a435bbe0366dd | add import for pyinstaller | kyuupichan/electrum,vertcoin/electrum-vtc,digitalbitbox/electrum,fireduck64/electrum,digitalbitbox/electrum,vertcoin/electrum-vtc,molecular/electrum,dabura667/electrum,wakiyamap/electrum-mona,neocogent/electrum,dabura667/electrum,asfin/electrum,spesmilo/electrum,cryptapus/electrum,spesmilo/electrum,neocogent/electrum,r... | lib/__init__.py | lib/__init__.py | from version import ELECTRUM_VERSION
from util import format_satoshis, print_msg, print_error, set_verbosity
from wallet import Synchronizer, Wallet, Imported_Wallet
from storage import WalletStorage
from coinchooser import COIN_CHOOSERS
from network import Network, pick_random_server
from interface import Connection, ... | from version import ELECTRUM_VERSION
from util import format_satoshis, print_msg, print_error, set_verbosity
from wallet import Synchronizer, Wallet, Imported_Wallet
from storage import WalletStorage
from coinchooser import COIN_CHOOSERS
from network import Network, pick_random_server
from interface import Connection, ... | mit | Python |
03ba8db41d0a4a0b8db236658d3373c8d9a4acfb | Add doc string | speed-of-light/pyslider | lib/__init__.py | lib/__init__.py | __doc__ = """
Pyslider library
`exp`: core part
`auto`: some auto scripts
`plotter`: plotting library
`ext`: some helpers provided by others
"""
__all__ = ["exp"]
| __all__ = ["exp"]
| agpl-3.0 | Python |
073cc2f9c5da800b20cb767bb245b4dcfe23edc9 | disable preload, better for daemon watcher | naggie/crates,naggie/crates,naggie/crates | index/admin.py | index/admin.py | from django.contrib import admin
from models import AudioFile
# Monkey patch FTW!
admin.site.site_header = 'Crates server administration'
def cover_art_html(audioFile):
# TODO: replace this with CAS-powered image field + admin form
if audioFile.cover_art_ref:
return r"""
<img src="/cas/{c... | from django.contrib import admin
from models import AudioFile
# Monkey patch FTW!
admin.site.site_header = 'Crates server administration'
def cover_art_html(audioFile):
# TODO: replace this with CAS-powered image field + admin form
if audioFile.cover_art_ref:
return r"""
<img src="/cas/{c... | mit | Python |
e6419685f9f8b78045d8f34f576198ce80093f87 | Update sorting.py | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite | labonneboite/common/sorting.py | labonneboite/common/sorting.py |
SCORE_SORTING_LABEL = 'Tri optimisé %s' % (
'<span class="badge badge-large badge-info" data-toggle="tooltip" data-placement="right" title="%s">?</span>' % (
"""
Tri exclusif La bonne boite basé sur le potentiel d'embauche des entreprises mis à jour toutes les 24 heures.
"""
)
)
SORT_FILTER_SCORE = "score"
SO... |
SCORE_SORTING_LABEL = 'Tri optimisé %s' % (
'<span class="badge badge-large badge-info" data-toggle="tooltip" data-placement="right" title="%s">?</span>' % (
"""
Tri exclusif LaBonneBoite basé sur le potentiel d'embauche des entreprises mis à jour toutes les 24 heures.
"""
)
)
SORT_FILTER_SCORE = "score"
SORT... | agpl-3.0 | Python |
5e26ca58e036440a43db81be45f7b3920c3c6078 | Use singleton log level | desihub/desispec,desihub/desispec | py/desispec/quicklook/qllogger.py | py/desispec/quicklook/qllogger.py | import logging
#from datetime import datetime
class QLLogger:
""" Simple logger class using logging """
__loglvl__=None
__loggername__="QuickLook"
def __init__(self,name=None,loglevel=logging.INFO):
if name is not None:
self.__loggername__=name
if QLLogger.__loglvl__ is None... | import logging
#from datetime import datetime
class QLLogger:
""" Simple logger class using logging """
__loglvl__=None
__loggername__="QuickLook"
def __init__(self,name=None,loglevel=logging.INFO):
if name is not None:
self.__loggername__=name
if self.__loglvl__ is None:
... | bsd-3-clause | Python |
cb3e5411faa72876a5313796644de2506b0a0fb1 | update import path | jeasoft/odoo,jeasoft/odoo,jeasoft/odoo,jeasoft/odoo,jeasoft/odoo,jeasoft/odoo,jeasoft/odoo,jeasoft/odoo | marcos_addons/debit_credit_note/wizard/__init__.py | marcos_addons/debit_credit_note/wizard/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2015 Marcos Organizador de Negocios SRL http://marcos.do
# Write by Eneldo Serrata (eneldo@marcos.do)
#
# This program is free software: you can redistribute it and/or modify
# it un... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2015 Marcos Organizador de Negocios SRL http://marcos.do
# Write by Eneldo Serrata (eneldo@marcos.do)
#
# This program is free software: you can redistribute it and/or modify
# it un... | agpl-3.0 | Python |
ec0710ad5bbbc723cb760bd0be12a2d8aa42d474 | fix database | tranlyvu/findLink,tranlyvu/find-link | findlink/find_link.py | findlink/find_link.py | from database.data_handle import DataHandle
from database.database import Page, Link
from findlink import searcher
from settings import session
class FindLink:
def __init__(self, starting_url, ending_url, limit=6):
""" Main class of the application
Parameters
--------------
starti... | from database.data_handle import DataHandle
from database.database import Page, Link
from findlink import searcher
from settings import session
class FindLink:
def __init__(self, starting_url, ending_url, limit=6):
""" Main class of the application
Parameters
--------------
starti... | apache-2.0 | Python |
108fa65760ed6334181d7ed5b129a2e8e24c38d2 | Update dsub version to 0.3.3 | DataBiosphere/dsub,DataBiosphere/dsub | dsub/_dsub_version.py | dsub/_dsub_version.py | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
81d90e81818eca1e43a6044351de487e41fe4c6a | expand getitem test | rstoneback/pysat,jklenzing/pysat | pysat/tests/test_constellation.py | pysat/tests/test_constellation.py | from nose.tools import raises
import pysat
# TODO
class TestConstellation:
"""Test the Constellation class."""
def setup(self):
"""Create instruments and a constellation for each test."""
self.instruments = [pysat.Instrument('pysat', 'testing',
cle... | from nose.tools import raises
import pysat
# TODO
class TestConstellation:
"""Test the Constellation class."""
def setup(self):
"""Create instruments and a constellation for each test."""
self.instruments = [pysat.Instrument('pysat', 'testing',
cle... | bsd-3-clause | Python |
564c1c2cd6a48fadc1c6dc6debe0c0df01891c4b | Include binary_read/write in init file | ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost | python/bifrost/blocks/__init__.py | python/bifrost/blocks/__init__.py | # Copyright (c) 2016, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | # Copyright (c) 2016, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | bsd-3-clause | Python |
0b0f0eb4d10c76ece44714fe5e9f74d9e484a199 | add /error/difference | pyannote/pyannote-server,pyannote/pyannote-server | pyannote/server/views/error.py | pyannote/server/views/error.py | #!/usr/bin/env python
# encoding: utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2013-2014 CNRS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without li... | #!/usr/bin/env python
# encoding: utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2013-2014 CNRS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without li... | mit | Python |
6931489733a568a98a452ba3581f70bc3d7d1dea | update version for pypi | google/jax,google/jax,google/jax,google/jax,tensorflow/probability,tensorflow/probability | jax/version.py | jax/version.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
6789d7d09ae0c6178669999fadad46e7dae24c20 | add comment | petspats/pyhacores,petspats/pyhacores | pyhacores/filter/dc_removal.py | pyhacores/filter/dc_removal.py | from pyha import Hardware, Sfix, simulate, sims_close
import numpy as np
from pyhacores.filter import MovingAverage
class DCRemoval(Hardware):
"""
Filter out DC component, loosely based on: https://www.dsprelated.com/showarticle/58.php
Change is that the delay is not matched to the output (this keeps the... | from pyha import Hardware, Sfix, simulate, sims_close
import numpy as np
from pyhacores.filter import MovingAverage
class DCRemoval(Hardware):
"""
Filter out DC component, loosely based on: https://www.dsprelated.com/showarticle/58.php
Change is that the delay is not matched to the output (this keeps the... | apache-2.0 | Python |
43b1200a3a12bfdd8cc6ef8748c11ad5358c0422 | Update morletExample.py | andrew0harney/EEG-Multi-Channel-Utility | morletExample.py | morletExample.py | import numpy as np
import matplotlib.pyplot as plt
import tables
import pandas as pd
from SignalManager import SignalManager
from gridFT import calcFFT, plot_morlet,morlet
from signalUtils import normSignal
import pickle
#This script generates data containing a periodic signal with experimental epochs.
#It then attem... | #Warning - this code was written for previous versions of signalManager and may now be incompatable
import numpy as np
import matplotlib.pyplot as plt
import tables
import pandas as pd
from SignalManager import SignalManager
from gridFT import calcFFT, plot_morlet,morlet
import pickle
ws = 0.1
x = np.linspace(-np.pi,... | mit | Python |
f0e417fc774f82df172bfb07fa0a7c552c2aeffc | Update test_sensor.py | jamesleesaunders/pi-hive,jamesleesaunders/PyAlertMe | pyalertme/tests/test_sensor.py | pyalertme/tests/test_sensor.py | import sys
sys.path.insert(0, '../../')
from pyalertme import *
import unittest
from mock_serial import Serial
class TestSensor(unittest.TestCase):
def setUp(self):
self.ser = Serial()
self.device_obj = Sensor()
self.device_obj.start(self.ser)
def tearDown(self):
self.device_... | import sys
sys.path.insert(0, '../../')
from pyalertme import *
import unittest
from mock_serial import Serial
class TestSensor(unittest.TestCase):
def setUp(self):
self.serialObj = Serial()
self.deviceObj = Sensor()
self.deviceObj.start(self.serialObj)
def tearDown(self):
se... | mit | Python |
2ee2e1af57b2c6d7b4a660f1bb0f513e88e11517 | fix the second citation attributes (re #8065) | ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article | src/zeit/content/article/edit/citation.py | src/zeit/content/article/edit/citation.py | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.cms.i18n import MessageFactory as _
import grokcore.component
import zeit.content.article.edit.block
import zeit.content.article.edit.interfaces
import zeit.edit.block
class Citation(zeit.edit.block.SimpleElement):
area = zeit.content.ar... | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.cms.i18n import MessageFactory as _
import grokcore.component
import zeit.content.article.edit.block
import zeit.content.article.edit.interfaces
import zeit.edit.block
class Citation(zeit.edit.block.SimpleElement):
area = zeit.content.ar... | bsd-3-clause | Python |
849b9eb93220af324343facb5f83d112de952fa0 | Add note to docstring of `figure` and `figsize`. | tonysyu/mpltools,matteoicardi/mpltools | mpltools/util.py | mpltools/util.py | import matplotlib.pyplot as plt
__all__ = ['figure', 'figsize']
def figure(aspect_ratio=1.3, scale=1, width=None, *args, **kwargs):
"""Return matplotlib figure window.
Calculate figure height using `aspect_ratio` and *default* figure width.
Parameters
----------
aspect_ratio : float
As... | import matplotlib.pyplot as plt
__all__ = ['figure', 'figsize']
def figure(aspect_ratio=1.3, scale=1, width=None, *args, **kwargs):
"""Return matplotlib figure window.
Parameters
----------
aspect_ratio : float
Aspect ratio, width / height, of figure.
scale : float
Scale default... | bsd-3-clause | Python |
8e9c153f375ed2d84a112e4c38dbfe91f15399ba | delete the node from BST | bkpathak/Programs-Collections,bkpathak/HackerRank-Problems,bkpathak/HackerRank-Problems,bkpathak/Programs-Collections | python/tree/delete_bst_node.py | python/tree/delete_bst_node.py | # Delete the node from the tree
# Approach
# If node is leaf Node: Detach the node and update the deletd parent child with
# null
# Node to be deleted with only one Node: Connect the parent with chile and
# remove the node
# Node to be deletd having two child: Replace the mode to be deletd with the
# minimum value from... | # Delete the node from the tree
# Approach
# If node is leaf Node: Detach the node and update the deletd parent child with
# null
# Node to be deleted with only one Node: Connect the parent with chile and
# remove the node
| mit | Python |
c6f3175c00a7e2b30e4ff5ab0e61c39967366c81 | Remove messages that were removed at pyflakes 2.5.0 | klen/pylama | pylama/lint/pylama_pyflakes.py | pylama/lint/pylama_pyflakes.py | """Pyflakes support."""
from pyflakes import checker
from pylama.context import RunContext
from pylama.lint import LinterV2 as Abstract
m = checker.messages
CODES = {
m.UnusedImport.message: "W0611",
m.RedefinedWhileUnused.message: "W0404",
m.ImportShadowedByLoopVar.message: "W0621",
m.ImportStarUsed... | """Pyflakes support."""
from pyflakes import checker
from pylama.context import RunContext
from pylama.lint import LinterV2 as Abstract
m = checker.messages
CODES = {
m.UnusedImport.message: "W0611",
m.RedefinedWhileUnused.message: "W0404",
m.RedefinedInListComp.message: "W0621",
m.ImportShadowedByLo... | mit | Python |
4ab994b2eea8c6ba7bcf85345f47e1658befcda6 | Refactor bottle html generation. | neilvallon/pyMap | app.py | app.py | from bottle import *
import matplotlib.pyplot as plt
import random, math, os, cStringIO
from datetime import datetime
from MapGenerator import *
def buildHTMLMap(seed, width, height):
tstart = datetime.now()
m = MapGenerator(int(width), int(height), str(seed))
#m.makeRandom().smooth().smooth().smooth().removeIsla... | from bottle import *
import matplotlib.pyplot as plt
import random, math, os, cStringIO
from datetime import datetime
from MapGenerator import *
@get('/img/<filename:re:.*\.(jpg|png|gif|ico)>')
def images(filename):
return static_file(filename, root='static/img')
@route('/<seed>.png')
def index(seed=300):
resp... | mit | Python |
25452cf43033603f3894a6273013a28e4269b27e | Fix naming | JokerQyou/bot | app.py | app.py | # coding: utf-8
import json
import flask
from flask import request
import redis
from redis_wrap import get_hash, get_list
import telegram
from utils import *
import botcommands
__name__ = u'eth0_bot'
__author__ = u'Joker_Qyou'
__config__ = u'config.json'
app = flask.Flask(__name__)
app.debug = True
with open(__con... | # coding: utf-8
import json
import flask
from flask import request
import redis
from redis_wrap import get_hash, get_list
import telegram
from utils import *
import botcommands
__name__ = u'eth0_bot'
__author__ = u'Joker_Qyou'
__config__ = u'config.json'
app = flask.Flask(__name__)
app.debug = True
with open(__con... | bsd-2-clause | Python |
fef12d2a5cce5c1db488a4bb11b9c21b83a66cab | Update JSONGeneratorEncoder to subclass DjangoJSONEncoder This handles Decimals and datetimes | murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado | avocado/export/_json.py | avocado/export/_json.py | import inspect
from django.core.serializers.json import DjangoJSONEncoder
from _base import BaseExporter
class JSONGeneratorEncoder(DjangoJSONEncoder):
"Handle generator objects and expressions."
def default(self, obj):
if inspect.isgenerator(obj):
return list(obj)
return super(JSO... | import json
import inspect
from _base import BaseExporter
class JSONGeneratorEncoder(json.JSONEncoder):
"Handle generator objects and expressions."
def default(self, obj):
if inspect.isgenerator(obj):
return list(obj)
return super(JSONGeneratorEncoder, self).default(obj)
class JS... | bsd-2-clause | Python |
2aafff0dbdc32a92b492fb3e5206e16cba4865d2 | add unicode methods to all models, add cups_left method to Beer | philips/tapkick,philips/tapkick,philips/tapkick,philips/tapkick,philips/tapkick | web/webapp/beer/models.py | web/webapp/beer/models.py | from django.db import models
from beer_types import BEER_TYPE_CHOICES
TAP_NUMBER_CHOICES = (
(1, 'Tap number 1'),
(2, 'Tap number 2'),
)
class Beer(models.Model):
beer_type = models.CharField(max_length=3, choices=BEER_TYPE_CHOICES)
name = models.CharField(max_length=255)
start_date = models.DateT... | from django.db import models
from beer_types import BEER_TYPE_CHOICES
TAP_NUMBER_CHOICES = (
(1, 'Tap number 1'),
(2, 'Tap number 2'),
)
class Beer(models.Model):
beer_type = models.CharField(max_length=3, choices=BEER_TYPE_CHOICES)
name = models.CharField(max_length=255)
start_date = models.DateT... | bsd-2-clause | Python |
f7fac123bf72af01272bc27a1dfabb788f611908 | Update LogOnlySMTPBackend docstring. Not only admin emails are allowed, all approved emails are still sent. | caktus/django-email-bandit,caktus/django-email-bandit | bandit/backends/smtp.py | bandit/backends/smtp.py | from __future__ import unicode_literals
from django.core.mail.backends.smtp import EmailBackend as SMTPBackend
from bandit.backends.base import HijackBackendMixin, LogOnlyBackendMixin
class HijackSMTPBackend(HijackBackendMixin, SMTPBackend):
"""
This backend intercepts outgoing messages drops them to a sing... | from __future__ import unicode_literals
from django.core.mail.backends.smtp import EmailBackend as SMTPBackend
from bandit.backends.base import HijackBackendMixin, LogOnlyBackendMixin
class HijackSMTPBackend(HijackBackendMixin, SMTPBackend):
"""
This backend intercepts outgoing messages drops them to a sing... | bsd-3-clause | Python |
99c494ae8a3def1320f97a1da0d614d611ebfeaa | Fix app context | klen/tweetchi | base/tweetchi/celery.py | base/tweetchi/celery.py | from __future__ import absolute_import
from celery import Celery
from ..app import create_app
from .tweetchi import tweetchi
app = create_app()
ctx = app.test_request_context()
ctx.push()
celery = Celery('tweetchi')
celery.config_from_object(dict(
BROKER_URL='redis://localhost:6379/0',
CELERYBEAT_SCHEDULE=... | from __future__ import absolute_import
from celery import Celery
from ..app import create_app
from .tweetchi import tweetchi
app = create_app()
celery = Celery('tweetchi')
celery.config_from_object(dict(
BROKER_URL='redis://localhost:6379/0',
CELERYBEAT_SCHEDULE={
'tweetchi-beat': {
'tas... | bsd-3-clause | Python |
18c7b4f8984e950ccae00d8893d1e2a8dfb5c72d | Make cli.py work outside auction dir | znewman01/silent-auction | cli.py | cli.py | import pickle
import requests
import sys
from auction.crypto import User
def register(server, user, auction_id):
url = 'http://{}/auctions/{}/register'.format(server, auction_id)
payload = {'public_key': pickle.dumps(user.export_key())}
json = requests.post(url, data=payload).json()
return pickle.load... | import pickle
import requests
import sys
from crypto import User
def register(server, user, auction_id):
url = 'http://{}/auctions/{}/register'.format(server, auction_id)
payload = {'public_key': pickle.dumps(user.export_key())}
json = requests.post(url, data=payload).json()
return pickle.loads(json['... | mit | Python |
8903aa3e0ff74ccaea599347bdb90bb25a96aaea | simplify importing | rr-/dotfiles,rr-/dotfiles,rr-/dotfiles | libdotfiles/__main__.py | libdotfiles/__main__.py | #!/usr/bin/env python3
import os
import typing as T
from pathlib import Path
import click
from libdotfiles import logging
from libdotfiles.util import REPO_ROOT_DIR
class PathPath(click.Path):
"""A Click path argument that returns a pathlib Path, not a string."""
def convert(self, value: T.Any, param: T.An... | #!/usr/bin/env python3
import importlib
import os
import typing as T
from pathlib import Path
import click
from libdotfiles import logging
from libdotfiles.util import REPO_ROOT_DIR
class PathPath(click.Path):
"""A Click path argument that returns a pathlib Path, not a string."""
def convert(self, value: T... | mit | Python |
527593c5f183054e330894e6b7161e24cca265a5 | Fix so testdata can be loaded when setting up local environment | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily | lily/notes/factories.py | lily/notes/factories.py | import random
from datetime import datetime
import pytz
import factory
from factory.declarations import SubFactory, SelfAttribute, LazyAttribute
from factory.django import DjangoModelFactory
from faker.factory import Factory
from lily.accounts.factories import AccountFactory
from lily.contacts.factories import Contac... | import random
import factory
from factory.declarations import SubFactory, SelfAttribute, LazyAttribute
from factory.django import DjangoModelFactory
from faker.factory import Factory
from lily.accounts.factories import AccountFactory
from lily.contacts.factories import ContactFactory
from lily.users.factories import ... | agpl-3.0 | Python |
d83e61b7ec5c8bec137476b6af855231520678b7 | Update ipc_lista1.16.py | any1m1c/ipc20161 | lista1/ipc_lista1.16.py | lista1/ipc_lista1.16.py | #ipc_lista1.16
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa para uma loja de tintas. O programa deverá pedir o tamanho em metros quadrados da área a ser pintada. Considere que a cobertura da tinta é de 1 litro para cada 3 metros quadrados e que a tinta é vendida em latas de 18 ... | #ipc_lista1.16
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa para uma loja de tintas. O programa deverá pedir o tamanho em metros quadrados da área a ser pintada. Considere que a cobertura da tinta é de 1 litro para cada 3 metros quadrados e que a tinta é vendida em latas de 18 ... | apache-2.0 | Python |
d8d02c82d6e5891703207836d48d6459fdc57d67 | Update ipc_lista2.04.py | any1m1c/ipc20161 | lista2/ipc_lista2.04.py | lista2/ipc_lista2.04.py | #ipc_lista2.04
#Professor: Jucimar Junior
#Any Mnedes Carvalho - 1615310044
#
#
#
#
#Faça um programa que verifique se uma letra digitada
| #ipc_lista2.04
#Professor: Jucimar Junior
#Any Mnedes Carvalho - 1615310044
#
#
#
#
#Faça um programa que verifique
| apache-2.0 | Python |
7ef22d764e1b799ddec952f4f27a23a88cba5320 | Update ipc_lista2.05.py | any1m1c/ipc20161 | lista2/ipc_lista2.05.py | lista2/ipc_lista2.05.py | #ipc_lista2.05
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa para a leitura de duas notas parciais de um aluno. O programa deve calcular a média alcançada por aluno e apresentar:
#--A mensagem "Aprovado"
#--A mensagem "Reprovado'
#--A mensagem "Aprovado"
| #ipc_lista2.05
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa para a leitura de duas notas parciais de um aluno. O programa deve calcular a média alcançada por aluno e apresentar:
#--A mensagem "Aprovado"
#--A mensagem "Reprovado'
#--A mensagem
| apache-2.0 | Python |
a2df28245fc1bf6a7b79de1824828e2750f429b0 | Update ipc_lista2.05.py | any1m1c/ipc20161 | lista2/ipc_lista2.05.py | lista2/ipc_lista2.05.py | #ipc_lista2.05
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa para a leitura de duas notas parciais de um aluno. O programa deve calcular a média alcançada por aluno e apresentar:
#--A mensagem "Aprovado", se a média alcançada for maior ou igual a sete;
#--A mensagem "Reprovado"... | #ipc_lista2.05
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa para a leitura de duas notas parciais de um aluno. O programa deve calcular a média alcançada por aluno e apresentar:
#--A mensagem "Aprovado", se a média alcançada for maior ou igual a sete;
#--A mensagem "Reprovado"... | apache-2.0 | Python |
1cc1fb68724070aee795370c702f8aa7c2580aee | Change database region migration detail frindly status | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/region_migration/admin/databaseregionmigrationdetail.py | dbaas/region_migration/admin/databaseregionmigrationdetail.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django_services import admin
from ..service.databaseregionmigrationdetail import DatabaseRegionMigrationDetailService
from .. import models
import logging
from django.utils.html import format_html
LOG = logging.getLogger(__name__)
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django_services import admin
from ..service.databaseregionmigrationdetail import DatabaseRegionMigrationDetailService
from .. import models
import logging
from django.utils.html import format_html
LOG = logging.getLogger(__name__)
... | bsd-3-clause | Python |
8f427800d8d1ff99a7284f86b078f1aedf531db5 | Use NO_LOGIN_TYPE constant | ticklemepierce/osf.io,asanfilippo7/osf.io,TomHeatwole/osf.io,GageGaskins/osf.io,haoyuchen1992/osf.io,mfraezz/osf.io,laurenrevere/osf.io,alexschiller/osf.io,mattclark/osf.io,felliott/osf.io,mluke93/osf.io,monikagrabowska/osf.io,KAsante95/osf.io,chrisseto/osf.io,KAsante95/osf.io,doublebits/osf.io,TomHeatwole/osf.io,aaxel... | website/mails/presends.py | website/mails/presends.py | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from modularodm import Q
from website import settings
def no_addon(email):
return len(email.user.get_addons()) == 0
def no_login(email):
from website.models import QueuedMail, NO_LOGIN_TYPE
sent = QueuedMail.find(Q('user', 'eq', email.user)... | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from modularodm import Q
from website import settings
def no_addon(email):
return len(email.user.get_addons()) == 0
def no_login(email):
from website.models import QueuedMail
sent = QueuedMail.find(Q('user', 'eq', email.user) & Q('email_typ... | apache-2.0 | Python |
d1555cb34887e12124e7e2910b17e805617f4d44 | Remove redundant line | kbase/auth,olsonanl/kbauth,kbase/auth,PATRIC3/auth,olsonanl/auth,PATRIC3/auth,PATRIC3/auth,olsonanl/kbauth,olsonanl/auth,kbase/auth,mmundy42/auth,mmundy42/auth,olsonanl/auth,olsonanl/kbauth,mmundy42/auth,mmundy42/auth,olsonanl/kbauth,olsonanl/auth,olsonanl/kbauth,PATRIC3/auth,olsonanl/auth,PATRIC3/auth,kbase/auth,kbase... | python-libs/get_nexus_token.py | python-libs/get_nexus_token.py | #!/usr/bin/env python
# get_nexus_token.py
#
# Installation requirements:
# 1. Globus Online account - register at globusonline.org with
# a username and password
# 2. httplib2 - run `easy_install httplib2`
#
# usage: get_nexus_token.py [-h] [-u USERNAME] [-p PASSWORD] [-s URL]
#
# Get Nexus Token wit... | #!/usr/bin/env python
# get_nexus_token.py
#
# Installation requirements:
# 1. Globus Online account - register at globusonline.org with
# a username and password
# 2. httplib2 - run `easy_install httplib2`
#
# usage: get_nexus_token.py [-h] [-u USERNAME] [-p PASSWORD] [-s URL]
#
# Get Nexus Token wit... | mit | Python |
f0d71dc2d6027158ab883ddabb83af20996108ba | remove unused import | monetate/sqlalchemy,WinterNis/sqlalchemy,davidfraser/sqlalchemy,sqlalchemy/sqlalchemy,wujuguang/sqlalchemy,hsum/sqlalchemy,ThiefMaster/sqlalchemy,bdupharm/sqlalchemy,pdufour/sqlalchemy,halfcrazy/sqlalchemy,inspirehep/sqlalchemy,wfxiang08/sqlalchemy,276361270/sqlalchemy,graingert/sqlalchemy,olemis/sqlalchemy,elelianghh/... | test/conftest.py | test/conftest.py | #!/usr/bin/env python
"""
pytest plugin script.
This script is an extension to py.test which
installs SQLAlchemy's testing plugin into the local environment.
"""
import sys
from os import path
for pth in ['../lib']:
sys.path.insert(0, path.join(path.dirname(path.abspath(__file__)), pth))
from sqlalchemy.testing... | #!/usr/bin/env python
"""
pytest plugin script.
This script is an extension to py.test which
installs SQLAlchemy's testing plugin into the local environment.
"""
import sys
import imp
from os import path
for pth in ['../lib']:
sys.path.insert(0, path.join(path.dirname(path.abspath(__file__)), pth))
from sqlalch... | mit | Python |
245dd2ef403cd88aebf5dd8923585a9e0489dd97 | Change UNSET to so bool(UNSET) is False. | shakefu/MongoAlchemy,shakefu/MongoAlchemy,shakefu/MongoAlchemy | mongoalchemy/util.py | mongoalchemy/util.py | # The MIT License
#
# Copyright (c) 2010 Jeffrey Jenkins
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | # The MIT License
#
# Copyright (c) 2010 Jeffrey Jenkins
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | mit | Python |
1a8ecc6911d9e6d20ed95c35b347674ad0fdb830 | make scheme private | mylokin/mongoext | mongoext/document.py | mongoext/document.py | from __future__ import absolute_import
import mongoext.collection
import mongoext.scheme
import mongoext.exc
class MetaDocument(type):
def __new__(cls, name, bases, attrs):
fields = {}
for base in bases:
for attr, obj in vars(base).iteritems():
if issubclass(type(obj),... | from __future__ import absolute_import
import mongoext.collection
import mongoext.scheme
import mongoext.exc
class MetaDocument(type):
def __new__(cls, name, bases, attrs):
fields = {}
for base in bases:
for attr, obj in vars(base).iteritems():
if issubclass(type(obj),... | mit | Python |
b940919ddc4cbe3d372a70873ca8ed68ff24569c | add docs on descriptor | mylokin/mongoext | mongoext/document.py | mongoext/document.py | from __future__ import absolute_import
import weakref
import mongoext.collection
import mongoext.scheme
import mongoext.exc
class AbstractField(object):
def __init__(self, field):
self.field = field
self.data = weakref.WeakKeyDictionary()
def __get__(self, instance, owner):
# every ... | from __future__ import absolute_import
import weakref
import mongoext.collection
import mongoext.scheme
import mongoext.exc
class AbstractField(object):
def __init__(self, field):
self.field = field
self.data = weakref.WeakKeyDictionary()
def __get__(self, instance, owner):
return s... | mit | Python |
3662a029cf3468d2c7d71e5a22d43f66250dbc25 | Add integration test to check that YouTube API errors exit | garg10may/yturl | tests/integration_tests.py | tests/integration_tests.py | #!/usr/bin/env python2
import os
import yturl
from nose.tools import assert_raises, eq_ as eq
from mock import patch
@patch("yturl.urlopen")
def test_quality_as_word_ok(urlopen_mock):
good_f = open(os.path.join(os.path.dirname(__file__), "files/good"), "rb")
urlopen_mock.return_value = good_f
chosen_uri ... | #!/usr/bin/env python2
import os
import yturl
from nose.tools import assert_raises, eq_ as eq
from mock import patch
@patch("yturl.urlopen")
def test_quality_as_word_ok(urlopen_mock):
good_f = open(os.path.join(os.path.dirname(__file__), "files/good"), "rb")
urlopen_mock.return_value = good_f
chosen_uri ... | isc | Python |
5d55603049dd4294027d6c2d2ba17f9b44650678 | Upgrade TensorFlow to 1.15.4 | google/mozc-devices,google/mozc-devices | mozc-nazoru/setup.py | mozc-nazoru/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 | Python |
1c153ac1e4f7e10c641d6524a19f664923041d52 | Update hash_db_password.py | dpgaspar/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,qpxu007/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,rpiotti/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Fla... | bin/hash_db_password.py | bin/hash_db_password.py | import sys
from werkzeug.security import generate_password_hash
from flask_appbuilder.security.models import User
try:
from app import app, db
except:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
if len(sys.argv) < 2:
print "Without typical app structure use parameter t... | import sys
from werkzeug.security import generate_password_hash
from flask_appbuilder.security.models import User
try:
from app import app, db
except:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
if len(sys.argv) < 2:
print "Without typical app structure use parameter t... | bsd-3-clause | Python |
d3fec93476458d4f84732a3dd297e548713f6244 | Update integration.modules.test_network.NetworkTest.test_network_ping test address | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/test_network.py | tests/integration/modules/test_network.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
# Import Salt Libs
import salt.utils
URL = 'google-public-dns-a.google.com'
class NetworkTest(ModuleCase):
'''
Vali... | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
# Import Salt Libs
import salt.utils
URL = 'repo.saltstack.com'
class NetworkTest(ModuleCase):
'''
Validate network... | apache-2.0 | Python |
356bb11ad8d8c9b40e03e27c23126911ec7aa844 | Add host to CORS | erikiado/jp2_online,erikiado/jp2_online,erikiado/jp2_online | jp2_online/settings/production.py | jp2_online/settings/production.py | # -*- coding: utf-8 -*-
from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['138.197.197.47', 'junipero.erikiado.com']
CORS_ORIGIN_WHITELIST = ('138.197.197.47', 'junipero.erikiado.com')
STATIC_ROOT = os.path.join(BASE_DIR, "../static/") | # -*- coding: utf-8 -*-
from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['138.197.197.47', 'junipero.erikiado.com']
CORS_ORIGIN_WHITELIST = ('138.197.197.47')
STATIC_ROOT = os.path.join(BASE_DIR, "../static/") | mit | Python |
c5133b062dc78d6b673772357e10c2726b89de64 | use callback re-routing to parralelize dogpile | graingert/reportificate,chrissorchard/malucrawl,chrissorchard/malucrawl,graingert/reportificate | malware_crawl/search.py | malware_crawl/search.py | import requests
from urlparse import urlparse, parse_qs
import lxml.html
import itertools
from celery import task, chord, group, chain
from six.moves import map
from django.conf import settings
def dogpile_link_handle(url):
# parse the click handler from dogpile to get the real URL
return parse_qs(urlparse(... | import requests
from urlparse import urlparse, parse_qs
import lxml.html
import itertools
from celery import task
from six.moves import map
from django.conf import settings
def dogpile_link_handle(url):
# parse the click handler from dogpile to get the real URL
return parse_qs(urlparse(url).query)["du"][0]
... | mit | Python |
cda7a6535bd7ccd20037761da211235542bed5d6 | Revert [8799]. That wasn't ready for prime-time yet -- thanks, git-svn! | adieu/django-nonrel,adieu/django-nonrel,adieu/django-nonrel | tests/regressiontests/datatypes/models.py | tests/regressiontests/datatypes/models.py | """
This is a basic model to test saving and loading boolean and date-related
types, which in the past were problematic for some database backends.
"""
from django.db import models
from django.conf import settings
class Donut(models.Model):
name = models.CharField(max_length=100)
is_frosted = models.BooleanFi... | """
This is a basic model to test saving and loading boolean and date-related
types, which in the past were problematic for some database backends.
"""
from django.db import models
from django.conf import settings
class Donut(models.Model):
name = models.CharField(max_length=100)
is_frosted = models.BooleanFi... | bsd-3-clause | Python |
431444d1eed6da189225802a2d75bce2f35efc27 | Remove print statement | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | tests/rnacentral/r2dt/should_show_test.py | tests/rnacentral/r2dt/should_show_test.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2021] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2021] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | apache-2.0 | Python |
3b50b38ff71c2a35376eccfffbba700815868e68 | Disable debug mode in default configuration. | jaapverloop/massa | massa/default_config.py | massa/default_config.py | # -*- coding: utf-8 -*-
DEBUG = False
SECRET_KEY = '##CHANGEME##'
SQLALCHEMY_DATABASE_URI = 'postgresql://massa:secret@localhost/massa'
SQLALCHEMY_ECHO = False
| # -*- coding: utf-8 -*-
DEBUG = True
SECRET_KEY = '##CHANGEME##'
SQLALCHEMY_DATABASE_URI = 'postgresql://massa:secret@localhost/massa'
SQLALCHEMY_ECHO = False
| mit | Python |
2e532777809dcc27d562f7c17783ad604cd08706 | Clean up the core keys generator script | GNOME/grilo,GNOME/grilo | tools/grilo-inspect/generate_core_keys.py | tools/grilo-inspect/generate_core_keys.py | #
# generate_core_keys.py
#
# Author: Juan A. Suarez Romero <jasuarez@igalia.com>
#
# Copyright (C) 2016 Igalia S.L.
#
# Generates a .c file containing an array with the core keys
#
import re
import sys
COMMENT_RE = re.compile(
r'''
//.*?$ | /\*.*?\*/ | \'(?:\\. | [^\\\'])*\' | "(?:\\. | [^\\"])*"
''',
... | #
# generate_core_keys.py
#
# Author: Juan A. Suarez Romero <jasuarez@igalia.com>
#
# Copyright (C) 2016 Igalia S.L.
#
# Generates a .c file containing an array with the core keys
#
import re
import sys
# From https://stackoverflow.com/a/241506
def comment_remover(text):
def replacer(match):
s = match.gro... | lgpl-2.1 | Python |
24b2701fc5ebacf617807043dc8dc5f6a59fe1ab | Fix failing py33 test | sloria/webargs,nealrs/webargs,jmcarp/webargs,jmcarp/webargs,yufeiminds/webargs,Basis/webargs,stas/webargs,hyunchel/webargs | tests/test_bottleparser.py | tests/test_bottleparser.py | # -*- coding: utf-8 -*-
import mock
import pytest
from bottle import Bottle, debug, request, response
from webtest import TestApp
from webargs import Arg
from webargs.bottleparser import BottleParser
from .compat import text_type, b
hello_args = {
'name': Arg(text_type, default='World', validate=lambda n: len(n... | # -*- coding: utf-8 -*-
import mock
import pytest
from bottle import Bottle, debug, request, response
from webtest import TestApp
from webargs import Arg
from webargs.bottleparser import BottleParser
from .compat import text_type, b
hello_args = {
'name': Arg(text_type, default='World', validate=lambda n: len(n... | mit | Python |
c46184f9147309b052e2e793fcb4eaed00afccde | break up test_foreign_keys into parts | eywalker/datajoint-python,dimitri-yatsenko/datajoint-python,datajoint/datajoint-python | tests/test_foreign_keys.py | tests/test_foreign_keys.py | from nose.tools import assert_equal, assert_false, assert_true, raises
from datajoint.declare import declare
from datajoint import DataJointError
from . import schema_advanced
@raises(DataJointError) # TODO: remove after fixing issue #300
def test_aliased_fk():
person = schema_advanced.Person()
parent = ... | from nose.tools import assert_equal, assert_false, assert_true, raises
from datajoint.declare import declare
from datajoint import DataJointError
from . import schema_advanced
@raises(DataJointError) # TODO: remove after fixing issue #300
def test_aliased_fk():
person = schema_advanced.Person()
parent = ... | lgpl-2.1 | Python |
2cde32cbf83529c456853d8021fe50c79bfe3bdf | resolve text-export | openconnectome/ndio,jhuapl-boss/intern,neurodata/ndio,neurodata/ndio,neurodata/ndio | tests/test_image_export.py | tests/test_image_export.py | import unittest
import ndio.remote.OCP as OCP
import ndio.ramon
import ndio.convert.png as ndpng
import ndio.convert.tiff as ndtiff
import numpy
class TestDownload(unittest.TestCase):
def setUp(self):
self.oo = OCP()
def test_export_import_png(self):
# kasthuri11/image/xy/3/1000,1100/1000,11... | import unittest
import ndio.remote.OCP as OCP
import ndio.ramon
import ndio.convert.png as ndpng
import ndio.convert.tiff as ndtiff
import numpy
class TestDownload(unittest.TestCase):
def setUp(self):
self.oo = OCP()
def test_export_import_png(self):
# kasthuri11/image/xy/3/1000,1100/1000,11... | apache-2.0 | Python |
fb46a9f7bdd6f8385922b89e84d2f0f5927396cd | Add another boring section. | flupzor/newsdiffs,flupzor/bijgeschaafd,flupzor/newsdiffs,flupzor/newsdiffs,flupzor/bijgeschaafd,flupzor/bijgeschaafd,flupzor/newsdiffs,flupzor/bijgeschaafd | news/parsers/nunl.py | news/parsers/nunl.py | from pyquery import PyQuery as pq
import lxml
from baseparser import BaseParser
from .utils import html_to_text
class NuNLParser(BaseParser):
SUFFIX = ''
domains = ['www.nu.nl']
feeder_base = 'http://www.nu.nl/'
feeder_pat = '^http://www.nu.nl/\w+/\d+/'
feeder_pages = ['http://www.nu.nl/', ]
... | from pyquery import PyQuery as pq
import lxml
from baseparser import BaseParser
from .utils import html_to_text
class NuNLParser(BaseParser):
SUFFIX = ''
domains = ['www.nu.nl']
feeder_base = 'http://www.nu.nl/'
feeder_pat = '^http://www.nu.nl/\w+/\d+/'
feeder_pages = ['http://www.nu.nl/', ]
... | mit | Python |
9694ec300020cb6c194eeb14c9521b3c5f31b4dd | Update test to use repo_name | tony/libvcs | tests/test_hg.py | tests/test_hg.py | # -*- coding: utf-8 -*-
"""Tests for libvcs hg repos."""
from __future__ import absolute_import, print_function, unicode_literals
import os
import pytest
from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import run, which
if not which('hg'):
pytestmark = pytest.mark.skip(reason="hg is not a... | # -*- coding: utf-8 -*-
"""Tests for libvcs hg repos."""
from __future__ import absolute_import, print_function, unicode_literals
import os
import pytest
from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import run, which
if not which('hg'):
pytestmark = pytest.mark.skip(reason="hg is not a... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.