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 |
|---|---|---|---|---|---|---|---|---|
ed59e09152cabef7fb401cbe6be9c10da5824533 | remove redundant import in rsa.py | hasadna/anyway,hasadna/anyway,hasadna/anyway,hasadna/anyway | anyway/parsers/rsa.py | anyway/parsers/rsa.py | # -*- coding: utf-8 -*-
import json
from ..constants import CONST
from ..models import AccidentMarker
from ..utilities import init_flask
from .utils import batch_iterator
from flask_sqlalchemy import SQLAlchemy
from openpyxl import load_workbook
from dateutil import parser
def _iter_rows(filename):
workbook = loa... | # -*- coding: utf-8 -*-
import json
from ..constants import CONST
from ..models import AccidentMarker
from ..utilities import init_flask
from .utils import batch_iterator
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from openpyxl import load_workbook
from dateutil import parser
def _iter_rows... | mit | Python |
da32344e42ae14b13368b473a77bff74cdc900ca | Fix add_edge in MixInParallelRunner.create_graph | tkf/buildlet | buildlet/runner/mixinparallel.py | buildlet/runner/mixinparallel.py | import itertools
import networkx as nx
from .simple import primitive_run
class MixInParallelRunner(object):
def run_parent(self, task):
self.create_graph(task)
self.submit_tasks()
self.wait_tasks()
def create_graph(self, task):
self.graph = graph = nx.DiGraph()
self... | import itertools
import networkx as nx
from .simple import primitive_run
class MixInParallelRunner(object):
def run_parent(self, task):
self.create_graph(task)
self.submit_tasks()
self.wait_tasks()
def create_graph(self, task):
self.graph = graph = nx.DiGraph()
self... | bsd-3-clause | Python |
ac204b2ab4a07113e040b04fe7dd2c59cd31ffcd | fix up device names | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | distro/rbuilderstorage.py | distro/rbuilderstorage.py | #
# Copyright (c) 2011 rPath Inc.
#
import os
from amiconfig.errors import *
from amiconfig.lib import util
from amiconfig.lib import spacedaemon
from amiconfig.plugin import AMIPlugin
class AMIConfigPlugin(AMIPlugin):
name = 'rbuilderstorage'
def configure(self):
"""
[rbuilderstorage]
... | #
# Copyright (c) 2011 rPath Inc.
#
import os
from amiconfig.errors import *
from amiconfig.lib import util
from amiconfig.lib import spacedaemon
from amiconfig.plugin import AMIPlugin
class AMIConfigPlugin(AMIPlugin):
name = 'rbuilderstorage'
def configure(self):
"""
[rbuilderstorage]
... | apache-2.0 | Python |
fb20dc78787c92952c4d27301b3db726cf829dee | Update twitter url regex | billyvg/piebot | modules/urlparser/twitter.py | modules/urlparser/twitter.py | import re
import urllib2
import traceback
try:
import simplejson as json
except ImportError:
import json
class Twitter(object):
"""Checks incoming messages for Twitter urls and calls the Twitter API to
retrieve the tweet.
TODO:
Implement commands for Twitter functionality
"""
pa... | import re
import urllib2
import traceback
try:
import simplejson as json
except ImportError:
import json
class Twitter(object):
"""Checks incoming messages for Twitter urls and calls the Twitter API to
retrieve the tweet.
TODO:
Implement commands for Twitter functionality
"""
pa... | mit | Python |
c359768e257a7bcbfe93e137a0fc1e81b92d6573 | Update bitonic_sort with type hints, doctest, snake_case names (#4016) | TheAlgorithms/Python | sorts/bitonic_sort.py | sorts/bitonic_sort.py | """
Python program for Bitonic Sort.
Note that this program works only when size of input is a power of 2.
"""
from typing import List
def comp_and_swap(array: List[int], index1: int, index2: int, direction: int) -> None:
"""Compare the value at given index1 and index2 of the array and swap them as per
the g... | # Python program for Bitonic Sort. Note that this program
# works only when size of input is a power of 2.
# The parameter dir indicates the sorting direction, ASCENDING
# or DESCENDING; if (a[i] > a[j]) agrees with the direction,
# then a[i] and a[j] are interchanged.
def compAndSwap(a, i, j, dire):
if (dire == ... | mit | Python |
f4008376c8ccd361250b8350a10afb9227c5c166 | add parser stubs | theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs | bulbs/instant_articles/parser.py | bulbs/instant_articles/parser.py | from bs4 import BeautifulSoup
def has_attr(attr):
def inner_has_attr(tag):
return tag.has_attr(attr)
return inner_has_attr
def parse_betty(tag):
if (tag.name == 'div' and
'image' in tag.get('class', {}) and
tag.attrs['data-type'] == 'image' and
tag.has_attr('data-... | from bs4 import BeautifulSoup
def has_attr(attr):
def inner_has_attr(tag):
return tag.has_attr(attr)
return inner_has_attr
def parse_betty(tag):
if (tag.name == 'div' and
'image' in tag.get('class', {}) and
tag.attrs['data-type'] == 'image' and
tag.has_attr('data-... | mit | Python |
23c03e69dc4a20b1ee61b02f6826bb0e13acc1e6 | Adjust arguments in function call | homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps | byceps/services/email/service.py | byceps/services/email/service.py | """
byceps.services.email.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import List, Optional
from ... import email
from ...typing import BrandID
from ...util.jobqueue import enqueue
from .models import EmailConfig
... | """
byceps.services.email.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import List, Optional
from ... import email
from ...typing import BrandID
from ...util.jobqueue import enqueue
from .models import EmailConfig
... | bsd-3-clause | Python |
787abe44ca65fb879ef8a6534bdf671d01f8a045 | Fix test runner importing wrong module. | wearehoods/django-model-publisher-ai,wearehoods/django-model-publisher-ai,wearehoods/django-model-publisher-ai,jp74/django-model-publisher,jp74/django-model-publisher,jp74/django-model-publisher | runtests.py | runtests.py | import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
ROOT_URLCONF='publisher.urls',
INSTALLED_APPS=[
... | import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
ROOT_URLCONF='publisher.urls',
INSTALLED_APPS=[
... | bsd-3-clause | Python |
bccc963950f764666f06f30c94bc0059ebcc330c | Revert "Remove unused method" | puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/ui/fields.py | corehq/apps/userreports/ui/fields.py | import json
from django import forms
from django.utils.translation import ugettext as _
from corehq.apps.userreports.models import DataSourceConfiguration
from corehq.apps.userreports.ui.widgets import JsonWidget
class ReportDataSourceField(forms.ChoiceField):
def __init__(self, domain, *args, **kwargs):
... | import json
from django import forms
from django.utils.translation import ugettext as _
from corehq.apps.userreports.models import DataSourceConfiguration
from corehq.apps.userreports.ui.widgets import JsonWidget
class ReportDataSourceField(forms.ChoiceField):
def __init__(self, domain, *args, **kwargs):
... | bsd-3-clause | Python |
bc3f76d4af716f272f74e39958d22a092bc83939 | Add support for payment method mealvoucher | mollie/mollie-api-python | mollie/api/objects/method.py | mollie/api/objects/method.py | from .base import Base
from .issuer import Issuer
from .list import List
class Method(Base):
@classmethod
def get_resource_class(cls, client):
from ..resources.methods import Methods
return Methods(client)
BANCONTACT = 'bancontact'
BANKTRANSFER = 'banktransfer'
BELFIUS = 'belfius'... | from .base import Base
from .issuer import Issuer
from .list import List
class Method(Base):
@classmethod
def get_resource_class(cls, client):
from ..resources.methods import Methods
return Methods(client)
BANCONTACT = 'bancontact'
BANKTRANSFER = 'banktransfer'
BELFIUS = 'belfius'... | bsd-2-clause | Python |
edbe729f14cbb2d1c3212f2bc935bd5823b58c65 | Add missing import in fields.py | ulule/django-courriers,ulule/django-courriers | courriers/fields.py | courriers/fields.py | from django.forms.fields import MultipleChoiceField
from django.core import validators
from django.db import models
from django.core import exceptions
class SeparatedValuesField(models.CharField):
__metaclass__ = models.SubfieldBase
def __init__(self, *args, **kwargs):
self.token = kwargs.pop('token'... | from django.forms.fields import MultipleChoiceField
from django.core import validators
from django.db import models
class SeparatedValuesField(models.CharField):
__metaclass__ = models.SubfieldBase
def __init__(self, *args, **kwargs):
self.token = kwargs.pop('token', ',')
super(SeparatedValue... | mit | Python |
9a46c882766957be3489cd1092a66901ec45ea71 | Fix status on rebuild | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci | mrbelvedereci/build/views.py | mrbelvedereci/build/views.py | from datetime import datetime
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.http import HttpResponseForbidden
from django.shortcuts import get_object_or_404
from ansi2html import Ansi2HTMLConverter
from mrbelvedereci.build.models import Build
from mrbelvedereci.build.task... | from datetime import datetime
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.http import HttpResponseForbidden
from django.shortcuts import get_object_or_404
from ansi2html import Ansi2HTMLConverter
from mrbelvedereci.build.models import Build
from mrbelvedereci.build.task... | bsd-3-clause | Python |
d4b6546b1480ffead8335c1ddfd4e3db70f5a34d | use prefetch related to reduce query overhead | crateio/crate.web,crateio/crate.web | crate_project/apps/packages/views.py | crate_project/apps/packages/views.py | from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.detail import DetailView
from packages.models import Release
class ReleaseDetail(DetailView):
model = Release
queryset = Release.objects.filter(
... | from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.detail import DetailView
from packages.models import Release
class ReleaseDetail(DetailView):
model = Release
queryset = Release.objects.filter(d... | bsd-2-clause | Python |
c8783899f91064e0f20d50458004c9a00ead6233 | include created_at in host list | meganlkm/do-cli,meganlkm/do-cli | do_cli/commands/common.py | do_cli/commands/common.py | import click
from do_cli.cache import DO_CACHE
from do_cli.utils.helpers import str2list
from do_cli.utils.json_helpers import byteify
from do_cli.formatters import format_json
def format_response(data, pretty):
return format_json(byteify(data)) if pretty else byteify(data)
def get_objects(name, cache_max_age, ... | import click
from do_cli.cache import DO_CACHE
from do_cli.utils.helpers import str2list
from do_cli.utils.json_helpers import byteify
from do_cli.formatters import format_json
def format_response(data, pretty):
return format_json(byteify(data)) if pretty else byteify(data)
def get_objects(name, cache_max_age, ... | mit | Python |
5a1fd2207baf0a54039b630d341351038aeeb6ba | work around IE's caching. | apache/steve,apache/steve,apache/steve,apache/steve,apache/steve,apache/steve | pytest/www/cgi-bin/lib/response.py | pytest/www/cgi-bin/lib/response.py | #!/usr/bin/env python
import json
responseCodes = {
200: 'Okay',
201: 'Created',
206: 'Partial content',
304: 'Not Modified',
400: 'Bad Request',
403: 'Access denied',
404: 'Not Found',
410: 'Gone',
500: 'Server Error'
}
def respond(code, js):
c = responseCodes[... | #!/usr/bin/env python
import json
responseCodes = {
200: 'Okay',
201: 'Created',
206: 'Partial content',
304: 'Not Modified',
400: 'Bad Request',
403: 'Access denied',
404: 'Not Found',
410: 'Gone',
500: 'Server Error'
}
def respond(code, js):
c = responseCodes[... | apache-2.0 | Python |
68282ad2c60a679bfa4deefdc30cffb698954b1d | Add PyZinc import test for scenecoordinatesystem. Issue 3361. | hsorby/zinc,OpenCMISS/zinc,hsorby/zinc,OpenCMISS/zinc,OpenCMISS/zinc,OpenCMISS/zinc,hsorby/zinc,hsorby/zinc | python/import_tests/importtests.py | python/import_tests/importtests.py | import os, sys, unittest
class ImportTestCase(unittest.TestCase):
def testImportContext(self):
from zinc import context
def testImportDifferentialOperator(self):
from zinc import differentialoperator
def testImportElement(self):
from zinc import element
def testImpor... | import os, sys, unittest
class ImportTestCase(unittest.TestCase):
def testImportContext(self):
from zinc import context
def testImportDifferentialOperator(self):
from zinc import differentialoperator
def testImportElement(self):
from zinc import element
def testImpor... | mpl-2.0 | Python |
5ff4f1ad5e188eb8049527f9882a3a7d02485c19 | move 'load_op_library','LayerHelper' to 'paddle/incubate' (#30339) | luotao1/Paddle,luotao1/Paddle,PaddlePaddle/Paddle,luotao1/Paddle,PaddlePaddle/Paddle,luotao1/Paddle,luotao1/Paddle,PaddlePaddle/Paddle,PaddlePaddle/Paddle,PaddlePaddle/Paddle,luotao1/Paddle,PaddlePaddle/Paddle,luotao1/Paddle,PaddlePaddle/Paddle | python/paddle/incubate/__init__.py | python/paddle/incubate/__init__.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | apache-2.0 | Python |
a6a0e9cce63ac0a035e3655278d37d0a9f5c77d8 | Update examples/abstract.py. | brandjon/simplestruct | examples/abstract.py | examples/abstract.py | """Demonstrates how to combine Struct with abstract base classes."""
from abc import ABCMeta, abstractmethod
from simplestruct import Struct, Field, MetaStruct
class Abstract(metaclass=ABCMeta):
@abstractmethod
def foo(self):
pass
# If we ran this code
#
# class Concrete(Abstract, Struct):
# ... | # Illustrates how to combine Struct with abstract base classes.
from abc import ABCMeta, abstractmethod
from simplestruct import Struct, Field, MetaStruct
class Abstract(metaclass=ABCMeta):
@abstractmethod
def foo(self):
pass
# If we ran this code
#
# class Concrete(Abstract, Struct):
# f... | mit | Python |
e486374fb23ddd0274b89d040abfe7fe7ac93e93 | make dialog handler pull constants data from model | scrbrd/scoreboard,scrbrd/scoreboard | handlers/dialog.py | handlers/dialog.py | """ Module: dialog
Handle all incoming requests for dialog creation.
"""
from model.app.dialog import DialogModel
from handlers.query import QueryHandler
class CreateGameDialogHandler(QueryHandler):
""" Handle rendering the empty Create Game Dialog. """
def get_model(self):
""" Override avoids ... | """ Module: dialog
Handle all incoming requests for dialog creation.
"""
from handlers.query import QueryHandler
class CreateGameDialogHandler(QueryHandler):
""" Handle rendering the empty Create Game Dialog. """
def process_asynchronous_request(self):
""" Override forces the dialog to render sy... | mit | Python |
476ae823be57f12d757b00d1bf4938e0d49e9439 | Bump up version | smly/videolectures-dl | videolectures/__init__.py | videolectures/__init__.py | # -*- coding: utf-8 -*-
# ------
# License: MIT
# Copyright (c) 2013 Kohei Ozaki (eowenr atmark gmail dot com)
"""
init for videolectures
"""
__version__ = '2013.10.28'
| # -*- coding: utf-8 -*-
# ------
# License: MIT
# Copyright (c) 2013 Kohei Ozaki (eowenr atmark gmail dot com)
"""
init for videolectures
"""
__version__ = '2013.10.27'
| mit | Python |
96badef90e3d6e837f35d67f7fcc88c50033d954 | enable key management url | hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler | web_frontend/cloudscheduler/glintwebui/urls.py | web_frontend/cloudscheduler/glintwebui/urls.py | from django.conf.urls import url
from . import views
from .celery_app import image_collection
from .utils import check_collection_task, set_collection_task
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^project_details/(?P<group_name>.+)/$', views.project_details, name='project_details'),
# ... | from django.conf.urls import url
from . import views
from .celery_app import image_collection
from .utils import check_collection_task, set_collection_task
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^project_details/(?P<group_name>.+)/$', views.project_details, name='project_details'),
# ... | apache-2.0 | Python |
1870b34f812d93b887c0417205ed9beaf07bcfe4 | Update version to upload a new release to PyPi | davidmogar/genderator | genderator/__init__.py | genderator/__init__.py | __version__ = '0.1.1'
| __version__ = '0.1.0'
| mit | Python |
3f759ca3ce02808fdb93010d3d011be066c5c2cc | Set development version | wfscheper/hasher,wfscheper/hasher | hasher/__init__.py | hasher/__init__.py | # Copyright 2013 Walter Scheper
#
# 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 writin... | # Copyright 2013 Walter Scheper
#
# 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 writin... | apache-2.0 | Python |
7d406610790100c6deb4ca4a5bccb768a0f3f3cf | Add some helpful documentation to the Python example | solus-project/linux-driver-management,solus-project/linux-driver-management | examples/list-usb.py | examples/list-usb.py | #!/usr/bin/env python2
#
# This file is Public Domain and provided only for documentation purposes.
#
# Run : python2 ./list-usb.py
#
# Note: This will happily run with Python3 too, I just picked a common baseline
#
import gi
gi.require_version('Ldm', '0.1')
from gi.repository import Ldm, GObject
class PretendyPlugin... | #!/usr/bin/env python2
#
# This file is Public Domain and provided only for documentation purposes.
#
# Run : python2 ./list-usb.py
#
# Note: This will happily run with Python3 too, I just picked a common baseline
#
import gi
gi.require_version('Ldm', '0.1')
from gi.repository import Ldm, GObject
class PretendyPlugin... | lgpl-2.1 | Python |
a54860c1e0a3819ac3dca7934736339c6384562f | add comment for plotting the ball groundtruth | BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH | Utils/py/BallDetection/RegressionNetwork/utility_functions/visualize.py | Utils/py/BallDetection/RegressionNetwork/utility_functions/visualize.py | """
TODO show images from dataset with annotations for different datasets (naoth, b-human, etc)
"""
import numpy as np
import h5py
import matplotlib.pyplot as plt
import pickle
from pathlib import Path
DATA_DIR = Path(Path(__file__).parent.parent.absolute() / "data").resolve()
MODEL_DIR = Path(Path(__file__).parent.pa... | """
TODO show images from dataset with annotations for different datasets (naoth, b-human, etc)
"""
import numpy as np
import h5py
import matplotlib.pyplot as plt
import pickle
from pathlib import Path
DATA_DIR = Path(Path(__file__).parent.parent.absolute() / "data").resolve()
MODEL_DIR = Path(Path(__file__).parent.pa... | apache-2.0 | Python |
00e5adf2aa4223e37a191a454300d888af5687f5 | Rework the pip runner to use `PathFinder` | pypa/pip,sbidoul/pip,pfmoore/pip,pfmoore/pip,pypa/pip,pradyunsg/pip,pradyunsg/pip,sbidoul/pip | src/pip/__pip-runner__.py | src/pip/__pip-runner__.py | """Execute exactly this copy of pip, within a different environment.
This file is named as it is, to ensure that this module can't be imported via
an import statement.
"""
import runpy
import sys
import types
from importlib.machinery import ModuleSpec, PathFinder
from os.path import dirname
from typing import Optiona... | """Execute exactly this copy of pip, within a different environment.
This file is named as it is, to ensure that this module can't be imported via
an import statement.
"""
import importlib.util
import runpy
import sys
import types
from importlib.machinery import ModuleSpec
from os.path import dirname, join
from typin... | mit | Python |
810bc464209a078ec3899d2603d36456afa71f4f | update binomial_p tests and ensure p-values match scipy.stats.binom.cdf | kellieotto/permute,jarrodmillman/permute,statlab/permute,kellieotto/permute | permute/tests/test_binomialp.py | permute/tests/test_binomialp.py | """
Unit tests for binomialp.py
"""
import math
from nose.tools import assert_equal, assert_almost_equal, assert_less, raises
from nose.plugins.attrib import attr
from scipy.stats import binom
from ..binomialp import binomial_p
def test_binomial_p():
assert_almost_equal(binomial_p(5, 10, 0.5, 10**5, 'greater')[0... | """
Unit tests for binomialp.py
"""
import math
from nose.tools import assert_equal, assert_almost_equal, assert_less, raises
from nose.plugins.attrib import attr
from ..binomialp import binomial_p
def less():
assert_almost_equal(binomial_p([0, 1, 0, 1], 10, 5, 10**5, 'greater')[0], 0.14)
def greater():
assert_al... | bsd-2-clause | Python |
2b9b5d2c1a01597f6f1b4691caff66e574f9da5c | add missing const_prefmap dict. | arskom/spyne,arskom/spyne,arskom/spyne | spyne/const/xml_ns.py | spyne/const/xml_ns.py |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... | lgpl-2.1 | Python |
1904b5d7426330d9ec50ba9dc1f5c01f861086e8 | Add 1080 Ti info | RuiShu/tensorbayes | examples/test_gpu.py | examples/test_gpu.py | """
Basic wall-clock test for a generic convolutional neural network
Tesla K40c:
Elapsed wall-clock time: 58.0986320972
Average time per iter: 0.0580986320972
GeForce GTX 1080 Ti:
Elapsed wall-clock time: 41.549612999
Average time per iter: 0.041549612999
"""
import numpy as np
import tensorflow as tf
import tensorb... | """
Basic wall-clock test for a generic convolutional neural network
Tesla K40c:
Elapsed wall-clock time: 58.0986320972
Average time per iter: 0.0580986320972
"""
import numpy as np
import tensorflow as tf
import tensorbayes as tb
from tensorflow.contrib.framework import arg_scope
from tensorbayes.layers import conv2... | mit | Python |
283d9ad556357b80a2373ade589bcf118700b47f | Reformat mcp3008 module with black | flyte/pi-mqtt-gpio | pi_mqtt_gpio/modules/mcp3008.py | pi_mqtt_gpio/modules/mcp3008.py | from pi_mqtt_gpio.modules import GenericSensor
import logging
REQUIREMENTS = ("adafruit-mcp3008",)
SENSOR_SCHEMA = {
"channel": dict(
type="string",
required=False,
empty=False,
default="CH0",
allowed=[
"CH0",
"CH1",
"CH2",
"C... | from pi_mqtt_gpio.modules import GenericSensor
import logging
REQUIREMENTS = ("adafruit-mcp3008",)
SENSOR_SCHEMA = {
"channel": dict(
type="string",
required=False,
empty=False,
default="CH0",
allowed=["CH0", "CH1", "CH2", "CH3", "CH4", "CH5", "CH6", "CH7",
... | mit | Python |
88dc15263e54fb8078869f90add52e957ece4d4f | Use URL from cli | coldhakca/atlas-tools-misc | sample-ssl-test.py | sample-ssl-test.py | #!/usr/bin/env python
# Loads JSON data from:
# https://atlas.ripe.net/measurements/3196765/
#
# Iterate results to filter out errors
if __name__ == "__main__":
import json
import urllib
import OpenSSL
import sys
if len(sys.argv) > 1:
# URL of measurement to examine
url = sys.argv[1]
# Pull in ... | #!/usr/bin/env python
# Loads JSON data from:
# https://atlas.ripe.net/measurements/3196765/
#
# Iterate results to filter out errors
import json
import urllib
import OpenSSL
# URL of measurement to examine
url = "https://atlas.ripe.net/api/v2/measurements/3196765/results?start=1451433600&stop=1451519999&format=json... | mit | Python |
2f1bf82b6aba4b75ea7707b222603a5ec3488016 | fix volt package.volt | dbralir/glad,0x1100/glad,valeriog-crytek/glad,bsmr-opengl/glad,aaronmjacobs/glad,valeriog-crytek/glad,QUSpilPrgm/glad,aaronmjacobs/glad,0x1100/glad,hrehfeld/glad,0x1100/glad,dbralir/glad,valeriog-crytek/glad,valeriog-crytek/glad,bsmr-opengl/glad,aaronmjacobs/glad,0x1100/glad,hrehfeld/glad,dbralir/glad,QUSpilPrgm/glad,Q... | glad/generator/volt.py | glad/generator/volt.py | from glad.generator.d import DGenerator
import os.path
class VoltGenerator(DGenerator):
MODULE = 'amp'
LOADER = 'loader'
ENUMS = 'enums'
EXT = 'ext'
FUNCS = 'funcs'
TYPES = 'types'
FILE_EXTENSION = '.volt'
API = ''
LOAD_GL_NAME = 'load'
@property
def PACKAGE(self):
... | from glad.generator.d import DGenerator
import os.path
class VoltGenerator(DGenerator):
MODULE = 'amp'
LOADER = 'loader'
ENUMS = 'enums'
EXT = 'ext'
FUNCS = 'funcs'
TYPES = 'types'
FILE_EXTENSION = '.volt'
API = ''
LOAD_GL_NAME = 'load'
@property
def PACKAGE(self):
... | mit | Python |
7d722b5ff87ae1306e089e1bf5839632e628b663 | Add SNS topic for event NewCorsSiteRequestReceived | GeoscienceAustralia/geodesy-domain-model,GeoscienceAustralia/Geodesy-Web-Services,GeoscienceAustralia/Geodesy-Web-Services,GeoscienceAustralia/Geodesy-Web-Services,GeoscienceAustralia/geodesy-domain-model,GeoscienceAustralia/Geodesy-Web-Services | aws/customise-stack-template.py | aws/customise-stack-template.py | from amazonia.classes.sns import SNS
from troposphere import Ref, Join, cloudwatch
from troposphere.sns import Topic, Subscription
def user_registration_topic(emails):
return topic("UserRegistrationReceived", emails)
def new_cors_site_request_received_topic(emails):
return topic("NewCorsSiteRequestReceived",... | from amazonia.classes.sns import SNS
from troposphere import Ref, Join, cloudwatch
from troposphere.sns import Topic, Subscription
def user_registration_topic(emails):
return topic("UserRegistrationReceived", emails)
def topic(topic_title, emails):
topic = Topic(topic_title,
DisplayName=Join("", ... | bsd-3-clause | Python |
d084bbac68191328003ab25e114b24643ae1de4f | refactor attrs example | yunstanford/sanic-transmute | examples/example_attrs_model.py | examples/example_attrs_model.py | from sanic import Sanic, Blueprint
from sanic.response import json
from sanic_transmute import describe, add_route, add_swagger, APIException
from sanic.exceptions import ServerError
import attr
@attr.s
class User:
points = attr.ib(type=int)
app = Sanic()
bp = Blueprint("test_blueprints", url_prefix="/blueprint... | from sanic import Sanic, Blueprint
from sanic.response import json
from sanic_transmute import describe, add_route, add_swagger, APIException
from sanic.exceptions import ServerError
import attr
@attr.s
class User:
points = attr.ib(type=int)
app = Sanic()
bp = Blueprint("test_blueprints", url_prefix="/blueprint... | mit | Python |
d0e634e4472dcd82009801626c8e51d0a16fcae6 | Update workshops as well as talks | WebCampZg/conference-web,WebCampZg/conference-web,WebCampZg/conference-web | cfp/management/commands/update_talks_and_workshops_from_applications.py | cfp/management/commands/update_talks_and_workshops_from_applications.py | from django.core.management.base import BaseCommand, CommandError
from events.models import Event
class Command(BaseCommand):
help = "Copies talk title and descriptions from the application."
def add_arguments(self, parser):
parser.add_argument('event_id', type=int)
def handle(self, *args, **op... | from django.core.management.base import BaseCommand, CommandError
from events.models import Event
class Command(BaseCommand):
help = "Copies talk title and descriptions from the application."
def add_arguments(self, parser):
parser.add_argument('event_id', type=int)
def handle(self, *args, **op... | bsd-3-clause | Python |
de10e589d037debddf58bb3112f0079519bf29c3 | Allow alternate origins for Tornado connections. | vmlaker/wabbit,vmlaker/wabbit,vmlaker/wabbit,vmlaker/wabbit | src/py/websocket_serve.py | src/py/websocket_serve.py | """
Serve webcam images from Memcached over a websocket.
"""
# Import standard modules.
import base64
from datetime import datetime
from collections import defaultdict
import os
import sys
# Import 3rd-party modules.
from memcache import Client
from tornado import websocket, web, ioloop
import coils
port = int(sys.a... | """
Serve webcam images from Memcached over a websocket.
"""
# Import standard modules.
import base64
from datetime import datetime
from collections import defaultdict
import os
import sys
# Import 3rd-party modules.
from memcache import Client
from tornado import websocket, web, ioloop
import coils
port = int(sys.a... | mit | Python |
1c3e146d7217600f414dac52e8489074402ba272 | Update drivers.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | chips/sensor/tcs3472x/drivers.py | chips/sensor/tcs3472x/drivers.py | # This code has to be added to the corresponding __init__.py
DRIVERS["tcs3472X"] = ["TCS34721", "TCS34723", "TCS34725", "TCS34727"]
| apache-2.0 | Python | |
e1ab705c777528c294d2653e6c3251943db18cfa | comment out saving tweets to deprecated status db | jeromecc/doctoctocbot | src/bot/onstatus.py | src/bot/onstatus.py | from django.db.utils import DatabaseError
import logging
import tweepy
from bot.doctoctocbot import is_following_rules, retweet, isknown, has_greenlight, has_retweet_hashtag
from bot.lib.statusdb import Addstatus
from bot.twitter import getAuth
from conversation.models import create_tree
from moderation.moderate impor... | from django.db.utils import DatabaseError
import logging
import tweepy
from bot.doctoctocbot import is_following_rules, retweet, isknown, has_greenlight, has_retweet_hashtag
from bot.lib.statusdb import Addstatus
from bot.twitter import getAuth
from conversation.models import create_tree
from moderation.moderate impor... | mpl-2.0 | Python |
9d848dd79eb43b62ad389675b1d8c8a79bd59b5b | Add bandit ID to prefix of more_info link | stackforge/bandit,stackforge/bandit,chair6/bandit | bandit/core/docs_utils.py | bandit/core/docs_utils.py | # -*- coding:utf-8 -*-
#
# Copyright 2016 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unl... | # -*- coding:utf-8 -*-
#
# Copyright 2016 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unl... | apache-2.0 | Python |
064f62ccaaecacc38b67a728231662101a783f11 | sort other way | calin-iorgulescu/vmchecker,cojocar/vmchecker,cojocar/vmchecker,calin-iorgulescu/vmchecker,rosedu/vmchecker,cojocar/vmchecker,calin-iorgulescu/vmchecker,calin-iorgulescu/vmchecker,rosedu/vmchecker,cojocar/vmchecker,rosedu/vmchecker,rosedu/vmchecker,calin-iorgulescu/vmchecker,rosedu/vmchecker,cojocar/vmchecker,rosedu/vmc... | bin/check_latest_versions.py | bin/check_latest_versions.py | #! /usr/bin/env python2.5
import misc
import os
import remote_check
import sys
import subprocess
import time
def main():
root = misc.vmchecker_root()
back = root + "/back"
for hw in os.listdir(back):
print ("hw: " + hw)
hwdir = back + "/" + hw
for name in os.listdir(hwdir):
... | #! /usr/bin/env python2.5
import misc
import os
import remote_check
import sys
import subprocess
def main():
root = misc.vmchecker_root()
back = root + "/back"
for hw in os.listdir(back):
print ("hw: " + hw)
hwdir = back + "/" + hw
for name in os.listdir(hwdir):
print (... | mit | Python |
7888b285250a732d22f9c49601b04eb535129a1c | add blog root | sdpython/pysqllike | _doc/sphinxdoc/source/conf.py | _doc/sphinxdoc/source/conf.py | import sys
import os
import datetime
import re
import cloud_sptheme as csp
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0])))
sys.path.insert(
0,
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
... | import sys
import os
import datetime
import re
import cloud_sptheme as csp
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0])))
sys.path.insert(
0,
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
... | mit | Python |
29ce25fe6cd227f2c38ca61d1c8db1cc5ec87a81 | fix bug which caused rb score for beer not to be read | atlefren/beertools | beertools/util/parsers.py | beertools/util/parsers.py | # -*- coding: utf-8 -*-
import HTMLParser
html_parser = HTMLParser.HTMLParser()
def string_parser(val):
s = html_parser.unescape(val.strip())
if s == '':
return None
return s
def int_parser(val):
try:
return int(float(val))
except ValueError:
return None
def float_par... | # -*- coding: utf-8 -*-
import HTMLParser
html_parser = HTMLParser.HTMLParser()
def string_parser(val):
s = html_parser.unescape(val.strip())
if s == '':
return None
return s
def int_parser(val):
try:
return int(val)
except ValueError:
return None
def float_parser(val... | mit | Python |
c4584591afb3aa3fc45b4f2bea29ebfbf1b18a71 | add levenshtein and segment_error_rate to TweetyNetModel.metrics | yardencsGitHub/tf_syllable_segmentation_annotation | src/tweetynet/model.py | src/tweetynet/model.py | import numpy as np
import torch
import vak
from .network import TweetyNet
def acc(y_pred, y):
return y_pred.eq(y.view_as(y_pred)).sum().item() / np.prod(y.shape)
class TweetyNetModel(vak.Model):
@classmethod
def from_config(cls, config, logger=None):
network = TweetyNet(**config['network'])
... | import numpy as np
import torch
import vak
from .network import TweetyNet
def acc(y_pred, y):
return y_pred.eq(y.view_as(y_pred)).sum().item() / np.prod(y.shape)
class TweetyNetModel(vak.Model):
@classmethod
def from_config(cls, config, logger=None):
network = TweetyNet(**config['network'])
... | bsd-3-clause | Python |
2c4524c1f40ef9963caefec4ed258974b80a6db1 | Define public interface in sms module | messente/messente-python | messente/api/sms/__init__.py | messente/api/sms/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2016 Messente Communications OÜ
#
# 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 2016 Messente Communications OÜ
#
# 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 |
e8f0af0ff6fa1c3f72c575bda14bf1ef83edaf4e | Remove code 9 handler. | ultimate-pa/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec | benchexec/tools/nitwit.py | benchexec/tools/nitwit.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import benchexec.result as result
import benchexec.tools.templat... | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import benchexec.result as result
import benchexec.tools.templat... | apache-2.0 | Python |
456bf650d0c6c487616869986ca29bab4768b0cb | Choose which branch will be deployed | losmiserables/djangodash2012,losmiserables/djangodash2012 | dash2012/fabfile.py | dash2012/fabfile.py | #encoding: utf-8
from fabric.api import run, settings, cd, env
env.use_ssh_config = True
env.ssh_config_path = '~/.ssh/config'
def deploy(branch='master'):
with settings(host_string='dash.daltonmatos.com'):
with cd("/var/mongrel2/apps/djangodash2012.daltonmatos.com"):
with cd("app/djangodash2... | #encoding: utf-8
from fabric.api import run, settings, cd, env
env.use_ssh_config = True
env.ssh_config_path = '~/.ssh/config'
def deploy():
with settings(host_string='dash.daltonmatos.com'):
with cd("/var/mongrel2/apps/djangodash2012.daltonmatos.com"):
with cd("app/djangodash2012/"):
... | bsd-3-clause | Python |
2f291b8747274bdadb738c885139d6dd603f8270 | Fix lint | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | readthedocs/proxito/views/utils.py | readthedocs/proxito/views/utils.py | import os
import logging
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from .decorators import map_project_slug, map_subproject_slug
log = logging.getLogger(__name__) # noqa
def fast_404(request, *args, **kwargs):
"""
A fast error page handler.
This stops us from... | import os
import logging
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from .decorators import map_project_slug, map_subproject_slug
log = logging.getLogger(__name__) # noqa
def fast_404(request, *args, **kwargs):
"""
A fast error page handler.
This stops us from... | mit | Python |
575e2649acd5b641c9404af3b6a5e2761213dc61 | Fix dal_check integrity error when autocomplete not enabled | shacker/django-todo,shacker/django-todo,shacker/django-todo | todo/check.py | todo/check.py | from django.core.checks import Error, register
# the sole purpose of this warning is to prevent people who have
# django-autocomplete-light installed but not configured to start the app
@register()
def dal_check(app_configs, **kwargs):
from django.conf import settings
from todo.features import HAS_AUTOCOMPLETE... | from django.core.checks import Error, register
# the sole purpose of this warning is to prevent people who have
# django-autocomplete-light installed but not configured to start the app
@register()
def dal_check(app_configs, **kwargs):
from django.conf import settings
from todo.features import HAS_AUTOCOMPLETE... | bsd-3-clause | Python |
8f14f2132e4abf80c2989e316de35a0b4d98d933 | remove unused code | anlutro/botologist,x89/botologist,x89/botologist,moopie/botologist | botologist/protocol/__init__.py | botologist/protocol/__init__.py | import logging
log = logging.getLogger(__name__)
import botologist.plugin
class Client:
def __init__(self, name):
self.name = name
self.channels = {}
self.error_handler = None
self.on_connect = []
self.on_disconnect = []
self.on_join = []
self.on_privmsg = []
@property
def nick(self):
return sel... | import logging
log = logging.getLogger(__name__)
import botologist.plugin
class Protocol:
def new_client(self, config):
raise NotImplementedError('method new_client must be defined')
def new_user(self, *args, **kwargs):
raise NotImplementedError('method new_user must be defined')
def new_channel(self, *args... | mit | Python |
145b8fcbaa4d63b16487563adadc3153bc613cf1 | Use PROTOCOL_TLS to future proof. | fastly/fastly-py,fastly/fastly-py | fastly/connection.py | fastly/connection.py | """
"""
from __future__ import absolute_import
import json
import ssl
from six.moves import http_client
from fastly._version import __version__
from fastly import errors
class Connection(object):
def __init__(self, host='api.fastly.com', secure=True, port=None, root='',
timeout=10.0):
s... | """
"""
from __future__ import absolute_import
import json
import ssl
from six.moves import http_client
from fastly._version import __version__
from fastly import errors
class Connection(object):
def __init__(self, host='api.fastly.com', secure=True, port=None, root='',
timeout=10.0):
s... | mit | Python |
fbc52701e77ccedc8b23cf9e60f5273db495fcf1 | stop overwriting neutron BaseTestCase configuration files | openstack/neutron-vpnaas,openstack/neutron-vpnaas | neutron_vpnaas/tests/base.py | neutron_vpnaas/tests/base.py | # Copyright 2014 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | # Copyright 2014 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | apache-2.0 | Python |
8636a23ca0e1075c42bc2bb501d5becc024f5a0b | Update _version.py | quantumlib/OpenFermion,quantumlib/OpenFermion,quantumlib/OpenFermion | src/openfermion/_version.py | src/openfermion/_version.py | # 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 writing, software
# distribu... | # 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 writing, software
# distribu... | apache-2.0 | Python |
5b63b724a89c11aa06a8281cf778063c4a8a7096 | Return the right URL when a file is posted | ivoire/Artifactorial,ivoire/Artifactorial,ivoire/Artifactorial | Artifactor/views.py | Artifactor/views.py | # -*- coding: utf-8 -*-
# vim: set ts=4
from django.forms import ModelForm
from django.http import Http404, HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from Artifactor.models import Artifact
def index(re... | # -*- coding: utf-8 -*-
# vim: set ts=4
from django.forms import ModelForm
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from Artifactor.models import Artifact
def ... | mit | Python |
d1979c327939dba9ec03a877241d49f3f49d97d9 | Fix indentation | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com | gratipay/exceptions.py | gratipay/exceptions.py | """
This module contains exceptions shared across application code.
"""
from __future__ import print_function, unicode_literals
from gratipay.utils.i18n import LocalizedErrorResponse
class ProblemChangingUsername(Exception):
def __str__(self):
return self.msg.format(self.args[0])
class UsernameIsEmpty(... | """
This module contains exceptions shared across application code.
"""
from __future__ import print_function, unicode_literals
from gratipay.utils.i18n import LocalizedErrorResponse
class ProblemChangingUsername(Exception):
def __str__(self):
return self.msg.format(self.args[0])
class UsernameIsEmpty(... | mit | Python |
d767ae3aa2f432a3fdedf131dd21b44c3a5e023d | Bump version to 1.3.1 | vrtsystems/hszinc,vrtsystems/hszinc | hszinc/__init__.py | hszinc/__init__.py | # -*- coding: utf-8 -*-
# Zinc dumping and parsing module
# (C) 2016 VRT Systems
#
# vim: set ts=4 sts=4 et tw=78 sw=4 si:
import warnings
# First verify if pint is available
PINT_AVAILABLE = False
try:
from pint import UnitRegistry
PINT_AVAILABLE = True
from .pintutil import define_haystack_units
u... | # -*- coding: utf-8 -*-
# Zinc dumping and parsing module
# (C) 2016 VRT Systems
#
# vim: set ts=4 sts=4 et tw=78 sw=4 si:
import warnings
# First verify if pint is available
PINT_AVAILABLE = False
try:
from pint import UnitRegistry
PINT_AVAILABLE = True
from .pintutil import define_haystack_units
u... | bsd-2-clause | Python |
b41f6bea013150b45f66054786b5d7cfc177d819 | fix send event to ST for TV STATUS | DiegoAntonino/SmartThings,DiegoAntonino/SmartThings | SmartThings-Raspberry-TV_integration-master/python_code/full_status_chequer.py | SmartThings-Raspberry-TV_integration-master/python_code/full_status_chequer.py | from conf import configuration
import json
import time
import tools
def main():
print "Stating 'FULL Status Chequer'"
TV_STATUS = ''
try:
while True:
# check TV status
TV_STATUS = check_tv_status(TV_STATUS)
# check RPI status
tools.send_event_to_st... | from conf import configuration
import json
import time
import tools
def main():
print "Stating 'FULL Status Chequer'"
TV_STATUS = ''
try:
while True:
# check TV status
TV_STATUS = check_tv_status(TV_STATUS)
# check RPI status
tools.send_event_to_st... | apache-2.0 | Python |
e6aa6f83cb3783d399e6cecc89c95e65ba288d7a | Add GithubMeta to parse github repo's information | lord63/flask_toolbox,lord63/flask_toolbox | flask_toolbox/crawler/github.py | flask_toolbox/crawler/github.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
from lxml import html
class GithubMeta(object):
def __init__(self, response):
self.tree = html.fromstring(response.text)
def _get_num(self, css_expression, index):
return int(self.tree.csss... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
class GithubMeta(object):
pass
| mit | Python |
5706257685820787b70bfef6798491c34b9b9ad9 | Add check for PDF files | govro/ckanext-romania_theme,govro/ckanext-romania_theme,govro/ckanext-romania_theme,govro/ckanext-romania_theme | ckanext/romania_theme/plugin.py | ckanext/romania_theme/plugin.py | import ckan.model as model
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import os
def get_number_of_files():
return model.Session.execute("select count(*) from resource where state = 'active'").first()[0]
def get_number_of_external_links():
return model.Session.execute("select count... | import ckan.model as model
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import os
def get_number_of_files():
return model.Session.execute("select count(*) from resource where state = 'active'").first()[0]
def get_number_of_external_links():
return model.Session.execute("select count... | agpl-3.0 | Python |
14dcd8789c764743cfcb2e7a7b9b7d33b21a2779 | Fix .published() to accept current date as well. | edoburu/django-fluent-blogs,edoburu/django-fluent-blogs | fluent_blogs/models/managers.py | fluent_blogs/models/managers.py | """
The manager class for the CMS models
"""
from datetime import datetime
from django.db import models
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
class EntryQuerySet(QuerySet):
def published(self):
"""
Return only published entries
"""
f... | """
The manager class for the CMS models
"""
from datetime import datetime
from django.db import models
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
class EntryQuerySet(QuerySet):
def published(self):
"""
Return only published entries
"""
f... | apache-2.0 | Python |
da94dae69c37cc57b82775e7511a976752eef668 | Remove unused import | LPgenerator/django-cacheops,Suor/django-cacheops | cacheops/redis.py | cacheops/redis.py | from __future__ import absolute_import
import warnings
import six
from funcy import decorator, identity, memoize
import redis
from .conf import settings
if settings.CACHEOPS_DEGRADE_ON_FAILURE:
@decorator
def handle_connection_failure(call):
try:
return call()
except redis.Connec... | from __future__ import absolute_import
import warnings
import six
from funcy import decorator, identity, memoize
import redis
from django.core.exceptions import ImproperlyConfigured
from .conf import settings
if settings.CACHEOPS_DEGRADE_ON_FAILURE:
@decorator
def handle_connection_failure(call):
tr... | bsd-3-clause | Python |
d02416cd28d46e82db215c882f9cbfaccb3d2422 | use /tmp for caching, so that autoscaling instances don't use their template's cache | badele/cloudwatch-mon-scripts-python,gtrevg/cloudwatch-mon-scripts-python,markpeek/cloudwatch-mon-scripts-python,pebble/cloudwatch-mon-scripts-python,pebble/cloudwatch-mon-scripts-python,osiegmar/cloudwatch-mon-scripts-python,avengerpenguin/cloudwatch-mon-scripts-python,mgk/cloudwatch-mon-scripts-python | bin/cloud_watch_client.py | bin/cloud_watch_client.py | # Copyright 2015 Oliver Siegmar
#
# Based on Perl-Version of CloudWatch Monitoring Scripts for Linux -
# Copyright 2013 Amazon.com, Inc. or its affiliates. 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 ma... | # Copyright 2015 Oliver Siegmar
#
# Based on Perl-Version of CloudWatch Monitoring Scripts for Linux -
# Copyright 2013 Amazon.com, Inc. or its affiliates. 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 ma... | apache-2.0 | Python |
fd5d60586998e6899571563afdb32247907b93e1 | fix merge conflicts | googlei18n/TachyFont,googlei18n/TachyFont,bstell/TachyFont,googlei18n/TachyFont,googlei18n/TachyFont,bstell/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,googlefonts/TachyFont,moyogo/tachyfont,bstell/TachyFont,bstell/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,googlefonts/TachyFont,googlefonts/TachyFont,bstell/... | run_time/src/gae_server/browser_redirector.py | run_time/src/gae_server/browser_redirector.py | """
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... | """
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... | apache-2.0 | Python |
76dace5493929878e934b1e62ab5c21f6ae46c5e | Add utils to top-level import | pybel/pybel-tools,pybel/pybel-tools,pybel/pybel-tools | src/pybel_tools/__init__.py | src/pybel_tools/__init__.py | # -*- coding: utf-8 -*-
"""
PyBEL Tools is tested on Python3 installations on Mac OS and Linux on
`Travis CI <https://travis-ci.org/pybel/pybel-tools>`_.
.. warning:: Python2 and Windows are not thoroughly tested
Installation
------------
Easiest
~~~~~~~
Download the latest stable code from `PyPI <https://pypi.py... | # -*- coding: utf-8 -*-
"""
PyBEL Tools is tested on Python3 installations on Mac OS and Linux on
`Travis CI <https://travis-ci.org/pybel/pybel-tools>`_.
.. warning:: Python2 and Windows are not thoroughly tested
Installation
------------
Easiest
~~~~~~~
Download the latest stable code from `PyPI <https://pypi.py... | mit | Python |
565a7860be5468cf585fa618083d521343bc92b3 | Bump pants version to 0.0.41 | slyphon/pants,cevaris/pants,qma/pants,sameerparekh/pants,wisechengyi/pants,baroquebobcat/pants,sid-kap/pants,qma/pants,di0spyr0s/pants,di0spyr0s/pants,gmalmquist/pants,15Dkatz/pants,ericzundel/pants,di0spyr0s/pants,gmalmquist/pants,ity/pants,wisechengyi/pants,lahosken/pants,foursquare/pants,gmalmquist/pants,twitter/pan... | src/python/pants/version.py | src/python/pants/version.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
VERSION = '0.0.41'
| # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
VERSION = '0.0.40'
| apache-2.0 | Python |
bb0f8b3e054df4d82579de0c5780bc4e85d2aff8 | use condition field in re_route | mbauskar/frappe,frappe/frappe,ESS-LLP/frappe,tmimori/frappe,mhbu50/frappe,tmimori/frappe,neilLasrado/frappe,rohitwaghchaure/frappe,maxtorete/frappe,saurabh6790/frappe,maxtorete/frappe,manassolanki/frappe,bcornwellmott/frappe,manassolanki/frappe,adityahase/frappe,rohitwaghchaure/frappe,rohitwaghchaure/frappe,elba7r/fram... | frappe/patches/v7_0/re_route.py | frappe/patches/v7_0/re_route.py | import frappe
from frappe.model.base_document import get_controller
def execute():
update_routes(['Blog Post', 'Blog Category', 'Web Page'])
def update_routes(doctypes):
"""Patch old routing system"""
for d in doctypes:
frappe.reload_doctype(d)
c = get_controller(d)
condition = ''
if c.website.condition_f... | import frappe
def execute():
update_routes(['Blog Post', 'Blog Category', 'Web Page'])
def update_routes(doctypes):
"""Patch old routing system"""
for d in doctypes:
frappe.reload_doctype(d)
try:
frappe.db.sql("""update `tab{0}` set route = concat(ifnull(parent_website_route, ""),
if(ifnull(parent_websi... | mit | Python |
c3c6acfc9bc0f49c3289ab8162ef9c35f3d401a6 | Remove get_good_connection and use pool method directly | wiki-ai/wikilabels,wiki-ai/wikilabels,wiki-ai/wikilabels | wikilabels/database/db.py | wikilabels/database/db.py | import logging
from contextlib import contextmanager
from psycopg2.extras import RealDictCursor
from psycopg2.pool import ThreadedConnectionPool
from .campaigns import Campaigns
from .labels import Labels
from .tasks import Tasks
from .worksets import Worksets
class DB:
def __init__(self, pool):
self.po... | import logging
from contextlib import contextmanager
import psycopg2
from psycopg2.extras import RealDictCursor
from psycopg2.pool import ThreadedConnectionPool
from .campaigns import Campaigns
from .labels import Labels
from .tasks import Tasks
from .worksets import Worksets
class DB:
def __init__(self, pool):... | mit | Python |
7ffaed8be6a1b308f829cb944429459a62ca159e | fix get_receiver_filtered_queryset on group object | allink/woodstock | woodstock/models/group.py | woodstock/models/group.py | from django import forms
from django.contrib import admin
from django.db import models
from pennyblack.options import JobUnitMixin, \
JobUnitAdmin
from woodstock import settings
#-----------------------------------------------------------------------------
# Group
#----------------------------------------------... | from django import forms
from django.contrib import admin
from django.db import models
from pennyblack.options import JobUnitMixin, \
JobUnitAdmin
from woodstock import settings
#-----------------------------------------------------------------------------
# Group
#----------------------------------------------... | bsd-3-clause | Python |
d60bc5fbe4be37bb7832b78d8f8c7b5805d73aff | Change stft to librosa | johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification | bird/signal_processing.py | bird/signal_processing.py | import scipy
import numpy as np
import mock
import sys
sys.modules.update((mod_name, mock.Mock()) for mod_name in ['matplotlib',
'matplotlib.pyplot',
'matplotlib.image'])
import librosa
def stft(x, f... | import scipy
import numpy as np
def stft(x, fs, framesz, hop):
framesamp = int(framesz*fs)
hopsamp = int(hop*fs)
w = scipy.hanning(framesamp)
X = scipy.array([scipy.fft(w*x[i:i+framesamp])
for i in range(0, len(x)-framesamp, hopsamp)])
return X
def istft(X, fs, T, hop):
x ... | mit | Python |
a6aaf45348ca1e8a52d261fff6053e0bc5f4902e | Fix FatalError message printing | atsushieno/cerbero,nirbheek/cerbero,centricular/cerbero,fluendo/cerbero,atsushieno/cerbero,GStreamer/cerbero,GStreamer/cerbero,centricular/cerbero,GStreamer/cerbero,fluendo/cerbero,nirbheek/cerbero,fluendo/cerbero,GStreamer/cerbero,GStreamer/cerbero,atsushieno/cerbero,nirbheek/cerbero,atsushieno/cerbero,centricular/cer... | cerbero/errors.py | cerbero/errors.py | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | lgpl-2.1 | Python |
5697c4b82dee9171151be7bcbd3647f937c57895 | Correct file url | gg7/sentry,Natim/sentry,daevaorn/sentry,drcapulet/sentry,jean/sentry,gencer/sentry,songyi199111/sentry,argonemyth/sentry,JamesMura/sentry,nicholasserra/sentry,BayanGroup/sentry,boneyao/sentry,vperron/sentry,ngonzalvez/sentry,camilonova/sentry,imankulov/sentry,looker/sentry,jokey2k/sentry,imankulov/sentry,wong2/sentry,l... | src/sentry/models/tagkey.py | src/sentry/models/tagkey.py | """
sentry.models.tagkey
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.urlresolvers import reverse
from django.db import models
from sentry.constants import MAX_TAG_KEY_LENGTH, TAG_LABELS
from sentry.... | """
sentry.models.tagkey
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.urlresolvers import reverse
from django.db import models
from sentry.constants import MAX_TAG_KEY_LENGTH, TAG_LABELS
from sentry.... | bsd-3-clause | Python |
1e8a67860c6ae51ec228e3e3212e8cf16d42e3a4 | fix indent | abretaud/python-chado | chado/__init__.py | chado/__init__.py | from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import mapper, sessionmaker
class Analysis(object):
pass
class Organism(object):
pass
class Dbxref(object):
pass
class Cvterm(object):
pass
class Db(object):
pass
class Cv(object):
pass
def ChadoAuth(parser):
pa... | from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import mapper, sessionmaker
class Analysis(object):
pass
class Organism(object):
pass
class Dbxref(object):
pass
class Cvterm(object):
pass
class Db(object):
pass
class Cv(object):
pass
def ChadoAuth(parser):
parser.add_argument('-h', ... | mit | Python |
5d7df2eb1bd1a8bd572e9ad656696870d0f297d4 | Fix zhibo.tv regular expression. | xyuanmu/you-get,xyuanmu/you-get | src/you_get/extractors/zhibo.py | src/you_get/extractors/zhibo.py | #!/usr/bin/env python
__all__ = ['zhibo_download']
from ..common import *
def zhibo_vedio_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
# http://video.zhibo.tv/video/details/d103057f-663e-11e8-9d83-525400ccac43.html
html = get_html(url)
title = r1(r'<title>([\s\S]*)</title>... | #!/usr/bin/env python
__all__ = ['zhibo_download']
from ..common import *
def zhibo_vedio_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
# http://video.zhibo.tv/video/details/d103057f-663e-11e8-9d83-525400ccac43.html
html = get_html(url)
title = r1(r'<title>([\s\S]*)</title>... | mit | Python |
01e8e38c0ecf6a5b28941fcdf15c533383950888 | Clarify `ECONNRESET` explanation in cheroot.errors | cherrypy/cheroot | cheroot/errors.py | cheroot/errors.py | # -*- coding: utf-8 -*-
"""Collection of exceptions raised and/or processed by Cheroot."""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import errno
import sys
class MaxSizeExceeded(Exception):
"""Exception raised when a client sends more data then acceptable within limi... | # -*- coding: utf-8 -*-
"""Collection of exceptions raised and/or processed by Cheroot."""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import errno
import sys
class MaxSizeExceeded(Exception):
"""Exception raised when a client sends more data then acceptable within limi... | bsd-3-clause | Python |
d71009ed1327feb81bec656aa7533738564856fe | Add `DictListExtractionTransformer` | skylander86/ycml | ycml/transformers/misc.py | ycml/transformers/misc.py | __all__ = ['DictExtractionTransformer', 'DictListExtractionTransformer']
from . import PureTransformer
class DictExtractionTransformer(PureTransformer):
"""Extract a given key from dictionary object."""
def __init__(self, key=None, default=None, **kwargs):
super(DictExtractionTransformer, self).__in... | __all__ = ['DictExtractionTransformer']
from . import PureTransformer
class DictExtractionTransformer(PureTransformer):
"""Extract a given key from dictionary object."""
def __init__(self, key=None, default=None, **kwargs):
super(DictExtractionTransformer, self).__init__(**kwargs)
self.set_p... | apache-2.0 | Python |
351a5bfc86ddc11752cccfc197c16542eb3876db | Delete line | techbureau/zaifbot,techbureau/zaifbot | zaifbot/trade/strategy.py | zaifbot/trade/strategy.py | import time
from zaifbot.exchange.api.http import BotTradeApi
from zaifbot.logger import trade_logger
class Strategy:
# todo: able to handle multiple rules
def __init__(self, entry_rule, exit_rule, stop_rule=None):
self._trade_api = BotTradeApi()
self._entry_rule = entry_rule
self._exi... | import time
from zaifbot.exchange.api.http import BotTradeApi
from zaifbot.logger import trade_logger
class Strategy:
# todo: able to handle multiple rules
def __init__(self, entry_rule, exit_rule, stop_rule=None):
self._trade_api = BotTradeApi()
self._entry_rule = entry_rule
self._exi... | mit | Python |
bad17d465ce4a7c11a3fbb4df6c71770d1ac2651 | fix minor bug in report error if no stat selected in ostasum.py | justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools | analysis/opensimulator-stats-analyzer/src/ostasum.py | analysis/opensimulator-stats-analyzer/src/ostasum.py | #!/usr/bin/python
import argparse
import fnmatch
from osta.osta import *
import pprint
import sys
############
### MAIN ###
############
parser = argparse.ArgumentParser(formatter_class = argparse.RawTextHelpFormatter)
parser.add_argument(
'--select',
help = "Select a subset of stats by their fullname using... | #!/usr/bin/python
import argparse
import fnmatch
from osta.osta import *
import pprint
import sys
############
### MAIN ###
############
parser = argparse.ArgumentParser(formatter_class = argparse.RawTextHelpFormatter)
parser.add_argument(
'--select',
help = "Select a subset of stats by their fullname using... | bsd-3-clause | Python |
6eee7f059c70ce216a6492d7f710d4edb57d356c | Fix URLHaus feed - last_online delimiter | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/feeds/public/urlhaus.py | plugins/feeds/public/urlhaus.py | import logging
from datetime import timedelta
from core import Feed
from core.errors import ObservableValidationError
from core.observables import Url
class UrlHaus(Feed):
default_values = {
"frequency": timedelta(minutes=20),
"name": "UrlHaus",
"source": "https://urlhaus.abuse.ch/downloa... | import logging
from datetime import timedelta
from core import Feed
from core.errors import ObservableValidationError
from core.observables import Url
class UrlHaus(Feed):
default_values = {
"frequency": timedelta(minutes=20),
"name": "UrlHaus",
"source": "https://urlhaus.abuse.ch/downloa... | apache-2.0 | Python |
7b7270e4d026479f0456c752db4c449e063c9ea4 | Add freetype to skia_base_libs when building for NaCl | csulmone/skia,csulmone/skia,csulmone/skia,csulmone/skia | gyp/skia_base_libs.gyp | gyp/skia_base_libs.gyp | # The minimal set of static libraries for basic Skia functionality.
{
'variables': {
'component_libs': [
'core.gyp:core',
'opts.gyp:opts',
'ports.gyp:ports',
'utils.gyp:utils',
],
'conditions': [
[ 'skia_arch_type == "x86" and skia_os != "android"', {
'component_libs'... | # The minimal set of static libraries for basic Skia functionality.
{
'variables': {
'component_libs': [
'core.gyp:core',
'opts.gyp:opts',
'ports.gyp:ports',
'utils.gyp:utils',
],
'conditions': [
[ 'skia_arch_type == "x86" and skia_os != "android"', {
'component_libs'... | bsd-3-clause | Python |
b909235e65e83604ed4fa504d642595008fc6a29 | test throws 200 should 422 | ENCODE-DCC/encoded,ENCODE-DCC/encoded,ENCODE-DCC/encoded,ENCODE-DCC/encoded | src/encoded/tests/test_accession_replacement.py | src/encoded/tests/test_accession_replacement.py | import pytest
@pytest.fixture
def human_donor(lab, award, organism):
return {
'award': award['uuid'],
'lab': lab['uuid'],
'organism': organism['uuid'],
}
def test_replaced_accession_not_in_name(testapp, human_donor):
donor1 = testapp.post_json('/human_donor', human_donor, status=... | import pytest
@pytest.fixture
def human_donor(lab, award, organism):
return {
'award': award['uuid'],
'lab': lab['uuid'],
'organism': organism['uuid'],
}
def test_replaced_accession_not_in_name(testapp, human_donor):
donor1 = testapp.post_json('/human_donor', human_donor, status=... | mit | Python |
acb6cdc2b0c3c3c52c88f21b0c6b3b4ec52622e3 | remove the sys.path.append | melrief/Hadoop-Log-Tools | hadoop/log/counters.py | hadoop/log/counters.py | #!/usr/bin/env python
from __future__ import print_function,division
import argparse
import json
import os
import sys
import os.path
from hadoop.util.padding import to_tab
def parse_args(args):
p = argparse.ArgumentParser()
p.add_argument('-i','--input-files',required=True, nargs='+'
,type... | #!/usr/bin/env python
from __future__ import print_function,division
import argparse
import json
import os
import sys
import os.path
sys.path.append(os.path.abspath('.'))
from hadoop.util.padding import to_tab
def parse_args(args):
p = argparse.ArgumentParser()
p.add_argument('-i','--input-files',required=True,... | apache-2.0 | Python |
65edfe704bab42a517c798bea90d4fc1fed1de63 | Return the correct filename, even if the file is empty | myint/cppclean,myint/cppclean,myint/cppclean,myint/cppclean | headers/cpp/headers.py | headers/cpp/headers.py | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | apache-2.0 | Python |
1d193339ff0237298dc2ee7a96c232d3fd6c34de | Set application mask. | ctn-archive/nengo_spinnaker_2014,ctn-archive/nengo_spinnaker_2014,ctn-archive/nengo_spinnaker_2014,ctn-archive/nengo_spinnaker_2014 | nengo_spinnaker/simulator.py | nengo_spinnaker/simulator.py | import sys
from pacman103.core import control
from pacman103 import conf
from . import builder
class Simulator(object):
def __init__(self, model, dt=0.001, seed=None):
# Build the model
self.builder = builder.Builder()
self.dao = self.builder(model, dt, seed)
self.dao.writeTextSp... | import sys
from pacman103.core import control
from pacman103 import conf
from . import builder
class Simulator(object):
def __init__(self, model, dt=0.001, seed=None):
# Build the model
self.builder = builder.Builder()
self.dao = self.builder(model, dt, seed)
self.dao.writeTextSp... | mit | Python |
618bf6d4c1fc5e60b7e94d1ad1030bf2cf0de5c2 | Move string above the imports so it becomes a docstring | ImmobilienScout24/afp-alppaca,ImmobilienScout24/alppaca,ImmobilienScout24/alppaca,ImmobilienScout24/afp-alppaca | src/main/python/alppaca/server_mock/__init__.py | src/main/python/alppaca/server_mock/__init__.py | """ Super simple IMS mock.
Just listens on localhost:8080 for the appropriate url, returns a test role and
a dummy JSON response.
"""
from __future__ import print_function, absolute_import, unicode_literals, division
from datetime import datetime, timedelta
from textwrap import dedent
from bottle import Bottle
impo... | from __future__ import print_function, absolute_import, unicode_literals, division
from datetime import datetime, timedelta
from textwrap import dedent
from bottle import Bottle
import pytz
""" Super simple IMS mock.
Just listens on localhost:8080 for the appropriate url, returns a test role and
a dummy JSON respon... | apache-2.0 | Python |
661d0d4b2c821ffb1513cd4e92f34d29bcbb0f8e | Print top author names | charanpald/APGL | exp/influence2/ProcessResults.py | exp/influence2/ProcessResults.py |
import numpy
import matplotlib
matplotlib.use("GTK3Agg")
import matplotlib.pyplot as plt
from exp.influence2.ArnetMinerDataset import ArnetMinerDataset
from exp.influence2.GraphRanker import GraphRanker
from apgl.util.Latex import Latex
from apgl.util.Util import Util
from apgl.util.Evaluator import Evaluator
r... |
import numpy
import matplotlib
matplotlib.use("GTK3Agg")
import matplotlib.pyplot as plt
from exp.influence2.ArnetMinerDataset import ArnetMinerDataset
from exp.influence2.GraphRanker import GraphRanker
from apgl.util.Latex import Latex
from apgl.util.Util import Util
from apgl.util.Evaluator import Evaluator
r... | bsd-3-clause | Python |
5759d11126b8f5c26cde73fa7d6b934d70581726 | Bump version. | concordusapps/alchemist | src/alchemist/meta.py | src/alchemist/meta.py | # -*- coding: utf-8 -*-
version = '0.2.10'
description = ('A server architecture built on top of a solid foundation '
'provided by flask, sqlalchemy, and various extensions.')
| # -*- coding: utf-8 -*-
version = '0.3.0'
description = ('A server architecture built on top of a solid foundation '
'provided by flask, sqlalchemy, and various extensions.')
| mit | Python |
65be9926d1e6d769fcf6d88a6a9788791beef187 | Make ID3Lab allow attr to be pluggable | dalejung/id3lab,dalejung/id3lab | id3lab/__init__.py | id3lab/__init__.py | import IPython
import ts_charting.lab.lab as tslab
import ipycli.standalone as sa
from workbench import sharedx
class ID3Lab(tslab.Lab):
_html_obj = None
def __init__(self, draw=False, html_obj=None):
super(ID3Lab, self).__init__(draw=draw)
if html_obj is None:
html_obj = sharedx
... | import IPython
import ts_charting.lab.lab as tslab
import ipycli.standalone as sa
from workbench import sharedx
class ID3Lab(tslab.Lab):
def get_varname(self):
"""
Try to get the variable that this lab is
bound to in the IPython kernel
"""
inst = IPython.InteractiveShell._... | apache-2.0 | Python |
dea5018d1dc4ee7f385abd67fd804ed47ba37664 | change field name on meal model | savoirfairelinux/sous-chef,savoirfairelinux/santropol-feast,savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/sous-chef,madmath/sous-chef,savoirfairelinux/santropol-feast,savoirfairelinux/sous-chef,madmath/sous-chef | django/santropolFeast/meal/models.py | django/santropolFeast/meal/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Meal(models.Model):
class Meta:
verbose_name_plural = _('meals')
# Meal information
name = models.CharField(
max_length=50,
verbose_name=_('name')
)
description = models.TextField(v... | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Meal(models.Model):
class Meta:
verbose_name_plural = _('meals')
# Meal information
nom = models.CharField(max_length=50, verbose_name=_('name'))
description = models.TextField(verbose_name=_('descript... | agpl-3.0 | Python |
48d686661789dc30fb073bf6849993f36f093f6c | Add a note for safewrap. | plfiorini/django-gems | django_gems/templatetags/safewrap.py | django_gems/templatetags/safewrap.py | #
# Django Gems.
#
# Copyright (C) 2012 Pier Luigi Fiorini
#
# Author(s):
# Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must r... | #
# Django Gems.
#
# Copyright (C) 2012 Pier Luigi Fiorini
#
# Author(s):
# Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must r... | bsd-3-clause | Python |
1bd7be23242be942a372bb552148cc4ed1d9f4e2 | Add lazy records in which the data is only evaluated when used. | SPIhub/hummingbird,FXIhub/hummingbird,FXIhub/hummingbird | src/backend/record.py | src/backend/record.py | # --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# ----------------------------------------------------------------... | # --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# ----------------------------------------------------------------... | bsd-2-clause | Python |
1c456c7a3c85dd022a47a501e296d0a34320016f | Remove unused import | foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy,foauth/foauth.org | services/flickr.py | services/flickr.py | import foauth.providers
class Flickr(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://www.flickr.com/'
docs_url = 'http://www.flickr.com/services/api/'
# URLs to interact with the API
request_token_url = 'http://www.flickr.com/services/oauth/request_token'
au... | from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
import foauth.providers
class Flickr(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://www.flickr.com/'
docs_url = 'http://www.flickr.com/services/api/'
# URLs to interact with the API
request_token_url = '... | bsd-3-clause | Python |
01d4e9f2d570126e8ee9f0b3a111ee2d9e198fc1 | use env variable to decide DEBUG or not on heroku | farhaanbukhsh/junction,hTrap/junction,ChillarAnand/junction,nava45/junction,akshayaurora/junction,nava45/junction,shashisp/junction,hTrap/junction,farhaanbukhsh/junction,shashisp/junction,Rahul91/junction,ChillarAnand/junction,pythonindia/junction,pythonindia/junction,praba230890/junction,praba230890/junction,akshayaur... | settings/heroku.py | settings/heroku.py | import dj_database_url
DATABASES = {
'default': dj_database_url.config()
}
ALLOWED_HOSTS = ['.herokuapp.com']
| import dj_database_url
DATABASES = {
'default': dj_database_url.config()
}
ALLOWED_HOSTS = ['.herokuapp.com']
DEBUG = False
| mit | Python |
723b0dfcd992ad45eec3d862aff4097ed7299b4e | switch github-fork-repos from github3.py -> pygithub | lsst-sqre/sqre-codekit,lsst-sqre/sqre-codekit | codekit/cli/github_fork_repos.py | codekit/cli/github_fork_repos.py | #!/usr/bin/env python3
"""Fork LSST repos into a showow GitHub organization."""
from .. import codetools
import argparse
import codekit.pygithub as pygithub
import os
import progressbar
import textwrap
def parse_args():
"""Parse command-line arguments"""
parser = argparse.ArgumentParser(
prog='github... | #!/usr/bin/env python3
"""Fork LSST repos into a showow GitHub organization."""
import argparse
import textwrap
import os
from time import sleep
import progressbar
from .. import codetools
def parse_args():
"""Parse command-line arguments"""
parser = argparse.ArgumentParser(
prog='github-fork-repos',... | mit | Python |
7e0268df1a25d2ae2567c1cd3419545e8c8cf913 | Update fract/model/sieve.py | dceoy/fractus | fract/model/sieve.py | fract/model/sieve.py | #!/usr/bin/env python
import logging
import pandas as pd
import statsmodels.api as sm
from .feature import LogReturnFeature
class LRFeatureSieve(LogReturnFeature):
def __init__(self, type, drop_zero=False):
super().__init__(type=type, drop_zero=drop_zero)
self.__logger = logging.getLogger(__nam... | #!/usr/bin/env python
import logging
import warnings
import pandas as pd
import statsmodels.api as sm
from .feature import LogReturnFeature
class LRFeatureSieve(LogReturnFeature):
def __init__(self, type, drop_zero=False):
super().__init__(type=type, drop_zero=drop_zero)
self.__logger = logging... | mit | Python |
c730099a9dddd8ae0ef58f60b6d0c0a7f7f79c5f | Add methods to _utils to check if path and handles are writable | althonos/fs.archive | fs/archive/_utils.py | fs/archive/_utils.py | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import io
import sys
import errno
import importlib
def import_from_names(*names):
for name in names:
try:
return importlib.import_module(name)
except ImportError:
conti... | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import importlib
def import_from_names(*names):
for name in names:
try:
return importlib.import_module(name)
except ImportError:
continue
return None
| mit | Python |
356a19bdf1d09d8bd253022e1fd46c934b726f19 | add actionAnglePower to top-level | jobovy/galpy,followthesheep/galpy,jobovy/galpy,followthesheep/galpy,jobovy/galpy,jobovy/galpy,followthesheep/galpy,followthesheep/galpy | galpy/actionAngle.py | galpy/actionAngle.py | from galpy.actionAngle_src import actionAngle
from galpy.actionAngle_src import actionAngleFlat
from galpy.actionAngle_src import actionAnglePower
#
# Classes
#
actionAngle= actionAngle.actionAngle
actionAngleFlat= actionAngleFlat.actionAngleFlat
actionAnglePower= actionAnglePower.actionAnglePower
| from galpy.actionAngle_src import actionAngle
from galpy.actionAngle_src import actionAngleFlat
#
# Classes
#
actionAngle= actionAngle.actionAngle
actionAngleFlat= actionAngleFlat.actionAngleFlat
| bsd-3-clause | Python |
50975e929bcbd93b4cbc46317c60c353b02e5d63 | Use Pagination using case accesor Accessing cases from couch also | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/hqwebapp/management/commands/synch_phone_nums.py | corehq/apps/hqwebapp/management/commands/synch_phone_nums.py | from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from django.core.management.base import BaseCommand
from corehq.apps.users.models import CommCareUser
from corehq.apps.sms.tasks import sync_user_phone_numbers as sms_sync_user_phone_numbers
from coreh... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from corehq.apps.users.models import CommCareUser
from corehq.apps.sms.tasks import sync_user_phone_numbers as sms_sync_user_phone_numbers
from corehq.form_processor.models import CommCar... | bsd-3-clause | Python |
7122f7d66b83d04b6680ddde8f6a590f2a755e72 | Fix bug in git_squash_branch.py. | airtimemedia/depot_tools,azureplus/chromium_depot_tools,sarvex/depot-tools,liaorubei/depot_tools,G-P-S/depot_tools,xuyuhan/depot_tools,michalliu/chromium-depot_tools,smikes/depot_tools,npe9/depot_tools,Midrya/chromium,mlufei/depot_tools,CoherentLabs/depot_tools,aleonliao/depot_tools,fracting/depot_tools,azureplus/chrom... | git_squash_branch.py | git_squash_branch.py | #!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import sys
from git_common import squash_current_branch
def main(args):
parser = argparse.ArgumentParser()
parser... | #!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import sys
from git_common import squash_current_branch
def main(args):
parser = argparse.ArgumentParser()
parser... | bsd-3-clause | Python |
a90c37ab9324b1c675352596bcbb229bb05d87c9 | fix parser source string to unicode | nyaruka/django-hamlpy,GetHappie/HamlPy,frankvdp/HamlPy,frankvdp/HamlPy,jessemiller/HamlPy,frankvdp/HamlPy,jessemiller/HamlPy,Psycojoker/HamlPy,jessemiller/HamlPy,GetHappie/HamlPy,GetHappie/HamlPy,Psycojoker/HamlPy,GetHappie/HamlPy,nyaruka/django-hamlpy,Psycojoker/HamlPy,frankvdp/HamlPy | hamlpy/templatize.py | hamlpy/templatize.py | """
This module decorates the django templatize function to parse haml templates
before the translation utility extracts tags from it.
"""
from django.utils.translation import trans_real
import hamlpy
def decorate_templatize(func):
def templatize(src, origin=None):
hamlParser = hamlpy.Compiler()
html = hamlPars... | """
This module decorates the django templatize function to parse haml templates
before the translation utility extracts tags from it.
"""
from django.utils.translation import trans_real
import hamlpy
def decorate_templatize(func):
def templatize(src, origin=None):
hamlParser = hamlpy.Compiler()
html = hamlPars... | mit | Python |
c9924bffc67a89708ee920afecda4af65f1b201b | Update version.py | VUIIS/dax,VUIIS/dax | dax/version.py | dax/version.py | VERSION = '2.5.4'
| VERSION = '2.5.3'
| mit | Python |
9a68c9030229503a43b45ac14eac438295a47b84 | Bump package version to 3.3 | kjd/idna | idna/package_data.py | idna/package_data.py | __version__ = '3.3'
| __version__ = '3.2'
| bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.