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 |
|---|---|---|---|---|---|---|---|---|
df561c787e8ee8ab7d1da3ceacaa644343ec238e | refactor for example 3 | looselycoupled/xbus-501-timing-demonstrations | 3-example.py | 3-example.py | #!/usr/bin/env python
# 3-example
# A simple demonstration script to find the largest prime number
# below a given limit.
#
# This file is intentionally inefficient in order to demonstrate
# various ways to time execution
#
# Usage:
# python 3-example.py 10000
#
# Author: Allen Leis <al1075@georgetown.edu>
# Create... | #!/usr/bin/env python
# 3-example
# A simple demonstration script to find the largest prime number
# below a given limit.
#
# This file is intentionally inefficient in order to demonstrate
# various ways to time execution
#
# Usage:
# python 3-example.py 10000
#
# Author: Allen Leis <al1075@georgetown.edu>
# Create... | mit | Python |
b6e0ba974abe0d6bf712ecf5c0d116804050c9e3 | Update get_checksum | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/hoster/ZippyshareCom.py | module/plugins/hoster/ZippyshareCom.py | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
__version__ = "0.73"
__pattern__ = r'h... | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
__version__ = "0.72"
__pattern__ = r'h... | agpl-3.0 | Python |
5534cd5ebd295e724b8ce1987f5a5fd8a45bc2ab | Remove unused class | CenterForOpenScience/osf.io,mattclark/osf.io,crcresearch/osf.io,alexschiller/osf.io,jnayak1/osf.io,kch8qx/osf.io,adlius/osf.io,brianjgeiger/osf.io,cwisecarver/osf.io,samchrisinger/osf.io,monikagrabowska/osf.io,doublebits/osf.io,Johnetordoff/osf.io,zachjanicki/osf.io,jnayak1/osf.io,caseyrollins/osf.io,rdhyee/osf.io,mluk... | website/addons/base/testing/utils.py | website/addons/base/testing/utils.py | # -*- coding: utf-8 -*-
class MockFolder(dict, object):
def __init__(self):
self.name = 'Fake Folder'
self.json = {'id': 'Fake Key', 'parent_id': 'cba321'}
self['data'] = {'name': 'Fake Folder', 'key': 'Fake Key'}
self['name'] = 'Fake Folder'
self['id'] = 'Fake Key'
| # -*- coding: utf-8 -*-
class MockNode(object):
addon = None
addon_name = None
def __init__(self, name=None):
self.addon_name = name
@property
def is_deleted(self):
return False
@property
def is_public(self):
return True
def get_addon(self, name):
if... | apache-2.0 | Python |
846c5f9deb99b1bc377ff57f1309d92701733563 | fix url parameters order | skitoo/django-gravatar | django_gravatar/templatetags/gravatar.py | django_gravatar/templatetags/gravatar.py |
from django.template import Library
from django_gravatar.settings import GRAVATAR_DEFAULT_URL, GRAVATAR_SECURE
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
import hashlib
register = Library()
@register.simple_tag
def gravatar_url(email, size=80):
url = 'http... |
from django.template import Library
from django_gravatar.settings import GRAVATAR_DEFAULT_URL, GRAVATAR_SECURE
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
import hashlib
register = Library()
@register.simple_tag
def gravatar_url(email, size=80):
url = 'http... | mit | Python |
b14d5c2ca2dfe4ee1d194f13c061d0e2ea23f8b7 | Add LDFLAGS for Linux stlink build | BreakawayConsulting/xyz | rules/stlink.py | rules/stlink.py | import xyz
import os
import shutil
class Stlink(xyz.BuildProtocol):
pkg_name = 'stlink'
deps = ['libusb']
def configure(self):
pass
def make(self):
if self.config['host'].endswith('darwin'):
os_ldflags = 'OS_LDFLAGS="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation... | import xyz
import os
import shutil
class Stlink(xyz.BuildProtocol):
pkg_name = 'stlink'
deps = ['libusb']
def configure(self):
pass
def make(self):
if self.config['host'].endswith('darwin'):
os_ldflags = 'OS_LDFLAGS="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation... | mit | Python |
d348d084df1b0840dcb425be8b6dc9d8c52dee6a | fix urlpatterns for admin site. | cage1016/django-oscar-hooks,cage1016/django-oscar-hooks,cage1016/django-oscar-hooks | sandbox/urls.py | sandbox/urls.py | from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
from django.conf.urls.static import static
from hooks.dashboard.app import application as hooks_dashboard
from oscar.app import application
admin.autodiscover()
urlpatterns = [
url(r'^i18n/', inc... | from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.conf import settings
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from hooks.dashboard.app import applicatio... | bsd-3-clause | Python |
aa5e9ad2721c5fc0bbeacebccf456a25ae46017b | Fix misprints in docstring | openstack/python-ironicclient,NaohiroTamura/python-ironicclient,NaohiroTamura/python-ironicclient,openstack/python-ironicclient | ironicclient/tests/functional/utils.py | ironicclient/tests/functional/utils.py | # Copyright (c) 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | # Copyright (c) 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | apache-2.0 | Python |
ae3137d06479451f28f66ccfccc48d09075ef1c9 | add and clean up examples | novastorm/Python-Playground | fundamentals.py | fundamentals.py | # fundamentals.py
# output
print "Hello World."
# variable assignment
aVariableContainer = "a variable"
# variable usage
print "Examples of %s" % aVariableContainer
# input from keyboard
aUserName = raw_input("Your name: ")
print "Greetings, %s" % aUserName
# functions with return value
def defaultGreeting():
... | # fundamentals.py
print "Hello World."
aVariableContainer = "a variable"
print "Examples of %s" % aVariableContainer
aName = raw_input("Your name: ")
print "Greetings, %s" % aName
def defaultGreeting():
print "A default greeting"
defaultGreeting()
def printMe(me, andMe=""):
print "%s %s" % (me, andMe)
... | mit | Python |
de3df324bb9126686d5151bb2961983411a33f3e | Remove commented out prints | dean/cs325-winter2015 | assign4/assignment4.py | assign4/assignment4.py | import csv
import math
from pulp import *
def t(day, x0, x1, x2, x3, x4, x5):
return (
(x5 * math.sin((2 * math.pi * day) / (365.25 * 10.7))) +
(x4 * math.cos((2 * math.pi * day) / (365.25 * 10.7))) +
(x3 * math.sin((2 * math.pi * day) / 365.25)) +
(x2 * math.cos((2 * math.pi * da... | import csv
import math
from pulp import *
def t(day, x0, x1, x2, x3, x4, x5):
return (
(x5 * math.sin((2 * math.pi * day) / (365.25 * 10.7))) +
(x4 * math.cos((2 * math.pi * day) / (365.25 * 10.7))) +
(x3 * math.sin((2 * math.pi * day) / 365.25)) +
(x2 * math.cos((2 * math.pi * da... | mit | Python |
d785341c45462d0430c3a3f942283ec2781358b3 | Update data_prepare.py | trolleway/geodata,trolleway/geodata | wikipedia-kyoto/data_prepare.py | wikipedia-kyoto/data_prepare.py |
#download, filter and convert OSM data to GIS layers
#download
url = 'http://download.geo'
filename = 'kansai-latest.osm.pbf'
bbox = '135.571993,34.926126,135.960634,35.144269'
if not os.path.isfile(filename):
print('download file '+url)
r = requests.get(url)
if r.status_code == 404:
quit(url + ... |
#download, filter and convert OSM data to GIS layers
#download
url = 'http://download.geo'
filename = 'kansai-latest.osm.pbf'
bbox = '135.571993,34.926126,135.960634,35.144269'
if not os.path.isfile(filename):
print('download file '+url)
r = requests.get(url)
if r.status_code == 404:
quit(url + ... | unlicense | Python |
7c814025297e9c24c8d00e7c60ea15811ac168b3 | Work in progress | petrveprek/persona | persona.py | persona.py | #!python3
"""persona"""
import sys
import time
from collections import deque
from html.parser import HTMLParser
from urllib.request import urlopen
from urllib.parse import urljoin
class LinkParser(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == 'a':
for (key, value) in attrs:
... | #!python3
"""persona"""
import sys
import time
from html.parser import HTMLParser
from urllib.request import urlopen
from urllib.parse import urljoin
class LinkParser(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == 'a':
for (key, value) in attrs:
if key == 'href':... | mit | Python |
82e02a14bf660bded9c4c4a9f66b0a5139479755 | Fix tempest tests list | openstack/zaqar,openstack/zaqar,openstack/zaqar,openstack/zaqar | zaqar/tests/tempest_plugin/plugin.py | zaqar/tests/tempest_plugin/plugin.py | # Copyright (c) 2016 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | # Copyright (c) 2016 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | apache-2.0 | Python |
b27ed53059ae08e314f1d97b01ac35ac9d3b403f | Simplifie la gestion des fichiers statiques en développement. | dezede/dezede,dezede/dezede,dezede/dezede,dezede/dezede | dezede/urls.py | dezede/urls.py | # coding: utf-8
from django.conf import settings
from django.conf.urls import *
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from ajax_select import urls as ajax_select_urls
from filebrowser.sites import site
from .views... | # coding: utf-8
from django.conf import settings
from django.conf.urls import *
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from ajax_select import urls as ajax_select_urls
from filebrowser.sites import site
from .views import HomeView, CustomSearchView, autocom... | bsd-3-clause | Python |
e6cf8c244cdffa08d67a45c3a44236c3b91aab78 | Update RMG example liquid_phase with multiplicity label | chatelak/RMG-Py,pierrelb/RMG-Py,enochd/RMG-Py,comocheng/RMG-Py,chatelak/RMG-Py,nyee/RMG-Py,enochd/RMG-Py,nickvandewiele/RMG-Py,nyee/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py,comocheng/RMG-Py | examples/rmg/liquid_phase/input.py | examples/rmg/liquid_phase/input.py | # Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
# Constraints on generated species
generatedSpeciesConstraints(
maximumRad... | # Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
# List of species
species(
label='octane',
reactive=True,
structur... | mit | Python |
bbb8c90391e446de81833bc38dba4233a781fa5b | Bump version for development of next release | scrapinghub/kafka-python,DataDog/kafka-python,mumrah/kafka-python,ohmu/kafka-python,dpkp/kafka-python,mumrah/kafka-python,ohmu/kafka-python,scrapinghub/kafka-python,dpkp/kafka-python | kafka/version.py | kafka/version.py | __version__ = '2.0.1-dev'
| __version__ = '2.0.0'
| apache-2.0 | Python |
2a9d716903f8519579e1678eb4c45edd806bd5ed | Fix misnamed variable | eugene-eeo/katana | katana/parser.py | katana/parser.py | import re
from collections import deque, namedtuple
class Scanner(object):
def __init__(self, exprs):
self.scanner = re.Scanner([
tuple(e) for e in exprs
])
def scan(self, string):
tokens, extra = self.scanner.scan(string)
if extra:
raise ValueError
... | import re
from collections import deque, namedtuple
class Scanner(object):
def __init__(self, exprs):
self.scanner = re.Scanner([
tuple(e) for e in exprs
])
def scan(self, string):
tokens, extra = self.scanner.scan(string)
if extra:
raise ValueError
... | mit | Python |
136898b4a535ebcb9bdc2893dce57578f0848f30 | add concatenate_traces to utils | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | disaggregator/utils.py | disaggregator/utils.py | from ApplianceTrace import ApplianceTrace
from ApplianceInstance import ApplianceInstance
from ApplianceType import ApplianceType
from ApplianceSet import ApplianceSet
def concatenate_traces(traces):
'''
Given a list of consecutive appliance traces, returns a single concatenated
trace. Must be sampled at t... | from ApplianceTrace import ApplianceTrace
from ApplianceInstance import ApplianceInstance
from ApplianceType import ApplianceType
from ApplianceSet import ApplianceSet
| mit | Python |
b9aec36890601b8d9a70fe909b1d881723aea6f9 | simplify message | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/ex-submodules/casexml/apps/phone/exceptions.py | corehq/ex-submodules/casexml/apps/phone/exceptions.py | from casexml.apps.case.exceptions import CommCareCaseError
class RestoreException(ValueError, CommCareCaseError):
"""
For stuff that goes wrong during restore
"""
message = "unknown problem during OTA restore"
class BadStateException(RestoreException):
"""
Case state hash inconsistencies
... | from casexml.apps.case.exceptions import CommCareCaseError
class RestoreException(ValueError, CommCareCaseError):
"""
For stuff that goes wrong during restore
"""
message = "unknown problem during OTA restore"
class BadStateException(RestoreException):
"""
Case state hash inconsistencies
... | bsd-3-clause | Python |
13d7c4b862e9e08df7e579905d517673012f5f89 | Update disco.py | umbresp/dream-cogs | disco/disco.py | disco/disco.py | import discord
import time
from discord.ext import commands
from random import choice, randint
import cogs.utils
import asyncio
from cogs.utils import checks
class disco:
"""Changes a role's color every x seconds. Must be 60 or superior."""
def __init__(self, bot):
self.bot = bot
@checks.ad... | import discord
import time
from discord.ext import commands
from random import choice, randint
import cogs.utils
import asyncio
from cogs.utils import checks
class disco:
"""Changes a role's color every x seconds. Must be 60 or superior."""
def __init__(self, bot):
self.bot = bot
@checks.ad... | mit | Python |
360f6ebca938f6256e6b115cd7e19d233e8108f1 | replace circle_mask with ellipse_mask that works much better | pme1123/pyroots,pme1123/pyroots | pyroots/image_manipulation.py | pyroots/image_manipulation.py | """
Created on Fri May 6 14:55:54 2016
@author: pme
Contents:
- img_split
- circle_mask
"""
import numpy as np
from skimage import draw
def img_split(img):
"""
Split a multispectral image into its bands.
Parameters
----------
img : array
A 3- or 4-band image or array
Returns
-------
Returns a list... | """
Created on Fri May 6 14:55:54 2016
@author: pme
Contents:
- img_split
- circle_mask
"""
import numpy as np
def img_split(img):
"""
Split a multispectral image into its bands.
Parameters
----------
img : array
A 3- or 4-band image or array
Returns
-------
Returns a list where each section is a ... | apache-2.0 | Python |
3c1f3e71a60cb7d128aa60103999e4bb91d6bb88 | Add new feature detectors to repeatability test | lenck/vlb,lenck/vlb,lenck/vlb | python/test/test_rep_bench.py | python/test/test_rep_bench.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# ===========================================================
# File Name: test_rep_bench.py
# Author: Xu Zhang, Columbia University
# Creation Date: 01-25-2019
# Last Modified: Tue Mar 5 00:03:28 2019
#
# Usage: python test_rep_bench.py
# Description:test repeatability ... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# ===========================================================
# File Name: test_rep_bench.py
# Author: Xu Zhang, Columbia University
# Creation Date: 01-25-2019
# Last Modified: Tue Mar 5 00:03:28 2019
#
# Usage: python test_rep_bench.py
# Description:test repeatability ... | bsd-2-clause | Python |
9541fd723308d51f7c380649a81b4992074a1193 | Append the name of the current language to the URLs | DeveloperMal/wger,petervanderdoes/wger,DeveloperMal/wger,kjagoo/wger_stark,petervanderdoes/wger,wger-project/wger,kjagoo/wger_stark,rolandgeider/wger,wger-project/wger,DeveloperMal/wger,kjagoo/wger_stark,DeveloperMal/wger,petervanderdoes/wger,wger-project/wger,rolandgeider/wger,rolandgeider/wger,kjagoo/wger_stark,peter... | workout_manager/urls.py | workout_manager/urls.py | from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
urlpatterns = i18n_patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('manager.urls')),
url(r'exercise/', include('exercises.ur... | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('manager.urls')),
url(r'exercise/', include('exercises.urls')),
url(r'weight/', include('weight.urls')),
... | agpl-3.0 | Python |
038e60b342367e3ea6499d16d4f8a9666d99d0bf | Fix for 3.3 and 3.4 | illagrenan/django-custom-500,illagrenan/django-custom-500 | django_custom_500/example_project/tests/test_basic.py | django_custom_500/example_project/tests/test_basic.py | # -*- encoding: utf-8 -*-
# ! python2
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
"""Tests for django-custom-500's decorators"""
import unittest
import requests
from django.test import TestCase, LiveServerTestCase
class NormalViewTestCase(Tes... | # -*- encoding: utf-8 -*-
# ! python2
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
"""Tests for django-custom-500's decorators"""
import unittest
import requests
from django.test import TestCase, LiveServerTestCase
class NormalViewTestCase(Tes... | mit | Python |
2626fc6fdc7c77a864fb648542a7772cc6939e17 | add test for single special characters | ebroecker/canmatrix,altendky/canmatrix,altendky/canmatrix,ebroecker/canmatrix | src/canmatrix/tests/test_dbc.py | src/canmatrix/tests/test_dbc.py | # -*- coding: utf-8 -*-
import io
import textwrap
import string
import pytest
import canmatrix.dbc
def test_long_signal_name_imports():
long_signal_name = u'FAILURE_ZELL_UNTERTEMPERATUR_ENTLADEN_ALARM_IDX_01'
assert len(long_signal_name) > 32
dbc = io.BytesIO(textwrap.dedent(u'''\
BO_ 1 testFrame1: ... | # -*- coding: utf-8 -*-
import io
import textwrap
import canmatrix.dbc
def test_long_signal_name_imports():
long_signal_name = u'FAILURE_ZELL_UNTERTEMPERATUR_ENTLADEN_ALARM_IDX_01'
assert len(long_signal_name) > 32
dbc = io.BytesIO(textwrap.dedent(u'''\
BO_ 1 testFrame1: 1 TEST_ECU
SG_ someShor... | bsd-2-clause | Python |
d60097a0092cb4421d80ab65853c3af980318fcd | Add victim/<victim_id> url | esarafianou/rupture,esarafianou/rupture,dimriou/rupture,dimkarakostas/rupture,dionyziz/rupture,dionyziz/rupture,dionyziz/rupture,dimkarakostas/rupture,dionyziz/rupture,dimriou/rupture,dimriou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,esarafianou/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,d... | backend/breach/urls.py | backend/breach/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^get_work/(?P<victim_id>\d+)$', views.get_work, name='get_work'),
url(r'^get_work$', views.get_work, name='get_work'),
url(r'^work_completed/(?P<victim_id>\d+)$', views.work_completed, name='work_completed'),
url(r'^work_comple... | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^get_work/(?P<victim_id>\d+)$', views.get_work, name='get_work'),
url(r'^get_work$', views.get_work, name='get_work'),
url(r'^work_completed/(?P<victim_id>\d+)$', views.work_completed, name='work_completed'),
url(r'^work_comple... | mit | Python |
80df135e0f9e4a5953fd64792c279a6fc2d71bd7 | add the expectation | tlevine/map-vectorizer,tlevine/map-vectorizer,nypl-spacetime/map-vectorizer,NYPL/map-vectorizer,NYPL/map-vectorizer,nypl-spacetime/map-vectorizer | config/test/test_vectorize_config_parser.py | config/test/test_vectorize_config_parser.py | import os
from ..vectorize_config_parser import parse
import pytest
def test_parse():
expected = {
'basecolors': [
[205, 200, 186],
[194, 175, 170],
[191, 172, 167],
[185, 172, 163],
[180, 185, 163],
[178, 179, 157],
... | import os
from ..vectorize_config_parser import parse
import pytest
def test_parse():
with open(os.path.abspath(os.path.join(__file__, '..', '..', 'vectorize_config_default.txt'))) as fp:
observed = parse(fp)
assert observed == {}
| mit | Python |
607176606f85ca9749e900128bbec289276cda4d | add help tooltip on user flag | brain-tec/connector,brain-tec/connector,open-synergy/connector,hugosantosred/connector,brain-tec/connector,acsone/connector,hugosantosred/connector,open-synergy/connector,acsone/connector,acsone/connector | connector_job_subscribe/models/res_users.py | connector_job_subscribe/models/res_users.py | # -*- coding: utf-8 -*-
# Copyright 2016 Cédric Pigeon
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
class ResUsers(models.Model):
_inherit = 'res.users'
subscribe_job = fields.Boolean('Jobs Notifications',
default=True,
... | # -*- coding: utf-8 -*-
# Copyright 2016 Cédric Pigeon
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
class ResUsers(models.Model):
_inherit = 'res.users'
subscribe_job = fields.Boolean('Jobs Notifications',
default=True)
| agpl-3.0 | Python |
83f0520de2e103b609053a250c1f3d8f791fa7ba | Fix ValidateTemplate description printing | vasiliykochergin/euca2ools,gholms/euca2ools,vasiliykochergin/euca2ools,nagyistoce/euca2ools,jhajek/euca2ools,jhajek/euca2ools,gholms/euca2ools,nagyistoce/euca2ools | euca2ools/commands/cloudformation/validatetemplate.py | euca2ools/commands/cloudformation/validatetemplate.py | # Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | # Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | bsd-2-clause | Python |
a18b1f8b2012c9e0ed39a1c99f96eeeaac470af7 | add dst_addr to traceroute if it exists | coldhakca/atlas-tools-misc | atlas-examine-traceroute-measurement.py | atlas-examine-traceroute-measurement.py | #!/usr/bin/env python
# Examine RIPE Atlas SSL Measurement Data
#
# Loads JSON data from URL specified on cmdline:
# Usage:
# ./atlas-examine-ssl-measurement.py <URL>
# Where URL is an atlas ripe results api endpoint
if __name__ == "__main__":
import json
import urllib
import OpenSSL
import sys
import G... | #!/usr/bin/env python
# Examine RIPE Atlas SSL Measurement Data
#
# Loads JSON data from URL specified on cmdline:
# Usage:
# ./atlas-examine-ssl-measurement.py <URL>
# Where URL is an atlas ripe results api endpoint
if __name__ == "__main__":
import json
import urllib
import OpenSSL
import sys
import G... | mit | Python |
0a5b43acaea37b0920b9ebcc1979869d270d5d1c | Make unit test valid | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx | awx/main/tests/unit/api/test_filters.py | awx/main/tests/unit/api/test_filters.py | import pytest
from rest_framework.exceptions import PermissionDenied
from awx.api.filters import FieldLookupBackend
from awx.main.models import Credential, JobTemplate
@pytest.mark.parametrize(u"empty_value", [u'', ''])
def test_empty_in(empty_value):
field_lookup = FieldLookupBackend()
with pytest.raises(Va... | import pytest
from rest_framework.exceptions import PermissionDenied
from awx.api.filters import FieldLookupBackend
from awx.main.models import Credential, JobTemplate
@pytest.mark.parametrize(u"empty_value", [u'', ''])
def test_empty_in(empty_value):
field_lookup = FieldLookupBackend()
with pytest.raises(Va... | apache-2.0 | Python |
9f131594bb8476621c33fa5c0f2c3e319dab6cc4 | Update chatcmds_default.py | f4ble/Arkon,f4ble/pyarc | configs/chatcmds_default.py | configs/chatcmds_default.py | from ark.chat_commands_handler import ChatCommands
from ark.chat_commands.other import CmdsOther
from ark.chat_commands.admin import CmdsAdmin
def init():
#Admin cmds
ChatCommands.register_chat_command_regex('!admin_filter_add.*',CmdsAdmin.admin_filter_add)
ChatCommands.register_chat_command_regex('!admin... | from ark.chat_commands_handler import ChatCommands
from ark.chat_commands.other import CmdsOther
from ark.chat_commands.admin import CmdsAdmin
def init():
#Admin cmds
ChatCommands.register_chat_command_regex('!admin_filter_add.*',CmdsAdmin.admin_filter_add)
ChatCommands.register_chat_command_regex('!admin... | apache-2.0 | Python |
269d8306af4ff6047e62a9b447d61bb615723a9d | Remove unnecessary clean methods | python/pythondotorg,proevo/pythondotorg,manhhomienbienthuy/pythondotorg,python/pythondotorg,proevo/pythondotorg,python/pythondotorg,proevo/pythondotorg,manhhomienbienthuy/pythondotorg,manhhomienbienthuy/pythondotorg,manhhomienbienthuy/pythondotorg,python/pythondotorg,proevo/pythondotorg | jobs/forms.py | jobs/forms.py | from django import forms
from django.forms.widgets import CheckboxSelectMultiple, HiddenInput
from markupfield.widgets import MarkupTextarea
from .models import Job, JobReviewComment
from cms.forms import ContentManageableModelForm
class JobForm(ContentManageableModelForm):
required_css_class = 'required'
... | from django import forms
from django.forms.widgets import CheckboxSelectMultiple, HiddenInput
from markupfield.widgets import MarkupTextarea
from .models import Job, JobReviewComment
from cms.forms import ContentManageableModelForm
class JobForm(ContentManageableModelForm):
required_css_class = 'required'
... | apache-2.0 | Python |
05a5e546efd208af1c7a951ababdb2773a485b46 | Update process frame | ENPH-479/dolphin-env-api,ENPH-479/dolphin-env-api,ENPH-479/dolphin-env-api,ENPH-479/dolphin-env-api | src/mk_naive_agent.py | src/mk_naive_agent.py | """ This module implements a basic Mario Kart AI agent using a saved state-decision map.
The basic Mario Kart AI agent functions as follows:
1) The state-decision map contains the probabilities of taking an action in a certain state (downsampled image)
2) Using the state-decision map, the basic Mario Kart AI c... | """ This module implements a basic Mario Kart AI agent using a saved state-decision map.
The basic Mario Kart AI agent functions as follows:
1) The state-decision map contains the probabilities of taking an action in a certain state (downsampled image)
2) Using the state-decision map, the basic Mario Kart AI c... | mit | Python |
b69f94682b08ccd51894fae111e400640457f7d8 | fix minor stuff | allanlei/django-pdf | djpdf/views.py | djpdf/views.py | from django.views import generic
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.http import HttpResponse
DefaultRenderingBackend = get_callable(getattr(settings, 'PDF_DEFAULT_RENDERING_BACKEND', 'djpdf.backends.wkh... | from django.views import generic
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
from django.core.urlresolvers import get_callable
DefaultRenderingBackend = get_callable(getattr(settings, 'PDF_DEFAULT_RENDERING_BACKEND', 'djpdf.backends.wkhtmltopdf.RenderingBackend'))
class ... | bsd-3-clause | Python |
55bdb2a97092323cea54d68a38293198a31acfc6 | Add frontend build to the deploy process | alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws | dmaws/build.py | dmaws/build.py | import os
import re
import subprocess
import tempfile
import zipfile
from .utils import run_cmd
SSH_REPO_PATTERN = re.compile('git@[^:]*:[^/]+/(.*)\.git')
HTTPS_REPO_PATTERN = re.compile('https://[^/]+/[^/]+/(.*)/(?:.git)?')
def run_git_cmd(args, cwd, stdout=None):
return run_cmd(
['git'] + args,
... | import os
import re
import subprocess
import tempfile
from .utils import run_cmd
SSH_REPO_PATTERN = re.compile('git@[^:]*:[^/]+/(.*)\.git')
HTTPS_REPO_PATTERN = re.compile('https://[^/]+/[^/]+/(.*)/(?:.git)?')
def run_git_cmd(args, cwd, stdout=None):
return run_cmd(
['git'] + args,
cwd=cwd,
... | mit | Python |
60179099b6ad7753d5af44363511c5b06ce454f5 | fix presence of log dir | bajibabu/merlin,bajibabu/merlin,ronanki/merlin,ashmanmode/TTSDNNRepo,ligz07/merlin,ashmanmode/TTSDNNRepo,ligz07/merlin,ronanki/merlin | test/test_classes.py | test/test_classes.py | # Test the classes used in Merlin pipeline
# TODO run some very simple training on random data)
import sys
import os
sys.path.append('../src')
import errno
import numpy as np
import cPickle
import logging
def makedir(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.errn... | # Test the classes used in Merlin pipeline
# TODO run some very simple training on random data)
import sys
import os
sys.path.append('../src')
import numpy as np
import cPickle
import logging
def build_model(hidden_layer_type):
logger.info(' DeepRecurrentNetwork '+str(hidden_layer_type))
nnmodel = DeepRecur... | apache-2.0 | Python |
5d33d3cbdb7d425e9840885a5836c65b9b26a990 | Test class for parsers | HIIT/mediacollection | test/test_parsers.py | test/test_parsers.py | import sys
import os
import importlib
path = os.path.abspath('..')
sys.path.append(path)
out = 'test_file.txt'
url_list = 'test_urls.txt'
class TestParser:
def test_file_exists(self):
urls = open(url_list, 'r')
for link in urls:
module = load_module(link)
initialise_file(m... | import sys
import os
import importlib
path = os.path.abspath('..')
sys.path.append(path)
out = 'test_file.txt'
url_list = 'test_urls.txt'
class TestParser:
def test_file_exists(self):
urls = open(url_list, 'r')
for link in urls:
module = load_module(link)
initialise_file(m... | mit | Python |
7511384b3096247a6b8a7adb756c0a8838b7f355 | bump version | hopshadoop/hops-util-py,hopshadoop/hops-util-py | hops/version.py | hops/version.py | __version__ = '1.8.3'
| __version__ = '1.8.2'
| apache-2.0 | Python |
058d77ed995bc60faaa8b2667227efb0ee997e93 | Add ignore to tests that do not have cxvpy | nilgoyyou/dipy,FrancoisRheaultUS/dipy,nilgoyyou/dipy,FrancoisRheaultUS/dipy | dipy/workflows/tests/test_reconst_mapmri.py | dipy/workflows/tests/test_reconst_mapmri.py | from os.path import join
import nibabel as nib
from nibabel.tmpdirs import TemporaryDirectory
import numpy as np
from nose.tools import eq_
from dipy.reconst import mapmri
from dipy.data import get_data
from dipy.workflows.reconst import ReconstMAPMRILaplacian, ReconstMAPMRIBoth, ReconstMAPMRIPositivity
def test_... | from os.path import join
import nibabel as nib
from nibabel.tmpdirs import TemporaryDirectory
import numpy as np
from nose.tools import eq_
from dipy.data import get_data
from dipy.workflows.reconst import ReconstMAPMRILaplacian, ReconstMAPMRIBoth, ReconstMAPMRIPositivity
def test_reconst_mmri_laplacian():
re... | bsd-3-clause | Python |
9b739c1ace673a36345d24461866b90de6622d13 | use /usr/bin/env instead /bin/env | arthurlockman/p.haul,arthurlockman/p.haul,jne100/p.haul,jne100/p.haul,jne100/p.haul,xemul/p.haul,arthurlockman/p.haul,aburluka/p.haul,xemul/p.haul,aburluka/p.haul,aburluka/p.haul,jne100/p.haul,arthurlockman/p.haul,xemul/p.haul,aburluka/p.haul,jne100/p.haul,aburluka/p.haul,xemul/p.haul,xemul/p.haul,arthurlockman/p.haul | test/zdtm/ct_init.py | test/zdtm/ct_init.py | #!/usr/bin/env python
import os
import sys
import signal
criu_tests_dir = sys.argv[1]
test_list = map(lambda x: x.strip(), open(sys.argv[2]).readlines())
def wup(foo, bar):
pass
signal.signal(signal.SIGTERM, wup)
def getmlist():
return map(lambda x: x.split()[4], open("/proc/self/mountinfo").readlines())
def try... | #!/bin/env python
import os
import sys
import signal
criu_tests_dir = sys.argv[1]
test_list = map(lambda x: x.strip(), open(sys.argv[2]).readlines())
def wup(foo, bar):
pass
signal.signal(signal.SIGTERM, wup)
def getmlist():
return map(lambda x: x.split()[4], open("/proc/self/mountinfo").readlines())
def try_umo... | lgpl-2.1 | Python |
823a380c310ba23f4ccffe3c721f81d0646ee27b | add del node test | miracode/data-structures | test_simple_graph.py | test_simple_graph.py | import unittest
import simple_graph
class GraphTest(unittest.TestCase):
def test_no_nodes(self):
g = simple_graph.Graph()
no_nodes = g.nodes()
assert no_nodes == []
def test_nodes(self):
g = simple_graph.Graph()
g.nodes_list = [simple_graph.Node(), simple_graph.Node()... | import unittest
import simple_graph
class GraphTest(unittest.TestCase):
def test_no_nodes(self):
g = simple_graph.Graph()
no_nodes = g.nodes()
assert no_nodes == []
def test_nodes(self):
g = simple_graph.Graph()
g.nodes_list = [simple_graph.Node(), simple_graph.Node()... | mit | Python |
cca7dee87863219b382321ba563cb48b1e58a4fb | Add comments for tests of caching. | cupy/cupy,hvy/chainer,jnishi/chainer,ysekky/chainer,kashif/chainer,jnishi/chainer,delta2323/chainer,keisuke-umezawa/chainer,jnishi/chainer,niboshi/chainer,niboshi/chainer,hvy/chainer,keisuke-umezawa/chainer,okuta/chainer,wkentaro/chainer,wkentaro/chainer,tkerola/chainer,ronekko/chainer,ktnyt/chainer,chainer/chainer,kei... | tests/chainer_tests/functions_tests/pooling_tests/test_pooling_nd_kernel.py | tests/chainer_tests/functions_tests/pooling_tests/test_pooling_nd_kernel.py | import unittest
import mock
import chainer
from chainer.functions.pooling import pooling_nd_kernel
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'ndim': [2, 3, 4],
}))
@attr.gpu
class TestPoolingNDKernelMemo(unittest.TestCase):
def setUp(self):
... | import unittest
import mock
import chainer
from chainer.functions.pooling import pooling_nd_kernel
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'ndim': [2, 3, 4],
}))
@attr.gpu
class TestPoolingNDKernelMemo(unittest.TestCase):
def setUp(self):
... | mit | Python |
fb23594c2fd34ac4bc147353c48df71179f223b5 | Update models.py | zhounanshu/Flask-AppBuilder,qpxu007/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,qpxu007/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,rpiotti/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,rpiotti/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Fl... | examples/quickfiles/app/models.py | examples/quickfiles/app/models.py | from flask import Markup
from flask_appbuilder.models.mixins import AuditMixin, BaseMixin, FileColumn, ImageColumn
from sqlalchemy import Table, Column, Integer, String, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from flask_appbuilder import Base
from flask_appbuilder.security.models import User
from f... | from flask import Markup
from flask_appbuilder.models.mixins import AuditMixin, BaseMixin, FileColumn, ImageColumn
from sqlalchemy import Table, Column, Integer, String, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from flask_appbuilder import Base
from flask_appbuilder.security.models import User
from f... | bsd-3-clause | Python |
7ec9e9a7f86c1e880b019c164fb6d095daa1ed1b | Update models.py | rpiotti/Flask-AppBuilder,rpiotti/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,qpxu007/Flask-AppBuilder,qpxu007/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu00... | examples/quickfiles/app/models.py | examples/quickfiles/app/models.py | from flask_appbuilder.models.mixins import AuditMixin, BaseMixin, FileColumn, ImageColumn
from sqlalchemy import Table, Column, Integer, String, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from flask_appbuilder import Base
from flask_appbuilder.security.models import User
from flask_appbuilde import Bas... |
from flask_appbuilder.models.mixins import AuditMixin, BaseMixin, FileColumn, ImageColumn
from sqlalchemy import Table, Column, Integer, String, Boolean, ForeignKey
from flask_appbuilder import Base
from flask_appbuilder.security.models import User
from app import db
"""
You can use the extra Flask-AppBuilder fields ... | bsd-3-clause | Python |
4932d6f3d4adaf6e475c2a5d5547694748926d7a | Simplify variable names in tests and add debug info. | abhijo89/django-cbv-inspector,abhijo89/django-cbv-inspector,abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector | cbv/tests.py | cbv/tests.py | from django.core.urlresolvers import reverse
from django.test import TestCase
from .factories import InheritanceFactory, KlassFactory, ProjectVersionFactory
from .views import Sitemap
class SitemapTest(TestCase):
def test_200(self):
ProjectVersionFactory.create()
response = self.client.get(revers... | from django.core.urlresolvers import reverse
from django.test import TestCase
from .factories import InheritanceFactory, KlassFactory, ProjectVersionFactory
from .views import Sitemap
class SitemapTest(TestCase):
def test_200(self):
ProjectVersionFactory.create()
response = self.client.get(revers... | bsd-2-clause | Python |
5e4c12067ee2b1d9affceaea789405422f7233a1 | Fix broken list_methods due to inspect behaviour | admk/soap | ce/common.py | ce/common.py | #!/usr/bin/env python
# vim: set fileencoding=UTF-8 :
import inspect
class DynamicMethods(object):
def list_methods(self, predicate):
"""Find all transform methods within the class that satisfies the
predicate.
Returns:
A list of tuples containing method names and correspon... | #!/usr/bin/env python
# vim: set fileencoding=UTF-8 :
import inspect
class DynamicMethods(object):
def list_methods(self, predicate):
"""Find all transform methods within the class that satisfies the
predicate.
Returns:
A list of tuples containing method names and correspon... | mit | Python |
4f9230df8acf5c268af9279cdf0d3976b63bd84e | Update manager.py | dpgaspar/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,rpiotti/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu007/... | flask_appbuilder/babel/manager.py | flask_appbuilder/babel/manager.py | from flask.ext.babel import Babel
class BabelManager(object):
babel = None
basel_default_locale = ''
def __init__(self, app):
self.babel = Babel(app)
self.basel_default_locale = self._get_default_locale(app)
self.babel.locale_selector_func = self.get_locale
def _get_... | from flask.ext.babel import Babel
class BabelManager(object):
babel = None
basel_default_locale = ''
def __init__(self, app):
self.babel = Babel(app)
self.basel_default_locale = self._get_default_locale(app)
babel.locale_selector_func = self.get_locale
def _get_defau... | bsd-3-clause | Python |
3498c7cfa33e03985b1b264ea8bc13de9b0a9a59 | Update Cron.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/Cron.py | service/Cron.py | # The following script will send a quote to a Log and Python every minute
cron = Runtime.createAndStart('cron', 'Cron')
log = Runtime.createAndStart('log', 'Log')
# add a task which sends text to the log service Log.log(string) every minute
cron.addTask('* * * * *','log','log', 'hello sir, time for your coffee'... | # The following script will send a quote to a Log and Speech service every minute.
speech = Runtime.createAndStart("speech","Speech")
cron = Runtime.createAndStart("cron", "Cron")
log = Runtime.createAndStart("log", "Log")
cron.addScheduledEvent("* * * * *","speech","speak", "hello sir, time for your coffee")
cr... | apache-2.0 | Python |
5c5b0fbf8e5a7389a741d15037276a403d4e0a70 | replace space with tab | qiyuangong/SEU_Web_Login | seu_weblogin.py | seu_weblogin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import httplib
import json
import sys
username = 'your_username'
password = 'your_password'
headers = {
'Content-Type': "application/json; charset=utf-8",
'dataType': "json",
'cache': False
}
url = "w.seu.edu.cn"
login_url = "/portal/logi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import httplib
import json
import sys
username = 'your_username'
password = 'your_password'
headers = {
'Content-Type': "application/json; charset=utf-8",
'dataType': "json",
'cache': False
}
url = "w.seu.edu.cn"
login_url = "... | mit | Python |
3499be7a9c38d008450c59d31cb11681e9721a95 | Bump the version to 1.6.0 | google/agi,google/gapid,google/gapid,pmuetschard/gapid,google/gapid,google/agi,google/agi,google/gapid,google/gapid,pmuetschard/gapid,google/agi,pmuetschard/gapid,pmuetschard/gapid,google/agi,google/agi,google/gapid,google/agi,pmuetschard/gapid,google/gapid,google/gapid,pmuetschard/gapid,google/agi,pmuetschard/gapid,pm... | version.bzl | version.bzl | # Copyright (C) 2018 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
#
# Unless required by applicable law or agreed to in writ... | # Copyright (C) 2018 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
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 | Python |
f18138dff34062e2924b238be4679474e9c7fb9c | Fix typo in Modifier migration downgrade script | eskwire/evesrp,paxswill/evesrp,paxswill/evesrp,eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,eskwire/evesrp | evesrp/migrate/versions/5795c29b2c7a_.py | evesrp/migrate/versions/5795c29b2c7a_.py | """Change RelativeModifier.value to a Numeric/Decimal
Revision ID: 5795c29b2c7a
Revises: 19506187e7aa
Create Date: 2014-07-23 14:43:45.748696
"""
# revision identifiers, used by Alembic.
revision = '5795c29b2c7a'
down_revision = '19506187e7aa'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql impor... | """Change RelativeModifier.value to a Numeric/Decimal
Revision ID: 5795c29b2c7a
Revises: 19506187e7aa
Create Date: 2014-07-23 14:43:45.748696
"""
# revision identifiers, used by Alembic.
revision = '5795c29b2c7a'
down_revision = '19506187e7aa'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql impor... | bsd-2-clause | Python |
93b87a3953d4d96d0e96af978edebf53eb467a0e | Fix test | IntelLabs/numba,IntelLabs/numba,stonebig/numba,gdementen/numba,pombredanne/numba,jriehl/numba,gdementen/numba,gmarkall/numba,ssarangi/numba,stuartarchibald/numba,numba/numba,numba/numba,gdementen/numba,pitrou/numba,seibert/numba,sklam/numba,cpcloud/numba,ssarangi/numba,numba/numba,stuartarchibald/numba,gdementen/numba,... | numba/tests/test_llvm_version_check.py | numba/tests/test_llvm_version_check.py | from __future__ import print_function, division, absolute_import
import imp
import sys
from numba import unittest_support as unittest
class TestLlvmVersion(unittest.TestCase):
def test_llvmlite_version(self):
# test the system it's running on
import llvmlite
import numba
self.as... | from __future__ import print_function, division, absolute_import
import imp
import sys
from numba import unittest_support as unittest
class TestLlvmVersion(unittest.TestCase):
def test_llvmlite_version(self):
# test the system it's running on
import llvmlite
import numba
self.as... | bsd-2-clause | Python |
0d58997d0f9e16e3649f2a3606481c449f090909 | Fix division by zero error | OcelotProject/Compare,OcelotProject/Compare,OcelotProject/Compare | ocelot_compare/comparison/exchanges.py | ocelot_compare/comparison/exchanges.py | from numpy import isclose
from collections import defaultdict
from itertools import zip_longest
def consolidate(lst):
results = []
for x, y in lst:
if x and y:
results.append((x[0], x[1], x[2],
isclose(x[3], y[3], rtol=1e-04, atol=1e-06),
... | from numpy import isclose
from collections import defaultdict
from itertools import zip_longest
def consolidate(lst):
results = []
for x, y in lst:
if x and y:
results.append((x[0], x[1], x[2],
isclose(x[3], y[3], rtol=1e-04, atol=1e-06),
... | bsd-3-clause | Python |
ac0d2862dfcb65ab048d725ba6b242f293b37aeb | improve the test | evernym/plenum,evernym/zeno | plenum/test/view_change/test_demote_node_delay_commit_on_one.py | plenum/test/view_change/test_demote_node_delay_commit_on_one.py | from plenum.test.delayers import cDelay
from plenum.test.helper import waitForViewChange
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
from plenum.test.pool_transactions.helper import demote_node
from plenum.test.stasher import delay_rules
from plenum.test.test_node import ensureElectionsD... | from plenum.test.delayers import cDelay
from plenum.test.helper import waitForViewChange
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
from plenum.test.pool_transactions.helper import demote_node
from plenum.test.stasher import delay_rules
from plenum.test.test_node import ensureElectionsD... | apache-2.0 | Python |
853e4b233115cec1997ae0129ffd4f1f2f2157a3 | Bump test version | pheanex/xpython,N-Parsons/exercism-python,exercism/python,exercism/xpython,exercism/python,behrtam/xpython,smalley/python,mweb/python,jmluy/xpython,behrtam/xpython,jmluy/xpython,exercism/xpython,mweb/python,pheanex/xpython,smalley/python,N-Parsons/exercism-python | exercises/rail-fence-cipher/rail_fence_cipher_test.py | exercises/rail-fence-cipher/rail_fence_cipher_test.py | import unittest
from rail_fence_cipher import encode, decode
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.1
class RailFenceTests(unittest.TestCase):
def test_encode_with_two_rails(self):
self.assertMultiLineEqual(
encode('XOXOXOXOXOXOXOXOXO', 2), 'XXXXXXXXXOOOOOOO... | import unittest
from rail_fence_cipher import encode, decode
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
class RailFenceTests(unittest.TestCase):
def test_to_encode_with_two_rails(self):
self.assertMultiLineEqual(
encode('XOXOXOXOXOXOXOXOXO', 2), 'XXXXXXXXXOOOO... | mit | Python |
1fb4842ef87167a01918208c5fc66a73b51946b4 | Update tests to version 1.0.1 to resolve #1020 | behrtam/xpython,smalley/python,pheanex/xpython,exercism/xpython,jmluy/xpython,exercism/xpython,pheanex/xpython,jmluy/xpython,smalley/python,exercism/python,exercism/python,N-Parsons/exercism-python,behrtam/xpython,N-Parsons/exercism-python | exercises/rna-transcription/rna_transcription_test.py | exercises/rna-transcription/rna_transcription_test.py | import unittest
from rna_transcription import to_rna
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.1
class DNATests(unittest.TestCase):
def test_transcribes_cytosine_to_guanine(self):
self.assertEqual(to_rna('C'), 'G')
def test_transcribes_guanine_to_cytosine(self):
... | import unittest
from rna_transcription import to_rna
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
class DNATests(unittest.TestCase):
def test_transcribes_guanine_to_cytosine(self):
self.assertEqual(to_rna('G'), 'C')
def test_transcribes_cytosine_to_guanine(self):
... | mit | Python |
21e8f6049f404c5924f962517fc16ecff0cedb08 | fix an error during doc building | biothings/biothings.api,biothings/biothings.api | biothings/hub/datatransform/__init__.py | biothings/hub/datatransform/__init__.py | from biothings.hub.datatransform.datatransform import DataTransform
from biothings.hub.datatransform.datatransform import IDStruct
from biothings.hub.datatransform.datatransform import DataTransformEdge
from biothings.hub.datatransform.datatransform import RegExEdge
from biothings.hub.datatransform.datatransform import... | from biothings.hub.datatransform.datatransform import DataTransform
from biothings.hub.datatransform.datatransform import IDStruct
from biothings.hub.datatransform.datatransform import DataTransformEdge
from biothings.hub.datatransform.datatransform import RegExEdge
from biothings.hub.datatransform.datatransform import... | apache-2.0 | Python |
e3f2de68006c57982883af880f0f63b9a7d8a38e | Add tests | morrislab/rnascan,morrislab/rnascan,morrislab/rnascan,morrislab/rnascan | tests/preprocess_seq_test.py | tests/preprocess_seq_test.py | #!/usr/bin/env python
import unittest
import sys
sys.path.append("..")
import motif_scan as ms
#from Bio import motifs, SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC, SingleLetterAlphabet
class PreprocessSeqTestCase(unittest.TestCase):
def test_preprocessSeq_1(s... | #!/usr/bin/env python
import unittest
import sys
sys.path.append("..")
import motif_scan as ms
#from Bio import motifs, SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
class PreprocessSeqTestCase(unittest.TestCase):
def test_preprocessSeq_1(self):
'''Test ... | agpl-3.0 | Python |
bcf744f455fae54392cd84377a9f76ec2ba3a921 | add debug_outputDebugString() | yasokada/python-160224-BYOP-main | BYOP-main.py | BYOP-main.py | #!/usr/bin/env python
#--- selection of import based on the package ---
''' 1. with python3-serial'''
import serial
''' 2. without python3-serial'''
#from dummySerial import CDummySerial
#serial = CDummySerial()
#-----------------
'''
v0.5 2016 Feb. 29
- add debug_outputDebugString()
v0.4 2016 Feb. 24
- add conta... | #!/usr/bin/env python
#--- selection of import based on the package ---
''' 1. with python3-serial'''
import serial
''' 2. without python3-serial'''
#from dummySerial import CDummySerial
#serial = CDummySerial()
#-----------------
'''
v0.4 2016 Feb. 24
- add contact by Vital
v0.3 2016 Feb. 24
- group_run commands... | mit | Python |
5587b4fbd52e422325d8352a824c1c4c530e402b | Make pull_me.py executable | dnuffer/carrot_slots | pull_me.py | pull_me.py | #!/usr/bin/env python
from random import randint
from time import sleep
from os import system
from easygui import msgbox
while True:
sleep(randint(30, 600))
#for _ in range(5):
# print "\a"
# time.sleep(.2)
system("aplay /usr/lib/libreoffice/share/gallery/sounds/kongas.wav")
msgbox("Hi Dan", "Time is up"... | from random import randint
from time import sleep
from os import system
from easygui import msgbox
while True:
time.sleep(randint(30, 600))
#for _ in range(5):
# print "\a"
# time.sleep(.2)
system("aplay /usr/lib/libreoffice/share/gallery/sounds/kongas.wav")
msgbox("Hi Dan", "Time is up")
| apache-2.0 | Python |
1371af137fcf24ef3888194f696302b377a27d1b | Add tests for songs index page | alykhank/Tunezout,alykhank/Tunezout | songs/tests.py | songs/tests.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from songs.models import Song, Genre
def create_song(title, artist, year, genre, approved):
"""
Creates a song with the given attributes.
"""
return Song.objects.create(title=title, artist=artist, year=year, genre=genre, approved=approve... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | mit | Python |
53588c254d0a3569e275affaaf20e55a707dd66a | test fix | SergeyPirogov/testcontainers-python | tests/test_docker_manager.py | tests/test_docker_manager.py | from testcontainers_python.context_manager import docker_client
from testcontainers_python.docker_client import DockerClient
def test_docker_run_selenium():
docker = DockerClient()
docker.stop_all()
docker.run('selenium/hub:2.53.0', bind_ports={4444: 4444}, name='selenium-hub')
docker.run('selenium/no... | from testcontainers_python.context_manager import docker_client
from testcontainers_python.docker_client import DockerClient
def test_docker_run_selenium():
docker = DockerClient()
docker.stop_all()
docker.run('selenium/hub:2.53.0', bind_ports={4444: 4444}, name='selenium-hub')
docker.run('selenium/no... | apache-2.0 | Python |
43032b652507edd42a0a8ff697b59ff5f57a1592 | print bases in a sorted order in summarize-reads.py | terrycojones/dark-matter,bamueh/dark-matter,bamueh/dark-matter,terrycojones/dark-matter,acorg/dark-matter,acorg/dark-matter | bin/summarize-reads.py | bin/summarize-reads.py | #!/usr/bin/env python
from dark.summarize import summarizeReads
import sys
if len(sys.argv) != 2:
print('Usage: %s file.fasta / file.fastq' % sys.argv[0], file=sys.stderr)
sys.exit(1)
else:
filename = sys.argv[1]
if filename.lower().endswith('q'):
filetype = 'fastq'
else:
# Assume... | #!/usr/bin/env python
from dark.summarize import summarizeReads
import sys
if len(sys.argv) != 2:
print('Usage: %s file.fasta / file.fastq' % sys.argv[0], file=sys.stderr)
sys.exit(1)
else:
filename = sys.argv[1]
if filename.lower().endswith('q'):
filetype = 'fastq'
else:
# Assume... | mit | Python |
012ab9bf79ae2f70079534ce6ab527f8e08a50f3 | Fix template that was accidentally overwritten | anastasia-tarasova/indy-sdk,anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,anastasia-tarasova/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,Art... | doc/tutorials/python/secure-msg-template.py | doc/tutorials/python/secure-msg-template.py | import asyncio
import time
import re
async def prep(wallet_handle, my_vk, their_vk, msg):
print('prepping %s' % msg)
async def init():
return None, None, None, None, None
async def read(wallet_handle, my_vk):
print('reading')
async def demo():
wallet_handle, my_did, my_vk, their_did, their_vk = awai... | async def init():
me = input('Who are you? ').strip()
wallet_name = '%s-wallet' % me
# 1. Create Wallet and Get Wallet Handle
try:
await wallet.create_wallet(pool_name, wallet_name, None, None, None)
except:
pass
wallet_handle = await wallet.open_wallet(wallet_name, None, None)
... | apache-2.0 | Python |
a118e2b7133cf4391c1df41d95f9e4329a0bf5e9 | Remove test data folder with all contents during setUp | notapresent/rtrss,notapresent/rtrss,notapresent/rtrss,notapresent/rtrss | tests/__init__.py | tests/__init__.py | import logging
import unittest
import os
import shutil
from sqlalchemy import create_engine
from rtrss import config, database
logging.disable(logging.ERROR)
engine = create_engine(config.SQLALCHEMY_DATABASE_URI,
echo=False,
client_encoding='utf8')
# Reconfigure sessio... | import logging
import unittest
import os
import shutil
from sqlalchemy import create_engine
from rtrss import config, database
logging.disable(logging.ERROR)
engine = create_engine(config.SQLALCHEMY_DATABASE_URI,
echo=False,
client_encoding='utf8')
# Reconfigure sessio... | apache-2.0 | Python |
89169d3f4ff50e0fbb7d63607ad0d888d95a63b9 | fix travis | lmaurits/BEASTling | tests/cli_test.py | tests/cli_test.py | import os
from pathlib import Path
import pytest
from beastling.cli import main
def _run_main(commandline='', status=0):
with pytest.raises(SystemExit) as context:
main(*commandline.split())
assert context.code == status
def test_main(capsys):
_run_main(status=2)
def test_help(capsys):
... | from pathlib import Path
import pytest
from beastling.cli import main
def _run_main(commandline='', status=0):
with pytest.raises(SystemExit) as context:
main(*commandline.split())
assert context.code == status
def test_main(capsys):
_run_main(status=2)
def test_help(capsys):
_run_ma... | bsd-2-clause | Python |
05ba07accf0882e1b2d0d9fa0c2481759a47855d | Set a fixture | adamtheturtle/vws-python,adamtheturtle/vws-python | tests/conftest.py | tests/conftest.py | import pytest
import os
class VuforiaServerCredentials:
"""
TODO
"""
def __init__(self, access_key: str, secret_key: str) -> None:
"""
TODO, Args, Ivar
"""
self.access_key = bytes(access_key, encoding='utf-8')
self.secret_key = bytes(secret_key, encoding='utf-... | import pytest
import os
class VuforiaServerCredentials:
"""
TODO
"""
def __init__(self, access_key: str, secret_key: str) -> None:
"""
TODO, Args, Ivar
"""
self.access_key = bytes(access_key, encoding='utf-8')
self.secret_key = bytes(secret_key, encoding='utf-... | mit | Python |
5621a795735711abe1abf10a6f28fdd2caed8260 | Add more Orbit fixtures | poliastro/poliastro | tests/conftest.py | tests/conftest.py | import pytest
from astropy import units as u
from astropy.coordinates import solar_system_ephemeris
from astropy.time import Time
from poliastro.bodies import Earth, Sun
from poliastro.twobody import Orbit
solar_system_ephemeris.set("builtin")
@pytest.fixture
def earth_perihelion():
return Time("2020-01-05 07:4... | import pytest
from astropy.coordinates import solar_system_ephemeris
from astropy.time import Time
solar_system_ephemeris.set("builtin")
@pytest.fixture
def earth_perihelion():
return Time("2020-01-05 07:47:00", scale="tdb")
| mit | Python |
6e27341fd00757ea9b8fd89a21650cc475e218ac | Expand sys.modules cleaner in conftest to clean EVERYTHING | pyinvoke/invoke,pyinvoke/invoke | tests/conftest.py | tests/conftest.py | import logging
import os
import sys
import termios
from invoke.vendor.six import iteritems
import pytest
from mock import patch
from _util import support
# pytest seems to tweak logging such that Invoke's debug logs go to stderr,
# which is then hella spammy if one is using --capture=no (which one must in
# order t... | import logging
import os
import sys
import termios
from invoke.vendor.six import iteritems
import pytest
from mock import patch
from _util import support
# pytest seems to tweak logging such that Invoke's debug logs go to stderr,
# which is then hella spammy if one is using --capture=no (which one must in
# order t... | bsd-2-clause | Python |
9a72e6dc71abf516e3959e7e04bb65750b1461fb | Add necessary SECRET_KEY to tests.settings | dym/django-offline-messages | tests/settings.py | tests/settings.py | # django-offline-messages Test Settings
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'offline_messages',
'tests'
)
ROOT_URLCONF = ''
COVERAGE_AD... | # django-offline-messages Test Settings
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'offline_messages',
'tests'
)
ROOT_URLCONF = ''
COVERAGE_AD... | bsd-3-clause | Python |
eb03d1fd901d7a7d642f8a310f49af154069a4a6 | Use assert_raises in test_cli | LuminosoInsight/python-ftfy | tests/test_cli.py | tests/test_cli.py | import subprocess
import os
from nose.tools import eq_, assert_raises
# Get the filename of 'halibote.txt', which contains some mojibake about
# Harry Potter in Chinese
THIS_DIR = os.path.dirname(__file__)
TEST_FILENAME = os.path.join(THIS_DIR, 'halibote.txt')
CORRECT_OUTPUT = '【更新】《哈利波特》石堧卜才新婚娶初戀今痠逝\n'
FAILED_OUTPUT... | import subprocess
import os
from nose.tools import eq_
# Get the filename of 'halibote.txt', which contains some mojibake about
# Harry Potter in Chinese
THIS_DIR = os.path.dirname(__file__)
TEST_FILENAME = os.path.join(THIS_DIR, 'halibote.txt')
CORRECT_OUTPUT = '【更新】《哈利波特》石堧卜才新婚娶初戀今痠逝\n'
FAILED_OUTPUT = '''ftfy erro... | mit | Python |
eb4b85ad7626382c6117a26aefd483d31a0dad60 | Make string comparison cross-platform by using os.linesep | rspeer/python-ftfy | tests/test_cli.py | tests/test_cli.py | import subprocess
import os
from nose.tools import eq_, assert_raises
# Get the filename of 'halibote.txt', which contains some mojibake about
# Harry Potter in Chinese
THIS_DIR = os.path.dirname(__file__)
TEST_FILENAME = os.path.join(THIS_DIR, 'halibote.txt')
CORRECT_OUTPUT = os.linesep.join(['【更新】《哈利波特》石堧卜才新婚娶初戀今痠逝... | import subprocess
import os
from nose.tools import eq_, assert_raises
# Get the filename of 'halibote.txt', which contains some mojibake about
# Harry Potter in Chinese
THIS_DIR = os.path.dirname(__file__)
TEST_FILENAME = os.path.join(THIS_DIR, 'halibote.txt')
CORRECT_OUTPUT = '【更新】《哈利波特》石堧卜才新婚娶初戀今痠逝\n'
FAILED_OUTPUT... | mit | Python |
1de254b56eba45ecdc88d26272ab1f123e734e25 | Add test for writing spatial grid to file | stgl/scarplet,rmsare/scarplet | tests/test_dem.py | tests/test_dem.py | import unittest
import numpy as np
import filecmp
TESTDATA_FILENAME = os.path.join(os.path.dirname(__file__), 'data/big_basin.tif')
class CalculationMethodsTestCase(unittest.TestCase):
def setUp(self):
self.dem = DEMGrid(TESTDATA_FILENAME)
def test_calculate_slope(self):
... | import unittest
import numpy as np
class CalculationMethodsTestCase(unittest.TestCase):
def setUp(self):
self.dem = DEMGrid()
def test_calculate_slope(self):
sx, sy = self.dem._calculate_slope()
def test_calculate_laplacian(self):
del2z = self.dem._calculate_lapalacian()
... | mit | Python |
28f25bb7ca5a415bbc3ca2aabd7e290339140a9f | Add mocked test of build_resolver | bacher09/dynsupdate | tests/test_dns.py | tests/test_dns.py | from .utils import TestCase, skipUnless, mock
from dynsupdate import client
import os
class DnsTests(TestCase):
@skipUnless(os.getenv("SLOW"), "To slow")
def test_build_resolver(self):
domain = 'google-public-dns-a.google.com'
res = client.NameUpdate.build_resolver(domain)
self.assert... | from .utils import TestCase, skipUnless
from dynsupdate import client
import os
class DnsTests(TestCase):
@skipUnless(os.getenv("SLOW"), "To slow")
def test_build_resolver(self):
domain = 'google-public-dns-a.google.com'
res = client.NameUpdate.build_resolver(domain)
self.assertListEq... | bsd-3-clause | Python |
bde1c4315a6a1ff2b565c94255fa20a4066dd5f4 | add test that checks GitCommit.message with empty body | Woile/commitizen,Woile/commitizen | tests/test_git.py | tests/test_git.py | from commitizen import git
class FakeCommand:
def __init__(self, out=None, err=None):
self.out = out
self.err = err
def test_git_object_eq():
git_commit = git.GitCommit(
rev="sha1-code", title="this is title", body="this is body"
)
git_tag = git.GitTag(rev="sha1-code", name="... | from commitizen import git
class FakeCommand:
def __init__(self, out=None, err=None):
self.out = out
self.err = err
def test_git_object_eq():
git_commit = git.GitCommit(
rev="sha1-code", title="this is title", body="this is body"
)
git_tag = git.GitTag(rev="sha1-code", name="... | mit | Python |
5cb01f6c5f9d9033286614294ce611c4e115bcfe | change test_knn to use spect_params from hvc.parse.ref_spect_params | NickleDave/hybrid-vocal-classifier | tests/test_knn.py | tests/test_knn.py | """
tests knn module
"""
# from standard library
import glob
# from dependencies
import yaml
import pytest
import hvc.audiofileIO
from hvc.features import knn
from hvc.parse.ref_spect_params import refs_dict
with open('../hvc/parse/feature_groups.yml') as ftr_grp_yaml:
valid_feature_groups_dict = yaml.load(ftr_... | """
tests knn module
"""
# from standard library
import glob
# from dependencies
import yaml
import pytest
import hvc.audiofileIO
from hvc.features import knn
with open('../hvc/parse/feature_groups.yml') as ftr_grp_yaml:
valid_feature_groups_dict = yaml.load(ftr_grp_yaml)
class TestKNN:
"""
unit tests ... | bsd-3-clause | Python |
36dd1493f329e82edd4ed514bfaaa0b58c882141 | Fix not awaited ProgressTracker bug | virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool | virtool/processes.py | virtool/processes.py | STEP_COUNTS = {
"delete_reference": 2,
"import_reference": 0,
"setup_remote_reference": 0,
"update_remote_reference": 0,
"update_software": 0,
"install_hmms": 0
}
FIRST_STEPS = {
"delete_reference": "delete_indexes",
"import_reference": "load_file",
"setup_remote_reference": "",
... | STEP_COUNTS = {
"delete_reference": 2,
"import_reference": 0,
"setup_remote_reference": 0,
"update_remote_reference": 0,
"update_software": 0,
"install_hmms": 0
}
FIRST_STEPS = {
"delete_reference": "delete_indexes",
"import_reference": "load_file",
"setup_remote_reference": "",
... | mit | Python |
858474786155c666d296146641e9fed1889a5590 | Format code | m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps | byceps/services/site/transfer/models.py | byceps/services/site/transfer/models.py | """
byceps.services.site.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import NewType
from attr import attrib, attrs
from ....typing import PartyID
SiteID = NewType('SiteID', str)
@attrs(frozen=Tru... | """
byceps.services.site.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import NewType
from attr import attrib, attrs
from ....typing import PartyID
SiteID = NewType('SiteID', str)
@attrs(frozen=Tr... | bsd-3-clause | Python |
2fd3922b6facf73177d1fa5dcc8af19383cfa003 | disable 'counter' and 'litex_sata' on forks | SymbiFlow/symbiflow-examples,SymbiFlow/symbiflow-examples | .github/scripts/generate_job_matrix.py | .github/scripts/generate_job_matrix.py | #!/usr/bin/env python3
from sys import argv as sys_argv
isFork = len(sys_argv)>1 and sys_argv[1] != 'SymbiFlow/symbiflow-examples'
runs_on = (
'ubuntu-latest'
if isFork else
['self-hosted', 'Linux', 'X64']
)
examples = [
"picosoc",
"litex",
"litex_linux",
"button_controller",
"pulse_... | #!/usr/bin/env python3
from sys import argv as sys_argv
isFork = len(sys_argv)>1 and sys_argv[1] != 'SymbiFlow/symbiflow-examples'
runs_on = (
'ubuntu-latest'
if isFork else
['self-hosted', 'Linux', 'X64']
)
examples = [
"counter",
"picosoc",
"litex",
"litex_linux",
"litex_sata",
... | apache-2.0 | Python |
763de91775d3c60aeaf96d5a7e14d4c090f0ed99 | Use curses instead of just doing stupid shit. | msullivan/cmd-queue | cmd_queue.py | cmd_queue.py | #!/usr/bin/env python3
"""Stupid script to queue up a list of commands and trigger them
with a keystroke and to move backward and forward through the list.
I hacked this up for running sound for a show off of linux, since I
(sort of surprisingly, to me) couldn't find any decent software to
do this."""
import sys
impo... | #!/usr/bin/env python3
"""Stupid script to queue up a list of commands and trigger them
with a keystroke and to move backward and forward through the list.
I hacked this up for running sound for a show off of linux, since I
(sort of surprisingly, to me) couldn't find any decent software to
do this."""
# I am not prou... | mit | Python |
7653f2c6e4f72e40eefee5d70d83ceafb8bc4282 | Use context manager to read syntax file | Thom1729/YAML-Macros | lib/extend.py | lib/extend.py | from collections import OrderedDict
import ruamel.yaml
yaml = ruamel.yaml.YAML()
class Operation():
def __init__(self, extension):
self.extension = extension
class Merge(Operation):
def apply(self, base):
ret = base.copy()
for key, value in self.extension.items():
if key i... | from collections import OrderedDict
import ruamel.yaml
yaml = ruamel.yaml.YAML()
class Operation():
def __init__(self, extension):
self.extension = extension
class Merge(Operation):
def apply(self, base):
ret = base.copy()
for key, value in self.extension.items():
if key i... | mit | Python |
02640ea4d9a3585326dc9c3bb973c01f9b3e1d9a | Update views.py | bardia-heydarinejad/Graph,bardia-heydarinejad/Graph,bardia73/Graph,bardia73/Graph | vertex/views.py | vertex/views.py | from django.shortcuts import render_to_response,RequestContext
from django.http import HttpResponse,HttpResponseRedirect
from vertex.models import Vertex,Edge,Friends,Flow
from Django.utils import timezone
def profile(request, user_id):
try:
vertex = Vertex.objects.get(user_id=user_id)
fname = vertex.fi... | from django.shortcuts import render_to_response,RequestContext
from django.http import HttpResponse,HttpResponseRedirect
from vertex.models import Vertex
def profile(request, user_id):
try:
vertex = Vertex.objects.get(user_id=user_id)
fname = vertex.firstname
lname = vertex.lastname
flowl... | mit | Python |
616e542ee32b1ac83dd4d1977119ef670520c476 | Simplify getting countries associated with warehouse | mociepka/saleor,mociepka/saleor,mociepka/saleor | saleor/warehouse/models.py | saleor/warehouse/models.py | import uuid
from typing import Set
from django.db import models
from django.utils.translation import pgettext_lazy
from ..account.models import Address
from ..shipping.models import ShippingZone
class WarehouseQueryset(models.QuerySet):
def prefetch_data(self):
return self.select_related("address").pref... | import uuid
from django.db import models
from django.utils.translation import pgettext_lazy
from ..account.models import Address
from ..shipping.models import ShippingZone
class WarehouseQueryset(models.QuerySet):
def prefetch_data(self):
return self.select_related("address").prefetch_related("shipping_... | bsd-3-clause | Python |
63ec7e54e756b9b5448618da434981a0689067c2 | Drop Py2 and six on salt/modules/netaddress.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/netaddress.py | salt/modules/netaddress.py | """
Module for getting information about network addresses.
.. versionadded:: 2016.3.0
:depends: netaddr
"""
__virtualname__ = "netaddress"
try:
import netaddr
HAS_NETADDR = True
except ImportError as e:
HAS_NETADDR = False
def __virtual__():
"""
Only load if netaddr library exist.
"""
... | # -*- coding: utf-8 -*-
"""
Module for getting information about network addresses.
.. versionadded:: 2016.3.0
:depends: netaddr
"""
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
from salt.ext import six
__virtualname__ = "netaddress"
# Import thir... | apache-2.0 | Python |
b6d9e7c24b0185d6a715adee4fc457afda6078f4 | Fix UUID field migration for change email request model. | opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind | src/waldur_core/core/migrations/0008_changeemailrequest_uuid.py | src/waldur_core/core/migrations/0008_changeemailrequest_uuid.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_changeemailrequest'),
]
operations = [
migrations.AddField(
model_name='changeemailrequest', name='uuid', field=models.UUIDField(),
),
]
| from django.db import migrations
import waldur_core.core.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0007_changeemailrequest'),
]
operations = [
migrations.AddField(
model_name='changeemailrequest',
name='uuid',
field=wald... | mit | Python |
ead27579a42765d11ee6ba943c04996c596e492a | Improve condition sample to demonstrate ==, >= and <. (#607) | kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines | samples/basic/condition.py | samples/basic/condition.py | #!/usr/bin/env python3
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 | Python |
9334860d4a7d8ac5ac749e46986a9e8fd38b2aae | Improve debugging message to show the number of running browsers upon failures. | catapult-project/catapult-csm,SummerLW/Perf-Insight-Report,catapult-project/catapult,sahiljain/catapult,catapult-project/catapult-csm,benschmaus/catapult,benschmaus/catapult,catapult-project/catapult,benschmaus/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,catapult-project/catapult-csm,catapult-project/catap... | telemetry/telemetry/core/platform/tracing_controller_backend.py | telemetry/telemetry/core/platform/tracing_controller_backend.py | # 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.
from telemetry.core.platform import tracing_category_filter
from telemetry.core.platform import tracing_options
class TracingControllerBackend(object):
d... | # 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.
from telemetry.core.platform import tracing_category_filter
from telemetry.core.platform import tracing_options
class TracingControllerBackend(object):
d... | bsd-3-clause | Python |
b2ea19150088e8ffd648dd72cfbb8ccd23677f1d | Fix model | OpenJUB/jay,OpenJUB/jay,OpenJUB/jay,kuboschek/jay,kuboschek/jay,kuboschek/jay | votes/models.py | votes/models.py | from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
from settings.models import VotingSystem
from filters.models import UserFilter
from jay.restricted import is_restricted_word
# Create your models here.
class Vote(models.Model):
system = models.ForeignKey(Voti... | from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
from settings.models import VotingSystem
from filters.models import UserFilter
from jay.restricted import is_restricted_word
# Create your models here.
class Vote(models.Model):
system = models.ForeignKey(Voti... | mit | Python |
0a741e2d7f6425b2a9718e2f552a7c1af378ea26 | Add a Model class which includes a default primary key | ismail-s/warehouse,HonzaKral/warehouse,karan/warehouse,chopmann/warehouse,pypa/warehouse,wlonk/warehouse,ismail-s/warehouse,pypa/warehouse,alex/warehouse,pypa/warehouse,alex/warehouse,ismail-s/warehouse,alex/warehouse,chopmann/warehouse,karan/warehouse,ismail-s/warehouse,pypa/warehouse,dstufft/warehouse,chopmann/wareho... | warehouse/db.py | warehouse/db.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
# distributed under the Li... | # 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
# distributed under the Li... | apache-2.0 | Python |
f6ea0a7d8119d3140808585828f85aad0cc54e6e | Update script to work with Galileo | amcolash/WaterPi,amcolash/WaterIoT,amcolash/WaterIoT,amcolash/WaterPi,amcolash/WaterPi,amcolash/WaterPi,amcolash/WaterIoT,amcolash/WaterIoT | water_analog.py | water_analog.py | #!/usr/bin/env python
from __future__ import division # treat all division as non-integer division (remainders)
import mraa
import time
import signal
import sys
import auth
import twitter
import json
# Path to use for web server / checkout and data
PATH='/home/root/WaterIoT/'
# Define "enable" for the sensor
SENSOR... | #!/usr/bin/env python
from __future__ import division # treat all division as non-integer division (remainders)
import RPi.GPIO as GPIO # Allows us to call our GPIO pins and names it just GPIO
import time
import signal
import sys
import auth
import twitter
import json
import spidev
# Define "enable" for the sensor
S... | mit | Python |
346132595be2ef5b28dacdf6c0ca5af25f11d4d3 | remove 'exec' from run func | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | scripts/jenkins/jsbuild.py | scripts/jenkins/jsbuild.py | #!/usr/bin/env python
import argparse
import subprocess
import os
import sys
def run(command, **kwargs):
defaults = {
'shell': True
}
defaults.update(kwargs)
return_code = subprocess.call(command, **defaults)
if return_code:
sys.exit(return_code)
def run_bg(command, **kwargs):
... | #!/usr/bin/env python
import argparse
import subprocess
import os
import sys
def run(command, **kwargs):
defaults = {
'shell': True
}
defaults.update(kwargs)
return_code = subprocess.call(command, **defaults)
if return_code:
sys.exit(return_code)
def run_bg(command, **kwargs):
... | mit | Python |
d93c0317cc56938b8623d79817aad7c13434aeb6 | Fix critical bug in getUserPath() | MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3 | scripts/lib/getUserPath.py | scripts/lib/getUserPath.py | def getUserPath(filename, is_command):
import lib.app, os
# Places quotation marks around the full path, to handle cases where the user-specified path / file name contains spaces
# However, this should only occur in situations where the output is being interpreted as part of a full command string;
# if the ex... | def getUserPath(filename, is_command):
import lib.app, os
# Places quotation marks around the full path, to handle cases where the user-specified path / file name contains spaces
# However, this should only occur in situations where the output is being interpreted as part of a full command string;
# if the ex... | mpl-2.0 | Python |
e9bf67732b842d43cba75be9da5098198bc450aa | change uri config | peuyeum/peuyeum,peuyeum/peuyeum,peuyeum/peuyeum | lib/sampeu.py | lib/sampeu.py | #!/usr/bin/env python
"""
Settings and Modules of Peuyeum
sampeu.py
created by Rolly Maulana Awangga
"""
import config
import urllib
import os
webURI = config.webURI
apiURI = config.apiURI
viewspath="./apps/views/"
templatepath="./apps/templates/"
def generateView(route):
return os.system('python '+templatepath+ro... | #!/usr/bin/env python
"""
Settings and Modules of Peuyeum
sampeu.py
created by Rolly Maulana Awangga
"""
import config
import urllib
import os
keyuri = config.keyuri
tokenuri = config.tokenuri
viewspath="./apps/views/"
templatepath="./apps/templates/"
def generateView(route):
return os.system('python '+templatepat... | agpl-3.0 | Python |
abc83b01f6328f36b420da5be1a3e4488173a90e | Update twitch.py | TingPing/plugins,TingPing/plugins | HexChat/twitch.py | HexChat/twitch.py | import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'TingPing'
__module_version__ = '3'
__module_description__ = 'Better integration with Twitch.tv'
# Very much a work in progress...
# Commands from http://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commands
# /ban may conflict with other... | import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'TingPing'
__module_version__ = '2'
__module_description__ = 'Better integration with Twitch.tv'
# Very much a work in progress...
# Commands from http://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commands
# /ban may conflict with other... | mit | Python |
01e19cbe008ae3663eb185823bb90a8f912c018a | Fix search api tests | jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud | src/wirecloud/commons/tests/searchers.py | src/wirecloud/commons/tests/searchers.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014-2015 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either v... | # -*- coding: utf-8 -*-
# Copyright (c) 2014-2015 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either v... | agpl-3.0 | Python |
9e36327e694a495c24ec6f17a110c8ec01d553c6 | Improve quaternion unit-tests (Python) | humanoid-path-planner/hpp-corbaserver,humanoid-path-planner/hpp-corbaserver | tests/quat.py | tests/quat.py | from hpp import Quaternion
from math import sqrt
import numpy as np
ok=True
for q in (
[ 0.5,-0.5,-0.5,-0.5],
[-0.5,-0.5, 0.5,-0.5],
[0,0, 1/sqrt(2),1/sqrt(2)],
[0,0,-1/sqrt(2),1/sqrt(2)],
[0,-1/sqrt(2),0,1/sqrt(2)],
):
q1 = Quaternion(q)
r,p,y = q1.toRPY()
... | from hpp import Quaternion
import numpy as np
for q in (
[ 0.5,-0.5,-0.5,-0.5],
[-0.5,-0.5, 0.5,-0.5],
):
q = Quaternion(q)
r,p,y = q.toRPY()
qq = Quaternion()
qq.fromRPY(r,p,y)
assert (q.array - qq.array < 1e-6).all()
| bsd-2-clause | Python |
3481267c074a724fbf2d1d2da66fe198e74e9051 | test case changes | unicefuganda/uSurvey,unicefuganda/uSurvey,unicefuganda/uSurvey,unicefuganda/uSurvey,unicefuganda/uSurvey | survey/tests/forms/test_about_us_form.py | survey/tests/forms/test_about_us_form.py | from django.test import TestCase
from survey.forms.aboutus_form import AboutUsForm
class AboutUsFormTest(TestCase):
def test_valid(self):
form_data = {
'content': 'description goes here',
}
aboutus_form = AboutUsForm(form_data)
self.assertTrue(aboutus_form.is_valid())
... | from django.test import TestCase
from survey.forms.aboutus_form import AboutUsForm
class AboutUsFormTest(TestCase):
def test_valid(self):
form_data = {
'content': 'description goes here',
}
aboutus_form = AboutUsForm(form_data)
self.assertTrue(aboutus_form.is_valid())
... | bsd-3-clause | Python |
2530b9b22700dd441c2779d289004755d79b8166 | Add note about resetting object in loop | BranSeals/uml-to-cpp | uml-to-cpp.py | uml-to-cpp.py | # Copyright (C) 2017 Bran Seals. All rights reserved.
# Created: 2017-06-05
print("== UML to CPP ==")
print("Create or modify C++ header and implementation files by plaintext UML.")
#print("Enter a UML filename: ") # file import currently disabled
# check if file isn't too bonkers
uml = [] # pull UML into memory as st... | # Copyright (C) 2017 Bran Seals. All rights reserved.
# Created: 2017-06-05
print("== UML to CPP ==")
print("Create or modify C++ header and implementation files by plaintext UML.")
#print("Enter a UML filename: ") # file import currently disabled
# check if file isn't too bonkers
uml = [] # pull UML into memory as st... | mit | Python |
5a52238d4c310a6be7bcb9514197fd4c0c692a2d | Set unix socket file permission (#428) | vijos/vj4,vijos/vj4,vijos/vj4,vijos/vj4 | vj4/server.py | vj4/server.py | import atexit
import coloredlogs
import logging
import os
import shutil
import signal
import socket
import sys
import urllib.parse
from aiohttp import web
from coloredlogs import syslog
from vj4 import app
from vj4.util import options
options.define('listen', default='http://127.0.0.1:8888', help='Server listening ad... | import atexit
import coloredlogs
import logging
import os
import signal
import socket
import sys
import urllib.parse
from aiohttp import web
from coloredlogs import syslog
from vj4 import app
from vj4.util import options
options.define('listen', default='http://127.0.0.1:8888', help='Server listening address.')
optio... | agpl-3.0 | Python |
7604b81c2a3beea57a808e7a599842fb7c22bce3 | change dependency so pickle could work | machinalis/yalign,machinalis/yalign,pombredanne/yalign,pombredanne/yalign | yalign/svm.py | yalign/svm.py | #!/usr/bin/env python
# coding: utf-8
"""
Support Vector Machine Classifier
"""
import numpy
from sklearn import svm
from simpleai.machine_learning import Classifier
class SVMClassifier(Classifier):
def learn(self):
vectors = []
answers = []
for data in self.dataset:
vector =... | #!/usr/bin/env python
# coding: utf-8
"""
Support Vector Machine Classifier
"""
import numpy
from sklearn import svm
from simpleai.machine_learning import Classifier
class SVMClassifier(Classifier):
def learn(self):
vectors = []
answers = []
for data in self.dataset:
vector =... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.