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 |
|---|---|---|---|---|---|---|---|---|
dd11c2f99d8bea8baeceb99836b23d1bf9799b4e | Add a bit more logic in find leg view | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot | home/views.py | home/views.py | import json
import requests
from django.shortcuts import render, redirect
from tot import settings
def index(request):
user = request.user
return render(
request,
'home/index.html',
{'user': user}
)
def about(request):
return render(request, 'home/about.html')
def find_leg... | import json
import requests
from django.shortcuts import render, redirect
from tot import settings
def index(request):
user = request.user
return render(
request,
'home/index.html',
{'user': user}
)
def about(request):
return render(request, 'home/about.html')
def find_leg... | mit | Python |
e3a3f55b0db2a5ed323e23dc0d949378a9871a15 | Duplicate small parts to make general text parser independent and simple | eddiejessup/nex | nex/parsing/general_text_parser.py | nex/parsing/general_text_parser.py | from ..rply import ParserGenerator
from ..tokens import BuiltToken
term_types = ['SPACE', 'RELAX', 'LEFT_BRACE', 'BALANCED_TEXT_AND_RIGHT_BRACE']
gen_txt_pg = ParserGenerator(term_types, cache_id="general_text")
@gen_txt_pg.production('general_text : filler LEFT_BRACE BALANCED_TEXT_AND_RIGHT_BRACE')
def general_tex... | from ..tokens import BuiltToken
from .common_parsing import pg as common_pg
gen_txt_pg = common_pg.copy_to_extend()
@gen_txt_pg.production('general_text : filler LEFT_BRACE BALANCED_TEXT_AND_RIGHT_BRACE')
def general_text(p):
return BuiltToken(type_='general_text', value=p[2].value,
posit... | mit | Python |
5093aab6d4fe3bb47d2fcd6f239ff66a96298dca | Update test_ocb_correction.py | aburrell/ocbpy,aburrell/ocbpy | ocbpy/tests/test_ocb_correction.py | ocbpy/tests/test_ocb_correction.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2017, AGB & GC
# Full license can be found in License.md
#-----------------------------------------------------------------------------
""" Tests the ocboundary class and functions
"""
import numpy as np
import unittest
from ocbpy import ocb_correction as ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2017, AGB & GC
# Full license can be found in License.md
#-----------------------------------------------------------------------------
""" Tests the ocboundary class and functions
"""
import numpy as np
import unittest
from ocbpy import ocb_correction as ... | bsd-3-clause | Python |
c6b8ff0f5c8b67dd6d48ccfe8c82b98d33b979a6 | Manage case where api installed with --editable | openfisca/openfisca-web-api,openfisca/openfisca-web-api | openfisca_web_api/scripts/serve.py | openfisca_web_api/scripts/serve.py | # -*- coding: utf-8 -*-
import os
import sys
from logging.config import fileConfig
from wsgiref.simple_server import make_server
from paste.deploy import loadapp
hostname = 'localhost'
port = 2000
def main():
conf_file_path = os.path.join(sys.prefix, 'share', 'openfisca', 'openfisca-web-api', 'development-fr... | # -*- coding: utf-8 -*-
import os
import sys
from logging.config import fileConfig
from wsgiref.simple_server import make_server
from paste.deploy import loadapp
hostname = 'localhost'
port = 2000
def main():
conf_file_path = os.path.join(sys.prefix, 'share', 'openfisca', 'openfisca-web-api', 'development-fr... | agpl-3.0 | Python |
779445099f21e78522f2da00e8306b3da4c1dca4 | update version to 0.6.2 beta 5 | imaginal/openprocurement.search,openprocurement/openprocurement.search | openprocurement/search/__init__.py | openprocurement/search/__init__.py | # -*- coding: utf-8 -*-
__version__ = "0.6.2b5"
| # -*- coding: utf-8 -*-
__version__ = "0.6.2b1"
| apache-2.0 | Python |
9b63b3bf17c3fc8391096dce5394a7aef65fbecc | Update stock_data_mining.py | pollseed/data-mining | src/stock_data_mining.py | src/stock_data_mining.py | import scipy as sp
import matplotlib.pyplot as plt
# ストックデータをタブで区分けして返します.
def get_stock_data_csv():
return sp.genfromtxt("../data/stock_test.tsv", delimiter="\t")
# 指定したストックデータから列指向で指定引数を抜き取り返します.
def get_stock_line(stock, x_number, y_number):
return (stock[:,x_number], stock[:,y_number])
# 散布図を出力します.
def scatter... | import scipy as sp
import matplotlib.pyplot as plt
# ストックデータをタブで区分けして返します.
def get_stock_data_csv():
return sp.genfromtxt("../data/stock_test.tsv", delimiter="\t")
# 指定したストックデータから列指向で指定引数を抜き取り返します.
def get_stock_line(stock, x_number, y_number):
return (stock[:,x_number], stock[:,y_number])
# 散布図を出力します.
def scatter... | mit | Python |
eb85668f403cdd67431083cf000a9a128f207673 | Add add_metaclass to dimod.compatibility23 from python six | oneklc/dimod,oneklc/dimod | dimod/compatibility23.py | dimod/compatibility23.py | # Most of this code is from the python six package, under the following license:
#
# Copyright (c) 2010-2018 Benjamin Peterson
#
# 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 restri... | import sys
import itertools
import inspect
from collections import namedtuple
_PY2 = sys.version_info.major == 2
if _PY2:
range_ = xrange
zip_ = itertools.izip
def iteritems(d):
return d.iteritems()
def itervalues(d):
return d.itervalues()
def iterkeys(d):
return d.it... | apache-2.0 | Python |
7f3fd67032c3fa1104c34be370fe5ddaff081de8 | bump to 0.6.3. | tsuru/tsuru-circus | tsuru/__init__.py | tsuru/__init__.py | # Copyright 2013 tsuru-circus authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.6.3"
| # Copyright 2013 tsuru-circus authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.6.2"
| bsd-3-clause | Python |
cf5a306cf17f12f4dc1b9de6876182b320d75592 | Update generate_sample_data.py | longjon/caffe,CZCV/s-dilation-caffe,CZCV/s-dilation-caffe,CZCV/s-dilation-caffe,gnina/gnina,wangg12/caffe,gnina/gnina,wangg12/caffe,wangg12/caffe,tackgeun/caffe,longjon/caffe,tackgeun/caffe,gnina/gnina,tackgeun/caffe,gogartom/caffe-textmaps,wangg12/caffe,gnina/gnina,gnina/gnina,CZCV/s-dilation-caffe,longjon/caffe,gogar... | src/caffe/test/test_data/generate_sample_data.py | src/caffe/test/test_data/generate_sample_data.py | """
Generate data used in the HDF5DataLayer test.
"""
import os
import numpy as np
import h5py
num_cols = 8
num_rows = 10
height = 6
width = 5
total_size = num_cols * num_rows * height * width
data = np.arange(total_size)
data = data.reshape(num_rows, num_cols, height, width)
data = data.astype('float32')
# We had a... | """
Generate data used in the HDF5DataLayer test.
"""
import os
import numpy as np
import h5py
num_cols = 8
num_rows = 10
height = 6
width = 5
total_size = num_cols * num_rows * height * width
data = np.arange(total_size)
data = data.reshape(num_rows, num_cols, height, width)
data = data.astype('float32')
# We had a... | bsd-2-clause | Python |
9d7d37847f01ecca03d0f76be4f00f35ba54fbb6 | Update env_detect.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/env_detect.py | device/src/env_detect.py | #!/usr/bin/env python
#Weather station.
#detect environment information from several sensors:
#water leverl, air humity, raining, air temperature, light sensitivity.
#Air temperature&humity sensor: DHT11.
#Add dht.py in micropython/stmhal/modules, refer to esp8266
#Compile the DHT in firmware, then use DHT lib in appli... | #!/usr/bin/env python
#Weather station.
#detect environment information from several sensors:
#water leverl, air humity, raining, air temperature, light sensitivity.
#Air temperature&humity sensor: DHT11.
#Add dht.py in micropython/stmhal/modules, refer to esp8266
#Compile the DHT in firmware, then use DHT lib in appli... | mit | Python |
094abcf18908e12f71af14786f18a9b0eae76b2b | Improve URL name | rennerocha/dojopuzzles | dojopuzzles/dojopuzzles/urls.py | dojopuzzles/dojopuzzles/urls.py | """dojopuzzles URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | """dojopuzzles URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | mit | Python |
c008cee41f06ec020c1d180fee4cd408d50fda9e | Add an OnCall class | wking/django-on-call | django_on_call/models.py | django_on_call/models.py | import datetime
from django.db import models
class OnCall (models.Model):
rule = models.TextField(
verbose_name='on-call rule',
help_text='Python statement for determining the on-call admin')
def get_on_call(self, now=None):
if now is None:
now = datetime.datetime.now()
... | from django.db import models
# Create your models here.
| bsd-2-clause | Python |
c315ec78fc7a4ea54d2a2e8fb8d800a0dfbbccaa | Add missing test for standard workflow | liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,... | src/adhocracy_core/adhocracy_core/workflows/test_standard.py | src/adhocracy_core/adhocracy_core/workflows/test_standard.py | from pyramid import testing
from pytest import fixture
from pytest import mark
class TestStandardWorkflow:
def get_acl(self, state, registry):
from adhocracy_core.schema import ACM
from adhocracy_core.authorization import acm_to_acl
from .standard import standard_meta
acm = ACM().d... | from pyramid import testing
from pytest import fixture
from pytest import mark
@fixture
def integration(integration):
integration.include('adhocracy_core.workflows')
return integration
@mark.usefixtures('integration')
def test_includeme_add_standard_workflow(registry):
from . import AdhocracyACLWorkflow
... | agpl-3.0 | Python |
0ee1afec8f89cba966e628dd1345575968e0ce5f | use set_backend_preference | ponty/psidialogs,ponty/psidialogs,ponty/psidialogs | psidialogs/examples/demo.py | psidialogs/examples/demo.py | import logging
from entrypoint2 import entrypoint
import psidialogs
log = logging.getLogger(__name__)
g_backend = ""
def testdata(title, dialogtype):
return dict(
message=u"This is the 'message'! (%s,%s) \u20ac" % (g_backend, dialogtype),
choices=[u"1 \u20ac", "Two", "Three"],
# text=u... | import logging
from entrypoint2 import entrypoint
import psidialogs
log = logging.getLogger(__name__)
g_backend = ""
def testdata(title, dialogtype):
# f = open(__file__)
# text = f.read()
# f.close()
# text = "long text"
return dict(
message=u"This is the 'message'! (%s,%s) \u20ac" %... | bsd-2-clause | Python |
cd5f5bd482ef59d3398ac30a8a123122e387ee7e | update version date | stonebig/winpython,winpython/winpython | winpython/__init__.py | winpython/__init__.py | # -*- coding: utf-8 -*-
"""
WinPython License Agreement (MIT License)
-----------------------------------------
Copyright (c) 2012-2013 Pierre Raybaut
Copyright (c) 2014-2021+ The Winpython development team https://github.com/winpython/
Permission is hereby granted, free of charge, to any person
obtaining a... | # -*- coding: utf-8 -*-
"""
WinPython License Agreement (MIT License)
-----------------------------------------
Copyright (c) 2012-2013 Pierre Raybaut
Copyright (c) 2014-2021+ The Winpython development team https://github.com/winpython/
Permission is hereby granted, free of charge, to any person
obtaining a... | mit | Python |
ca3cf38565c34f068e05a7dd7808f85d3163a411 | fix bug in error message | xmaruto/mcord,xmaruto/mcord,jermowery/xos,cboling/xos,cboling/xos,cboling/xos,jermowery/xos,xmaruto/mcord,jermowery/xos,xmaruto/mcord,jermowery/xos,cboling/xos,cboling/xos | xos/tosca/resources/service.py | xos/tosca/resources/service.py | import os
import pdb
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
import pdb
from core.models import Service,User,CoarseTenant
from xosresource import XOSResource
class XOSService(XOSResource):
provides = "tosca.nodes.Service"
xos_model... | import os
import pdb
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
import pdb
from core.models import Service,User,CoarseTenant
from xosresource import XOSResource
class XOSService(XOSResource):
provides = "tosca.nodes.Service"
xos_model... | apache-2.0 | Python |
987a041e9bb1d71d44bc5bd33927e56804f87ab6 | Fix org | python-glasgow/pythonglasgow,python-glasgow/pythonglasgow,python-glasgow/pythonglasgow | ug/config/base.py | ug/config/base.py | import warnings
from os import environ
THREADS_PER_PAGE = 8
DATABASE_CONNECT_OPTIONS = {}
SQLALCHEMY_DATABASE_URI = environ.get('HEROKU_POSTGRESQL_OLIVE_URL')
SECRET_KEY = environ.get('SECRET_KEY')
CSRF_ENABLED = True
CSRF_SESSION_KEY = environ.get('CSRF_SESSION_KEY')
ADMINS = frozenset(['dougal85@gmail.com'])
DEBU... | import warnings
from os import environ
THREADS_PER_PAGE = 8
DATABASE_CONNECT_OPTIONS = {}
SQLALCHEMY_DATABASE_URI = environ.get('HEROKU_POSTGRESQL_OLIVE_URL')
SECRET_KEY = environ.get('SECRET_KEY')
CSRF_ENABLED = True
CSRF_SESSION_KEY = environ.get('CSRF_SESSION_KEY')
ADMINS = frozenset(['dougal85@gmail.com'])
DEBU... | bsd-3-clause | Python |
85f2d20a98f8f62db3e381e7b14c99a091da36cc | fix overwritten wiki.py | Bitergia/allura,apache/incubator-allura,heiths/allura,apache/allura,Bitergia/allura,apache/incubator-allura,heiths/allura,apache/allura,apache/allura,leotrubach/sourceforge-allura,Bitergia/allura,apache/allura,lym/allura-git,apache/incubator-allura,apache/allura,heiths/allura,Bitergia/allura,heiths/allura,lym/allura-gi... | HelloForge/helloforge/model/wiki.py | HelloForge/helloforge/model/wiki.py | from datetime import datetime
from time import sleep
from pylons import c
import re
import markdown
import pymongo
from pymongo.errors import OperationFailure
from ming import schema as S
from ming import Field
from pyforge.model import Artifact, Message, User
wikiwords = [
(r'\b([A-Z]\w+[A-Z]+\w+)', r'<a href... | Quick Ming Example
=========================
Here is some sample code from a TG project that uses ming::
class Artifact(Document):
class __mongometa__:
session = ProjectSession(Session.by_name('main'))
name='artifact'
# Artifact base schema
_id = Field(S.ObjectId)... | apache-2.0 | Python |
0163769edf991a9214abb90e1354b754f0b2a3e6 | Bump version to 0.7.0-dev. | enthought/distarray,enthought/distarray | distarray/__version__.py | distarray/__version__.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | bsd-3-clause | Python |
2b44e078c2efad409c24a03edcac2b5861857f15 | Change APIv2 key URL | rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,OWASP/django-DefectDojo,OWASP/django-DefectDojo | dojo/user/urls.py | dojo/user/urls.py | from django.conf.urls import url
from django.contrib.auth.views import login
from dojo.user import views
urlpatterns = [
# user specific
url(r'^login$', login,
{'template_name': 'dojo/login.html'}, name='login'),
url(r'^logout$', views.logout_view, name='logout'),
url(r'^alerts$', views.alert... | from django.conf.urls import url
from django.contrib.auth.views import login
from dojo.user import views
urlpatterns = [
# user specific
url(r'^login$', login,
{'template_name': 'dojo/login.html'}, name='login'),
url(r'^logout$', views.logout_view, name='logout'),
url(r'^alerts$', views.alert... | bsd-3-clause | Python |
a4e6e540dcb775614fa4be6c43c1d825e06a0007 | Change used_mem semantics, so that it matches vm.percent and htop's memory usage report | fmarchenko/i3pystatus,Elder-of-Ozone/i3pystatus,MaicoTimmerman/i3pystatus,schroeji/i3pystatus,plumps/i3pystatus,eBrnd/i3pystatus,drwahl/i3pystatus,claria/i3pystatus,opatut/i3pystatus,drwahl/i3pystatus,richese/i3pystatus,Arvedui/i3pystatus,onkelpit/i3pystatus,onkelpit/i3pystatus,Elder-of-Ozone/i3pystatus,ncoop/i3pystatu... | i3pystatus/mem.py | i3pystatus/mem.py | from i3pystatus import IntervalModule
from psutil import virtual_memory
MEGABYTE = 1024 * 1024
class Mem(IntervalModule):
"""
Shows memory load
Available formatters:
* {avail_mem}
* {percent_used_mem}
* {used_mem}
* {total_mem}
Requires psutil (from PyPI)
"""
format = "{ava... | from i3pystatus import IntervalModule
from psutil import virtual_memory
MEGABYTE = 1024 * 1024
class Mem(IntervalModule):
"""
Shows memory load
Available formatters:
* {avail_mem}
* {percent_used_mem}
* {used_mem}
* {total_mem}
Requires psutil (from PyPI)
"""
format = "{ava... | mit | Python |
a04ebf38c42f899245dddee13a99d056a13674ff | fix syntax | shortdudey123/gbot | modules/weather.py | modules/weather.py | #!/usr/bin/env python
# =============================================================================
# file = weather.py
# description = gbot module
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-12
# mod_date = 2014-07-12
# version = 0.1
# usage = loaded by gbot
# notes =
# python_ver = 2.7.... | #!/usr/bin/env python
# =============================================================================
# file = weather.py
# description = gbot module
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-12
# mod_date = 2014-07-12
# version = 0.1
# usage = loaded by gbot
# notes =
# python_ver = 2.7.... | apache-2.0 | Python |
1c9a6944b1b04a25180b5be4f0f3da9ee9e68221 | enable caching of the PackageIndex page | crateio/crate.io | crate_project/apps/packages/simple/views.py | crate_project/apps/packages/simple/views.py | from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseNotFound, HttpResponsePermanentRedirect
from django.views.decorators.cache import cache_page
from django.views.generic.detail import DetailView
from django.views.generic.list import ListVie... | from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseNotFound, HttpResponsePermanentRedirect
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from crate.template2 import env
from packages.mod... | bsd-2-clause | Python |
55cf0b1fbc3e36bfc5f18d1b0b6455e94d905366 | fix he bug logger name | ihadzic/jim,ihadzic/jim,ihadzic/jim | jim/util.py | jim/util.py | #!/usr/bin/env python2
import sys
import logging
# This is default (test-only) certificate located in ./certs directory.
# default certificate is self-signed, so we don't have 'ca_cert' field
# in the dictionary. Normally, we need one to point to the 'CA'
test_ssl_options = { 'certfile' : sys.prefix + '/var/jim/certs... | #!/usr/bin/env python2
import sys
import logging
# This is default (test-only) certificate located in ./certs directory.
# default certificate is self-signed, so we don't have 'ca_cert' field
# in the dictionary. Normally, we need one to point to the 'CA'
test_ssl_options = { 'certfile' : sys.prefix + '/var/jim/certs... | mit | Python |
8e44f41e7c6a13428bdecd7b918d430ee72c0296 | Whitelist ted | adusca/pulse_actions,armenzg/pulse_actions,mozilla/pulse_actions | pulse_actions/utils/misc.py | pulse_actions/utils/misc.py | """
This module helps with functionality which is common to all handlers.
"""
import logging
from mozci.mozci import valid_builder
LOG = logging.getLogger(__name__)
BUILDERNAME_REPLACEMENTS = [
('Rev5 MacOSX Yosemite 10.10', 'Rev7 MacOSX Yosemite 10.10.5'),
('TB Rev5 MacOSX Yosemite 10.10', 'TB Rev7 MacOSX Y... | """
This module helps with functionality which is common to all handlers.
"""
import logging
from mozci.mozci import valid_builder
LOG = logging.getLogger(__name__)
BUILDERNAME_REPLACEMENTS = [
('Rev5 MacOSX Yosemite 10.10', 'Rev7 MacOSX Yosemite 10.10.5'),
('TB Rev5 MacOSX Yosemite 10.10', 'TB Rev7 MacOSX Y... | mpl-2.0 | Python |
537cf5da8b0328d7e6d745a4ab5456b77702e124 | Make ExternalProgramService use async process from tornado | arteria-project/arteria-delivery | delivery/services/external_program_service.py | delivery/services/external_program_service.py |
from tornado.process import Subprocess
from tornado import gen
from subprocess import PIPE
from delivery.models.execution import ExecutionResult, Execution
class ExternalProgramService(object):
"""
A service for running external programs
"""
@staticmethod
def run(cmd):
"""
Run... |
import subprocess
import logging
from delivery.models.execution import ExecutionResult, Execution
log = logging.getLogger(__name__)
class ExternalProgramService(object):
"""
A service for running external programs
"""
@staticmethod
def run(cmd):
"""
Run a process and do not wai... | mit | Python |
26dd8cf3599ffb6b10f56d06195b2ffcbbf92d74 | add measurement to test runner | byteweaver/django-eca-catalogue | eca_catalogue/tests/runtests.py | eca_catalogue/tests/runtests.py | #!/usr/bin/env python
"""
Inspired by https://github.com/mbrochh/tdd-with-django-reusable-app
Thanks a lot!
"""
import os
import sys
from django.conf import settings
EXTERNAL_APPS = [
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django... | #!/usr/bin/env python
"""
Inspired by https://github.com/mbrochh/tdd-with-django-reusable-app
Thanks a lot!
"""
import os
import sys
from django.conf import settings
EXTERNAL_APPS = [
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django... | bsd-3-clause | Python |
1b2b51a30a276914ac189bf671ae705b7ad34055 | Update doyouloveme.py | Anismash/Ani-Cogs | doyouloveme/doyouloveme.py | doyouloveme/doyouloveme.py | from discord.ext import commands
import os
import random
import discord
class doyouloveme:
"""Do the Bot loves You?"""
def __init__(self, bot):
self.bot = bot
self.love = ["Yes, I do! :heart:",
"Die!",
"I-It's not that I like you or anythi... | from discord.ext import commands
import os
import random
import discord
class doyouloveme:
"""Do the Bot loves You?"""
def __init__(self, bot):
self.bot = bot
self.love = ["Yes, I do!","Die!","I-It's not that I like you or anything...","If you bow down and kiss my feet, {}"]
... | mit | Python |
6c9b6636b63a80dcbb0335dc7aa91735de36d177 | Bump event converter subversion | fangeugene/the-blue-alliance,nwalters512/the-blue-alliance,bdaroz/the-blue-alliance,jaredhasenklein/the-blue-alliance,tsteward/the-blue-alliance,the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blue-alliance,tsteward/the-blue-alliance,phil-lopreiato/the-blue-alliance,the-blue-alliance/the-blue-alliance,fangeug... | database/dict_converters/event_converter.py | database/dict_converters/event_converter.py | from database.dict_converters.converter_base import ConverterBase
from database.dict_converters.district_converter import DistrictConverter
class EventConverter(ConverterBase):
SUBVERSIONS = { # Increment every time a change to the dict is made
3: 2,
}
@classmethod
def _convert(cls, events, ... | from database.dict_converters.converter_base import ConverterBase
from database.dict_converters.district_converter import DistrictConverter
class EventConverter(ConverterBase):
SUBVERSIONS = { # Increment every time a change to the dict is made
3: 1,
}
@classmethod
def _convert(cls, events, ... | mit | Python |
a207affa67296734950cd74db784aa37665f8a3b | update exp1 application | pupeng/hone,bolshoibooze/hone,pupeng/hone,bolshoibooze/hone,pupeng/hone,bolshoibooze/hone,pupeng/hone,bolshoibooze/hone | Controller/exp_evalCpuMem.py | Controller/exp_evalCpuMem.py | '''
HONE application
Author: Peng Sun
Purpose:
debug
'''
import time
from hone_lib import *
def CpuMemQuery():
q = (Select(['app','cpu','memory'])*
From('AppStatus')*
Where([('app','==','python')])*
Every(1000))
return q
def SumCpuMem(table):
cpuSum = []
memSum = []
fo... | '''
HONE application
Author: Peng Sun
Purpose:
debug
'''
from hone_lib import *
from math import *
import time, sys
def CpuMemQuery():
q = (Select(['app','cpu','memory'])*
From('AppStatus')*
Where([('app','==','python')])*
Every(1000))
return q
def SumCpuMem(table):
#print tabl... | bsd-3-clause | Python |
f6a0e0c48d62b4933a11bd0344ec7be003414b88 | check for anonymous user in visible_to template tag | numbas/editor,numbas/editor,numbas/editor | editor/templatetags/timeline.py | editor/templatetags/timeline.py | from django.core.serializers import serialize
import json
from django.template import Library
register = Library()
@register.filter
def can_delete_timeline_item(user,item):
return item.can_be_deleted_by(user)
@register.filter
def visible_to(items,user):
if user.is_anonymous():
return items
else:
... | from django.core.serializers import serialize
import json
from django.template import Library
register = Library()
@register.filter
def can_delete_timeline_item(user,item):
return item.can_be_deleted_by(user)
@register.filter
def visible_to(items,user):
return items.exclude(hidden_by=user)
| apache-2.0 | Python |
bac15571b5461c2fc02284d3edf37c290a05fdbc | load product demo in demo only | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/l10n_in/__manifest__.py | addons/l10n_in/__manifest__.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Indian - Accounting',
'version': '2.0',
'description': """
Indian Accounting: Chart of Account.
====================================
Indian accounting chart and localization.
Odoo allows to manag... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Indian - Accounting',
'version': '2.0',
'description': """
Indian Accounting: Chart of Account.
====================================
Indian accounting chart and localization.
Odoo allows to manag... | agpl-3.0 | Python |
ddaead07883504deab1a568cc7763478fe598385 | Rename constraint to fix name clash with new relation #305 | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | pycroft/model/facilities.py | pycroft/model/facilities.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from sqlalchemy import Column, ForeignKey, UniqueConstraint
from sqlalchemy.ext.hybrid i... | # -*- coding: utf-8 -*-
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from sqlalchemy import Column, ForeignKey, UniqueConstraint
from sqlalchemy.ext.hybrid i... | apache-2.0 | Python |
8ae86a26b54e137641b83ea628d5b6da15409efd | Update persiste_example.py record syntax. | seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core | samples/persist_example.py | samples/persist_example.py | """A sample involving creation of persistent tables
"""
import os
from blaze import Table, fromiter, mean, std, params, open
from random import random
def build_table(table_name, rows):
"""build the table to use in our example.
if already built just open it"""
if not os.path.exists(table_name):
d... | """A sample involving creation of persistent tables
"""
import os
from blaze import Table, fromiter, mean, std, params, open
from random import random
def build_table(table_name, rows):
"""build the table to use in our example.
if already built just open it"""
if not os.path.exists(table_name):
d... | bsd-2-clause | Python |
72631bc8ac90cb9dc2cc566e1d80af38fdecab34 | clean up the code | alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | alphatwirl/roottree/BEvents.py | alphatwirl/roottree/BEvents.py | # Tai Sakuma <tai.sakuma@cern.ch>
from Events import Events
from BranchBuilder import BranchBuilder
##__________________________________________________________________||
class BEvents(Events):
def __init__(self, tree, maxEvents = -1, start = 0):
super(BEvents, self).__init__(tree, maxEvents, start)
... | # Tai Sakuma <tai.sakuma@cern.ch>
from Events import Events
from BranchBuilder import BranchBuilder
##__________________________________________________________________||
class BEvents(Events):
def __init__(self, tree, maxEvents = -1, start = 0):
super(BEvents, self).__init__(tree, maxEvents, start)
... | bsd-3-clause | Python |
de3722dfced1b816910d85336f6c495c76fa9b43 | fix typo | silenius/amnesia,silenius/amnesia,silenius/amnesia | amnesia/modules/file/mapper.py | amnesia/modules/file/mapper.py | # -*- coding: utf-8 -*-
from sqlalchemy import orm
from amnesia.modules.mime import Mime
from amnesia.modules.file import File
from amnesia.modules.file import FileTranslation
from amnesia.modules.content import Content
from amnesia.modules.content import ContentTranslation
from amnesia.modules.content_type.utils im... | # -*- coding: utf-8 -*-
from sqlalchemy import orm
from amnesia.modules.mime import Mime
from amnesia.modules.file import File
from amnesia.modules.file import FileTranslation
from amnesia.modules.content import Content
from amnesia.modules.content import ContentTranslation
from amnesia.modules.content_type.utils im... | bsd-2-clause | Python |
5827c09e3a003f53baa5abe2d2d0fc5d695d4334 | Add flush to delete all renders print | arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity | arxiv_vanity/papers/management/commands/delete_all_expired_renders.py | arxiv_vanity/papers/management/commands/delete_all_expired_renders.py | from django.core.management.base import BaseCommand, CommandError
from ...models import Render
class Command(BaseCommand):
help = 'Deletes output of all expired renders'
def handle(self, *args, **options):
for render in Render.objects.expired().iterator():
try:
render.dele... | from django.core.management.base import BaseCommand, CommandError
from ...models import Render
class Command(BaseCommand):
help = 'Deletes output of all expired renders'
def handle(self, *args, **options):
for render in Render.objects.expired().iterator():
try:
render.dele... | apache-2.0 | Python |
297641da69982d6c76bd591296636b479cabf657 | fix delivery state computation | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/website_sale_delivery/models/res_country.py | addons/website_sale_delivery/models/res_country.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ResCountry(models.Model):
_inherit = 'res.country'
def get_website_sale_countries(self, mode='billing'):
res = super(ResCountry, self).get_website_sale_countries(m... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ResCountry(models.Model):
_inherit = 'res.country'
def get_website_sale_countries(self, mode='billing'):
res = super(ResCountry, self).get_website_sale_countries(m... | agpl-3.0 | Python |
9009a1fea626a934f6451d9e42b98e742a23abda | Update D_Velocity_components.py | Herpinemmanuel/Oceanography | Cas_1/D_Velocity_components.py | Cas_1/D_Velocity_components.py | import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,prefix=['U','V'])
nt = -1
nz =... | import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,prefix=['U','V'])
nt = -1
nz =... | mit | Python |
30b88146057022082252c5d1d698d4cb923cbe28 | include write key in auth header when sending events | isotoma/KeenClient-Python,ruleant/KeenClient-Python,keenlabs/KeenClient-Python | keen/api.py | keen/api.py | import requests
from keen import exceptions
__author__ = 'dkador'
class KeenApi(object):
"""
Responsible for communicating with the Keen API. Used by multiple
persistence strategies or async processing.
"""
# the default base URL of the Keen API
base_url = "https://api.keen.io"
# the def... | import requests
from keen import exceptions
__author__ = 'dkador'
class KeenApi(object):
"""
Responsible for communicating with the Keen API. Used by multiple
persistence strategies or async processing.
"""
# the default base URL of the Keen API
base_url = "https://api.keen.io"
# the def... | mit | Python |
836085922d15e1c87ada27b3f03a6678a41f1cb5 | Fix homepage | bow/pytest-pipeline | pytest_pipeline/__init__.py | pytest_pipeline/__init__.py | # -*- coding: utf-8 -*-
"""
pytest_pipeline
~~~~~~~~~~~~~~~
Pytest plugin for functional testing of data analysis pipelines.
:copyright: (c) 2014 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
"""
RELEASE = False
__version_info__ = ("0", "2", "0")
__version__ = ".".join(__version_info__)
__ve... | # -*- coding: utf-8 -*-
"""
pytest_pipeline
~~~~~~~~~~~~~~~
Pytest plugin for functional testing of data analysis pipelines.
:copyright: (c) 2014 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
"""
RELEASE = False
__version_info__ = ("0", "2", "0")
__version__ = ".".join(__version_info__)
__ve... | bsd-3-clause | Python |
1c1ac548a8b0ca19c7296417781336d88f5ab055 | fix version checks | pyamg/pyamg,pyamg/pyamg,pyamg/pyamg | pyamg/__init__.py | pyamg/__init__.py | """PyAMG: Algebraic Multigrid Solvers in Python"""
from __future__ import absolute_import
import numpy as np
import re
import scipy as sp
from .version import git_revision as __git_revision__
from .version import version as __version__
from .multilevel import coarse_grid_solver, multilevel_solver
from .classical imp... | """PyAMG: Algebraic Multigrid Solvers in Python"""
from __future__ import absolute_import
import numpy as np
import re
import scipy as sp
from .version import git_revision as __git_revision__
from .version import version as __version__
from .multilevel import coarse_grid_solver, multilevel_solver
from .classical imp... | mit | Python |
4a95eb37dba7a063b59ffa0575ecacd4fe59d5c2 | fix imports | allankilpatrick/pytest-testrail,dubner/pytest-testrail | pytest_testrail/conftest.py | pytest_testrail/conftest.py | import configparser
from .plugin import TestRailPlugin
from .testrail_api import APIClient
def pytest_addoption(parser):
group = parser.getgroup('testrail')
group.addoption(
'--testrail',
action='store',
help='Create and update testruns with TestRail')
group.addoption(
'--... | import configparser
from plugin import TestRailPlugin
from testrail_api import APIClient
def pytest_addoption(parser):
group = parser.getgroup('testrail')
group.addoption(
'--testrail',
action='store',
help='Create and update testruns with TestRail')
group.addoption(
'--no... | mit | Python |
fa2d2ae5fd34721e2acf0e072bb364cec60eda73 | Add pyblock + PPError exn + Strip one line statements | ccharly/pyaspp,lisqlql/pyaspp,lisqlql/pyaspp,ccharly/pyaspp | pyaspp/pp/pypp.py | pyaspp/pp/pypp.py | import re
import types
from .. import logger
class PPError(Exception):
pass
directive_re = re.compile('^#py.')
class Context(object):
""" Context """
filename = None
globalz = {}
def __init__(self, filename):
self.filename = filename
self.exec_stmt('import sys, os')
self... | import re
directive_re = re.compile('^#py.* ')
class Context(object):
""" Context """
filename = None
globalz = {}
def __init__(self, filename):
self.filename = filename
self.exec_stmt('import sys, os')
self.exec_stmt('_PYASPP_ROOT = os.path.abspath(os.path.dirname(sys.argv[0... | mit | Python |
bea4c8556dddc2e3f203b2424303a285e24d7bf7 | Change name for play view test | kaka0525/Copy-n-Haste,tpeek/Copy-n-Haste,kaka0525/Copy-n-Haste,kaka0525/Copy-n-Haste,tpeek/Copy-n-Haste,tpeek/Copy-n-Haste | CopyHaste/typing_test/tests.py | CopyHaste/typing_test/tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, Client
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.auth.models import User
from django.core import mail
from django.test.utils import override_settings... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, Client
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.auth.models import User
from django.core import mail
from django.test.utils import override_settings... | mit | Python |
00c6bb3713bbd30e3cfcf3987656976355a78554 | switch to revision 1.0.13 | pollen/pyrobus | pyluos/version.py | pyluos/version.py | version = '1.0.13'
| version = '1.0.11'
| mit | Python |
156a85d3719c9c3afc5b70ccee4792418f85fb33 | Add comment to script that requires netCDF4 and numpy | kinow/pccora | scripts/convert2netcdf4.py | scripts/convert2netcdf4.py | #!/usr/bin/env python3
# Requires: numpy, netCDF4
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'pccora'))
from pccora import *
from construct import *
from netCDF4 import Dataset
import numpy as np
b2 = np.dtype('int16')
b4 = np.dtype('int32')
st = np.dtype('str_')
def get_type(subco... | #!/usr/bin/env python3
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'pccora'))
from pccora import *
from construct import *
from netCDF4 import Dataset
import numpy as np
b2 = np.dtype('int16')
b4 = np.dtype('int32')
st = np.dtype('str_')
def get_type(subcon):
if Value == subcon.__c... | mit | Python |
4b5d9f4831b0fd04c8d10e7848225bfc9112e72b | Improve search model logic to not re-add non-filtered model | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | csunplugged/search/forms.py | csunplugged/search/forms.py | """Module for custom search form."""
from django import forms
from haystack.forms import ModelSearchForm
from topics.models import (
Lesson,
CurriculumIntegration,
CurriculumArea,
)
class CustomSearchForm(ModelSearchForm):
"""Class for custom search form."""
curriculum_areas = forms.ModelMultiple... | """Module for custom search form."""
from django import forms
from haystack.forms import ModelSearchForm
from topics.models import (
Lesson,
CurriculumIntegration,
CurriculumArea,
)
class CustomSearchForm(ModelSearchForm):
"""Class for custom search form."""
curriculum_areas = forms.ModelMultiple... | mit | Python |
d197f04761d50f0c7f6078a20f59048ea79e88e0 | add some handy functions | lqs/neven,mumer92/neven,mumer92/neven,lqs/neven,mumer92/neven,lqs/neven | python/pyneven.py | python/pyneven.py | from ctypes import *
class NevenFace(Structure):
_fields_ = [
("confidence", c_float),
("midpointx", c_float),
("midpointy", c_float),
("eyedist", c_float),
]
libneven = CDLL('libneven.so')
libneven.neven_create.argtypes = [c_int, c_int, c_int]
libneven.neven_detect.argtypes = ... | from ctypes import *
class NevenFace(Structure):
_fields_ = [
("confidence", c_float),
("midpointx", c_float),
("midpointy", c_float),
("eyedist", c_float),
]
libneven = CDLL('libneven.so')
libneven.neven_create.argtypes = [c_int, c_int, c_int]
libneven.neven_detect.argtypes = ... | apache-2.0 | Python |
67745b9a207ecdb187e32e818b1f43b0eaf592af | Bump version | martinsmid/pytest-ui | pytui/settings.py | pytui/settings.py | from __future__ import unicode_literals
DEBUG_MODULES = [
# 'pytui',
]
VERSION = '0.3b'
| from __future__ import unicode_literals
DEBUG_MODULES = [
# 'pytui',
]
VERSION = '0.2b2'
| mit | Python |
76b8598cda567b7d8e3a6dcb7d6852a252fe8524 | Bump version | martinsmid/pytest-ui | pytui/settings.py | pytui/settings.py | from __future__ import unicode_literals
DEBUG_MODULES = [
# 'pytui',
]
VERSION = '0.5'
| from __future__ import unicode_literals
DEBUG_MODULES = [
# 'pytui',
]
VERSION = '0.4'
| mit | Python |
38a6486cb4909b552181482bbf3360fd51168cd1 | Add revid to Notification object | wikimedia/pywikibot-core,jayvdb/pywikibot-core,npdoty/pywikibot,PersianWikipedia/pywikibot-core,hasteur/g13bot_tools_new,wikimedia/pywikibot-core,happy5214/pywikibot-core,happy5214/pywikibot-core,npdoty/pywikibot,Darkdadaah/pywikibot-core,magul/pywikibot-core,jayvdb/pywikibot-core,hasteur/g13bot_tools_new,magul/pywikib... | pywikibot/echo.py | pywikibot/echo.py | # -*- coding: utf-8 -*-
"""Classes and functions for working with the Echo extension."""
from __future__ import absolute_import, unicode_literals
import pywikibot
class Notification(object):
"""A notification issued by the Echo extension."""
def __init__(self, site):
"""Construct an empty Notifica... | # -*- coding: utf-8 -*-
"""Classes and functions for working with the Echo extension."""
from __future__ import absolute_import, unicode_literals
import pywikibot
class Notification(object):
"""A notification issued by the Echo extension."""
def __init__(self, site):
"""Construct an empty Notifica... | mit | Python |
daba73d2e7ddee8988d8391719e5f4c9ee3ee69e | update settings/internationalization.py: change TIME_ZONE accroding to Korea | jupiny/EnglishDiary,jupiny/EnglishDiary,jupiny/EnglishDiary | english_diary/english_diary/settings/partials/internationalization.py | english_diary/english_diary/settings/partials/internationalization.py | # Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Seoul'
USE_I18N = True
USE_L10N = True
USE_TZ = True
| # Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
| mit | Python |
57133a819d851d321559536a935412a22fc302d2 | Revert "I did a thiiiiing!" | Sirs0ri/PersonalAssistant | Samantha/plugins/schedule_plugin.py | Samantha/plugins/schedule_plugin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import core, threading, time, datetime
is_sam_plugin = 1
name = "Schedule"
keywords = []
has_toggle = 0
has_set = 0
class Plugin_Thread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.name = name + "_Thread"
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import core, threading, time, datetime
is_sam_plugin = 1
name = "Schedule"
keywords = []
has_toggle = 0
has_set = 0
class Plugin_Thread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.name = name + "_Thread"
... | mit | Python |
16ad5a3f17fdb96f2660019fabbd7bb787ae4ffb | Add pos for max_lemma_count also | alvations/pywsd,alvations/pywsd | pywsd/baseline.py | pywsd/baseline.py | #!/usr/bin/env python -*- coding: utf-8 -*-
#
# Python Word Sense Disambiguation (pyWSD): Baseline WSD
#
# Copyright (C) 2014-2020 alvations
# URL:
# For license information, see LICENSE.md
import random
custom_random = random.Random(0)
def random_sense(ambiguous_word, pos=None):
""" Returns a random sense. """
... | #!/usr/bin/env python -*- coding: utf-8 -*-
#
# Python Word Sense Disambiguation (pyWSD): Baseline WSD
#
# Copyright (C) 2014-2020 alvations
# URL:
# For license information, see LICENSE.md
import random
custom_random = random.Random(0)
def random_sense(ambiguous_word, pos=None):
""" Returns a random sense. """
... | mit | Python |
4f3a2c0443c880e4547ea31c5d8345f9202788fa | fix events for smartthings acceleration cluster (#26557) | mKeRix/home-assistant,rohitranjan1991/home-assistant,balloob/home-assistant,FreekingDean/home-assistant,Cinntax/home-assistant,tchellomello/home-assistant,Teagan42/home-assistant,w1ll1am23/home-assistant,joopert/home-assistant,tboyce021/home-assistant,pschmitt/home-assistant,soldag/home-assistant,mKeRix/home-assistant,... | homeassistant/components/zha/core/channels/manufacturerspecific.py | homeassistant/components/zha/core/channels/manufacturerspecific.py | """
Manufacturer specific channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import logging
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_send
fro... | """
Manufacturer specific channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import logging
from . import AttributeListeningChannel
from .. import registries
from ..const import REPORT_CONFIG_ASAP, REPOR... | mit | Python |
f41d9f84f814468a0d615e83e056bc4193229554 | fix gpu | YosefLab/scVI | scvi/metrics/imputation.py | scvi/metrics/imputation.py | import numpy as np
import torch
from scvi.utils import to_cuda, no_grad, eval_modules
@no_grad()
@eval_modules()
def imputation(vae, data_loader, rate=0.1):
distance_list = torch.FloatTensor([])
for tensorlist in data_loader:
if vae.use_cuda:
tensorlist = to_cuda(tensorlist)
sampl... | import numpy as np
import torch
from scvi.utils import to_cuda, no_grad, eval_modules
@no_grad()
@eval_modules()
def imputation(vae, data_loader, rate=0.1):
distance_list = torch.FloatTensor([])
if vae.use_cuda:
distance_list = distance_list.cuda(async=True)
for tensorlist in data_loader:
... | bsd-3-clause | Python |
c68a212e28aec3424af517e9f0b91365d8672fb6 | Update example.py | BobStevens/micropython | BMP085/example.py | BMP085/example.py | # Continuously polls the BMP180 Pressure Sensor
import pyb
from BMP085 import BMP085
# creating objects
blue = pyb.LED(4)
bmp180 = BMP085(port=2,address=0x77,mode=3,debug=False)
while 1:
blue.toggle()
temperature = bmp180.readTemperature()
print("%f celcius" % temperature)
pressure = bmp180.readPressure()
... | # Continuously polls the BMP180 Pressure Sensor
import pyb
import BMP085
# creating objects
blue = pyb.LED(4)
bmp180 = BMP085.BMP085(port=2,address=0x77,mode=3,debug=False)
while 1:
blue.toggle()
temperature = bmp180.readTemperature()
print("%f celcius" % temperature)
pressure = bmp180.readPressure()
pr... | mit | Python |
69d8a7a8db5557e9371dcc9864fcab6bc20cb78e | Make cmitfb migration accept domain | qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/app_manager/management/commands/migrate_app_to_cmitfb.py | corehq/apps/app_manager/management/commands/migrate_app_to_cmitfb.py | import logging
from lxml import etree as ET
from couchdbkit import ResourceNotFound
from django.core.management import BaseCommand
from corehq.apps.app_manager.dbaccessors import get_app_ids_in_domain
from corehq.apps.app_manager.models import Application, PreloadAction
from corehq.apps.app_manager.util import save_x... | import logging
from lxml import etree as ET
from django.core.management import BaseCommand
from corehq.apps.app_manager.models import Application, PreloadAction
from corehq.apps.app_manager.util import save_xform
from corehq.apps.app_manager.xform import XForm
logger = logging.getLogger('app_migration')
logger.setL... | bsd-3-clause | Python |
0ba9972733cc35cd43730054fd06d1f4a4ba59ee | bump to v2.4.0 | rubik/radon | radon/__init__.py | radon/__init__.py | '''This module contains the main() function, which is the entry point for the
command line interface.'''
__version__ = '2.4.0'
def main():
'''The entry point for Setuptools.'''
import sys
from radon.cli import program, log_error
if not sys.argv[1:]:
sys.argv.append('-h')
try:
pro... | '''This module contains the main() function, which is the entry point for the
command line interface.'''
__version__ = '2.3.1'
def main():
'''The entry point for Setuptools.'''
import sys
from radon.cli import program, log_error
if not sys.argv[1:]:
sys.argv.append('-h')
try:
pro... | mit | Python |
bfedd0eb87ad5bdf937a1f5f3e143a8e538ce86f | Rename package from avulsion to rafem. | katmratliff/avulsion-bmi,mcflugen/avulsion-bmi | rafem/__init__.py | rafem/__init__.py | """River Avulsion Module."""
from .riverbmi import BmiRiverModule
from .rivermodule import rivermodule
__all__ = ['BmiRiverModule', 'rivermodule']
| """River Avulsion Module."""
from .riverbmi import BmiRiverModule
from .rivermodule import RiverModule
__all__ = ['BmiRiverModule', 'RiverModule']
| mit | Python |
d15af7b083d9e75f4a8ec74149a66ccb44f536e3 | change get_club() to club | hbuyse/VBTournaments,hbuyse/VBTournaments,hbuyse/VBTournaments | core/admin.py | core/admin.py | #! /usr/bin/env python
__author__ = "Henri Buyse"
from django.contrib import admin
from .models import Event, Tournament
class TournamentAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['_event', '_date']}),
('Format', {'fields': ['_nb_players', '_sx_players']}),
('Level', {'fi... | #! /usr/bin/env python
__author__ = "Henri Buyse"
from django.contrib import admin
from .models import Event, Tournament
class TournamentAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['_event', '_date']}),
('Format', {'fields': ['_nb_players', '_sx_players']}),
('Level', {'fi... | mit | Python |
d2a2431ef73912d4f8747efac9491780abea130d | remove sleep in write() | viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker | core/alert.py | core/alert.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import random
from core import color
from core.languages import all_messages
from core.compatible import version
def messages(language, msg_id):
# Importing messages
msgs = all_messages()
# Returning selected langauge
if language i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import random
from core import color
from core.languages import all_messages
from core.compatible import version
def messages(language, msg_id):
# Importing messages
msgs = all_messages()
# Returning selected langauge
if language i... | apache-2.0 | Python |
dd023f3f342a96d88c4d2e80b33242304fe226f5 | Fix reading config and initializing template directory | jasedit/scriptorium,jasedit/papers_base | scriptorium/config.py | scriptorium/config.py | #!/usr/bin/env python
"""Configuration related functionality for scriptorium."""
import os
import yaml
import scriptorium
_DEFAULT_DIR = os.path.join(os.path.expanduser("~"), '.scriptorium')
_DEFAULT_CFG = os.path.join(_DEFAULT_DIR, 'config')
def read_config():
"""Read configuration values for scriptorium."""
... | #!/usr/bin/env python
"""Configuration related functionality for scriptorium."""
import os
import os.path
import shutil
import yaml
import scriptorium
_DEFAULT_DIR = os.path.join(os.path.expanduser("~"), '.scriptorium')
_DEFAULT_CFG = os.path.join(_DEFAULT_DIR, 'config')
def read_config():
"""Read configuration... | mit | Python |
a6c51c2e0c9867fa1256144203e1e14a68d4e74e | Add shutdown() method. | sippy/rtp_cluster,sippy/rtp_cluster | Cli_server_tcp.py | Cli_server_tcp.py | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistrib... | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistrib... | bsd-2-clause | Python |
7e88e8b35a7519c3ec6d20bb7f09817c46961d6d | set develop version | conan-io/conan,conan-io/conan,conan-io/conan | conans/__init__.py | conans/__init__.py | # Allow conans to import ConanFile from here
# to allow refactors
from conans.client.build.autotools_environment import AutoToolsBuildEnvironment
from conans.client.build.cmake import CMake
from conans.client.build.meson import Meson
from conans.client.build.msbuild import MSBuild
from conans.client.build.visual_enviro... | # Allow conans to import ConanFile from here
# to allow refactors
from conans.client.build.autotools_environment import AutoToolsBuildEnvironment
from conans.client.build.cmake import CMake
from conans.client.build.meson import Meson
from conans.client.build.msbuild import MSBuild
from conans.client.build.visual_enviro... | mit | Python |
aa20521ac568ad1b159d9bf6b01c01dec751971f | Update __init__.py | ktbyers/netmiko,ktbyers/netmiko | netmiko/citrix/__init__.py | netmiko/citrix/__init__.py | from __future__ import unicode_literals
from netmiko.citrix.netscaler_ssh import NetscalerSSH
__all__ = ['NetscalerSSH']
| mit | Python | |
c70c0522846caf22b02fc21c9e96f753db049bc9 | Make sure formatting on error is more user friendly and newlines are correctly replaced. | StackStorm/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2 | st2api/st2api/cmd/api.py | st2api/st2api/cmd/api.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
103a04b4d4373e2865cefef0d4e36cf41416807b | Save and load led state to file. | Joseja8/android_speechRecognition,Joseja8/android_speechRecognition | Connector/main.py | Connector/main.py | from pyfirmata import Arduino, time
import nltk
import sys
board = Arduino('/dev/ttyACM0')
nltk.data.path.append("/home/joseja/Documents/nltk_data")
tokenizer = nltk.TrekebankWordTokenizer()
def parse_input_tokens(input_tokens):
task = None
pins = []
if 'encender' in input_tokens:
task = 1
... | from pyfirmata import Arduino, time
import nltk
import sys
board = Arduino('/dev/ttyACM0')
nltk.data.path.append("/home/joseja/Documents/nltk_data")
tokenizer = nltk.TreebankWordTokenizer()
def parse_input_tokens(input_tokens):
task = None
pin = None
if 'encender' in input_tokens:
task = 1
e... | apache-2.0 | Python |
693f86962ef13240f188e63e5589bb6437b7beb4 | Fix project name. | pwcazenave/PyFVCOM | PyFVCOM/__init__.py | PyFVCOM/__init__.py | """
The FVCOM Python toolbox (PyFvcom)
"""
__version__ = '1.2'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
# Import numpy so we have it across the board.
import numpy as np
# Import everything!
import buoy_tools... | """
The FVCOM Python toolbox (pyfvcom)
"""
__version__ = '1.2'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
# Import numpy so we have it across the board.
import numpy as np
# Import everything!
import buoy_tools... | mit | Python |
2da2bcfa1b8986225dec078392a73c27b2a96576 | Fix the unicode tests | onitu/onitu,onitu/onitu,onitu/onitu | drivers/webdav/onitu_webdav/tests/driver.py | drivers/webdav/onitu_webdav/tests/driver.py | import os
import hashlib
from io import BytesIO
from tests.utils import driver
from onitu_webdav.wd import get_WEBDAV_client, create_dirs
from onitu.utils import get_random_string, b
class Driver(driver.Driver):
def __init__(self, *args, **options):
options['hostname'] = os.getenv(
"ONITU_WE... | import os
import hashlib
from io import BytesIO
from tests.utils import driver
from onitu_webdav.wd import get_WEBDAV_client, create_dirs
from onitu.utils import get_random_string
class Driver(driver.Driver):
def __init__(self, *args, **options):
options['hostname'] = os.getenv(
"ONITU_WEBDA... | mit | Python |
adf8e7bac244904cd20763132759a8d7cace5edd | Add missing (object) | jmikkola/dep_injector | injector/graph.py | injector/graph.py | import collections
class DependencyGraph(object):
""" A generic dependency graph, useful for checking some properties """
def __init__(self, graph):
""" Creates a new DependencyGraph
:param graph: A dict mapping a dependency name to a list of zero or more things it depends on
"""
... | import collections
class DependencyGraph:
""" A generic dependency graph, useful for checking some properties """
def __init__(self, graph):
""" Creates a new DependencyGraph
:param graph: A dict mapping a dependency name to a list of zero or more things it depends on
"""
self... | mit | Python |
6840081ec06339b6b4d3e9cdd1f36e894ddf1cd7 | fix example to work again | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | examples/quickstart/example3.py | examples/quickstart/example3.py | from neuroimaging.core.image.image import Image
from neuroimaging.modalities.fmri import fMRIImage
import numpy as N
import pylab
def mask_and_func(subject=0, run=1, offset=5):
M = Image('http://kff.stanford.edu/FIAC/fiac%d/fonc%d/fsl/mask.img' % (subject,run))
m = N.zeros(M.grid.shape)
middle = [slice... | from neuroimaging.core.image.image import Image
from neuroimaging.modalities.fmri import fMRIImage
import numpy as N
import pylab
def mask_and_func(subject=0, run=1, offset=5):
M = Image('http://kff.stanford.edu/FIAC/fiac%d/fonc%d/fsl/mask.img' % (subject,run))
m = N.zeros(M.grid.shape)
middle = [slice... | bsd-3-clause | Python |
c0b13cf6924aade86fe5fb9470f57d40a8ca8e50 | Update gcp children to inherit errors from gcp.py | google/capirca,google/capirca,google/capirca,google/capirca | capirca/lib/gcp.py | capirca/lib/gcp.py | # Lint as: python3
"""Generic Google Cloud Platform multi-product generator.
Base class for GCP firewalling products.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
from capirca.lib import aclgenerat... | # Lint as: python3
"""Generic Google Cloud Platform multi-product generator.
Base class for GCP firewalling products.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
from capirca.lib import aclgenerat... | apache-2.0 | Python |
57cad118f0bd321fce487a27fd9909529ef4d3b6 | Fix example | AxisPhilly/py-li | examples/save_permits_as_csv.py | examples/save_permits_as_csv.py | import sys
sys.path.append("..")
import li
import csv
import codecs
import cStringIO
class DictUnicodeWriter(object):
"""Unicode CSV writer from
http://stackoverflow.com/questions/5838605/python-dictwriter-writing-utf-8-encoded-csv-files
"""
def __init__(self, f, fieldnames, dialect=csv.excel, encodi... | import sys
sys.path.append("..")
import li
import csv
import codecs
import cStringIO
class DictUnicodeWriter(object):
"""Unicode CSV writer from
http://stackoverflow.com/questions/5838605/python-dictwriter-writing-utf-8-encoded-csv-files
"""
def __init__(self, f, fieldnames, dialect=csv.excel, encodi... | mit | Python |
dfbe71a6d6a1e8591b1a6d7d5baeda20f2e40c47 | Make function top level importable | bgyori/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,sorgerlab/indra,bgyori/indra,johnbachman/indra,johnbachman/belpy,johnbachman/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/belpy | indra/explanation/model_checker/__init__.py | indra/explanation/model_checker/__init__.py | from .model_checker import ModelChecker, PathResult, PathMetric, get_path_iter
from .pysb import PysbModelChecker
from .signed_graph import SignedGraphModelChecker
from .unsigned_graph import UnsignedGraphModelChecker
from .pybel import PybelModelChecker
from .model_checker import signed_edges_to_signed_nodes, prune_si... | from .model_checker import ModelChecker, PathResult, PathMetric, get_path_iter
from .pysb import PysbModelChecker
from .signed_graph import SignedGraphModelChecker
from .unsigned_graph import UnsignedGraphModelChecker
from .pybel import PybelModelChecker
| bsd-2-clause | Python |
ccf5c8128fe196875ef4e9352d28dddde319c997 | Remove un-needed print command | samjabrahams/anchorhub | anchorhub/util/tests/test_getanchorhubpath.py | anchorhub/util/tests/test_getanchorhubpath.py | """
Tests for getanchorhubpath.py
http://www.github.com/samjabrahams/anchorhub/util/getanchorhubpath.py
"""
import os.path as path
from anchorhub.util.getanchorhubpath import get_anchorhub_path
from anchorhub.compatibility import get_path_separator
def test_get_anchorhub_path_directory():
"""
getanchorhubpat... | """
Tests for getanchorhubpath.py
http://www.github.com/samjabrahams/anchorhub/util/getanchorhubpath.py
"""
import os.path as path
from anchorhub.util.getanchorhubpath import get_anchorhub_path
from anchorhub.compatibility import get_path_separator
def test_get_anchorhub_path_directory():
"""
getanchorhubpat... | apache-2.0 | Python |
6fa2144168530ac46062936fabcdcb3a2534e754 | rename attribute as an existing subclass already uses this... | moyogo/ufo2ft,jamesgk/ufo2fdk,jamesgk/ufo2ft,moyogo/ufo2fdk,googlei18n/ufo2ft,benkiel/ufo2fdk,daltonmaag/ufo2fdk,googlefonts/ufo2ft,typemytype/ufo2fdk,typesupply/ufo2fdk,bitforks/ufo2fdk,anthrotype/ufo2fdk | Lib/ufo2fdk/pens/__init__.py | Lib/ufo2fdk/pens/__init__.py | from fontTools.pens.basePen import BasePen
def roundInt(v):
return int(round(v))
def roundIntPoint((x, y)):
return roundInt(x), roundInt(y)
class RelativeCoordinatePen(BasePen):
def __init__(self, glyphSet):
BasePen.__init__(self, glyphSet)
self._lastX = None
self._lastY = None
... | from fontTools.pens.basePen import BasePen
def roundInt(v):
return int(round(v))
def roundIntPoint((x, y)):
return roundInt(x), roundInt(y)
class RelativeCoordinatePen(BasePen):
def __init__(self, glyphSet):
BasePen.__init__(self, glyphSet)
self._lastX = None
self._lastY = None
... | mit | Python |
282127681806131150059b36df8c55a9b58ab80c | add transpiled go result to comment | nok/sklearn-porter | examples/classifier/LinearSVC/go/example.py | examples/classifier/LinearSVC/go/example.py | from sklearn import svm
from sklearn.datasets import load_iris
from onl.nok.sklearn.Porter import port
iris = load_iris()
clf = svm.LinearSVC(C=1., random_state=0)
clf.fit(iris.data, iris.target)
# Cheese!
print(port(clf, language='go'))
"""
package main
import (
"fmt"
"math"
)
func predict(atts []float64) int... | from sklearn import svm
from sklearn.datasets import load_iris
from onl.nok.sklearn.Porter import port
iris = load_iris()
clf = svm.LinearSVC(C=1., random_state=0)
clf.fit(iris.data, iris.target)
# Cheese!
print(port(clf, language='go'))
| bsd-3-clause | Python |
7320f685b6218589b04201dc9a26b41f19c1c7e4 | Increment version | astro-pi/astro-pi-hat,RPi-Distro/python-sense-hat | sense_hat/__init__.py | sense_hat/__init__.py | from __future__ import absolute_import
from .sense_hat import SenseHat, SenseHat as AstroPi
from .stick import (
SenseStick,
InputEvent,
DIRECTION_UP,
DIRECTION_DOWN,
DIRECTION_LEFT,
DIRECTION_RIGHT,
DIRECTION_MIDDLE,
ACTION_PRESSED,
ACTION_RELEASED,
ACTION_HELD,
... | from __future__ import absolute_import
from .sense_hat import SenseHat, SenseHat as AstroPi
from .stick import (
SenseStick,
InputEvent,
DIRECTION_UP,
DIRECTION_DOWN,
DIRECTION_LEFT,
DIRECTION_RIGHT,
DIRECTION_MIDDLE,
ACTION_PRESSED,
ACTION_RELEASED,
ACTION_HELD,
... | bsd-3-clause | Python |
d0e5c03fe37d89747e870c57312701df0e2949c0 | Move ansi_escape to generic function | victal/ulp,victal/ulp | ulp/urlextract.py | ulp/urlextract.py | # coding=utf-8
import re
import os
import sys
# Regex for matching URLs
# See https://mathiasbynens.be/demo/url-regex
url_regex = re.compile(r"((https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?)")
ansi_escape_regex = re.compile(r"(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]", re.IGNORECASE)
INPUT_FILE = os.path.join(os.getenv('HOM... | # coding=utf-8
import re
import os
import sys
# Regex for matching URLs
# See https://mathiasbynens.be/demo/url-regex
url_regex = re.compile(r"((https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?)")
ansi_escape_regex = re.compile(r"(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]", re.IGNORECASE)
INPUT_FILE = os.path.join(os.getenv('HOM... | mit | Python |
a9ca371fe3625101f06663d7b6a11939b6426773 | use django_extension | Niharika29/bugtracker,Niharika29/bugtracker,Niharika29/bugtracker | bugtracker/bugtracker/bugtracker/settings/local.py | bugtracker/bugtracker/bugtracker/settings/local.py | """Development settings and globals."""
from __future__ import absolute_import
from os.path import join, normpath
from .base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-deb... | """Development settings and globals."""
from __future__ import absolute_import
from os.path import join, normpath
from .base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-deb... | mit | Python |
cedeb9791b002f75e47cc017707c57aa0d4c4672 | Make RPC codes a named tuple | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/components/components/prpc/codes.py | appengine/components/components/prpc/codes.py | # Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Definition of possible RPC response status codes."""
import collections
StatusCodeBase = collections.namedtuple('StatusCodeBase', ['value', '... | # Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Definition of possible RPC response status codes."""
class StatusCode(object):
"""Mirrors grpc.StatusCode in the gRPC Core.
See https://... | apache-2.0 | Python |
03c2674009906ea49df168c8e1a71f0ed3a9c2b0 | Update __init__.py | unixxxx/simplecms | config/__init__.py | config/__init__.py | import base64
import os
import mongoengine
__author__ = 'ShJashiashvili'
import bottle
import os
from models.cmsmodels import Users, Email, Posts
from datetime import datetime
DB_CREDENTIALS = {
'creds': {
'username': os.environ['OPENSHIFT_MONGODB_DB_USERNAME'],
'password': os.environ['OPENSHIFT... | import base64
import os
import mongoengine
__author__ = 'ShJashiashvili'
import bottle
import os
from models.cmsmodels import Users, Email, Posts
from datetime import datetime
DB_CREDENTIALS = {
'creds': {
'username': os.environ['OPENSHIFT_MONGODB_DB_USERNAME'],
'password': os.environ['OPENSHIFT... | mit | Python |
17f57895a024d61886d4b102966a013cda5d8296 | Drop unnecessary configuration [WAL-973] | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind | src/nodeconductor_assembly_waldur/experts/extension.py | src/nodeconductor_assembly_waldur/experts/extension.py | from __future__ import unicode_literals
from nodeconductor.core import NodeConductorExtension
class ExpertsExtension(NodeConductorExtension):
class Settings:
pass
@staticmethod
def django_app():
return 'nodeconductor_assembly_waldur.experts'
@staticmethod
def is_assembly():
... | from __future__ import unicode_literals
from nodeconductor.core import NodeConductorExtension
class ExpertsExtension(NodeConductorExtension):
class Settings:
WALDUR_EXPERTS = {
'IS_ACTIVE': False
}
@staticmethod
def django_app():
return 'nodeconductor_assembly_waldur.... | mit | Python |
992ce40ab6cb730b25f82dbcc4be70b4a194cbe2 | Make the shorttest script write profiling info to file | LogicalDash/LiSE,LogicalDash/LiSE | LiSE/shorttest.py | LiSE/shorttest.py | from LiSE.examples.college import install
from LiSE.engine import Engine
def test():
eng = Engine(":memory:")
install(eng)
for i in range(24):
eng.next_tick()
if __name__ == '__main__':
import cProfile
cProfile.run('test()', filename='profile')
| from LiSE.examples.college import install
from LiSE.engine import Engine
eng = Engine(":memory:")
install(eng)
for i in range(24):
eng.next_tick()
| agpl-3.0 | Python |
7996a26cdceb60669612cfd683372bb9fa12d105 | Fix docstring early stopping | google/flax,google/flax | flax/training/early_stopping.py | flax/training/early_stopping.py | # Copyright 2022 The Flax Authors.
#
# 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 wri... | # Copyright 2022 The Flax Authors.
#
# 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 wri... | apache-2.0 | Python |
69e3d2dfd68eb9f7b35a5dd5d853e340c31100d9 | Revert "no more sleeping for real!" | SirRujak/SirBot | dev/TOPSECRET/SirBot/SirBot.py | dev/TOPSECRET/SirBot/SirBot.py | # -*- coding: utf-8 -*-
#main sirbot script
ON = 1
SPLASH = 1
##try:
import lib.sirbot.initialize as initialize
if(SPLASH == 1):
#display splash
splash = initialize.splashing()
root = splash.root()
#import configurations
from lib.sirbot.configloader import configloader
config = configloader()
#import... | # -*- coding: utf-8 -*-
#main sirbot script
ON = 1
SPLASH = 1
##try:
import lib.sirbot.initialize as initialize
if(SPLASH == 1):
#display splash
splash = initialize.splashing()
root = splash.root()
#import configurations
from lib.sirbot.configloader import configloader
config = configloader()
#import... | mit | Python |
ef91b120492d54126f9a4ede63083a486d4cc05b | Change name class | Garvys/PingPongSkill | ping_pong_skill/ping_pong_skill.py | ping_pong_skill/ping_pong_skill.py | # -*-: coding utf-8 -*-
""" Skeleton Snips skill. """
class PingPongSkill:
""" Skeleton Snips skill. """
def __init__(self):
"""
:param hostname: hostname for some IoT device
:param light_ids: A list of light IDs
"""
pass
def turn_on(self):
""" Turn on something. ... | # -*-: coding utf-8 -*-
""" Skeleton Snips skill. """
class MySkill:
""" Skeleton Snips skill. """
def __init__(self, hostname, light_ids):
"""
:param hostname: hostname for some IoT device
:param light_ids: A list of light IDs
"""
self.hostname = hostname
self.... | mit | Python |
3645905a1108af2315529ea6473b96be823aaad6 | fix pycodestyle | uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot | pivot/templatetags/pivot_extras.py | pivot/templatetags/pivot_extras.py | from django import template
from django.conf import settings
from pivot.utils import get_latest_term, get_quarters_for_file, is_more_recent
register = template.Library()
@register.simple_tag
def year_select_tab(num_qtrs):
end_term = get_latest_term()
num_years = int(num_qtrs / 4)
end_year = end_term[2:]... | from django import template
from django.conf import settings
from pivot.utils import get_latest_term, get_quarters_for_file, is_more_recent
register = template.Library()
@register.simple_tag
def year_select_tab(num_qtrs):
end_term = get_latest_term()
num_years = int(num_qtrs / 4)
end_year = end_term[2:]... | apache-2.0 | Python |
b4f4e870877e4eae8e7dbf2dd9c961e5eec6980d | Add MIME-handling options to s3cmd | openpathsampling/openpathsampling,choderalab/openpathsampling,choderalab/openpathsampling,dwhswenson/openpathsampling,openpathsampling/openpathsampling,choderalab/openpathsampling,dwhswenson/openpathsampling,dwhswenson/openpathsampling,openpathsampling/openpathsampling,dwhswenson/openpathsampling,openpathsampling/openp... | devtools/ci/push-docs-to-s3.py | devtools/ci/push-docs-to-s3.py | import os
import pip
import tempfile
import subprocess
import openpathsampling.version
BUCKET_NAME = 'openpathsampling.org'
if not openpathsampling.version.release:
PREFIX = 'latest'
else:
PREFIX = openpathsampling.version.short_version
if not any(d.project_name == 's3cmd' for d in pip.get_installed_distribu... | import os
import pip
import tempfile
import subprocess
import openpathsampling.version
BUCKET_NAME = 'openpathsampling.org'
if not openpathsampling.version.release:
PREFIX = 'latest'
else:
PREFIX = openpathsampling.version.short_version
if not any(d.project_name == 's3cmd' for d in pip.get_installed_distribu... | mit | Python |
816824a83c11512e0f453b2c833776205e7b5565 | Add multi-GPU unittests for Function.Copy | okuta/chainer,chainer/chainer,jnishi/chainer,okuta/chainer,jnishi/chainer,ronekko/chainer,wkentaro/chainer,ktnyt/chainer,ktnyt/chainer,niboshi/chainer,okuta/chainer,kikusu/chainer,okuta/chainer,cemoody/chainer,tscohen/chainer,jnishi/chainer,wkentaro/chainer,niboshi/chainer,sinhrks/chainer,delta2323/chainer,niboshi/chai... | tests/chainer_tests/functions_tests/array_tests/test_copy.py | tests/chainer_tests/functions_tests/array_tests/test_copy.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
def _to_gpu(x, device_id):
if device_id >= 0:
return cuda.to_gpu(x, device_id)
else:
return x
c... | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
from chainer import testing
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.u... | mit | Python |
488800933542fc46cc9d1c63035a5c5f28af1048 | Update the lock webhook | straylightlabs/hands-free-lock,straylightlabs/hands-free-lock,straylightlabs/hands-free-lock,straylightlabs/hands-free-lock,straylightlabs/hands-free-lock | ScannerServer/ble_scanner.py | ScannerServer/ble_scanner.py | #!/usr/bin/env python
import datetime
import requests
import sys
import time
from subprocess import PIPE, Popen
from threading import Thread
from Queue import Queue, Empty
SCANNER_NAME = 'SCANNER0';
ON_POSIX = 'posix' in sys.builtin_module_names
def enqueue_output(out, queue):
for line in iter(out.readline, b'... | #!/usr/bin/env python
import datetime
import requests
import sys
import time
from subprocess import PIPE, Popen
from threading import Thread
from Queue import Queue, Empty
SCANNER_NAME = 'SCANNER0';
ON_POSIX = 'posix' in sys.builtin_module_names
def enqueue_output(out, queue):
for line in iter(out.readline, b'... | mit | Python |
5462b1dbd590647d3716b581b555d8f25c9ef450 | Add National Endowment for the Arts. | lukerosiak/inspectors-general,divergentdave/inspectors-general | inspectors/nea.py | inspectors/nea.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://arts.gov/oig
# Oldest report: 2005
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
AUDI... | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://arts.gov/oig
# Oldest report: 2005
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
AUDI... | cc0-1.0 | Python |
e45ba49d6e6b224c66ae7df8f98474e3ab47930a | Add support for python 3 print function. | ngraziano/isystem-to-mqtt | isystem_to_mqtt/tag_definition.py | isystem_to_mqtt/tag_definition.py | from __future__ import print_function
import logging
_LOGGER = logging.getLogger(__name__)
class TagDefinition(object):
""" Define a tag with mqtt topic and convertion """
def __init__(self, tag_name, convertion, needed_value=1):
self.tag_name = tag_name
self.convertion = convertion
... | import logging
_LOGGER = logging.getLogger(__name__)
class TagDefinition(object):
""" Define a tag with mqtt topic and convertion """
def __init__(self, tag_name, convertion, needed_value=1):
self.tag_name = tag_name
self.convertion = convertion
self.needed_value = needed_value
... | mit | Python |
1096b293af15059ce363c0569d5927de2cefd9c2 | Remove unnecessary print | srisankethu/coala-bears,coala/coala-bears,naveentata/coala-bears,ankit01ojha/coala-bears,refeed/coala-bears,seblat/coala-bears,Vamshi99/coala-bears,Vamshi99/coala-bears,srisankethu/coala-bears,coala/coala-bears,ankit01ojha/coala-bears,shreyans800755/coala-bears,aptrishu/coala-bears,refeed/coala-bears,Shade5/coala-bears... | tests/python/pyroma_test_files/complete/complete/__init__.py | tests/python/pyroma_test_files/complete/complete/__init__.py | import os
os.__doc__
| import os
print(os.__doc__)
| agpl-3.0 | Python |
fca7c86e762f598abcdc0beeb76792fe3c6e7217 | Add asserts | lukedawilson/ld37 | robot_algorithm_tests.py | robot_algorithm_tests.py | from robot_algorithm import RobotAlgorithm
import inspect
class Sprite:
def __init__(self, left = False, right = False, front = False):
self.left = left
self.right = right
self.front = front
self.commands = []
def get_commands(self):
return self.commands
... | from robot_algorithm import RobotAlgorithm
class Sprite:
def __init__(self, left = False, right = False, front = False):
self.left = left
self.right = right
self.front = front
self.commands = []
def get_commands(self):
return self.commands
def rotate(se... | unlicense | Python |
40491b243beca358e81184857a155fb4d2d52157 | Add a more useful representation of Shipper objects | jbittel/drogher | drogher/shippers/base.py | drogher/shippers/base.py | import re
class Shipper(object):
barcode = None
barcode_pattern = None
shipper = None
def __init__(self, barcode):
self.barcode = barcode
def __repr__(self):
return "%s('%s')" % ('shippers.' + self.__class__.__name__, self.barcode)
@property
def is_valid(self):
i... | import re
class Shipper(object):
barcode = None
barcode_pattern = None
shipper = None
def __init__(self, barcode):
self.barcode = barcode
@property
def is_valid(self):
if self.matches_barcode and self.valid_checksum:
return True
return False
@property... | bsd-3-clause | Python |
74efcf38efab0edff0040218f5b847db8716bc83 | Use show instead of show_d3 | etgalloway/mpld3,jakevdp/mpld3,e-koch/mpld3,mpld3/mpld3,e-koch/mpld3,mpld3/mpld3,jakevdp/mpld3,etgalloway/mpld3 | create_example.py | create_example.py | import os
import urllib2
import numpy as np
import matplotlib.pyplot as plt
import mpld3
#----------------------------------------------------------------------
# create the figure and axes
fig, ax = plt.subplots(2, 2, figsize=(8, 8),
subplot_kw={'axisbg':'#EEEEEE'})
for axi in ax.flat:
axi... | import os
import urllib2
import numpy as np
import matplotlib.pyplot as plt
from mpld3 import fig_to_d3, show_d3
#----------------------------------------------------------------------
# create the figure and axes
fig, ax = plt.subplots(2, 2, figsize=(8, 8),
subplot_kw={'axisbg':'#EEEEEE'})
for... | bsd-3-clause | Python |
22a4cad3848bd38a36921f26f1e14b601419595b | test csp.stop | ubolonton/twisted-csp | csp/test/basic.py | csp/test/basic.py | from twisted.trial.unittest import TestCase
from twisted.internet.defer import Deferred
from csp.test_helpers import async
from csp import Channel, put, take, go, sleep, stop
from csp import put_then_callback, take_then_callback
class Putting(TestCase):
@async
def test_immediate_taken(self):
ch = Cha... | from twisted.trial.unittest import TestCase
from twisted.internet.defer import Deferred
from csp.test_helpers import async
from csp import Channel, put, take, go, sleep
from csp import put_then_callback, take_then_callback
class Putting(TestCase):
@async
def test_immediate_taken(self):
ch = Channel()... | epl-1.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.