commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
2997b84a5ead65f6c17128baef3e3039957d97f8 | dduplicated/cli.py | dduplicated/cli.py | # The client of DDuplicated tool.
from os import path as opath, getcwd
from sys import argv
from dduplicated import commands
def get_paths(params):
paths = []
for param in params:
path = opath.join(getcwd(), param)
if opath.exists(path) and opath.isdir(path) and not opath.islink(path):
paths.append(path)
r... | # The client of DDuplicated tool.
from os import path as opath, getcwd
from pprint import pprint
from sys import argv
from dduplicated import commands
def get_paths(params):
paths = []
for param in params:
path = opath.join(getcwd(), param)
if opath.exists(path) and opath.isdir(path) and not opath.islink(path):... | Update in output to terminal. | Update in output to terminal.
Signed-off-by: messiasthi <8562fc1efba9a3c99753c749fdfb1b6932b70fbf@gmail.com>
| Python | mit | messiasthi/dduplicated-cli |
b1efc997c510fbdcaeb8d3ba9b4202ac810bb9ff | util/html_clean.py | util/html_clean.py | import bleach
DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6']
def clean_for_user_description(html):
"""
Removes dangerous tags, including h1.
"""
return bleach.clean(html, tags=USER_DESCR_A... | import bleach
DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']
USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']
def clean_for_user_description(html):
"""
Removes dangerous tags, including h1.
"""
return bleach.clean(h... | Allow <br /> and <p> in descriptions | Allow <br /> and <p> in descriptions
| Python | bsd-3-clause | fsr/course-management,fsr/course-management |
4673b980252f5fd4c490652d9af63eac02506614 | dimod/reference/composites/structure.py | dimod/reference/composites/structure.py | from dimod.core.sampler import Sampler
from dimod.core.composite import Composite
from dimod.core.structured import Structured
from dimod.decorators import bqm_structured
class StructureComposite(Sampler, Composite, Structured):
"""Creates a structured composed sampler from an unstructured sampler.
todo
... | from dimod.core.sampler import Sampler
from dimod.core.composite import Composite
from dimod.core.structured import Structured
from dimod.decorators import bqm_structured
class StructureComposite(Sampler, Composite, Structured):
"""Creates a structured composed sampler from an unstructured sampler.
"""
# ... | Update Structure composite to use the new abc | Update Structure composite to use the new abc
| Python | apache-2.0 | dwavesystems/dimod,dwavesystems/dimod |
6d38920c1867921235c002b6ad411fd08378dd1f | fluent_contents/tests/test_models.py | fluent_contents/tests/test_models.py | from django.contrib.contenttypes.models import ContentType
from fluent_contents.models import ContentItem
from fluent_contents.tests.utils import AppTestCase
class ModelTests(AppTestCase):
"""
Testing the data model.
"""
def test_stale_model_str(self):
"""
No matter what, the Content... | from django.contrib.contenttypes.models import ContentType
from fluent_contents.models import ContentItem
from fluent_contents.tests.utils import AppTestCase
class ModelTests(AppTestCase):
"""
Testing the data model.
"""
def test_stale_model_str(self):
"""
No matter what, the Content... | Fix Django 1.8+ tests for stale content type | Fix Django 1.8+ tests for stale content type
| Python | apache-2.0 | django-fluent/django-fluent-contents,edoburu/django-fluent-contents,edoburu/django-fluent-contents,django-fluent/django-fluent-contents,django-fluent/django-fluent-contents,edoburu/django-fluent-contents |
a16a822ede8ad987b2234f29a31f9fe79c27cbd5 | dbaas/workflow/steps/util/clone/clone_database.py | dbaas/workflow/steps/util/clone/clone_database.py | # -*- coding: utf-8 -*-
import logging
from util import full_stack
from util import call_script
from django.conf import settings
from drivers import factory_for
from system.models import Configuration
from notification.util import get_clone_args
from ...base import BaseStep
from ....exceptions.error_codes import DBAAS_... | # -*- coding: utf-8 -*-
import logging
from util import full_stack
from util import call_script
from django.conf import settings
from drivers import factory_for
from system.models import Configuration
from notification.util import get_clone_args
from ...base import BaseStep
from ....exceptions.error_codes import DBAAS_... | Add call_script output to workflow_dict traceback | Add call_script output to workflow_dict traceback
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service |
870c89649032480587bdb03ae31f4eecf21eebf7 | tldr/parser.py | tldr/parser.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import click
def parse_page(page):
"""Parse the command man page."""
with open(page) as f:
lines = f.readlines()
for line in lines:
if line.startswith('#'):
continue
elif line.startsw... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import click
from tldr.config import get_config
def parse_page(page):
"""Parse the command man page."""
colors = get_config()['colors']
with open(page) as f:
lines = f.readlines()
for line in lines:
... | Use color configurations from config file | Use color configurations from config file
| Python | mit | lord63/tldr.py |
9710589f34e50bdf2fa19b1fcd827b07d4248ab6 | dodo_commands/extra/dodo_standard_commands/commit-config.py | dodo_commands/extra/dodo_standard_commands/commit-config.py | from argparse import ArgumentParser
from dodo_commands.framework import Dodo
from dodo_commands.framework.config import Paths
import os
def _args():
parser = ArgumentParser()
parser.add_argument('-m', dest='message')
args = Dodo.parse_args(parser)
return args
if Dodo.is_main(__name__, safe=True):
... | from argparse import ArgumentParser
from dodo_commands.framework import Dodo
from dodo_commands.framework.config import Paths
import os
def _args():
parser = ArgumentParser()
parser.add_argument(
'--message', '-m', dest='message', help='The commit message')
args = Dodo.parse_args(parser)
retur... | Allow both -m and --message | Allow both -m and --message
| Python | mit | mnieber/dodo_commands |
52ffc2b264cbacaee56017cd4a67df4511d60392 | celery/managers.py | celery/managers.py | from django.db import models
from celery.registry import tasks
from datetime import datetime, timedelta
__all__ = ["TaskManager", "PeriodicTaskManager"]
class TaskManager(models.Manager):
def get_task(self, task_id):
task, created = self.get_or_create(task_id=task_id)
return task
def is... | from django.db import models
from celery.registry import tasks
from datetime import datetime, timedelta
__all__ = ["TaskManager", "PeriodicTaskManager"]
class TaskManager(models.Manager):
def get_task(self, task_id):
task, created = self.get_or_create(task_id=task_id)
return task
def is... | Add is_done=True to get_all_expired filter. | Add is_done=True to get_all_expired filter.
| Python | bsd-3-clause | WoLpH/celery,cbrepo/celery,cbrepo/celery,ask/celery,frac/celery,WoLpH/celery,mitsuhiko/celery,ask/celery,mitsuhiko/celery,frac/celery |
697fbacc04bc41dea056377e85ba6b29949d8feb | wars/device.py | wars/device.py | import pygame
from pygame.locals import *
from wars.block import Block
class Device(object):
# Static params
height = 60
# Object params
blocks = []
title = None
pos_y = None
def __init__(self, title, pos):
self.title = title
self.pos_y = pos
self.blocks = []
... | import pygame
from pygame.locals import *
from wars.block import Block
class Device(object):
# Static params
height = 60
# Object params
blocks = []
title = None
pos_y = None
def __init__(self, title, pos):
self.title = title
self.pos_y = pos
self.blocks = []
... | Remove objects when they are not used | Remove objects when they are not used
| Python | mit | cmol/wifi-wars |
5d901fddb0c863f811b0de40c063bb00b50e5394 | ion/processes/bootstrap/plugins/bootstrap_core.py | ion/processes/bootstrap/plugins/bootstrap_core.py | #!/usr/bin/env python
__author__ = 'Michael Meisinger'
from ion.core.bootstrap_process import BootstrapPlugin, AbortBootstrap
from pyon.public import IonObject, RT
from pyon.util.containers import get_safe
from interface.objects import ActorIdentity, Org
class BootstrapCore(BootstrapPlugin):
"""
Bootstrap ... | #!/usr/bin/env python
__author__ = 'Michael Meisinger'
from ion.core.bootstrap_process import BootstrapPlugin, AbortBootstrap
from pyon.public import IonObject, RT
from pyon.util.containers import get_safe
from interface.objects import ActorIdentity, Org
class BootstrapCore(BootstrapPlugin):
"""
Bootstrap ... | Add web authentication actor on bootstrap | Add web authentication actor on bootstrap
| Python | bsd-2-clause | ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services |
35974efcbae0c8a1b3009d7a2f38c73a52ff5790 | powerdns/admin.py | powerdns/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from powerdns.models import Domain, Record, Supermaster
class RecordAdmin(admin.ModelAdmin):
list_display = ('name', 'type', 'content', 'ttl', 'prio', 'change_date',)
list_filter = ['type', 'ttl',]
search_fields = ('name','content',)
class DomainAd... | # -*- coding: utf-8 -*-
from django.contrib import admin
from powerdns.models import Domain, Record, Supermaster
class RecordAdmin(admin.ModelAdmin):
list_display = ('name', 'type', 'content', 'ttl', 'prio', 'change_date',)
list_filter = ['type', 'ttl',]
search_fields = ('name','content',)
readonly_fi... | Mark some fields as readonly in the Admin panel as they are set by the server (Requires Django 1.2 or greater) | Mark some fields as readonly in the Admin panel as they are set by the server (Requires Django 1.2 or greater)
| Python | bsd-2-clause | dominikkowalski/django-powerdns-dnssec,zefciu/django-powerdns-dnssec,zefciu/django-powerdns-dnssec,dominikkowalski/django-powerdns-dnssec,dominikkowalski/django-powerdns-dnssec,allegro/django-powerdns-dnssec,allegro/django-powerdns-dnssec,dominikkowalski/django-powerdns-dnssec,allegro/django-powerdns-dnssec,allegro/dja... |
bb3ffdea2a76a86c1911426ce030c29abbd1074f | tempo/django/forms.py | tempo/django/forms.py | #!/usr/bin/env python
# coding=utf-8
from decimal import Decimal
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import Field, ValidationError
from tempo.django.widgets import ScheduleSetWidget
from tempo.schedule import Schedule
from tempo.scheduleset import ScheduleSet
class Sched... | #!/usr/bin/env python
# coding=utf-8
from decimal import Decimal
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import Field, ValidationError
from tempo.django.widgets import ScheduleSetWidget
from tempo.schedule import Schedule
from tempo.scheduleset import ScheduleSet
class Sched... | Make "to" not inclusive in widget | Make "to" not inclusive in widget
To avoid exceeding possible values.
| Python | bsd-3-clause | AndrewPashkin/python-tempo,AndrewPashkin/python-tempo |
d66355e4758b37be39d17d681ede1dbbd6b9b311 | setmagic/admin.py | setmagic/admin.py | from django import forms
from django.contrib import admin
from setmagic import settings
from setmagic.models import Setting
_denied = lambda *args: False
class SetMagicAdmin(admin.ModelAdmin):
list_display = 'label', 'current_value',
list_editable = 'current_value',
list_display_links = None
has_a... | from django import forms
from django.contrib import admin
from django.utils.importlib import import_module
from setmagic import settings
from setmagic.models import Setting
_denied = lambda *args: False
class SetMagicAdmin(admin.ModelAdmin):
list_display = 'label', 'current_value',
list_editable = 'current... | Use importlib to load custom fields by str | Use importlib to load custom fields by str
| Python | mit | 7ws/django-setmagic |
65137b42bd5ebee37cba0fd462e8f7484a3f9aaa | pelops/etl/hog.py | pelops/etl/hog.py | from skimage.feature import hog
from skimage import colos
from pelops.etl.feature_producer import FeatureProducer
class HOGFeatureProducer(FeatureProducer):
def __init__(self, chip_producer):
super().__init__(chip_producer)
def produce_features(self, chip):
"""Takes a chip object and return... | from skimage.feature import hog
from skimage import colos
from pelops.etl.feature_producer import FeatureProducer
class HOGFeatureProducer(FeatureProducer):
def __init__(self, chip_producer, image_size=(256,256), cells=(16, 16), orientations=8):
super().__init__(chip_producer)
self.image_size = ... | Replace magic numbers in `HOGFeatureProducer` | Replace magic numbers in `HOGFeatureProducer`
| Python | apache-2.0 | d-grossman/pelops,d-grossman/pelops,dave-lab41/pelops,Lab41/pelops,dave-lab41/pelops,Lab41/pelops |
71c9b12056de1e1fdcc1effd2fda4c4dd284afab | froide/problem/utils.py | froide/problem/utils.py | from django.core.mail import mail_managers
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
def inform_managers(report):
mail_managers(
_('New problem: {label} [#{reqid}]').format(
label=report.get_kind... | from django.core.mail import mail_managers
from django.conf import settings
from django.urls import reverse
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
def inform_managers(report):
admin_url = settings.SITE_URL + reverse(
'admin:problem_probl... | Add link to report admin page to report info mail | Add link to report admin page to report info mail | Python | mit | stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,fin/froide |
8f3b6912ac7dd9fa63143a7e482d880658e69ac4 | pyeda/__init__.py | pyeda/__init__.py | """
Python EDA Package
common.py
boolfunc.py -- Boolean functions
expr.py -- Boolean logic expressions
vexpr.py -- Boolean vector logic expressions
table.py -- Boolean tables
"""
__copyright__ = "Copyright (c) 2012, Chris Drake"
__version__ = "0.3.1"
| """
Python EDA Package
common.py
boolfunc.py -- Boolean functions
constant.py -- Boolean constant functions
expr.py -- Boolean logic expressions
vexpr.py -- Boolean vector logic expressions
table.py -- Boolean tables
"""
__copyright__ = "Copyright (c) 2012, Chris Drake"
__version__ = "0.3.1"
| Add constant.py to package docstring | Add constant.py to package docstring
| Python | bsd-2-clause | sschnug/pyeda,pombredanne/pyeda,pombredanne/pyeda,GtTmy/pyeda,cjdrake/pyeda,pombredanne/pyeda,GtTmy/pyeda,cjdrake/pyeda,sschnug/pyeda,karissa/pyeda,sschnug/pyeda,karissa/pyeda,cjdrake/pyeda,GtTmy/pyeda,karissa/pyeda |
ac1dcd9f7acb8e8867996c70aa0a35eb45fcdc53 | generator/php_di_gen.py | generator/php_di_gen.py | #! /usr/bin/python
"""
This script accepts a string with the following syntax:
Get the list of classes that a PHP class depends on.
Generate PHP code that
defines the fields with corresponding
names ( same name as the class name but with the first letter
converted to lower case ).
defines the constructor.
P... | #! /usr/bin/python
"""
This script accepts a string with the following syntax:
Get the list of classes that a PHP class depends on.
Generate PHP code that
defines the fields with corresponding
names ( same name as the class name but with the first letter
converted to lower case ).
defines the constructor.
P... | Fix import and update help | Fix import and update help
Use relative module name
The script may be invoked from a single executable without py extension.
| Python | apache-2.0 | HappyRay/php-di-generator |
f029a204289abb91d57e117d45772d24372a1a43 | requests-RT/rt.py | requests-RT/rt.py | #!/usr/bin/python
import requests
class RT:
def __init__(self, apikey):
self.apikey = apikey
@staticmethod
def make_request(url, params=None):
req = requests.get(url, params=params)
return req.content
def search(self, query, page_limit=30, page=1):
url = 'http://a... | #!/usr/bin/python
__author__ = 'Mahmoud Hossam'
__version__ = '0.1'
import requests
class RT:
def __init__(self, apikey):
self.apikey = apikey
@staticmethod
def make_request(url, params=None):
req = requests.get(url, params=params)
return req.content
def search(self, que... | Add author and version number | Add author and version number
| Python | bsd-2-clause | mahmoudhossam/requests-RT |
e9ec19e68ccefaee9a975a6adc26cb6e5f1f7f33 | pymodels/middlelayer/devices/__init__.py | pymodels/middlelayer/devices/__init__.py | from .dcct import DCCT
from .li_llrf import LiLLRF
from .rf import RF
from .sofb import SOFB
from .kicker import Kicker
from .septum import Septum
from .screen import Screen
from .bpm import BPM
from .ict import ICT
from .ict import TranspEff
from .egun import Bias
from .egun import Filament
from .egun import HVPS
| from .dcct import DCCT
from .li_llrf import LiLLRF
from .rf import RF
from .sofb import SOFB
from .kicker import Kicker
from .septum import Septum
from .screen import Screen
from .bpm import BPM
from .ict import ICT
from .ict import TranspEff
from .egun import Bias
from .egun import Filament
from .egun import HVPS
from... | Add timing in devices init | DEV.ENH: Add timing in devices init
| Python | mit | lnls-fac/sirius |
a9354124f4905f4befe9ff2ca8274406fbbb0dad | readux/annotations/migrations/0003_annotation_group_and_permissions.py | readux/annotations/migrations/0003_annotation_group_and_permissions.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
('annotations', '0002_add_volume_uri'),
]
operations = [
migrations.Create... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
('annotations', '0002_add_volume_uri'),
]
operations = [
migrations.Create... | Fix migration that adds custom annotation permissions | Fix migration that adds custom annotation permissions
| Python | apache-2.0 | emory-libraries/readux,emory-libraries/readux,emory-libraries/readux |
5531f188c7bf3030cb9fc3b46d92a1db60817b7c | confirmation/views.py | confirmation/views.py | # -*- coding: utf-8 -*-
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
__revision__ = '$Id: views.py 21 2008-12-05 09:21:03Z jarek.zgoda $'
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf import settings
from confirmation.models import Confirm... | # -*- coding: utf-8 -*-
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
__revision__ = '$Id: views.py 21 2008-12-05 09:21:03Z jarek.zgoda $'
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf import settings
from confirmation.models import Confirm... | Include confirmation key in context object. | Include confirmation key in context object.
This way our templates can reference the confirmation key later.
(imported from commit 4d57e1309386f2236829b6fdf4e4ad43c5b125c8)
| Python | apache-2.0 | schatt/zulip,deer-hope/zulip,PaulPetring/zulip,adnanh/zulip,jeffcao/zulip,hafeez3000/zulip,fw1121/zulip,KJin99/zulip,ufosky-server/zulip,mahim97/zulip,dhcrzf/zulip,dawran6/zulip,firstblade/zulip,akuseru/zulip,eastlhu/zulip,showell/zulip,dawran6/zulip,vikas-parashar/zulip,esander91/zulip,eastlhu/zulip,so0k/zulip,johnny9... |
6ea9492ae32ad744da4803dcab3cf57334dd69e5 | script_helpers.py | script_helpers.py | """A set of functions to standardize some options for python scripts."""
def setup_parser_help(parser, additional_docs=None):
"""
Set formatting for parser to raw and add docstring to help output
Parameters
----------
parser : `ArgumentParser`
The parser to be modified.
additional_d... | """A set of functions to standardize some options for python scripts."""
def setup_parser_help(parser, additional_docs=None):
"""
Set formatting for parser to raw and add docstring to help output
Parameters
----------
parser : `ArgumentParser`
The parser to be modified.
additional_d... | Change name of and add documentation to directory argument | Change name of and add documentation to directory argument
| Python | bsd-3-clause | mwcraig/msumastro |
07538222d07b0a565cadadd40df9bedeb12a4f60 | talk_timer.py | talk_timer.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import argparse
from time import sleep
import pyttsx
parser = argparse.ArgumentParser(description='Presentation timer with spoken warnings.')
parser.add_argument('minutes', type=int, nargs=1, help='Length of talk in minutes')
args = parser.parse_args()
minutes = args.m... | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import argparse
from time import sleep
import pyttsx
parser = argparse.ArgumentParser(description='Presentation timer with spoken warnings.')
parser.add_argument('minutes', type=int, help='Length of talk in minutes')
args = parser.parse_args()
print "Timing a {0}-minut... | Remove nargs param so that minutes is an int, not list. | Remove nargs param so that minutes is an int, not list.
| Python | bsd-3-clause | audreyr/useful |
b06eb92ec878a06a2fa1ce9b7eb4d253d5481daa | tests/activity/test_activity_deposit_assets.py | tests/activity/test_activity_deposit_assets.py | import unittest
from activity.activity_DepositAssets import activity_DepositAssets
import settings_mock
from ddt import ddt, data, unpack
@ddt
class TestDepositAssets(unittest.TestCase):
def setUp(self):
self.depositassets = activity_DepositAssets(settings_mock, None, None, None, None)
@unpack
@d... | import unittest
from activity.activity_DepositAssets import activity_DepositAssets
import settings_mock
from ddt import ddt, data, unpack
@ddt
class TestDepositAssets(unittest.TestCase):
def setUp(self):
self.depositassets = activity_DepositAssets(settings_mock, None, None, None, None)
@unpack
@d... | Change test data for mimetype to content_type. | Change test data for mimetype to content_type.
| Python | mit | gnott/elife-bot,gnott/elife-bot,jhroot/elife-bot,gnott/elife-bot,jhroot/elife-bot,jhroot/elife-bot |
a09274fbc9277de2cbd3336fca4922094b0db8d1 | crmapp/urls.py | crmapp/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'crmapp.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| from django.conf.urls import patterns, include, url
from marketing.views import HomePage
urlpatterns = patterns('',
# Marketing pages
url(r'^$', HomePage.as_view(), name="home"),
# Subscriber related URLs
# Admin URL
# Login/Logout URLs
# Account related URLs
# Contact related UR... | Create the Home Page > Create the URL Conf | Create the Home Page > Create the URL Conf
| Python | mit | tabdon/crmeasyapp,tabdon/crmeasyapp,deenaariff/Django |
f155c200dc6f8b7b9461f399a3d3642d23e64942 | snipsskills/templates/intent_template.py | snipsskills/templates/intent_template.py | # -*-: coding utf-8 -*-
""" Auto-generated intent class. """
# *****************************************************************************
# *****************************************************************************
# *****************************************************************************
#
# WARNING: THIS ... | # -*-: coding utf-8 -*-
""" Auto-generated intent class. """
# *****************************************************************************
# *****************************************************************************
# *****************************************************************************
#
# WARNING: THIS ... | Add intent sessionId siteId & customData | Add intent sessionId siteId & customData
| Python | mit | snipsco/snipsskills,snipsco/snipsskills,snipsco/snipsskills,snipsco/snipsskills |
a51d280ca7c7f487e6743e4f377f70641a8b4edd | turbustat/statistics/statistics_list.py | turbustat/statistics/statistics_list.py | # Licensed under an MIT open source license - see LICENSE
'''
Returns a list of all available distance metrics
'''
statistics_list = ["Wavelet", "MVC", "PSpec", "Bispectrum", "DeltaVariance",
"Genus", "VCS", "VCA", "Tsallis", "PCA", "SCF", "Cramer",
"Skewness", "Kurtosis", "VCS_S... | # Licensed under an MIT open source license - see LICENSE
'''
Returns a list of all available distance metrics
'''
statistics_list = ["Wavelet", "MVC", "PSpec", "Bispectrum", "DeltaVariance",
"Genus", "VCS", "VCA", "Tsallis", "PCA", "SCF", "Cramer",
"Skewness", "Kurtosis", "VCS_S... | Update the stats lists and add a 3D only version | Update the stats lists and add a 3D only version
| Python | mit | Astroua/TurbuStat,e-koch/TurbuStat |
50d69badbaeb41736269c99f7b301f09c9b24ecb | testing/test_models.py | testing/test_models.py | from k2catalogue import models
def test_safe_float_good():
assert models.safe_float("2") == 2.0
def test_safe_float_bad():
assert models.safe_float('this is not convertable to a float') is None
| from k2catalogue import models
def test_safe_float_good():
assert models.safe_float("2") == 2.0
def test_safe_float_bad():
assert models.safe_float('this is not convertable to a float') is None
def test_proposal_printing():
proposal = models.Proposal(proposal_id='abc')
assert repr(proposal) == '<Prop... | Add test for proposal printing | Add test for proposal printing
| Python | mit | mindriot101/k2catalogue |
855cea2b603453ce7ed907fc153962596de31f00 | src/json.py | src/json.py | msg = 'This is not yet implemented'
def validate(sketch):
"""
- sketch: a `dict`
"""
raise NotImplementedError(msg)
def readsketch_iter(iterable):
"""
- iterable: as return by ijson.parser
Returns a `dict` with a sketch information
"""
raise NotImplementedError(msg)
def readjamsc... | MSG = 'This is not yet implemented'
def validate(sketch):
"""
- sketch: a `dict`
"""
raise NotImplementedError(MSG)
def readsketch_iter(iterable):
"""
- iterable: as return by ijson.parser
Returns a `dict` with a sketch information
"""
raise NotImplementedError(MSG)
def readja... | Rename msg -> MSG (since a constant). | Rename msg -> MSG (since a constant).
| Python | mit | lgautier/mashing-pumpkins,lgautier/mashing-pumpkins,lgautier/mashing-pumpkins |
7cacf4f78f03e95eec51aac211779539954aee38 | pymanopt/manifolds/__init__.py | pymanopt/manifolds/__init__.py | from .grassmann import Grassmann
from .sphere import Sphere
from .stiefel import Stiefel
from .psd import PSDFixedRank, PSDFixedRankComplex, Elliptope, PositiveDefinite
from .oblique import Oblique
from .euclidean import Euclidean, Symmetric
from .product import Product
__all__ = ["Grassmann", "Sphere", "Stiefel", "PS... | from .grassmann import Grassmann
from .sphere import Sphere
from .stiefel import Stiefel
from .psd import PSDFixedRank, PSDFixedRankComplex, Elliptope, PositiveDefinite
from .oblique import Oblique
from .euclidean import Euclidean, Symmetric
from .product import Product
from .fixed_rank import FixedRankEmbedded
__all_... | Add FixedRankEmbedded to manifolds init. | Add FixedRankEmbedded to manifolds init.
Signed-off-by: Sebastian Weichwald <46f1a0bd5592a2f9244ca321b129902a06b53e03@sweichwald.de>
| Python | bsd-3-clause | j-towns/pymanopt,nkoep/pymanopt,tingelst/pymanopt,nkoep/pymanopt,pymanopt/pymanopt,nkoep/pymanopt,pymanopt/pymanopt |
c2b9bcb5c931f89dcbbf473cefe8b238e01e5429 | vpr/tests/migrate/shell_migrate.py | vpr/tests/migrate/shell_migrate.py | from django.db import connection
from vpr_content import models
def removeDuplicatedTitleInMaterial():
cur = connection.cursor()
qr0 = 'select id from vpr_content_material'
qr1 = 'select text from vpr_content_material where id=%d'
qr2 = 'update vpr_content_material set text=\'%s\' where id=%d'
pt0 ... | from django.db import connection
from vpr_content import models
def removeDuplicatedTitleInMaterial():
cur = connection.cursor()
qr0 = 'select id from vpr_content_material'
qr1 = 'select text from vpr_content_material where id=%d'
qr2 = 'update vpr_content_material set text=\'%s\' where id=%d'
pt0 ... | Add script for correcting language | Add script for correcting language
| Python | agpl-3.0 | voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo |
95c5b9c139bf69ac11338a4b2eaa9b8179d27284 | tests/test_async.py | tests/test_async.py | # -*- coding: utf-8 -*-
from asyncio import Future, gather, new_event_loop, sleep
from twisted.internet.defer import Deferred, ensureDeferred
from pyee import EventEmitter
def test_asyncio_emit():
"""Test that event_emitters can handle wrapping coroutines as used with
asyncio.
"""
loop = new_event_loo... | # -*- coding: utf-8 -*-
from asyncio import Future, gather, new_event_loop, sleep
from mock import Mock
from twisted.internet.defer import ensureDeferred
from pyee import EventEmitter
def test_asyncio_emit():
"""Test that event_emitters can handle wrapping coroutines as used with
asyncio.
"""
loop = n... | Replace my deferred with a mock | Replace my deferred with a mock
| Python | mit | jfhbrook/pyee |
7cde7a232a53138c2c199c16f55e0aecdcbf1aee | tests/test_basic.py | tests/test_basic.py | import sys
import pubrunner
import pubrunner.command_line
def test_countwords():
#pubrunner.pubrun('examples/CountWords/',True,True)
sys.argv = ['--test','examples/CountWords/']
pubrunner.command_line.main()
| import sys
import pubrunner
import pubrunner.command_line
def test_countwords():
#pubrunner.pubrun('examples/CountWords/',True,True)
sys.argv = ['pubrunner', '--test','examples/CountWords/']
pubrunner.command_line.main()
| Test wasn't using --test flag properly | Test wasn't using --test flag properly
| Python | mit | jakelever/pubrunner,jakelever/pubrunner |
711afeb0e01bc35b1f82588d814be4275f59f758 | spdx/tv_to_rdf.py | spdx/tv_to_rdf.py | #!/usr/bin/env python
# Copyright (C) 2017 BMW AG
# Author: Thomas Hafner
#
# 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/LICE... | #!/usr/bin/env python
# Copyright (C) 2017 BMW AG
# Author: Thomas Hafner
#
# 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... | Normalize license header. Update format. | Normalize license header. Update format.
Signed-off-by: Philippe Ombredanne <ca95c4a6a4931f366cbdaf5878c5016609417d37@nexb.com> | Python | apache-2.0 | spdx/tools-python |
fea76a8c9c03fef5c70e2fdd93d97cd3e096de7d | tests/test_mysql.py | tests/test_mysql.py | import unittest
from tests.common import load_check
import time
class TestMySql(unittest.TestCase):
def setUp(self):
# This should run on pre-2.7 python so no skiptest
self.skip = False
try:
import pymysql
except ImportError:
self.skip = True
def testChe... | import unittest
from tests.common import load_check
import time
class TestMySql(unittest.TestCase):
def setUp(self):
# This should run on pre-2.7 python so no skiptest
self.skip = False
try:
import pymysql
except ImportError:
self.skip = True
def testChe... | Add test for Mysql sc | Add test for Mysql sc
| Python | bsd-3-clause | brettlangdon/dd-agent,truthbk/dd-agent,jraede/dd-agent,relateiq/dd-agent,cberry777/dd-agent,tebriel/dd-agent,urosgruber/dd-agent,jraede/dd-agent,ess/dd-agent,Shopify/dd-agent,joelvanvelden/dd-agent,jyogi/purvar-agent,eeroniemi/dd-agent,citrusleaf/dd-agent,indeedops/dd-agent,eeroniemi/dd-agent,Mashape/dd-agent,Aniruddha... |
42f49d19b3657c62208aacee0f2dd77081bb5aa2 | zerver/migrations/0189_userprofile_add_some_emojisets.py | zerver/migrations/0189_userprofile_add_some_emojisets.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-08-28 19:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0188_userprofile_enable_login_emails'),
]
operations = [
migrati... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-08-28 19:01
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def change_emojiset_choice(apps: St... | Set default emoji to google-blob for existing users too. | emoji: Set default emoji to google-blob for existing users too.
This fixes an inconsistent test failure with test_users.py (that
depended on the ordering between this migration and the creation of
test database users like hamlet).
| Python | apache-2.0 | brainwane/zulip,brainwane/zulip,shubhamdhama/zulip,zulip/zulip,shubhamdhama/zulip,rht/zulip,showell/zulip,eeshangarg/zulip,punchagan/zulip,hackerkid/zulip,synicalsyntax/zulip,tommyip/zulip,showell/zulip,rishig/zulip,shubhamdhama/zulip,jackrzhang/zulip,synicalsyntax/zulip,dhcrzf/zulip,kou/zulip,andersk/zulip,dhcrzf/zuli... |
c46398091fbe591bbe79744ed4371fddcc454912 | IPython/html/terminal/handlers.py | IPython/html/terminal/handlers.py | """Tornado handlers for the terminal emulator."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
import terminado
from ..base.handlers import IPythonHandler
class TerminalHandler(IPythonHandler):
"""Render the terminal interface."""
... | """Tornado handlers for the terminal emulator."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
import terminado
from ..base.handlers import IPythonHandler
class TerminalHandler(IPythonHandler):
"""Render the terminal interface."""
... | Use relative URL for redirect in NewTerminalHandler | Use relative URL for redirect in NewTerminalHandler
| Python | bsd-3-clause | ipython/ipython,ipython/ipython |
b2bc500c6a715493c4187e5b1c62e02717d8e31c | glue/plugins/dendro_viewer/__init__.py | glue/plugins/dendro_viewer/__init__.py | def setup():
from .qt_widget import DendroWidget
from glue.config import qt_client
qt_client.add(DendroWidget)
| def setup():
from glue.config import qt_client
from .qt_widget import DendroWidget
from .data_factory import load_dendro
qt_client.add(DendroWidget)
| Add missing import of dendrogram data factory | Add missing import of dendrogram data factory
| Python | bsd-3-clause | stscieisenhamer/glue,saimn/glue,saimn/glue,stscieisenhamer/glue |
539c7a85a84fdb2fbe8ee3f5803778baf0c66841 | wmt/flask/__init__.py | wmt/flask/__init__.py | import os
from flask import Flask
from flask_login import LoginManager
from passlib.context import CryptContext
from .core import db
from .blueprints import register_blueprints
from .errors import ERROR_HANDLERS
class User(object):
def __init__(self, id):
self._id = id
def is_authenticated(self):
... | import os
from flask import Flask
from flask_login import LoginManager
from passlib.context import CryptContext
from .settings import WmtSettings
from .core import db
from .blueprints import register_blueprints
from .errors import ERROR_HANDLERS
class User(object):
def __init__(self, id):
self._id = id... | Use settings classes and set wmt_root_path. | Use settings classes and set wmt_root_path.
| Python | mit | mcflugen/wmt-rest,mcflugen/wmt-rest |
a479b445c18687827e7913e8b51abd5937848fe8 | anybox/buildbot/openerp/build_utils/analyze_oerp_tests.py | anybox/buildbot/openerp/build_utils/analyze_oerp_tests.py | """Analyse the tests log file given as argument.
Print a report and return status code 1 if failures are detected
"""
import sys
import re
FAILURE_REGEXPS = {
'Failure in Python block': re.compile(r'WARNING:tests[.].*AssertionError'),
'Errors during x/yml tests': re.compile(r'ERROR:tests[.]'),
'Errors or... | """Analyse the tests log file given as argument.
Print a report and return status code 1 if failures are detected
"""
import sys
import re
FAILURE_REGEXPS = {
'Failure in Python block': re.compile(r'WARNING:tests[.].*AssertionError'),
'Errors during x/yml tests': re.compile(r'ERROR:tests[.]'),
'Errors or... | Add regex to know if one field is use in a model where this field is not declared | Add regex to know if one field is use in a model where this field is not declared | Python | agpl-3.0 | anybox/anybox.buildbot.odoo |
24f0c0d311886571cc0c5f8badca026a6c534a52 | dask/array/__init__.py | dask/array/__init__.py | from __future__ import absolute_import, division, print_function
from ..utils import ignoring
from .core import (Array, stack, concatenate, tensordot, transpose, from_array,
choose, where, coarsen, broadcast_to, constant, fromfunction, compute,
unique, store)
from .core import (arccos, arcsin, arctan, ... | from __future__ import absolute_import, division, print_function
from ..utils import ignoring
from .core import (Array, stack, concatenate, tensordot, transpose, from_array,
choose, where, coarsen, broadcast_to, constant, fromfunction, compute,
unique, store)
from .core import (arccos, arcsin, arctan, ... | Move dask.array.creation.* into dask.array.* namespace | Move dask.array.creation.* into dask.array.* namespace
| Python | bsd-3-clause | mraspaud/dask,marianotepper/dask,minrk/dask,freeman-lab/dask,pombredanne/dask,ContinuumIO/dask,hainm/dask,ssanderson/dask,clarkfitzg/dask,jakirkham/dask,jakirkham/dask,PhE/dask,cowlicks/dask,ContinuumIO/dask,mikegraham/dask,cpcloud/dask,pombredanne/dask,hainm/dask,marianotepper/dask,simudream/dask,jcrist/dask,wiso/dask... |
36550f71f4161b0b5c7af872b78dd1e7d96b788a | scripts/patches/dynamodb.py | scripts/patches/dynamodb.py | patches = [
# duplicate GlobalSecondaryIndex
{
"op": "move",
"from": "/PropertyTypes/AWS::DynamoDB::GlobalTable.GlobalSecondaryIndex",
"path": "/PropertyTypes/AWS::DynamoDB::GlobalTable.GlobalTableGlobalSecondaryIndex",
},
{
"op": "replace",
"path": "/ResourceType... | patches = [
# duplicate GlobalSecondaryIndex
{
"op": "move",
"from": "/PropertyTypes/AWS::DynamoDB::GlobalTable.GlobalSecondaryIndex",
"path": "/PropertyTypes/AWS::DynamoDB::GlobalTable.GlobalTableGlobalSecondaryIndex",
},
{
"op": "replace",
"path": "/ResourceType... | Fix issue in spec 82.0.0 with DynamoDB KeySchema Type | Fix issue in spec 82.0.0 with DynamoDB KeySchema Type
| Python | bsd-2-clause | cloudtools/troposphere,cloudtools/troposphere |
8785f602900ab3bf3e297ee8f90ecf47c059cdde | sphinxcontrib/openstreetmap.py | sphinxcontrib/openstreetmap.py | # -*- coding: utf-8 -*-
"""
sphinxcontrib.openstreetmap
===========================
Embed OpenStreetMap on your documentation.
:copyright: Copyright 2015 HAYASHI Kentaro <kenhys@gmail.com>
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from docutils.parsers.rst import directives
from sphi... | # -*- coding: utf-8 -*-
"""
sphinxcontrib.openstreetmap
===========================
Embed OpenStreetMap on your documentation.
:copyright: Copyright 2015 HAYASHI Kentaro <kenhys@gmail.com>
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from docutils.parsers.rst import directives
from sphi... | Add marker as required parameter | Add marker as required parameter
| Python | bsd-2-clause | kenhys/sphinxcontrib-openstreetmap,kenhys/sphinxcontrib-openstreetmap |
2ba3dd9bafddd4dfd1ab712c59c6efadd58b1f46 | skimage/feature/__init__.py | skimage/feature/__init__.py | from ._daisy import daisy
from ._hog import hog
from .texture import greycomatrix, greycoprops, local_binary_pattern
from .peak import peak_local_max
from .corner import (corner_kitchen_rosenfeld, corner_harris, corner_shi_tomasi,
corner_foerstner, corner_subpix, corner_peaks)
from .corner_cy impor... | from ._daisy import daisy
from ._hog import hog
from .texture import greycomatrix, greycoprops, local_binary_pattern
from .peak import peak_local_max
from .corner import (corner_kitchen_rosenfeld, corner_harris, corner_shi_tomasi,
corner_foerstner, corner_subpix, corner_peaks)
from .corner_cy impor... | Add __all__ to feature package | Add __all__ to feature package
| Python | bsd-3-clause | WarrenWeckesser/scikits-image,michaelpacer/scikit-image,chintak/scikit-image,Midafi/scikit-image,bsipocz/scikit-image,almarklein/scikit-image,paalge/scikit-image,vighneshbirodkar/scikit-image,GaZ3ll3/scikit-image,ofgulban/scikit-image,GaZ3ll3/scikit-image,jwiggins/scikit-image,ClinicalGraphics/scikit-image,SamHames/sci... |
5c89aa079d94fe70bb5627eb67404bc65b80212a | sympy/solvers/decompogen.py | sympy/solvers/decompogen.py | from sympy.core import Function, Pow, sympify
from sympy.polys import Poly
def decompogen(f, symbol):
"""
Computes General functional decomposition of ``f``.
Given an expression ``f``, returns a list ``[f_1, f_2, ..., f_n]``,
where::
f = f_1 o f_2 o ... f_n = f_1(f_2(... f_n))
Note:... | from sympy.core import Function, Pow, sympify
from sympy.polys import Poly
def decompogen(f, symbol):
"""
Computes General functional decomposition of ``f``.
Given an expression ``f``, returns a list ``[f_1, f_2, ..., f_n]``,
where::
f = f_1 o f_2 o ... f_n = f_1(f_2(... f_n))
Note:... | Return `f` if no decomposition | Return `f` if no decomposition
Signed-off-by: AMiT Kumar <a9f82ad3e8c446d8f49d5b7e05ec2c64a9e15ea9@gmail.com>
| Python | bsd-3-clause | drufat/sympy,ChristinaZografou/sympy,chaffra/sympy,Vishluck/sympy,skidzo/sympy,ga7g08/sympy,wanglongqi/sympy,mafiya69/sympy,ga7g08/sympy,Davidjohnwilson/sympy,yashsharan/sympy,mcdaniel67/sympy,hargup/sympy,postvakje/sympy,Davidjohnwilson/sympy,VaibhavAgarwalVA/sympy,kaushik94/sympy,ChristinaZografou/sympy,MechCoder/sym... |
6d3b191bd35f64b097ffac2a514d2400f2e07983 | tests/__main__.py | tests/__main__.py | #!/usr/bin/env python3
import os
import sys
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
load = unittest.defaultTestLoader.loadTestsFromModule
suites = []
dirname = os.path.dirname(__file__)
sys.path.append(dirname)
filenames = os.listdir(dirname)
for filename in filenames:
... | #!/usr/bin/env python3
import os
import sys
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
load = unittest.defaultTestLoader.loadTestsFromModule
suites = []
dirname = os.path.dirname(__file__)
sys.path.append(dirname)
filenames = os.listdir(dirname)
for filename in filenames:
... | Fix return value of tests. | Fix return value of tests.
| Python | bsd-3-clause | ProgVal/Inceptoe,ProgVal/Inceptoe |
9fdd24ed20c553638cde7c67f994ea72da0ef149 | tests/conftest.py | tests/conftest.py | import shutil
from pathlib import Path
import pytest
from pandas_profiling.utils.cache import cache_file
@pytest.fixture(scope="function")
def get_data_file(tmpdir):
def getter(file_name, url):
source_file = cache_file(file_name, url)
# Move to temporary directory
test_path = Path(str(tm... | import shutil
from pathlib import Path
import pytest
from pandas_profiling.utils.cache import cache_file
@pytest.fixture(scope="function")
def get_data_file(tmpdir):
def getter(file_name, url):
source_file = cache_file(file_name, url)
# Move to temporary directory
test_path = Path(str(tm... | Convert Path to str for Python 3.5 | Convert Path to str for Python 3.5
| Python | mit | JosPolfliet/pandas-profiling,JosPolfliet/pandas-profiling |
09fc5b3e37cc0bcaf764c540f32d1a3eab1b8cf2 | tests/som_test.py | tests/som_test.py | import unittest
from parameterized import parameterized
from som.vm.universe import Universe
class SomTest(unittest.TestCase):
@parameterized.expand([
("ClassStructure",),
("Array" ,),
("Block" ,),
("ClassLoading" ,),
("Closure" ,),
("Coercio... | import unittest
from parameterized import parameterized
from som.vm.universe import Universe
class SomTest(unittest.TestCase):
@parameterized.expand([
("ClassStructure",),
("Array" ,),
("Block" ,),
("ClassLoading" ,),
("Closure" ,),
("Coercio... | Use in, because has_key seems to be deprecated | Use in, because has_key seems to be deprecated
Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>
| Python | mit | SOM-st/RTruffleSOM,SOM-st/PySOM,SOM-st/RPySOM,SOM-st/RPySOM,SOM-st/RTruffleSOM,smarr/RTruffleSOM,smarr/PySOM,smarr/RTruffleSOM,smarr/PySOM,SOM-st/PySOM |
e9e8428563545d00eda25a540a3621943bf34143 | tests/test_now.py | tests/test_now.py | # -*- coding: utf-8 -*-
import pytest
from freezegun import freeze_time
from jinja2 import Environment, exceptions
@pytest.fixture(scope='session')
def environment():
return Environment(extensions=['jinja2_time.TimeExtension'])
@pytest.yield_fixture(autouse=True)
def freeze():
freezer = freeze_time("2015-... | # -*- coding: utf-8 -*-
import pytest
from freezegun import freeze_time
from jinja2 import Environment, exceptions
@pytest.fixture
def environment():
return Environment(extensions=['jinja2_time.TimeExtension'])
@pytest.yield_fixture(autouse=True)
def freeze():
freezer = freeze_time("2015-12-09 23:33:01")
... | Implement a test for environment.datetime_format | Implement a test for environment.datetime_format
| Python | mit | hackebrot/jinja2-time |
0147e9a6c9d61028781b55f4f8e068e576b653a0 | manage.py | manage.py | import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from api import create_app, db
application = create_app(os.getenv('FLASK_CONFIG') or 'default')
migrate = Migrate(application, db)
manager = Manager(application)
manager.add_command('db', MigrateCommand)
@manager.command... | import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from api import create_app, db
application = create_app(os.getenv('FLASK_CONFIG') or 'default')
migrate = Migrate(application, db)
manager = Manager(application)
manager.add_command('db', MigrateCommand)
@manager.command... | Add create and drop db tasks | Add create and drop db tasks
| Python | mit | EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list |
b964c71509d1c562d4080a39bf5fc7333da39608 | fedora/__init__.py | fedora/__init__.py | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | Rearrange imports of gettext and release because of dependencies in circular import. | Rearrange imports of gettext and release because of dependencies in
circular import.
| Python | lgpl-2.1 | fedora-infra/python-fedora |
f3735ed56bff6425eb87f492707b7a8a5ef3119a | touch/__init__.py | touch/__init__.py | from pelican import signals
import logging
import os
import time
logger = logging.getLogger(__name__)
def touch_file(path, context):
content = context.get('article', context.get('page'))
if content and hasattr(content, 'date'):
mtime = time.mktime(content.date.timetuple())
logger.info('touc... | from pelican import signals
import logging
import os
import time
logger = logging.getLogger(__name__)
def set_file_utime(path, datetime):
mtime = time.mktime(datetime.timetuple())
logger.info('touching %s', path)
os.utime(path, (mtime, mtime))
def touch_file(path, context):
content = context.get(... | Make touch plugin touch files with lists | Make touch plugin touch files with lists
| Python | agpl-3.0 | xsteadfastx/pelican-plugins,doctorwidget/pelican-plugins,lazycoder-ru/pelican-plugins,Neurita/pelican-plugins,lele1122/pelican-plugins,mitchins/pelican-plugins,jantman/pelican-plugins,samueljohn/pelican-plugins,MarkusH/pelican-plugins,jakevdp/pelican-plugins,florianjacob/pelican-plugins,danmackinlay/pelican-plugins,dan... |
f4d5bafcf99d2117fe589d8c31f8aff8ed3467a5 | RefreshScripts.py | RefreshScripts.py | #from CreateTableFromDatabase import getRankingsFromDatabase
import time
from CheckAndPostForSeriesSubmissions import checkNewSubmissions
# Refreshes all other scripts every couple of minutes
def refreshScripts():
while True:
checkNewSubmissions()
timeToSleep = 900
print("Sleeping for " + ... | ### exclam /usr/bin/env python3
#from CreateTableFromDatabase import getRankingsFromDatabase
import time
from CheckAndPostForSeriesSubmissions import checkNewSubmissions
# Refreshes all other scripts every couple of minutes
def refreshScripts():
while True:
try:
checkNewSubmissions()
... | Refresh script now displays error message | Refresh script now displays error message
| Python | mit | LiquidFun/Reddit-GeoGuessr-Tracking-Bot |
e881465050ef9edbf2b47071b1fa2fc27ac26c1a | tests/Settings/TestExtruderStack.py | tests/Settings/TestExtruderStack.py | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import pytest #This module contains automated tests.
import unittest.mock #For the mocking and monkeypatching functionality.
import cura.Settings.ExtruderStack #The module we're testing.
from cura.Settings.Exceptions impor... | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import pytest #This module contains automated tests.
import unittest.mock #For the mocking and monkeypatching functionality.
import cura.Settings.ExtruderStack #The module we're testing.
from cura.Settings.Exceptions impor... | Add delimiter between global stuff and test cases | Add delimiter between global stuff and test cases
Helps provide some oversight since this module is about to explode in size.
Contributes to issue CURA-3497.
| Python | agpl-3.0 | hmflash/Cura,ynotstartups/Wanhao,Curahelper/Cura,ynotstartups/Wanhao,hmflash/Cura,fieldOfView/Cura,fieldOfView/Cura,Curahelper/Cura |
1d1348eb2126a0a8ee1a18b37a5254b59c3a4c76 | examples/ensemble/plot_forest_importances_faces.py | examples/ensemble/plot_forest_importances_faces.py | """
=======================================
Pixel importances with forests of trees
=======================================
This example shows the use of forests of trees to evaluate the importance
of the pixels in an image classification task (faces). The hotter the pixel,
the more important.
"""
print __doc__
impor... | """
=======================================
Pixel importances with forests of trees
=======================================
This example shows the use of forests of trees to evaluate the importance
of the pixels in an image classification task (faces). The hotter the pixel,
the more important.
"""
print __doc__
from ... | Update random forest face example to use several cores | Update random forest face example to use several cores
| Python | bsd-3-clause | scikit-learn/scikit-learn,madjelan/scikit-learn,xubenben/scikit-learn,Vimos/scikit-learn,nrhine1/scikit-learn,zhenv5/scikit-learn,liberatorqjw/scikit-learn,ndingwall/scikit-learn,beepee14/scikit-learn,shyamalschandra/scikit-learn,walterreade/scikit-learn,dhruv13J/scikit-learn,Adai0808/scikit-learn,Nyker510/scikit-learn... |
29d6010c18605179860afe08f5cac218e1a65716 | dbaas/workflow/steps/util/resize/check_database_status.py | dbaas/workflow/steps/util/resize/check_database_status.py | # -*- coding: utf-8 -*-
import logging
from ...util.base import BaseStep
LOG = logging.getLogger(__name__)
class CheckDatabaseStatus(BaseStep):
def __unicode__(self):
return "Checking database status..."
def do(self, workflow_dict):
try:
if not 'database' in workflow_dict:
... | # -*- coding: utf-8 -*-
import logging
from ...util.base import BaseStep
LOG = logging.getLogger(__name__)
class CheckDatabaseStatus(BaseStep):
def __unicode__(self):
return "Checking database status..."
def do(self, workflow_dict):
try:
if not 'database' in workflow_dict:
... | Change check_db connection resize step to wait database start process | Change check_db connection resize step to wait database start process
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service |
08167d79efb97a0728564caf96a96b08763ddf60 | bibliopixel/util/importer.py | bibliopixel/util/importer.py | import importlib
def import_symbol(typename):
"""Import a module or typename within a module from its name."""
try:
return importlib.import_module(typename)
except ImportError as e:
parts = typename.split('.')
if len(parts) > 1:
typename = parts.pop()
# Ca... | import importlib
def import_symbol(typename, package=None):
"""Import a module or typename within a module from its name."""
try:
return importlib.import_module(typename, package=package)
except ImportError as e:
parts = typename.split('.')
if len(parts) > 1:
typename ... | Add a package argument to import_symbol. | Add a package argument to import_symbol.
| Python | mit | ManiacalLabs/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel |
a5a92b81244076e8cf04c06398ce63a87d1357dd | adhocracy/tests/test_doctest_files.py | adhocracy/tests/test_doctest_files.py | from glob import glob
import doctest
from doctest import DocFileSuite
from os.path import dirname
import unittest
from adhocracy.tests.testbrowser import ADHOCRACY_LAYER, ADHOCRACY_LAYER_APP
from adhocracy.tests.testbrowser import app_url, instance_url
from adhocracy.tests.testbrowser import Browser
def find_use_cas... | from glob import glob
import doctest
from doctest import DocFileSuite
from os.path import dirname
import unittest
from adhocracy import model
from adhocracy.tests import testtools
from adhocracy.tests.testbrowser import ADHOCRACY_LAYER, ADHOCRACY_LAYER_APP
from adhocracy.tests.testbrowser import app_url, instance_url
... | Add the modules models and testtools to the doctest globals | Add the modules models and testtools to the doctest globals
| Python | agpl-3.0 | SysTheron/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,alkadis/vcv,alkadis/vcv,SysTheron/adhocracy,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocracy,phihag/adhocracy,liqd/adhocracy,phihag/adhocracy,SysTheron/adhocracy,liqd/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,alk... |
1ed6c3f6d79aca5d647e8ff8332096c4fc111548 | neuroimaging/utils/tests/test_utils.py | neuroimaging/utils/tests/test_utils.py | from numpy.testing import NumpyTest, NumpyTestCase
class test_Template(NumpyTestCase):
def setUp(self): pass
#print "TestCase initialization..."
def test_foo(self): pass
#print "testing foo"
def test_bar(self): pass
#print "testing bar"
if __name__ == '__main__':
Nump... | from numpy.testing import NumpyTest, NumpyTestCase
class test_Template(NumpyTestCase):
def setUp(self):
pass
#print "TestCase initialization..."
def test_foo(self):
self.fail('neuroimaging.utils, odict, path, etc... have _NO_ tests!')
if __name__ == '__main__':
NumpyTest().run()
| Fix test example so it runs. | BUG: Fix test example so it runs. | Python | bsd-3-clause | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD |
3a2b536f24eee711a1329daf7403bd92840a87e3 | gpxpandas/gpxreader.py | gpxpandas/gpxreader.py | __author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_segment(segment):
seg_dict = {}
for point in segment.points:
seg_dict[point.time] = [point.latitude, point.longitude,
poi... | __author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_segment(segment):
seg_dict = {}
for point in segment.points:
seg_dict[point.time] = [point.latitude, point.longitude,
poi... | Use gpx.name as index to gpx data_frame | Use gpx.name as index to gpx data_frame
| Python | mit | komax/gpx-pandas |
f2f422702985c3e890fa19a7f841baba837c5bba | main.py | main.py | from listing import Listing, session
from scraper import Scraper
from slack import Slack
import sys
import traceback
import time
slack = Slack()
def scrape():
results = 0
duplicates = 0
for result in Scraper().results():
results += 1
listing = Listing(result).process()
if listi... | from listing import Listing, session
from scraper import Scraper
from slack import Slack
from random import randint
import sys
import traceback
import time
slack = Slack()
def scrape():
results = 0
duplicates = 0
for result in Scraper().results():
results += 1
listing = Listing(result).... | Increase and fuzz sleep time | Increase and fuzz sleep time
| Python | mit | vboginskey/cribfinder |
56b4532bd330ad4075f882511c87cb97eaeff10e | jujupy/__init__.py | jujupy/__init__.py | from jujupy.client import *
from jujupy.client import _temp_env
__all__ = ['_temp_env']
| from jujupy.client import (
AgentsNotStarted,
AuthNotAccepted,
AGENTS_READY,
client_from_config,
ConditionList,
coalesce_agent_status,
describe_substrate,
EnvJujuClient,
EnvJujuClient1X,
EnvJujuClient25,
ensure_dir,
get_cache_path,
get_client_class,
get_local_root... | Switch to explicit imports for jujupy. | Switch to explicit imports for jujupy. | Python | agpl-3.0 | mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju |
55f0ab3ba544344bda4c95b014193dffe9db70cd | examples/99bottles.py | examples/99bottles.py | #!/usr/bin/env python
# XXX: Broken - Does O_NONBLOCK work at all?
"""An implementation of the Python Concurrency Problem of 99 Bottles of Beer
See: http://wiki.python.org/moin/Concurrency/99Bottles
"""
import sys
from circuits.io import File
from circuits import Component
from circuits.net.protocols import LP
c... | #!/usr/bin/env python
# XXX: Broken - Does O_NONBLOCK work at all?
"""An implementation of the Python Concurrency Problem of 99 Bottles of Beer
See: http://wiki.python.org/moin/Concurrency/99Bottles
"""
import sys
from circuits.io import File
from circuits import Component
from circuits.net.protocols import LP
c... | Use explicit API(s) for examples | Use explicit API(s) for examples
| Python | mit | nizox/circuits,eriol/circuits,treemo/circuits,treemo/circuits,treemo/circuits,eriol/circuits,eriol/circuits |
3f394b37174d97b53fdef8ce662e258c6b2aa337 | src/appleseed.python/studio/__init__.py | src/appleseed.python/studio/__init__.py |
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2017 Gleb Mishchenko, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy... |
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2017 Gleb Mishchenko, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy... | Add PySide to as.studio init preferred binding | Add PySide to as.studio init preferred binding
| Python | mit | luisbarrancos/appleseed,est77/appleseed,appleseedhq/appleseed,pjessesco/appleseed,gospodnetic/appleseed,Vertexwahn/appleseed,appleseedhq/appleseed,dictoon/appleseed,Aakash1312/appleseed,Biart95/appleseed,Vertexwahn/appleseed,dictoon/appleseed,Biart95/appleseed,aytekaman/appleseed,pjessesco/appleseed,aytekaman/appleseed... |
4f9e602bfbf145adfc93270d915325b59c710a46 | conman/routes/migrations/0001_initial.py | conman/routes/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
name='Route',
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
name='Route',
... | Update new migration to match existing docstring | Update new migration to match existing docstring
| Python | bsd-2-clause | Ian-Foote/django-conman,meshy/django-conman,meshy/django-conman |
2ac7b22e592557ea8be70311e641b1f42f6c7128 | tests/settings.py | tests/settings.py | import dj_database_url
DATABASES = {
'default': dj_database_url.config(
default='postgres://localhost/test_utils',
),
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
)
MIDDLEWARE_CLASSES = ()
SECRET_KEY = 'test'
| import dj_database_url
DATABASES = {
'default': dj_database_url.config(
default='postgres://localhost/test_utils',
),
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
)
MIDDLEWARE_CLASSES = ()
PASSWORD_HASHERS = ['django.contrib.auth.has... | Use md5 password hasher for tests | Use md5 password hasher for tests
| Python | bsd-2-clause | incuna/incuna-test-utils,incuna/incuna-test-utils |
d9d2c7d341894e28a5ad73469ec0d9d23d78429e | vispy/visuals/graphs/layouts/__init__.py | vispy/visuals/graphs/layouts/__init__.py | from .random import random # noqa
from .circular import circular # noqa
| import inspect
from .random import random
from .circular import circular
from .force_directed import fruchterman_reingold
_layout_map = {
'random': random,
'circular': circular,
'force_directed': fruchterman_reingold
}
def get(name, *args, **kwargs):
if name not in _layout_map:
raise KeyErr... | Add new way of retreiving graph layouts | Add new way of retreiving graph layouts
| Python | bsd-3-clause | ghisvail/vispy,michaelaye/vispy,Eric89GXL/vispy,michaelaye/vispy,Eric89GXL/vispy,Eric89GXL/vispy,drufat/vispy,drufat/vispy,ghisvail/vispy,michaelaye/vispy,drufat/vispy,ghisvail/vispy |
739ae88d817cb86723b126360aaf3dd6df3045c0 | tests/test_log.py | tests/test_log.py | import json
import logging
from unittest.mock import Mock, patch
from jsonrpcclient.log import _trim_string, _trim_values
def test_trim_string():
message = _trim_string("foo" * 100)
assert "..." in message
def test_trim_values():
message = _trim_values({"list": [0] * 100})
assert "..." in message["... | import json
import logging
from unittest.mock import Mock, patch
from jsonrpcclient.log import _trim_string, _trim_values, _trim_message
def test_trim_string():
message = _trim_string("foo" * 100)
assert "..." in message
def test_trim_values():
message = _trim_values({"list": [0] * 100})
assert "..... | Add coverage to some of log.py | Add coverage to some of log.py
| Python | mit | bcb/jsonrpcclient |
1927c503fda892490fb7262ba480e429a0f416fb | intermol/orderedset.py | intermol/orderedset.py | import collections
from copy import deepcopy
class OrderedSet(collections.Set):
def __init__(self, iterable=()):
self.d = collections.OrderedDict.fromkeys(iterable)
def add(self, key):
self.d[key] = None
def discard(self, key):
del self.d[key]
def difference_update(self, *a... | from collections.abc import Set
from collections import OrderedDict
from copy import deepcopy
class OrderedSet(Set):
def __init__(self, iterable=()):
self.d = OrderedDict.fromkeys(iterable)
def add(self, key):
self.d[key] = None
def discard(self, key):
del self.d[key]
def d... | Update collections imports for deprecations | Update collections imports for deprecations
| Python | mit | shirtsgroup/InterMol,shirtsgroup/InterMol |
3bd409a0c7f252811c7e8488493270d225e8616a | src/main/python/piglatin.py | src/main/python/piglatin.py | import sys
def parseCommandLine(argv):
return argv[1] if len(argv) > 1 else ""
if __name__ == "__main__":
latin = parseCommandLine(sys.argv)
print(latin)
print("igpay atinlay")
| import sys
def parseCommandLine(argv):
print 'Inside parser'
return argv[1] if len(argv) > 1 else ""
if __name__ == "__main__":
latin = parseCommandLine(sys.argv)
print(latin)
print("igpay atinlay")
| Test case: failing print for python3 | Test case: failing print for python3
| Python | mit | oneyoke/sw_asgmt_2 |
a09edcdf11c0d6c6b43cbff5029ac8cfb5741170 | application.py | application.py | #!/usr/bin/env python
import os
from app import create_app, db
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
application = create_app(os.getenv('FLASH_CONFIG') or 'development')
manager = Manager(application)
migrate = Migrate(application, db)
manager.add_command('db', Mig... | #!/usr/bin/env python
import os
from app import create_app, db
from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
application = create_app(os.getenv('FLASH_CONFIG') or 'development')
manager = Manager(application)
manager.add_command("runserver", Server(port=5000))
migr... | Update to run on port 5000 | Update to run on port 5000
For development we will want to run multiple apps, so they should each bind to a different port number.
The default port is 5000 anyway, but we should state the port explicitly in the code which is why I've added it here.
| Python | mit | mtekel/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,alphagov/digitalmarketplace-api,mtekel/digitalmarketplace-api,mtekel/digitalmarketplace-api,mtekel/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,alphagov/digitalmarketplace-... |
d2f1b9311b546c079490e5f0bdb45b9c9d570bb1 | system/test_coupling_fields.py | system/test_coupling_fields.py |
from __future__ import print_function
import os
import netCDF4 as nc
from model_test_helper import ModelTestHelper
class TestCouplingFields(ModelTestHelper):
def __init__(self):
super(TestCouplingFields, self).__init__()
def test_swflx(self):
"""
Compare short wave flux over a geog... |
from __future__ import print_function
import os
import netCDF4 as nc
from model_test_helper import ModelTestHelper
class TestCouplingFields(ModelTestHelper):
def __init__(self):
super(TestCouplingFields, self).__init__()
def test_swflx(self):
"""
Compare short wave flux over a geog... | Fix up paths in system test. | Fix up paths in system test.
| Python | apache-2.0 | CWSL/access-om |
655c3ca55a5b3bb1f03d524219c3d038c2d02ed5 | st2client/st2client/models/datastore.py | st2client/st2client/models/datastore.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... | Update KeyValuePair model so delete and other operations which require "id" attribute to be present still work. | Update KeyValuePair model so delete and other operations which require "id"
attribute to be present still work.
| Python | apache-2.0 | tonybaloney/st2,alfasin/st2,nzlosh/st2,tonybaloney/st2,pixelrebel/st2,Plexxi/st2,punalpatel/st2,StackStorm/st2,Itxaka/st2,nzlosh/st2,pinterb/st2,StackStorm/st2,emedvedev/st2,alfasin/st2,jtopjian/st2,peak6/st2,peak6/st2,emedvedev/st2,tonybaloney/st2,Itxaka/st2,lakshmi-kannan/st2,Plexxi/st2,grengojbo/st2,dennybaa/st2,nzl... |
3bee320f66d192e2e40b6b91a53c3ccd64c09443 | test/MSVC/query_vcbat.py | test/MSVC/query_vcbat.py | import sys
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
if sys.platform != 'win32':
msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
#####
# Test the basics
test.write('SConstruct',"""
import os
env = Environment(tools = ['MSVCC... | import sys
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
if sys.platform != 'win32':
msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
#####
# Test the basics
test.write('SConstruct',"""
from SCons.Tool.MSVCCommon import FindMSVSB... | Update our fake test for debugging purpose. | Update our fake test for debugging purpose.
| Python | mit | azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons |
165d76e68492070060a7045e08a7bec09a226093 | api/base/exceptions.py | api/base/exceptions.py |
from rest_framework import status
from rest_framework.exceptions import APIException
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
from rest_framework.views import exception_handler
response = exception_handler(exc, context)
# ... |
from rest_framework import status
from rest_framework.exceptions import APIException
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
# Import inside method to avoid errors when the OSF is loaded without Django
from rest_framework.view... | Add comment to explain import inside method | Add comment to explain import inside method
| Python | apache-2.0 | arpitar/osf.io,mluke93/osf.io,icereval/osf.io,DanielSBrown/osf.io,MerlinZhang/osf.io,pattisdr/osf.io,cslzchen/osf.io,ckc6cz/osf.io,ckc6cz/osf.io,sbt9uc/osf.io,RomanZWang/osf.io,sloria/osf.io,jnayak1/osf.io,petermalcolm/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,alexschiller/osf.io,Ghalko/osf.io,alexschiller/osf... |
2a925111aa0cd114b30e94c6a8d7d96d46f6d3d8 | appengine_config.py | appengine_config.py | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Custom A... | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Custom A... | Enable the Appstats Interactive Playground. | Enable the Appstats Interactive Playground.
| Python | apache-2.0 | riannucci/rietveldv2,riannucci/rietveldv2 |
df2fe66f64f79127374d2f183cb76966f77761ee | signac/common/errors.py | signac/common/errors.py | # Copyright (c) 2016 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the MIT License.
class Error(Exception):
pass
class ConfigError(Error, RuntimeError):
pass
class AuthenticationError(Error, RuntimeError):
pass
| # Copyright (c) 2016 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the MIT License.
class Error(Exception):
pass
class ConfigError(Error, RuntimeError):
pass
class AuthenticationError(Error, RuntimeError):
def __str__(self):
if len(self.arg... | Improve error message for authentication issues. | Improve error message for authentication issues.
| Python | bsd-3-clause | csadorf/signac,csadorf/signac |
b1adfacff3b7c319ae148e79807d371ded934a5c | tx_salaries/management/commands/generate_transformer_hash.py | tx_salaries/management/commands/generate_transformer_hash.py | from django.core.management.base import BaseCommand
from ...utils import transformer
class Command(BaseCommand):
def handle(self, filename, *args, **kwargs):
reader = transformer.convert_to_csv_reader(filename)
labels = reader.next()
print transformer.generate_key(labels)
| from django.core.management.base import BaseCommand
from ...utils import transformer
class Command(BaseCommand):
def handle(self, filename, *args, **kwargs):
reader = transformer.convert_to_csv_reader(filename)
labels = reader.next()
transformer_key = transformer.generate_key(labels)
... | Add message if transformer_hash already exists | Add message if transformer_hash already exists
| Python | apache-2.0 | texastribune/tx_salaries,texastribune/tx_salaries |
e4b47c9bc3de18c83a2fb718c806b7668b492de6 | authentication/urls.py | authentication/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/$', 'login', {'template_name': 'authentication/login.html'}),
url(r'^logout/$', 'logout_then_login')) | from django.conf.urls import patterns, include, url
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/$', 'login', {'template_name': 'authentication/login.html'}),
url(r'^logout/$', 'logout_then_login',name='logout')) | Add name to logout url regex | Add name to logout url regex
| Python | mit | DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune |
caa2b1e9303d2ba67a0491942d2459006ea8efe3 | bucky/__init__.py | bucky/__init__.py | from flask import Flask
from flask_login import LoginManager
from config import config
database = {}
login_manager = LoginManager()
def create_app(config_name):
app = Flask(__name__)
app.database = database
app.config.from_object(config[config_name])
login_manager.init_app(app)
@logi... | from flask import Flask
from flask_login import LoginManager
from config import config
database = {}
current_user = {}
login_manager = LoginManager()
def create_app(config_name):
app = Flask(__name__)
app.database = database
app.current_user = current_user
app.config.from_object(config[con... | Add current_user to app properties | Add current_user to app properties
| Python | mit | JoshuaOndieki/buckylist,JoshuaOndieki/buckylist |
b9b194b9eb9a9ddefa9549a522fc67c181acbc4a | tests/test_importlazy.py | tests/test_importlazy.py | """
To run this test:
1. cd importlazy/tests
2. python -m unittest test_importlazy.py
"""
import unittest
import sys
class ImportLazyTest(unittest.TestCase):
def test1_initial_state(self):
"""Initially, the module must not exist in the imported modules.
The package or module should not be import... | """
To run this test:
1. cd importlazy/tests
2. python -m unittest test_importlazy.py
"""
import unittest
import sys
class ImportLazyTest(unittest.TestCase):
def test1_initial_state(self):
"""Initially, the module must not exist in the imported modules.
The package or module should not be import... | Check the instance against the original class declaration. | Check the instance against the original class declaration.
| Python | mit | ldiary/importlazy |
0f16fe34654560f8889ad1f5b199cb8bfa2b3846 | tests/web/test_status.py | tests/web/test_status.py | """
Test Status Endpoint
GET /status
HEAD /status
"""
from biothings.tests.web import BiothingsTestCase
from setup import setup_es # pylint: disable=unused-import
class TestStatus(BiothingsTestCase):
def test_01_get(self):
res = self.request('/status').text
assert res == 'OK'
... | """
Test Status Endpoint
GET /status
HEAD /status
"""
from biothings.tests.web import BiothingsTestCase
from setup import setup_es # pylint: disable=unused-import
class TestStatus(BiothingsTestCase):
def test_01_get(self):
"""
{
"code": 200,
"status": "yel... | Update test case for status handler accordingly | Update test case for status handler accordingly
| Python | apache-2.0 | biothings/biothings.api,biothings/biothings.api |
69d88adcedaf3779e5bf5a5757a21c71d4aa3016 | novajoin/errors.py | novajoin/errors.py | # Copyright 2016 Red Hat, 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 agre... | # Copyright 2016 Red Hat, 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 agre... | Use Exception instead of StandardError | Use Exception instead of StandardError
StandardError was deprecated in python 3.X.
| Python | apache-2.0 | rcritten/novajoin |
6caa1c3962ecc7ab57dea83a5c7beef4f3c1220e | pmxbot/__init__.py | pmxbot/__init__.py | # -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
from __future__ import absolute_import
import socket
import logging
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'localhost',
server_port = 6667,
use_ssl = False,
password = No... | # -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
from __future__ import absolute_import
import socket
import logging as _logging
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'localhost',
server_port = 6667,
use_ssl = False,
p... | Fix issue with conflated pmxbot.logging | Fix issue with conflated pmxbot.logging
| Python | bsd-3-clause | jamwt/diesel-pmxbot,jamwt/diesel-pmxbot |
0928060f4390f221d68518a9ec7b8b43b82423b2 | iatidq/dqfunctions.py | iatidq/dqfunctions.py |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Adjust for new IATI Updates API; don't have to page through results | Adjust for new IATI Updates API; don't have to page through results
| Python | agpl-3.0 | pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality |
df45251622e6b935b27022e36fcbd79e9228f989 | bonobo/commands/init.py | bonobo/commands/init.py | import os
def execute(name, branch, overwrite_if_exists=False):
try:
from cookiecutter.main import cookiecutter
except ImportError as exc:
raise ImportError(
'You must install "cookiecutter" to use this command.\n\n $ pip install cookiecutter\n'
) from exc
if os.listdir... | import os
def execute(name, branch):
try:
from cookiecutter.main import cookiecutter
except ImportError as exc:
raise ImportError(
'You must install "cookiecutter" to use this command.\n\n $ pip install cookiecutter\n'
) from exc
overwrite_if_exists = False
project_... | Check if target directory is empty instead of current directory and remove overwrite_if_exists argument | Check if target directory is empty instead of current directory and remove overwrite_if_exists argument
| Python | apache-2.0 | hartym/bonobo,python-bonobo/bonobo,hartym/bonobo,hartym/bonobo,python-bonobo/bonobo,python-bonobo/bonobo |
c4bf617dddd15e77974b000e8fa90750e1761386 | siteconfig/__init__.py | siteconfig/__init__.py | from .configobj import Config
config = Config.from_environ()
# Add the data and some of the API as attributes of the top-level package.
globals().update(config)
get = config.get
| from .configobj import Config
config = Config.from_environ()
# Add the data and some of the API as attributes of the top-level package.
globals().update(config)
get = config.get
get_bool = config.get_bool
| Add get_bool to package exports | Add get_bool to package exports
| Python | bsd-3-clause | mikeboers/siteconfig,mikeboers/siteconfig |
4c71ba23720001d06d519a7828f2866814f1c46a | tests/conftest.py | tests/conftest.py | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import pytest
from UM.Application import Application
class FixtureApplication(Application):
def __init__(self):
Application._instance = None
super().__init__("test", "1.0")
def functionEvent(se... | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import pytest
from UM.Application import Application
from UM.Signal import Signal
class FixtureApplication(Application):
def __init__(self):
Application._instance = None
super().__init__("test", "1.... | Make sure to set the test application instance as app for Signals | Make sure to set the test application instance as app for Signals
This makes singals be properly emitted in tests
| Python | agpl-3.0 | onitake/Uranium,onitake/Uranium |
14917a4d503569147277bfd5fefa4b2600dfea40 | tests/conftest.py | tests/conftest.py | import pytest
@pytest.fixture(autouse=True)
def tagschecker(request):
tags = set(request.config.getini('TAGS'))
tags_marker = request.node.get_marker('tags')
xfailtags_marker = request.node.get_marker('xfailtags')
skiptags_marker = request.node.get_marker('skiptags')
if tags_marker and tags.isdi... | import pytest
@pytest.fixture(autouse=True)
def tagschecker(request):
tags = set(request.config.getini('TAGS'))
tags_marker = request.node.get_marker('tags')
xfailtags_marker = request.node.get_marker('xfailtags')
skiptags_marker = request.node.get_marker('skiptags')
if xfailtags_marker and not ... | Set xfailtags as first priority | Set xfailtags as first priority
| Python | mit | dincamihai/salt-toaster,dincamihai/salt-toaster |
eacfca844e5ab590acfcd193e2ca1fa379e10009 | alg_strongly_connected_components.py | alg_strongly_connected_components.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def strongly_connected_components():
"""Strongly connected components for graph.
Procedure:
- Call (Depth First Search) DFS on graph G to
compute finish times for each vertex.
- C... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def _previsit():
pass
def _postvisit():
pass
def dfs():
pass
def _transpose_graph():
pass
def _inverse_postvisit_vertex():
pass
def strongly_connected_components():
"""Strongl... | Add strongly connected components's methods | Add strongly connected components's methods
| Python | bsd-2-clause | bowen0701/algorithms_data_structures |
150058856f10992d0f65f47d79ac14e2f52818cc | cellcounter/urls.py | cellcounter/urls.py | from django.conf.urls import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from django.contrib.auth.views import login, logout
from cellcounter.main.views import new_count, view_cou... | from django.conf.urls import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from django.contrib.auth.views import login, logout
from cellcounter.main.views import new_count, view_cou... | Add URL to enable user list view | Add URL to enable user list view
| Python | mit | cellcounter/cellcounter,oghm2/hackdayoxford,cellcounter/cellcounter,cellcounter/cellcounter,haematologic/cellcountr,haematologic/cellcounter,cellcounter/cellcounter,haematologic/cellcountr,haematologic/cellcounter,haematologic/cellcounter,oghm2/hackdayoxford |
705b93f7fd688c4889562a9950c220db23ffa98a | tomso/__init__.py | tomso/__init__.py | __version__ = "0.0.12"
__all__ = [
'adipls',
'utils',
'constants',
'gyre',
'fgong',
'mesa',
'stars'
]
| __version__ = "0.0.12"
__all__ = [
'adipls',
'constants',
'fgong',
'gyre',
'mesa',
'stars',
'utils'
]
| Put modules in alphabetical order | Put modules in alphabetical order
| Python | mit | warrickball/tomso |
8445c6bc549285fea5313a72c0500e2240460332 | avalonstar/apps/subscribers/admin.py | avalonstar/apps/subscribers/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Ticket
class TicketAdmin(admin.ModelAdmin):
list_display = ['name', 'display_name', 'updated', 'is_active', 'is_paid', 'twid']
list_editable = ['is_active', 'is_paid']
ordering = ['-updated']
admin.site.register(Ticket, TicketAd... | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Ticket
class TicketAdmin(admin.ModelAdmin):
list_display = ['name', 'display_name', 'created', 'updated', 'is_active', 'is_paid', 'twid']
list_editable = ['created', 'updated', 'is_active', 'is_paid']
ordering = ['-updated']
adm... | Add created to list_display; make it editable. | Add created to list_display; make it editable.
| Python | apache-2.0 | bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv |
2e1b5f4804023cd551b1d641e4b4dc5ba693ff62 | demos/simple.py | demos/simple.py | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
if __name__ == '__main__':
sn = 0.2
ell = 0.670104947766
sf = 1.25415619045
model = pbm.Sinusoidal(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.GPUCB(gp, model.bounds... | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
def run_model(Model, sn, ell, sf, T):
model = Model(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.GPUCB(gp, model.bounds)
xmin = model.bounds[0][0]
xmax = model.bounds[0][1]... | Add a harder test example. | Add a harder test example.
| Python | bsd-2-clause | mwhoffman/pybo,jhartford/pybo |
d008a08d0c79610eba715842c2f437bf89f8787c | puffin/gui/form.py | puffin/gui/form.py | from flask_wtf import Form
from wtforms import StringField, IntegerField, PasswordField, SubmitField, SelectField
from wtforms.validators import Required, Length, Regexp
from ..core.db import db
from ..core.security import User
from .. import app
class ApplicationForm(Form):
start = SubmitField('Start')
stop =... | from flask_wtf import Form
from flask_security.core import current_user
from wtforms import StringField, IntegerField, PasswordField, SubmitField, SelectField
from wtforms.validators import Required, Length, Regexp
from ..core.db import db
from ..core.security import User
from .. import app
class ApplicationForm(Form)... | Allow changing domain to own | Allow changing domain to own
| Python | agpl-3.0 | loomchild/jenca-puffin,loomchild/puffin,puffinrocks/puffin,loomchild/puffin,puffinrocks/puffin,loomchild/puffin,loomchild/puffin,loomchild/puffin,loomchild/jenca-puffin |
5944ada060154cde31c1fe04adeb1fb10a718eaf | urllibRequests.py | urllibRequests.py | import urllib.request
import urllib.parse
def get(urlStr,params={}):
if params == {}:
req = urllib.request.urlopen(urlStr)
else:
reqdata = urllib.request.Request(urlStr,urllib.parse.urlencode(params).encode('ascii'))
req = urllib.request.urlopen(reqdata)
return req.read()
| import urllib.request
import urllib.parse
def get(urlStr,params={}):
reqdata = urllib.request.Request(urlStr)
reqdata.add_header('User-Agent',
'VocabTool/0.2 (https://github.com/RihanWu/vocabtool)')
if params != {}:
reqdata.data = urllib.parse.urlencode(params).encode('ascii'... | Add User-Agent for better netiquette | Add User-Agent for better netiquette
| Python | mit | RihanWu/vocabtool |
cde59e7f8f8ea74c720f107c80c933b5b9aa913e | recipy/__init__.py | recipy/__init__.py | # These lines ARE needed, as they actually set up sys.meta_path
from . import PatchWarnings
from . import PatchBaseScientific
from . import PatchScientific
from .log import *
from .utils import open
__version__ = '0.2.3'
# Patch built-in open function
# orig_open = __builtins__['open']
# def patched_open(*args, **k... | # These lines ARE needed, as they actually set up sys.meta_path
from . import PatchWarnings
from . import PatchBaseScientific
from . import PatchScientific
from .log import *
from .utils import open
__version__ = '0.3'
log_init()
| Remove old commented out code, and update version to 0.3 | Remove old commented out code, and update version to 0.3
| Python | apache-2.0 | recipy/recipy,recipy/recipy |
f7dd603d4e24134affda6430736838ecaaab9938 | jungle/cli.py | jungle/cli.py | # -*- coding: utf-8 -*-
import click
from . import __version__
class JungleCLI(click.MultiCommand):
"""Jangle CLI main class"""
def list_commands(self, ctx):
"""return available modules"""
return ['ec2', 'elb', 'emr', 'asg']
def get_command(self, ctx, name):
"""get command"""
... | # -*- coding: utf-8 -*-
import click
from . import __version__
class JungleCLI(click.MultiCommand):
"""Jangle CLI main class"""
def list_commands(self, ctx):
"""return available modules"""
return ['ec2', 'elb', 'emr', 'asg']
def get_command(self, ctx, name):
"""get command"""
... | Fix unintended ImportError for wrong subcommnad | Fix unintended ImportError for wrong subcommnad
| Python | mit | achiku/jungle |
d0211871e11d2a2ce9f9a961750aa12a28658c62 | vroom/graphics.py | vroom/graphics.py | import pygame
class Graphic:
car_color = (255, 50, 50)
car_width = 3
road_color = (255, 255, 255)
road_width = 6
draw_methods = {
'Car': 'draw_car',
'Road': 'draw_road',
}
def __init__(self, surface):
self.surface = surface
def draw(self, obj):
object_... | import pygame
class Graphic:
car_color = (255, 50, 50)
car_width = 3
road_color = (255, 255, 255)
road_width = 6
draw_methods = {
'Car': 'draw_car',
'Road': 'draw_road',
}
def __init__(self, surface):
self.surface = surface
def draw(self, obj):
object_... | Change car color depending on acceleration rate | Change car color depending on acceleration rate
| Python | mit | thibault/vroom |
bddf5358b92d58549496de41ffeea724aeb2feb7 | openmm/run_test.py | openmm/run_test.py | #!/usr/bin/env python
from simtk import openmm
# Check major version number
# If Z=0 for version X.Y.Z, out put is "X.Y"
assert openmm.Platform.getOpenMMVersion() == '7.1.1', "openmm.Platform.getOpenMMVersion() = %s" % openmm.Platform.getOpenMMVersion()
# Check git hash
assert openmm.version.git_revision == 'c1a64aa... | #!/usr/bin/env python
from simtk import openmm
# Check major version number
# If Z=0 for version X.Y.Z, out put is "X.Y"
assert openmm.Platform.getOpenMMVersion() == '7.2', "openmm.Platform.getOpenMMVersion() = %s" % openmm.Platform.getOpenMMVersion()
# Check git hash
assert openmm.version.git_revision == '07c1b86c9... | Update test for 7.2 beta build | [openmm] Update test for 7.2 beta build
| Python | mit | peastman/conda-recipes,omnia-md/conda-recipes,peastman/conda-recipes,omnia-md/conda-recipes,omnia-md/conda-recipes,peastman/conda-recipes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.