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
4b2fbad0d2cf4b9efc3c3f89e47c0ac2a83ad08d
tests/utils.py
tests/utils.py
from os import environ JOB_ID = environ.get("TRAVIS_JOB_ID", "loc") ENTITY_MAX_LEN = 36 BASE_NAME_MAX_LEN = ENTITY_MAX_LEN - 3 - 3 - 2 counters = {} def generate_entity_id(base_name="entity"): # Keep only the first characters base_name = base_name[:BASE_NAME_MAX_LEN] counter = counters[base_name] if bas...
from os import environ ENTITY_MAX_LEN = 36 BASE_NAME_MAX_LEN = ENTITY_MAX_LEN - 3 - 3 - 2 counters = {} def generate_entity_id(base_name="entity"): # Keep only the first characters base_name = base_name[:BASE_NAME_MAX_LEN] counter = counters[base_name] if base_name in counters else 0 counter += 1 ...
Remove the job id in the test to have conssitent name that does not change
Remove the job id in the test to have conssitent name that does not change
Python
bsd-3-clause
craft-ai/craft-ai-client-python,craft-ai/craft-ai-client-python
2979efa38e1b31424c69374b20bb6cf70c285395
source/globals/fieldtests.py
source/globals/fieldtests.py
# -*- coding: utf-8 -*- ## \package globals.fieldtests # MIT licensing # See: LICENSE.txt import wx ## Tests if a wx control/instance is enabled # # Function for compatibility between wx versions def FieldEnabled(field): if wx.MAJOR_VERSION > 2: return field.IsThisEnabled() else: r...
# -*- coding: utf-8 -*- ## \package globals.fieldtests # MIT licensing # See: LICENSE.txt import wx ## Tests if a wx control/instance is enabled # # Function for compatibility between wx versions # \param enabled # \b \e bool : Check if enabled or disabled def FieldEnabled(field, enabled=True): if wx.M...
Add 'enabled' argument to FieldEnabled to test negative values
Add 'enabled' argument to FieldEnabled to test negative values
Python
mit
AntumDeluge/desktop_recorder,AntumDeluge/desktop_recorder
1d2237655ef0ba225e6fa0b8d0959ed6b3e75726
runtests.py
runtests.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # """ File for running tests programmatically. """ # Third party imports import pytest def main(): """ Run pytest tests. """ errno = pytest.main(['-x', 'spyder_terminal', '-v', ...
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # """ File for running tests programmatically. """ # Third party imports import pytest def main(): """ Run pytest tests. """ errno = pytest.main(['-x', 'spyder_terminal', '-v', ...
Add timeout to all tests
Add timeout to all tests
Python
mit
spyder-ide/spyder-terminal,spyder-ide/spyder-terminal,spyder-ide/spyder-terminal,spyder-ide/spyder-terminal
030f8fec423acb99574bc2a9b8760e3b9a8e0025
tests/apptest.py
tests/apptest.py
#ToDo : Write tests for application interface import pytest import os from PyQt4.QtGui import * from PyQt4.QtCore import * from mp3wav.application import Mp3WavApp from mp3wav.exceptions.fileexception import FileTypeException from mp3wav.exceptions.libraryexception import LibraryException from mp3wav.exceptions.filenot...
#ToDo : Write tests for application interface import pytest import os from PyQt4.QtGui import * from PyQt4.QtCore import * from mp3wav.application import Mp3WavApp from mp3wav.exceptions.fileexception import FileTypeException from mp3wav.exceptions.libraryexception import LibraryException from mp3wav.exceptions.filenot...
Test modified to check for exception in lack of ffmpeg in travis
Test modified to check for exception in lack of ffmpeg in travis
Python
mit
kapilgarg1996/mp3wav
359445fa4d554d3dd2ba2cb2850af4b892d7090e
binder/tests/testapp/models/animal.py
binder/tests/testapp/models/animal.py
from django.db import models from binder.models import BinderModel # From the api docs: an animal with a name. We don't use the # CaseInsensitiveCharField because it's so much simpler to use # memory-backed sqlite than Postgres in the tests. Eventually we # might switch and require Postgres for tests, if we need man...
from django.db import models from binder.models import BinderModel from binder.exceptions import BinderValidationError # From the api docs: an animal with a name. We don't use the # CaseInsensitiveCharField because it's so much simpler to use # memory-backed sqlite than Postgres in the tests. Eventually we # might s...
Add overridden behaviour to testapp.
Add overridden behaviour to testapp.
Python
mit
CodeYellowBV/django-binder
06ef0b92b1c8e6cc2916f4d68ec3b4ae513c9085
july/people/views.py
july/people/views.py
from django.shortcuts import render_to_response from django.contrib.auth.decorators import login_required from django.template.context import RequestContext #from google.appengine.ext import db from july.people.models import Commit from gae_django.auth.models import User from django.http import Http404 from forms impor...
from django.shortcuts import render_to_response from django.contrib.auth.decorators import login_required from django.template.context import RequestContext #from google.appengine.ext import db from july.people.models import Commit from gae_django.auth.models import User from django.http import Http404 def user_profil...
Fix typo and move missing import into edit view
Fix typo and move missing import into edit view
Python
mit
julython/julython.org,julython/julython.org,ChimeraCoder/GOctober,julython/julython.org,ChimeraCoder/GOctober,julython/julython.org,ChimeraCoder/GOctober
5b4ba4e6cbb6cae1793c699a540aecb64236ca34
riot/app.py
riot/app.py
# -*- coding: utf-8 -*- import urwid def run_tag(tag, *args, **kwargs): loop = urwid.MainLoop(tag, *args, **kwargs) loop.run() def quit_app(): raise urwid.ExitMainLoop()
# -*- coding: utf-8 -*- import urwid def run_tag(tag, *args, **kwargs): loop = urwid.MainLoop(tag, *args, **kwargs) loop.screen.set_terminal_properties(colors=256) loop.run() def quit_app(): raise urwid.ExitMainLoop()
Set default property screen 256 colors.
Set default property screen 256 colors.
Python
mit
soasme/riotpy
ab8141cee63379495837c15d0fb433f941a3c27b
tools/reviews.py
tools/reviews.py
#!/usr/bin/python import json import utils def component_reviews(component, reviewer=None): cmd = ('ssh review.openstack.org gerrit query --format json ' '--current-patch-set project:%s status:open ' 'limit:10000' % component) if reviewer: cmd += ' reviewer:%s' % rev...
#!/usr/bin/python import argparse import json import utils def component_reviews(component, reviewer=None): cmd = ('ssh review.openstack.org gerrit query --format json ' '--current-patch-set project:%s status:open ' 'limit:10000' % component) if reviewer: cmd += ' re...
Handle args in the review helper.
Handle args in the review helper.
Python
apache-2.0
rcbau/hacks,rcbau/hacks,rcbau/hacks
aae994402b1b16a2bca4a486dad4bb452770eb26
tests/pipeline/test_provider_healthcheck.py
tests/pipeline/test_provider_healthcheck.py
"""Test Provider Health Check setting.""" from foremast.pipeline.construct_pipeline_block import check_provider_healthcheck TEST_SETTINGS = {'app': {'eureka_enabled': False}, 'asg': {'provider_healthcheck': {}}} def test_provider_healthcheck(): """Make sure default Provider Health Check works.""" provider_he...
"""Test Provider Health Check setting.""" from foremast.pipeline.construct_pipeline_block import check_provider_healthcheck TEST_SETTINGS = {'app': {'eureka_enabled': False}, 'asg': {'provider_healthcheck': {}}} def test_provider_healthcheck(): """Make sure default Provider Health Check works.""" health_chec...
Update Provider Health Check sanity
test: Update Provider Health Check sanity See also: PSOBAT-2465
Python
apache-2.0
gogoair/foremast,gogoair/foremast
976ca1d7f02a0aab7397a6eb1784436593e6c644
watchman/management/commands/watchman.py
watchman/management/commands/watchman.py
from __future__ import absolute_import import json from optparse import make_option from django.core.management.base import BaseCommand, CommandError from watchman.utils import get_checks class Command(BaseCommand): help = 'Runs the default django-watchman checks' option_list = BaseCommand.option_list + (...
from __future__ import absolute_import import json from optparse import make_option from django.core.management.base import BaseCommand, CommandError from watchman.utils import get_checks class Command(BaseCommand): help = 'Runs the default django-watchman checks' option_list = BaseCommand.option_list + (...
Swap equality checks for `in`
Swap equality checks for `in`
Python
bsd-3-clause
mwarkentin/django-watchman,mwarkentin/django-watchman,JBKahn/django-watchman,JBKahn/django-watchman
dfa92db8ba32a2209dacab04d9b14279f5f37f3d
core/scraper.py
core/scraper.py
from bs4 import BeautifulSoup def extract_blocks(page): soup = BeautifulSoup(page) table_rows = soup.find_all('tr') blocks = [] for i, row in enumerate(table_rows[4:-2]): table_cells = row.find_all('td') if table_cells: component_and_section = table_cells[1].get_text().rstr...
from bs4 import BeautifulSoup def extract_blocks(page): soup = BeautifulSoup(page) table_rows = soup.find_all('tr') blocks = [] for i, row in enumerate(table_rows[4:-2]): table_cells = row.find_all('td') if table_cells: component_and_section = table_cells[1].get_text().rstr...
Support seminars in addition to lectures and labs
Support seminars in addition to lectures and labs
Python
mit
tuzhucheng/uw-course-alerter,tuzhucheng/uw-course-alerter,tuzhucheng/uw-course-alerter,tuzhucheng/uw-course-alerter
8b3c438b3f5fb9b2538a30182dd4f5d306aa098b
ankieta/contact/forms.py
ankieta/contact/forms.py
from django import forms from django.core.mail import mail_managers from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from .models import Contact class ContactForm(forms.Form): personsLi...
from django import forms from django.core.mail import send_mail from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django.conf import settings from .models import Contact def my_mail_sen...
Fix contact form - send to recipient, not managers
Fix contact form - send to recipient, not managers
Python
bsd-3-clause
watchdogpolska/prezydent.siecobywatelska.pl,watchdogpolska/prezydent.siecobywatelska.pl,watchdogpolska/prezydent.siecobywatelska.pl
aa6da3aa2b7d4781ec0c3d94ea68c11d75b76506
bonobo/structs/graphs.py
bonobo/structs/graphs.py
from bonobo.constants import BEGIN class Graph: """ Represents a coherent directed acyclic graph of components. """ def __init__(self, *chain): self.nodes = [] self.graph = {BEGIN: set()} self.add_chain(*chain) def outputs_of(self, idx, create=False): if create an...
from bonobo.constants import BEGIN class Graph: """ Represents a coherent directed acyclic graph of components. """ def __init__(self, *chain): self.nodes = [] self.graph = {BEGIN: set()} self.add_chain(*chain) def outputs_of(self, idx, create=False): if create an...
Allow to specify output of a chain in the Graph class.
Allow to specify output of a chain in the Graph class.
Python
apache-2.0
hartym/bonobo,hartym/bonobo,hartym/bonobo,python-bonobo/bonobo,python-bonobo/bonobo,python-bonobo/bonobo
58eaaeca980d8ec92d77c201aa01d5c46cf761dd
neuroshare/NeuralEntity.py
neuroshare/NeuralEntity.py
from Entity import * class NeuralEntity(Entity): """Entity the represents timestamps of action potentials, i.e. spike times. Cutouts of the waveforms corresponding to spike data in a neural entity might be found in a separate :class:`SegmentEntity` (cf. :func:`source_entity_id`). """ def __init__(s...
from Entity import * class NeuralEntity(Entity): """Entity the represents timestamps of action potentials, i.e. spike times. Cutouts of the waveforms corresponding to spike data in a neural entity might be found in a separate :class:`SegmentEntity` (cf. :func:`source_entity_id`). """ def __init__(s...
Update Neural Entity (now complete)
doc: Update Neural Entity (now complete)
Python
lgpl-2.1
abhay447/python-neuroshare,G-Node/python-neuroshare,G-Node/python-neuroshare,abhay447/python-neuroshare
cef45980266463a49a76466d858a3eaab99fc377
flexget/plugins/module_change_warn.py
flexget/plugins/module_change_warn.py
import logging from flexget.manager import Session from flexget.plugin import * log = logging.getLogger('change') class ChangeWarn: """ Gives warning if user has deprecated / changed configuration in the root level. Will be replaced by root level validation in the future! """ def old_da...
import logging from flexget.manager import Session from flexget.plugin import * log = logging.getLogger('change') class ChangeWarn: """ Gives warning if user has deprecated / changed configuration in the root level. Will be replaced by root level validation in the future! """ def old_da...
Allow variables at root level for yaml definitions.
Allow variables at root level for yaml definitions. git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1062 3942dd89-8c5d-46d7-aeed-044bccf3e60c
Python
mit
jacobmetrick/Flexget,Danfocus/Flexget,X-dark/Flexget,X-dark/Flexget,offbyone/Flexget,poulpito/Flexget,gazpachoking/Flexget,lildadou/Flexget,malkavi/Flexget,v17al/Flexget,ZefQ/Flexget,crawln45/Flexget,ratoaq2/Flexget,malkavi/Flexget,antivirtel/Flexget,camon/Flexget,Pretagonist/Flexget,Pretagonist/Flexget,crawln45/Flexge...
d8fa29ee920984d0ae7ae94bc2fd09cde20b2b25
HOME/bin/lib/setup/__init__.py
HOME/bin/lib/setup/__init__.py
from pathlib import Path SETTINGS_PATH = 'conf/settings.py' PARTIALS_PATH = 'conf/partials.txt' HOME_DIR = 'HOME' def load_config(path=SETTINGS_PATH): settings = eval(open(path).read()) return settings def root(): # this file is under HOME_DIR, which is directly under the repo root path = Path(__fi...
from pathlib import Path SETTINGS_PATH = 'conf/settings.py' PARTIALS_PATH = 'conf/partials.txt' HOME_DIR = 'HOME' def load_config(path=SETTINGS_PATH): settings = eval(open(path).read()) return settings def root(): """Return the path of the root of this setup repository.""" # this file is under HOME...
Improve comment in setup module
Improve comment in setup module
Python
mit
kbd/setup,kbd/setup,kbd/setup,kbd/setup,kbd/setup
931758154d44c9b0e0cf5d049367ffddfdae28b1
external_tools/src/main/python/images/PropertiesParser.py
external_tools/src/main/python/images/PropertiesParser.py
# -*- coding: utf-8 -*- import ConfigParser import logging class PropertiesParser(object): """Parse a java like properties file Parser wrapping around ConfigParser allowing reading of java like properties file. Based on stackoverflow example: https://stackoverflow.com/questions/2819696/parsing-proper...
# -*- coding: utf-8 -*- import ConfigParser import logging class PropertiesParser(object): """Parse a java like properties file Parser wrapping around ConfigParser allowing reading of java like properties file. Based on stackoverflow example: https://stackoverflow.com/questions/2819696/parsing-proper...
Change logging to use print because of logger configuration error
Change logging to use print because of logger configuration error
Python
apache-2.0
mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData
799ed61e049da558f2fd87db8ef3bf0ad888681c
monasca/common/messaging/message_formats/reference/metrics.py
monasca/common/messaging/message_formats/reference/metrics.py
# Copyright 2014 Hewlett-Packard # # 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 2014 Hewlett-Packard # # 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...
Correct the 'reference' format transform method
Correct the 'reference' format transform method Currently, the 'reference' format transform method will traversal the metrics list and reconstruct every item of the list to add tenant_id and region info, but new transformed metrics list will use the reference of the local dict variable "transformed_metric", that will ...
Python
apache-2.0
stackforge/monasca-api,hpcloud-mon/monasca-events-api,openstack/monasca-api,sapcc/monasca-api,stackforge/monasca-api,hpcloud-mon/monasca-events-api,stackforge/monasca-api,hpcloud-mon/monasca-events-api,oneilcin/monasca-events-api,oneilcin/monasca-events-api,hpcloud-mon/monasca-events-api,sapcc/monasca-api,oneilcin/mona...
a4f010ed53615dcbe48c08a445e7d64045001133
base_comment_template/tests/test_base_comment_template.py
base_comment_template/tests/test_base_comment_template.py
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase class TestResPartner(TransactionCase): def setUp(self): self.template_id = self.env['base.comment.template'].create({ 'name': 'Comment before lines', 'position': 'before_...
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase class TestResPartner(TransactionCase): def setUp(self): super(TestResPartner, self).setUp() self.template_id = self.env['base.comment.template'].create({ 'name': 'Comment bef...
Move comment_template_id field to the Invoicing tab
[IMP] account_invoice_comment_template: Move comment_template_id field to the Invoicing tab [IMP] account_invoice_comment_template: rename partner field name from comment_template_id to invoice_comment_template_id [IMP] account_invoice_comment_template: Make partner field company_dependant and move domain definition ...
Python
agpl-3.0
OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine
40095b001ab95fda4cc80bcc807508e9580ebf2d
fireplace/cards/gvg/neutral_legendary.py
fireplace/cards/gvg/neutral_legendary.py
from ..utils import * ## # Minions # Dr. Boom class GVG_110: action = [Summon(CONTROLLER, "GVG_110t") * 2] # Boom Bot class GVG_110t: def deathrattle(self): return [Hit(RANDOM_ENEMY_CHARACTER, random.randint(1, 4))] # Sneed's Old Shredder class GVG_114: def deathrattle(self): legendary = randomCollectible(...
from ..utils import * ## # Minions # Dr. Boom class GVG_110: action = [Summon(CONTROLLER, "GVG_110t") * 2] # Boom Bot class GVG_110t: def deathrattle(self): return [Hit(RANDOM_ENEMY_CHARACTER, random.randint(1, 4))] # Sneed's Old Shredder class GVG_114: def deathrattle(self): legendary = randomCollectible(...
Implement Toshley, Mekgineer Thermaplugg and Gazlowe
Implement Toshley, Mekgineer Thermaplugg and Gazlowe
Python
agpl-3.0
amw2104/fireplace,oftc-ftw/fireplace,smallnamespace/fireplace,smallnamespace/fireplace,liujimj/fireplace,oftc-ftw/fireplace,amw2104/fireplace,butozerca/fireplace,Ragowit/fireplace,liujimj/fireplace,jleclanche/fireplace,butozerca/fireplace,Ragowit/fireplace,NightKev/fireplace,beheh/fireplace,Meerkov/fireplace,Meerkov/fi...
1ad03769569d86d1eda45f7c6582234ed455ea88
src/main.py
src/main.py
"""Where player runs the game""" import random import time import board import conversion import games if __name__ == '__main__': NUMBER_OF_TRIALS = 1 for i in range(NUMBER_OF_TRIALS): X_LOC_CHESS, Y_LOC_CHESS = board.identify_random_square() LOCATION = conversion.coordinate_to_alg(X_LOC_CHES...
"""Where player runs the game""" import random import time import board import conversion import games from settings import RECORD_FILE def write_record_to_file(a_string, file_name): with open(file_name, 'w') as f: f.write(a_string) def get_record_from_file(file_name): with open(file_name, 'r') as f...
Add functions to read/write to a record file
Add functions to read/write to a record file
Python
mit
blairck/chess_notation
96d12496e425806a635ba345a534c0ca2790754d
satchmo/apps/payment/modules/giftcertificate/processor.py
satchmo/apps/payment/modules/giftcertificate/processor.py
""" GiftCertificate processor """ from django.utils.translation import ugettext as _ from l10n.utils import moneyfmt from models import GiftCertificate from payment.modules.base import BasePaymentProcessor, ProcessorResult, NOTSET class PaymentProcessor(BasePaymentProcessor): def __init__(self, settings): ...
""" GiftCertificate processor """ from django.utils.translation import ugettext as _ from l10n.utils import moneyfmt from models import GiftCertificate from payment.modules.base import BasePaymentProcessor, ProcessorResult, NOTSET class PaymentProcessor(BasePaymentProcessor): def __init__(self, settings): ...
Fix the gift certificate module so that an invalid code won't throw an exception.
Fix the gift certificate module so that an invalid code won't throw an exception.
Python
bsd-3-clause
twidi/satchmo,ringemup/satchmo,ringemup/satchmo,dokterbob/satchmo,twidi/satchmo,dokterbob/satchmo,Ryati/satchmo,Ryati/satchmo
056d82002c133736a800b08bd071b71c9f5615f8
ci/generate_pipeline_yml.py
ci/generate_pipeline_yml.py
#!/usr/bin/env python import os from jinja2 import Template clusters = ['2_7_lts', '2_9', '2_10', '2_11_lts2'] # Commenting out this as we only have one example and it breaks tiles = [] # [d for d in os.listdir('../examples') if os.path.isdir(os.path.join('../examples', d))] with open('pipeline.yml.jinja2', 'r') as ...
#!/usr/bin/env python import os from jinja2 import Template clusters = ['2_7_lts', '2_11_lts2', '2_12', '2_13'] # Commenting out this as we only have one example and it breaks tiles = [] # [d for d in os.listdir('../examples') if os.path.isdir(os.path.join('../examples', d))] with open('pipeline.yml.jinja2', 'r') as...
Update TAS versions we test against
Update TAS versions we test against
Python
apache-2.0
cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator
bc8d7a7572fcde45ae95176301522979fa54aa87
carnifex/test/unit/mocks.py
carnifex/test/unit/mocks.py
from twisted.internet._baseprocess import BaseProcess from carnifex.inductor import ProcessInductor from twisted.internet.error import ProcessTerminated, ProcessDone class MockProcess(BaseProcess): def run(self, fauxProcessData): for childFd, data in fauxProcessData: self.proto.childDataReceiv...
from twisted.internet._baseprocess import BaseProcess from carnifex.inductor import ProcessInductor from twisted.internet.error import ProcessTerminated, ProcessDone class MockProcess(BaseProcess): def run(self, fauxProcessData): for childFd, data in fauxProcessData: self.proto.childDataReceiv...
Allow specifying what exit code to use when emulating process exit
Allow specifying what exit code to use when emulating process exit
Python
mit
sporsh/carnifex
fdaabeaa3694103153c81a18971e6b55597cd66e
Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Synth.py
Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Synth.py
import Axon from Kamaelia.Apps.Jam.Audio.Polyphony import Polyphoniser from Kamaelia.Apps.Jam.Audio.Mixer import MonoMixer class Synth(Axon.Component.component): polyphony = 8 polyphoniser = Polyphoniser def __init__(self, voiceGenerator, **argd): super(Synth, self).__init__(**argd) polyph...
import Axon from Kamaelia.Apps.Jam.Audio.Polyphony import Polyphoniser class Synth(Axon.Component.component): polyphony = 8 polyphoniser = Polyphoniser def __init__(self, voiceGenerator, **argd): super(Synth, self).__init__(**argd) polyphoniser = self.polyphoniser(**argd).activate() ...
Remove mixer section from synth code to reflect the components directly calling pygame mixer methods.
Remove mixer section from synth code to reflect the components directly calling pygame mixer methods.
Python
apache-2.0
sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia
75e14847fe2c0f0c40897e449bab093f4be1b17c
cineapp/jinja_filters.py
cineapp/jinja_filters.py
# -*- coding: utf-8 -*- from cineapp import app @app.template_filter() def minutes_to_human_duration(minutes_duration): """ Convert a duration in minutes into a duration in a cool format human readable """ try: hours,minutes = divmod(minutes_duration,60) return "%sh %smin" %(hours,minutes) except TypeError: ...
# -*- coding: utf-8 -*- from cineapp import app import datetime @app.template_filter() def minutes_to_human_duration(minutes_duration): """ Convert a duration in minutes into a duration in a cool format human readable """ try: hours,minutes = divmod(minutes_duration,60) return "%sh %smin" %(hours,minutes) ex...
Improve jinja filter date converter
Improve jinja filter date converter The filter now can convert date which are strings and not datetime objects.
Python
mit
ptitoliv/cineapp,ptitoliv/cineapp,ptitoliv/cineapp
4974f83d9ed1e085ef2daaeba4db56a4001055cf
comics/comics/ctrlaltdel.py
comics/comics/ctrlaltdel.py
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Ctrl+Alt+Del" language = "en" url = "http://www.cad-comic.com/cad/" start_date = "2002-10-23" rights = "Tim Buckley" class Crawler(CrawlerBase)...
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Ctrl+Alt+Del" language = "en" url = "https://cad-comic.com/category/ctrl-alt-del/" start_date = "2002-10-23" rights = "Tim Buckley" class Crawl...
Update "Ctrl+Alt+Del" after site change
Update "Ctrl+Alt+Del" after site change
Python
agpl-3.0
datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics
4007ecdc66e361bcb81bb5b661e682eeef0a6ea5
remo/profiles/migrations/0011_groups_new_onboarding_group.py
remo/profiles/migrations/0011_groups_new_onboarding_group.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def forwards(apps, schema_editor): """Create Onboarding group.""" Group = apps.get_model('auth', 'Group') Group.objects.create(name='Onboarding') def backwards(apps, schema_editor): """Delete On...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def forwards(apps, schema_editor): """Create Onboarding group.""" Group = apps.get_model('auth', 'Group') if not Group.objects.filter(name='Onboarding').exists(): Group.objects.create(name='On...
Check if Onboarding exists before creating.
Check if Onboarding exists before creating.
Python
bsd-3-clause
mozilla/remo,akatsoulas/remo,Mte90/remo,mozilla/remo,Mte90/remo,akatsoulas/remo,mozilla/remo,Mte90/remo,mozilla/remo,akatsoulas/remo,akatsoulas/remo,Mte90/remo
5e3be1d123063495f21d0c0068c7132d43fd9724
account/models.py
account/models.py
from django.db import models from django.db.models import signals from django.contrib.auth.models import User from course.models import Term class Profile(models.Model): user = models.OneToOneField(User) student_id = models.CharField(max_length=10, null=True) default_term = models.ForeignKey(Term, null=Tru...
from django.db import models from django.db.models import signals from django.contrib.auth.models import User from course.models import Term class Profile(models.Model): user = models.OneToOneField(User) student_id = models.CharField(max_length=10, null=True) default_term = models.ForeignKey(Term, null=Tru...
Fix login error for new accounts where a profile doesn't exist
Fix login error for new accounts where a profile doesn't exist
Python
apache-2.0
OpenCourseProject/OpenCourse,gravitylow/OpenCourse,gravitylow/OpenCourse,gravitylow/OpenCourse,OpenCourseProject/OpenCourse,OpenCourseProject/OpenCourse
7a07a89d59250127fce21b5f1b68492046b3eb60
pyshelf/search/metadata.py
pyshelf/search/metadata.py
from elasticsearch_dsl import String, Nested, Boolean, DocType, tokenizer, analyzer # Required for case sensitivity metadata_analyzer = analyzer("metadata_analyzer", tokenizer=tokenizer("keyword")) class Metadata(DocType): property_list = Nested( properties={ "name": String(), "v...
from elasticsearch_dsl import String, Nested, Boolean, DocType, tokenizer, analyzer # Required for case sensitivity # To add an analyzer to an existing mapping requires mapping to be "closed" case_sensitive_analyzer = analyzer("case_sensitive_analyzer", tokenizer=tokenizer("keyword")) class Metadata(DocType): p...
Add case sensitivity to field and clarify analyzer.
Add case sensitivity to field and clarify analyzer.
Python
mit
not-nexus/shelf,kyle-long/pyshelf,kyle-long/pyshelf,not-nexus/shelf
7bc777a5e9fb15720dd6b41aa5e1fbcfd7d3141b
tests/test_postgres_processor.py
tests/test_postgres_processor.py
import pytest import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings") from . import utils from scrapi.linter.document import NormalizedDocument, RawDocument from scrapi.processing.postgres import PostgresProcessor, Document test_db = PostgresProcessor() NORMALIZED = NormalizedDocument(utils.RE...
import pytest import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings") from . import utils from scrapi.linter.document import NormalizedDocument, RawDocument from scrapi.processing.postgres import PostgresProcessor, Document test_db = PostgresProcessor() NORMALIZED = NormalizedDocument(utils.RE...
Add django pytest mark to process raw test
Add django pytest mark to process raw test
Python
apache-2.0
CenterForOpenScience/scrapi,felliott/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,erinspace/scrapi,erinspace/scrapi,felliott/scrapi,mehanig/scrapi,fabianvf/scrapi
53646da453a4aa6d0e559ee3069626458f2fef78
common/urls.py
common/urls.py
import json import os import re from django.urls import re_path from civictechprojects import views def url_generator_from_pattern(pattern): return re.sub("\\(.+\\)", "{id}", pattern) def generate_url_patterns(spec_path, set_url_generators=False): # Read json file base_dir = os.path.dirname(__file__) ...
import json import os import re from django.urls import re_path from civictechprojects import views def url_generator_from_pattern(pattern): _pattern = pattern.replace('^', '').replace('$', '') return re.sub("\\(.+\\)", "{id}", _pattern) def generate_url_patterns(spec_path, set_url_generators=False): # ...
Fix backend home page url generator
Fix backend home page url generator
Python
mit
DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange
0f8e2313d6f0ec06806ea05e861d1fc47d3c3016
utils/internal/zz_parse.py
utils/internal/zz_parse.py
import sys sys.path.insert(0, '../..') from pycparser import c_parser, c_ast, parse_file if __name__ == "__main__": #ast = parse_file('zc_pp.c', use_cpp=True, cpp_path="../cpp.exe") parser = c_parser.CParser() #code = r'''int ar[30];''' code = r''' char ***arr3d[40]; ''' #code = r''' ...
from __future__ import print_function import sys from pycparser import c_parser, c_generator, c_ast, parse_file if __name__ == "__main__": parser = c_parser.CParser() code = r''' void* ptr = (int[ ]){0}; ''' print(code) ast = parser.parse(code) ast.show(attrnames=True, nodenames=True) ...
Clean up internal hacking util
Clean up internal hacking util
Python
bsd-3-clause
CtheSky/pycparser,CtheSky/pycparser,CtheSky/pycparser
044a051c637f256613ff307caf3ae0126d09b049
backend/unichat/views.py
backend/unichat/views.py
from django.http import JsonResponse, HttpResponse, HttpResponseBadRequest from django.views.decorators.csrf import csrf_exempt import json from helpers import get_school_list, check_signup_email def get_schools(request): resp = JsonResponse({'schools': get_school_list()}) resp['Access-Control-Allow-Origin'] ...
from django.http import JsonResponse, HttpResponse, HttpResponseBadRequest from django.views.decorators.csrf import csrf_exempt import json from helpers import get_school_list, check_signup_email def get_schools(request): resp = JsonResponse({'schools': get_school_list()}) resp['Access-Control-Allow-Origin'] ...
Add error message to BadRequest signup response for invalid method
Add error message to BadRequest signup response for invalid method
Python
mit
dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet
4c1c902010096d6d87d93b865d9c68794da51414
trex/parsers.py
trex/parsers.py
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from io import TextIOWrapper from rest_framework.parsers import BaseParser class PlainTextParser(BaseParser): media_type = "text/plain" def parse(self, stream, media_...
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from io import TextIOWrapper, BytesIO from django.core.handlers.wsgi import WSGIRequest from rest_framework.parsers import BaseParser class PlainTextParser(BaseParser): m...
Fix parsing data from request
Fix parsing data from request The object passed to the parser method is not a real IOBase stream. It may only be a Request object which has read, etc. methods. Therefore the real data must be encapsulated in a BytesIO stream before changing the content type.
Python
mit
bjoernricks/trex,bjoernricks/trex
b86c53c388c39baee1ddfe3a615cdad20d272055
antcolony/util.py
antcolony/util.py
import json def avg(iterable): return sum(iterable) / len(iterable) def nice_json_dump(data, filepath): with open(filepath, 'w') as f: json.dump(data, f, sort_keys=True, indent=4, separators=(',', ': '))
import json def avg(iterable): sum_ = 0 element_count = 0 for element in iterable: sum_ += element element_count += 1 return sum_ / element_count def nice_json_dump(data, filepath): with open(filepath, 'w') as f: json.dump(data, f, sort_keys=True, indent=4, separators=(',',...
Make avg() work with iterators
Make avg() work with iterators
Python
bsd-3-clause
ppolewicz/ant-colony,ppolewicz/ant-colony
b43c6604163e18ae03c6ef206c4892e0beb873f7
django_cradmin/demo/uimock_demo/urls.py
django_cradmin/demo/uimock_demo/urls.py
from django.urls import path from django_cradmin import viewhelpers from .views import overview urlpatterns = [ path('simple/<str:mockname>', viewhelpers.uimock.UiMock.as_view(template_directory='uimock_demo/simple/'), name='cradmin_uimock_demo_simple'), path('', overview.Overview....
from django.urls import path, re_path from django_cradmin import viewhelpers from .views import overview urlpatterns = [ re_path(r'^simple/(?P<mockname>.+)?$', viewhelpers.uimock.UiMock.as_view(template_directory='uimock_demo/simple/'), name='cradmin_uimock_demo_simple'), path('', ...
Fix url that was wrongly converted to django3.
Fix url that was wrongly converted to django3.
Python
bsd-3-clause
appressoas/django_cradmin,appressoas/django_cradmin,appressoas/django_cradmin
ac3c8155abae010fb79866addd1e9cd50f5cae78
tests/test_impersonation.py
tests/test_impersonation.py
from django.core.urlresolvers import reverse import pytest from saleor.userprofile.impersonate import can_impersonate from saleor.userprofile.models import User def test_staff_with_permission_can_impersonate( staff_client, customer_user, staff_user, permission_impersonate_user, staff_group): staff...
from django.core.urlresolvers import reverse import pytest from saleor.userprofile.impersonate import can_impersonate from saleor.userprofile.models import User def test_staff_with_permission_can_impersonate( staff_client, customer_user, staff_user, permission_impersonate_user, staff_group): staff...
Use reverse function in tests
Use reverse function in tests
Python
bsd-3-clause
UITools/saleor,maferelo/saleor,mociepka/saleor,UITools/saleor,mociepka/saleor,maferelo/saleor,UITools/saleor,UITools/saleor,maferelo/saleor,UITools/saleor,mociepka/saleor
8b545ee63ec695a77ba08fa5ff45b7d6dd3d94f8
cuteshop/downloaders/git.py
cuteshop/downloaders/git.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess from ..utils import DEVNULL, change_working_directory from .base import DOWNLOAD_CONTAINER def download(source_info): url = source_info['git'] subprocess.call( ('git', 'clone', url, DOWNLOAD_CONTAINER), stdout=DEVNULL, stderr=sub...
#!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess from ..utils import DEVNULL, change_working_directory from .base import DOWNLOAD_CONTAINER def _checkout(name): with change_working_directory(DOWNLOAD_CONTAINER): subprocess.call( ('git', 'checkout', name), stdout=DEV...
Add auto branch checkout functionality
Add auto branch checkout functionality
Python
mit
uranusjr/cuteshop
687f48ca94b67321a1576a1dbb1d7ae89fe6f0b7
tests/test_pubannotation.py
tests/test_pubannotation.py
import kindred def test_pubannotation_groST(): corpus = kindred.pubannotation.load('bionlp-st-gro-2013-development') assert isinstance(corpus,kindred.Corpus) fileCount = len(corpus.documents) entityCount = sum([ len(d.entities) for d in corpus.documents ]) relationCount = sum([ len(d.relations) for d in corpus...
import kindred def test_pubannotation(): corpus = kindred.pubannotation.load('bionlp-st-gro-2013-development') assert isinstance(corpus,kindred.Corpus) fileCount = len(corpus.documents) entityCount = sum([ len(d.entities) for d in corpus.documents ]) relationCount = sum([ len(d.relations) for d in corpus.docum...
Remove one of the pubannotation tests as their data seems to change
Remove one of the pubannotation tests as their data seems to change
Python
mit
jakelever/kindred,jakelever/kindred
31c921f0f88df5bc532db0f326ba9ef53318feb9
codejail/django_integration.py
codejail/django_integration.py
"""Django integration for codejail""" from django.core.exceptions import MiddlewareNotUsed from django.conf import settings import codejail.jail_code class ConfigureCodeJailMiddleware(object): """Middleware to configure codejail on startup.""" def __init__(self): python_bin = settings.CODE_JAIL.get...
"""Django integration for codejail. Code to glue codejail into a Django environment. """ from django.core.exceptions import MiddlewareNotUsed from django.conf import settings import codejail.jail_code class ConfigureCodeJailMiddleware(object): """ Middleware to configure codejail on startup. This is ...
Add more detail in docstring
Add more detail in docstring
Python
agpl-3.0
StepicOrg/codejail,edx/codejail
55ba2c2310a0f3a4a413801ce8edf52e001c9ffd
tornado_srv.py
tornado_srv.py
import tornado.web import tornado.wsgi import tornado.httpserver import tornado.ioloop from mojibake.main import app from mojibake.settings import PORT container = tornado.wsgi.WSGIContainer(app) http_server = tornado.httpserver.HTTPServer(container) http_server.listen(PORT) tornado.ioloop.IOLoop.instance().start()
import tornado.web import tornado.wsgi import tornado.httpserver import tornado.ioloop import os from mojibake.main import app from mojibake.settings import PORT if os.name == 'posix': import setproctitle setproctitle.setproctitle('mojibake') # Set the process title to mojibake print('Starting Mojibake...')...
Set the process title on posix systems
Set the process title on posix systems
Python
mit
ardinor/mojibake,ardinor/mojibake,ardinor/mojibake
2e9e14980d87239f861377d1dac45bb04d3f9712
tests/basics/array_intbig.py
tests/basics/array_intbig.py
# test array('q') and array('Q') try: from array import array except ImportError: import sys print("SKIP") sys.exit() print(array('q')) print(array('Q')) print(array('q', [0])) print(array('Q', [0])) print(array('q', [-2**63, -1, 0, 1, 2, 2**63-1])) print(array('Q', [0, 1, 2, 2**64-1])) print(bytes...
# test array types QqLl that require big-ints try: from array import array except ImportError: import sys print("SKIP") sys.exit() print(array('L', [0, 2**32-1])) print(array('l', [-2**31, 0, 2**31-1])) print(array('q')) print(array('Q')) print(array('q', [0])) print(array('Q', [0])) print(array('q...
Update array test for big-int with lL typecodes.
tests/basics: Update array test for big-int with lL typecodes.
Python
mit
TDAbboud/micropython,tralamazza/micropython,hiway/micropython,AriZuu/micropython,puuu/micropython,lowRISC/micropython,torwag/micropython,ryannathans/micropython,bvernoux/micropython,pozetroninc/micropython,pramasoul/micropython,deshipu/micropython,tralamazza/micropython,trezor/micropython,pramasoul/micropython,swegener...
b9ef72138c5312fe8eb7cfa48abe48a8c477afdc
test/test_type_checker_creator.py
test/test_type_checker_creator.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import pytest from dataproperty._type_checker_creator import IntegerTypeCheckerCreator from dataproperty._type_checker_creator import FloatTypeCheckerCreator from dataproperty._type_checker_creat...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import pytest import dataproperty._type_checker_creator as tcc import dataproperty._type_checker as tc class Test_TypeCheckerCreator(object): @pytest.mark.parametrize(["value", "is_convert...
Add tests for NoneTypeCheckerCreator class
Add tests for NoneTypeCheckerCreator class
Python
mit
thombashi/DataProperty
927915f11ce536074920c515fab6e6ec3134d390
tests/test_huckle_install.py
tests/test_huckle_install.py
from __future__ import absolute_import, division, print_function from subprocess import check_output import os def test_function(): setup = """ #!/bin/bash huckle install https://hcli.io/hcli/cli/jsonf?command=jsonf echo '{"hello":"world"}' | jsonf go """ out = check_output(['bash', '-c', se...
from __future__ import absolute_import, division, print_function import subprocess import os def test_function(): setup = """ #!/bin/bash huckle install https://hcli.io/hcli/cli/jsonf?command=jsonf echo '{"hello":"world"}' | jsonf go """ p1 = subprocess.Popen(['bash', '-c', setup], stdin=sub...
Revert "fix test by switching to check_output"
Revert "fix test by switching to check_output" This reverts commit 6cfd9d01d68c2f7ff4a8bba3351ee618e770d315.
Python
mit
cometaj2/huckle
1c0f0decd5bdcea3174cee650ba08fb427b67016
tests/test_rover_instance.py
tests/test_rover_instance.py
from unittest import TestCase from rover import Rover class TestRover(TestCase): def setUp(self): self.rover = Rover() def test_rover_compass(self): assert self.rover.compass == ['N', 'E', 'S', 'W'] def test_rover_position(self): assert self.rover.position == (self.rover.x, self...
from unittest import TestCase from rover import Rover class TestRover(TestCase): def setUp(self): self.rover = Rover() def test_rover_compass(self): assert self.rover.compass == ['N', 'E', 'S', 'W'] def test_rover_position(self): assert self.rover.position == (self.rover.x, self...
Add failing tests for rover forward movement
Add failing tests for rover forward movement
Python
mit
authentik8/rover
05e61f1be4005edf2ff439ca2613bce8af217ff7
pubsubpull/models.py
pubsubpull/models.py
""" Models. """ from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.db import models from pubsubpull.fields import JSONB class Request(models.Model): """A web request. """ user = models.ForeignKey(User, null=True, blank=True, related_name='reques...
""" Models. """ from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.db import models from pubsubpull.fields import JSONB class Request(models.Model): """A web request. """ user = models.ForeignKey(User, null=True, blank=True, related_name='reques...
Add more useful display of the request data.
Add more useful display of the request data.
Python
mit
KayEss/django-pubsubpull,KayEss/django-pubsubpull,KayEss/django-pubsubpull
5b8241ad808bd11971d0d684bafd6f9019e58397
tests/contrib/flask/tests.py
tests/contrib/flask/tests.py
import logging from flask import Flask from raven.base import Client from raven.contrib.flask import Sentry from unittest2 import TestCase class TempStoreClient(Client): def __init__(self, *args, **kwargs): self.events = [] super(TempStoreClient, self).__init__(*args, **kwargs) def send(self, ...
import logging from flask import Flask from raven.base import Client from raven.contrib.flask import Sentry from unittest2 import TestCase class TempStoreClient(Client): def __init__(self, *args, **kwargs): self.events = [] super(TempStoreClient, self).__init__(*args, **kwargs) def send(self, ...
Add url test for Flask
Add url test for Flask
Python
bsd-3-clause
nikolas/raven-python,Photonomie/raven-python,jmagnusson/raven-python,inspirehep/raven-python,danriti/raven-python,lopter/raven-python-old,nikolas/raven-python,johansteffner/raven-python,johansteffner/raven-python,daikeren/opbeat_python,daikeren/opbeat_python,someonehan/raven-python,inspirehep/raven-python,jmagnusson/ra...
4ccc5ea6cf25adb029f5e08cc0675e2b8415abdf
LayerView.py
LayerView.py
from UM.View.View import View from UM.View.Renderer import Renderer from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Resources import Resources class LayerView(View): def __init__(self): super().__init__() self._material = None def beginRendering(self): scene...
from UM.View.View import View from UM.View.Renderer import Renderer from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Resources import Resources class LayerView(View): def __init__(self): super().__init__() self._material = None def beginRendering(self): scene...
Support colours for rendering the layer view
Support colours for rendering the layer view
Python
agpl-3.0
markwal/Cura,DeskboxBrazil/Cura,ad1217/Cura,Curahelper/Cura,senttech/Cura,derekhe/Cura,fxtentacle/Cura,ynotstartups/Wanhao,ad1217/Cura,markwal/Cura,fxtentacle/Cura,Curahelper/Cura,quillford/Cura,hmflash/Cura,ynotstartups/Wanhao,fieldOfView/Cura,hmflash/Cura,totalretribution/Cura,quillford/Cura,lo0ol/Ultimaker-Cura,lo0o...
a3a5d2d6b76a4e903fea232b746b2df8b208ec9e
km3pipe/tests/test_plot.py
km3pipe/tests/test_plot.py
# Filename: test_plot.py # pylint: disable=locally-disabled,C0111,R0904,C0103 import numpy as np from km3pipe.testing import TestCase from km3pipe.plot import bincenters __author__ = "Moritz Lotze" __copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration." __credits__ = [] __license__ = "MIT" __mainta...
# Filename: test_plot.py # pylint: disable=locally-disabled,C0111,R0904,C0103 import numpy as np from km3pipe.testing import TestCase, patch from km3pipe.plot import bincenters, meshgrid, automeshgrid, diag __author__ = "Moritz Lotze" __copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration." __credit...
Add tests for plot functions
Add tests for plot functions
Python
mit
tamasgal/km3pipe,tamasgal/km3pipe
ef4c9f6a2e6fc1db01d93d937d24e444b0bb0ede
tests/memory_profiling.py
tests/memory_profiling.py
""" Script to try do detect any memory leaks that may be lurking in the C implementation of the PVector. """ import inspect import sys import time import memory_profiler import vector_test try: from pvectorc import pvector except ImportError: print("No C implementation of PVector available, terminating") s...
""" Script to try do detect any memory leaks that may be lurking in the C implementation of the PVector. """ import inspect import sys import time import memory_profiler import vector_test try: from pvectorc import pvector except ImportError: print("No C implementation of PVector available, terminating") s...
Improve memory error detection for less false positives
Improve memory error detection for less false positives
Python
mit
tobgu/pyrsistent,jkbjh/pyrsistent,Futrell/pyrsistent,tobgu/pyrsistent,jml/pyrsistent,jml/pyrsistent,tobgu/pyrsistent,jkbjh/pyrsistent,Futrell/pyrsistent,jkbjh/pyrsistent,Futrell/pyrsistent,jml/pyrsistent
ee2db892b4dafa33115779166773e248c17a1b43
kyoto/tests/test_client.py
kyoto/tests/test_client.py
import unittest import kyoto.server import kyoto.tests.dummy import kyoto.client class ServiceTestCase(unittest.TestCase): def setUp(self): self.address = ('localhost', 1337) self.server = kyoto.server.BertRPCServer([kyoto.tests.dummy]) self.server.start() self.service = kyoto.cli...
import unittest import kyoto.server import kyoto.tests.dummy import kyoto.client class ServiceTestCase(unittest.TestCase): def setUp(self): self.address = ('localhost', 1337) self.server = kyoto.server.BertRPCServer([kyoto.tests.dummy]) self.server.start() self.service = kyoto.cli...
Add valid module name test case
Add valid module name test case
Python
mit
kyoto-project/kyoto
84304d8c04f59421a76b7c070eb9bdcf58a72567
callbackLoader.py
callbackLoader.py
# -*- coding: latin-1 -*- ''' Created on 16.10.2012 @author: Teemu Pkknen ''' import imp import sys import os from qsdl.simulator.errors.ConfigurationInvalidError import ConfigurationInvalidError def get_callback_module( name ): scriptDir = os.path.dirname(os.path.realpath(__file__)) # Already loaded? ...
# -*- coding: latin-1 -*- ''' Created on 16.10.2012 @author: Teemu Pkknen ''' import imp import sys import os import ntpath from qsdl.simulator.errors.ConfigurationInvalidError import ConfigurationInvalidError def path_leaf(path): head, tail = ntpath.split(path) return tail or ntpath.basename(head) def g...
Make callback loader take into account directory names in loadable module name
Make callback loader take into account directory names in loadable module name
Python
mit
fire-uta/ir-simulation,fire-uta/ir-simulation
4a509970cb48b64046f88193efc141344437b151
tests/test_list_struct.py
tests/test_list_struct.py
import pytest from hypothesis import given from hypothesis.strategies import lists, integers, floats, one_of, composite from datatyping.datatyping import validate def test_empty(): assert validate([], []) is None @given(li=lists(integers())) def test_plain(li): assert validate([int], li) is None @given(l...
import pytest from hypothesis import given from hypothesis.strategies import lists, integers, floats, one_of, composite from datatyping.datatyping import validate def test_empty(): assert validate([], []) is None @given(li=lists(integers())) def test_plain(li): assert validate([int], li) is None @given(l...
Fix up mistakes in tests
Fix up mistakes in tests
Python
mit
Zaab1t/datatyping
3ce9f6d8537c6b6d0ec5a5e09c5f1f6b7b34699c
troposphere/eventschemas.py
troposphere/eventschemas.py
# Copyright (c) 2012-2019, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 14.1.0 from troposphere import Tags from . import AWSObject class Discoverer(AWSObject): resource_type = "A...
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 41.0.0 from troposphere import Tags from . import AWSObject from .validators import boolean class Discoverer(AW...
Update EventSchemas per 2021-09-02 changes
Update EventSchemas per 2021-09-02 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
76ed79593a832c1cf85615d21b31f18f2c7adebf
yanico/session/__init__.py
yanico/session/__init__.py
# Copyright 2015-2016 Masayuki Yamamoto # # 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 agree...
# Copyright 2015-2016 Masayuki Yamamoto # # 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 agree...
Add docstring into load function
Add docstring into load function Follow to Google style.
Python
apache-2.0
ma8ma/yanico
086e2bb85d0076c55dff886154664dc7179561fa
utils/summary_downloader.py
utils/summary_downloader.py
#!/usr/bin/env python # -*- coding: utf-8 -*- class SummaryDownloader(): # base url for official schedule json page SCHEDULE_URL_BASE = "http://statsapi.web.nhl.com/api/v1/schedule" # url template for official json gamefeed page JSON_GAME_FEED_URL_TEMPLATE = ( "http://statsapi.web.nhl.com/ap...
#!/usr/bin/env python # -*- coding: utf-8 -*- from dateutil.parser import parse from dateutil.relativedelta import DAILY from dateutil.rrule import rrule class SummaryDownloader(): # base url for official schedule json page SCHEDULE_URL_BASE = "http://statsapi.web.nhl.com/api/v1/schedule" # url template...
Add constructor to summary downloader
Add constructor to summary downloader
Python
mit
leaffan/pynhldb
50992031229ea903418935613cd5e1e561b04c91
Control/PID.py
Control/PID.py
class PID: def __init__(self, Kp=1, Ki=0.1, Kd=1, maxIntegralCorrection=0, minIntegralCorrection=-0): self.Kp = Kp # Proporiional gain self.Ki = Ki # Integral gain self.Kd = Kd # Derivative gain self.integral = 0 def incrementTime(self, error, dt): self.integral = self.integral + error*self.Ki*dt ...
class PID: def __init__(self, Kp=1, Ki=0.1, Kd=1, maxIntegralCorrection=0, minIntegralCorrection=-0): self.Kp = Kp # Proportional gain self.Ki = Ki # Integral gain self.Kd = Kd # Derivative gain self.integral = 0 def incrementTime(self, error, dt): self.integral = self.integral + error*self.Ki*dt d...
Correct typing error and arrange indentation
Correct typing error and arrange indentation
Python
mit
baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite
5162275b9b6136f2b97d195384bb9979a0d79bfc
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python import platform import sys BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '9f5271d31e0f32eac5a20ef6f543e3f1d43ad645' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', ...
#!/usr/bin/env python import platform import sys BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '56984fa0e4c3c745652510f342c0fb2724d846c2' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', ...
Upgrade libchromiumcontent for dbus headers
Upgrade libchromiumcontent for dbus headers
Python
mit
ianscrivener/electron,chriskdon/electron,yalexx/electron,subblue/electron,nekuz0r/electron,systembugtj/electron,trankmichael/electron,posix4e/electron,bitemyapp/electron,beni55/electron,mrwizard82d1/electron,Faiz7412/electron,rajatsingla28/electron,tomashanacek/electron,kokdemo/electron,darwin/electron,vipulroxx/electr...
335abda444cbd5651af0d9a298570144627c7022
passwordless/utils.py
passwordless/utils.py
import os import random import uuid from django.contrib.auth.hashers import make_password,is_password_usable from django.utils import timezone from datetime import timedelta WORDLIST_FILE = os.path.join(os.path.dirname(__file__), 'wordlist.txt') def make_token(): """ Generate a random token suitable for a...
import os import random import uuid from django.utils import timezone from datetime import timedelta WORDLIST_FILE = os.path.join(os.path.dirname(__file__), 'wordlist.txt') def make_token(): """ Generate a random token suitable for activation/confirmation via email A hex-encoded random UUID has plent...
Return app passwords as string
Return app passwords as string
Python
mit
Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters
f59919efefb78fffff564ec17c55f6df644e8d7e
server/lib/python/cartodb_services/cartodb_services/here/__init__.py
server/lib/python/cartodb_services/cartodb_services/here/__init__.py
from cartodb_services.here.geocoder import HereMapsGeocoder from cartodb_services.here.bulk_geocoder import HereMapsBulkGeocoder from cartodb_services.here.routing import HereMapsRoutingIsoline
from cartodb_services.here.geocoder import HereMapsGeocoder, HereMapsGeocoderV7 from cartodb_services.here.bulk_geocoder import HereMapsBulkGeocoder, HereMapsBulkGeocoderV7 from cartodb_services.here.service_factory import get_geocoder, get_bulk_geocoder, get_routing_isoline from cartodb_services.here.routing import He...
Add new imports for apikey parameter support
Add new imports for apikey parameter support
Python
bsd-3-clause
CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/geocoder-api,CartoDB/geocoder-api,CartoDB/geocoder-api,CartoDB/geocoder-api
a6405ccfc7f53f601088206c216c5167fd86359f
symposion/teams/backends.py
symposion/teams/backends.py
from django.db.models import Q from .models import Team class TeamPermissionsBackend(object): def authenticate(self, username=None, password=None): return None def get_team_permissions(self, user_obj, obj=None): """ Returns a set of permission strings that this user has through his/...
from django.db.models import Q from .models import Team class TeamPermissionsBackend(object): def authenticate(self, username=None, password=None): return None def get_team_permissions(self, user_obj, obj=None): """ Returns a set of permission strings that this user has through his/...
Fix team permissions backend not pulling out manager_permissions
Fix team permissions backend not pulling out manager_permissions Something like request.user.has_perm('reviews.can_manage_%s' % proposal.kind.section.slug) Will aways return false as the backend does a lookup of team membership (member or manager) but only grabs the 'permissions' and not the 'manager_permissions' fie...
Python
bsd-3-clause
pyconau2017/symposion,pyconau2017/symposion
23072e882edb6da55cb12ef0591a786235249670
ome/__main__.py
ome/__main__.py
# ome - Object Message Expressions # Copyright (c) 2015-2016 Luke McCarthy <luke@iogopro.co.uk>. All rights reserved. import sys from .command import command_args from .error import OmeError from .terminal import stderr def main(): stderr.reset() try: from . import compiler target = compiler.g...
# ome - Object Message Expressions # Copyright (c) 2015-2016 Luke McCarthy <luke@iogopro.co.uk>. All rights reserved. import sys from .command import command_args from .error import OmeError from .terminal import stderr def print_verbose(*args, **kwargs): if command_args.verbose: print(*args, **kwargs) d...
Use print_verbose for conditional printing.
Use print_verbose for conditional printing.
Python
mit
shaurz/ome,shaurz/ome
1bf4116bbd449769d209c4ff98b609b72bd312aa
api/views.py
api/views.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.models import User from rest_framework import viewsets from core.models import Timesheet, Task, Entry from .serializers import (UserSerializer, TimesheetSerializer, TaskSerializer, EntrySerializer) cl...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.models import User from rest_framework import viewsets import django_filters from core.models import Timesheet, Task, Entry from .serializers import (UserSerializer, TimesheetSerializer, TaskSerializer, ...
Add date min-max filtering to API
Add date min-max filtering to API
Python
bsd-2-clause
Leahelisabeth/timestrap,muhleder/timestrap,cdubz/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,overshard/timestrap,overshard/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,cdubz/timestrap,Leahelisabeth/timestrap,overshard/timestrap,cdubz/timestrap
b5e11827929f37da8d18616f1fb3fc2d62591515
djangocms_spa/decorators.py
djangocms_spa/decorators.py
from functools import wraps from django.conf import settings from django.core.cache import cache from django.template.response import ContentNotRenderedError from django.utils.decorators import available_attrs def cache_view(view_func): @wraps(view_func, assigned=available_attrs(view_func)) def _wrapped_view...
from functools import wraps from django.conf import settings from django.core.cache import cache from django.template.response import ContentNotRenderedError from django.utils.decorators import available_attrs def cache_view(view_func): @wraps(view_func, assigned=available_attrs(view_func)) def _wrapped_view...
Add language code to cache key explicitly
[language_activation] Add language code to cache key explicitly
Python
mit
dreipol/djangocms-spa,dreipol/djangocms-spa
e0aab62f2a693ca20a81c9e55c4220f379ac9eb1
socialregistration/templatetags/socialregistration_tags.py
socialregistration/templatetags/socialregistration_tags.py
from django import template register = template.Library() @register.tag def social_csrf_token(): """ Wrapper around the ``{% csrf_token %}`` template tag to make socialregistration work with both Django v1.2 and Django < v1.2 """ return CsrfNode() class CsrfNode(template.Node): def render...
from django import template register = template.Library() @register.tag def social_csrf_token(parser, token): """ Wrapper around the ``{% csrf_token %}`` template tag to make socialregistration work with both Django v1.2 and Django < v1.2 """ return CsrfNode() class CsrfNode(template.Node): ...
Add necessary arguments to the social_csrf_token tag.
Add necessary arguments to the social_csrf_token tag.
Python
mit
praekelt/django-socialregistration,aditweb/django-socialregistration,minlex/django-socialregistration,kapt/django-socialregistration,coxmediagroup/django-socialregistration,aditweb/django-socialregistration,flashingpumpkin/django-socialregistration,mark-adams/django-socialregistration,mark-adams/django-socialregistrati...
09ec6e4611a763e823a5e3d15fb233a0132fd06b
imagersite/imagersite/tests.py
imagersite/imagersite/tests.py
from django.test import Client, TestCase from django.contrib.auth.models import User HOME = '/' REGISTER = '/accounts/register/' LOGIN = '/login' LOGOUT = '/logout' class UnauthenticatedUser(TestCase): """Create unauth user for testing.""" def setUp(self): """Setup unauth user.""" client = C...
"""Tests for project level urls and views.""" from __future__ import unicode_literals from django.contrib.staticfiles import finders from django.test import Client, TestCase from django.contrib.auth.models import User HOME = '/' REGISTER = '/accounts/register/' LOGIN = '/login' LOGOUT = '/logout' DEFAULT_IMAGE = finde...
Add passing test for default image
Add passing test for default image
Python
mit
SeleniumK/django-imager,SeleniumK/django-imager,SeleniumK/django-imager
178c25714aaae056c115f1580f19d833486a54ac
datapipe/targets/objects.py
datapipe/targets/objects.py
from ..target import Target import hashlib import dill import joblib class PyTarget(Target): def __init__(self, name, obj=None): self._name = name self._obj = obj super(PyTarget, self).__init__() if not obj is None: self.set(obj) def identifier(self): return...
from ..target import Target import hashlib import dill import joblib class PyTarget(Target): def __init__(self, name, obj=None): self._name = name self._obj = obj super(PyTarget, self).__init__() if not obj is None: self.set(obj) def identifier(self): return...
Make PyTarget object work again
Make PyTarget object work again We now save a base64 encoded pickled version of the object.
Python
mit
ibab/datapipe
4d3f809ba5e1b5109e6f2e73d9c9630371660210
Bookie/bookie/lib/access.py
Bookie/bookie/lib/access.py
"""Handle auth and authz activities in bookie""" from pyramid.httpexceptions import HTTPForbidden class Authorize(object): """Context manager to check if the user is authorized use: with Authorize(some_key): # do work Will return NotAuthorized if it fails """ def __init__(s...
"""Handle auth and authz activities in bookie""" import logging from pyramid.httpexceptions import HTTPForbidden LOG = logging.getLogger(__name__) class Authorize(object): """Context manager to check if the user is authorized use: with Authorize(some_key): # do work Will return Not...
Update to make sure we log an error with an invalid key
Update to make sure we log an error with an invalid key
Python
agpl-3.0
GreenLunar/Bookie,adamlincoln/Bookie,wangjun/Bookie,bookieio/Bookie,GreenLunar/Bookie,teodesson/Bookie,adamlincoln/Bookie,pombredanne/Bookie,bookieio/Bookie,teodesson/Bookie,adamlincoln/Bookie,GreenLunar/Bookie,wangjun/Bookie,wangjun/Bookie,skmezanul/Bookie,wangjun/Bookie,GreenLunar/Bookie,skmezanul/Bookie,adamlincoln/...
0389fabdb0343b189b153cc909b05e88d3830b94
downstream_node/lib/node.py
downstream_node/lib/node.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from downstream_node.config import config from downstream_node.models import Challenges from heartbeat import Heartbeat from downstream_node.startup import db __all__ = ['create_token', 'delete_token', 'add_file', 'remove_file', 'gen_challenges', 'update_chall...
#!/usr/bin/env python # -*- coding: utf-8 -*- from downstream_node.config import config from downstream_node.models import Challenges, Files from heartbeat import Heartbeat from downstream_node.startup import db __all__ = ['create_token', 'delete_token', 'add_file', 'remove_file', 'gen_challenges', 'updat...
Fix for new column names
Fix for new column names
Python
mit
Storj/downstream-node,Storj/downstream-node
efc1988d704a7a1231046dea8af65dcdba7897fd
py/fbx_write.py
py/fbx_write.py
# !/usr/bin/env python # Blender has moved to Python 3! import sys import os import bpy for sysarg in sys.argv: print(sysarg) py_args = sys.argv[sys.argv.index('--') + 1] py_args = py_args.split(' ') for arg in py_args: if (arg.startswith('basedir:')): basedir = arg.split('basedir:')[1] else: ...
# !/usr/bin/env python # Blender has moved to Python 3! import sys import os import bpy for sysarg in sys.argv: print(sysarg) py_args = sys.argv[sys.argv.index('--') + 1] py_args = py_args.split(' ') for arg in py_args: if (arg.startswith('basedir:')): basedir = arg.split('basedir:')[1] else: ...
Quit Blender after writing FBX
Quit Blender after writing FBX
Python
mit
hackmcr15-code-a-la-mode/mol-vis-hack,hackmcr15-code-a-la-mode/mol-vis-hack
c3c703b411d05e6f2d52a0b3695b9dc22bc907d8
test/test_main.py
test/test_main.py
from mpf.main import main def test_main(): main()
import matplotlib matplotlib.use('Agg') # Not to use X server. For TravisCI. from mpf.main import main def test_main(): main()
Make matplotlib work with TravisCI
Make matplotlib work with TravisCI
Python
mit
Vayel/MPF,tartopum/MPF
1a5aeabcdfae02125e167e8a221de4151819f5b5
test.py
test.py
import unittest from enigma import Enigma, Steckerbrett, Umkehrwalze, Walzen class RotorTestCase(unittest.TestCase): def test_rotor_encoding(self): rotor = Walzen(wiring='EKMFLGDQVZNTOWYHXUSPAIBRCJ', notch='Q') self.assertEqual('E', rotor.encode('A')) def run_tests(): runner = unittest.Text...
import unittest from enigma import Enigma, Steckerbrett, Umkehrwalze, Walzen class RotorTestCase(unittest.TestCase): def test_rotor_encoding(self): rotor = Walzen(wiring='EKMFLGDQVZNTOWYHXUSPAIBRCJ', notch='Q') self.assertEqual('E', rotor.encode('A')) def test_rotor_reverse_encoding(self): ...
Test if default rotor encodes backwards properly
Test if default rotor encodes backwards properly
Python
mit
ranisalt/enigma
6160da958f4b8ecb1553c7bcca0b32bc1a5a1649
tests/conftest.py
tests/conftest.py
import os import shutil import tempfile import builtins import subprocess import pytest from rever import environ @pytest.fixture def gitrepo(request): """A test fixutre that creates and destroys a git repo in a temporary directory. This will yield the path to the repo. """ cwd = os.getcwd() ...
import os import shutil import tempfile import builtins import subprocess import pytest import sys from rever import environ @pytest.fixture def gitrepo(request): """A test fixutre that creates and destroys a git repo in a temporary directory. This will yield the path to the repo. """ cwd = os.g...
Make sure .git test directory is removed on Windows
Make sure .git test directory is removed on Windows
Python
bsd-3-clause
scopatz/rever,ergs/rever
c4e71b56e74ab8b81a670c690fef6942d4a412b4
ocds/storage/backends/fs.py
ocds/storage/backends/fs.py
import os import os.path import logging import datetime from .base import Storage from ocds.storage.errors import InvalidPath logger = logging.getLogger(__name__) class FSStorage(Storage): def __init__(self, base_path): self.base_path = base_path if not os.path.exists(self.base_path): ...
import os import os.path import logging import datetime import simplejson as json from .base import Storage from ocds.export.helpers import encoder from ocds.storage.errors import InvalidPath join = os.path.join logger = logging.getLogger(__name__) class FSStorage(Storage): def __init__(self, base_path): ...
Add basic file system storage
Add basic file system storage
Python
apache-2.0
yshalenyk/openprocurement.ocds.export,yshalenyk/ocds.storage,yshalenyk/ocds.export,yshalenyk/openprocurement.ocds.export
2ccfb54f493bf0ffa07db910514a8429a2c51d73
changes/api/node_job_index.py
changes/api/node_job_index.py
from __future__ import absolute_import from sqlalchemy.orm import joinedload from changes.api.base import APIView from changes.api.serializer.models.job import JobWithBuildSerializer from changes.models import Job, JobStep, Node class NodeJobIndexAPIView(APIView): def get(self, node_id): node = Node.que...
from __future__ import absolute_import from sqlalchemy.orm import joinedload from changes.api.base import APIView from changes.models import Build, Job, JobStep, Node class NodeJobIndexAPIView(APIView): def get(self, node_id): node = Node.query.get(node_id) if node is None: return ''...
Improve query patterns on node job list
Improve query patterns on node job list
Python
apache-2.0
wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes
8beaab317d5da25edd093be42f57e35ac12408b8
feincms3/plugins/html.py
feincms3/plugins/html.py
""" Plugin providing a simple textarea where raw HTML, CSS and JS code can be entered. Most useful for people wanting to shoot themselves in the foot. """ from django.db import models from django.utils.html import mark_safe from django.utils.translation import ugettext_lazy as _ from content_editor.admin import Cont...
""" Plugin providing a simple textarea where raw HTML, CSS and JS code can be entered. Most useful for people wanting to shoot themselves in the foot. """ from django import forms from django.db import models from django.utils.html import mark_safe from django.utils.translation import ugettext_lazy as _ from content...
Make the default HTML textarea smaller
Make the default HTML textarea smaller
Python
bsd-3-clause
matthiask/feincms3,matthiask/feincms3,matthiask/feincms3
614f83d826c51a51ebb4feb01371a441473af423
featureflow/__init__.py
featureflow/__init__.py
__version__ = '1.16.14' from model import BaseModel from feature import Feature, JSONFeature, TextFeature, CompressedFeature, \ PickleFeature from extractor import Node, Graph, Aggregator, NotEnoughData from bytestream import ByteStream, ByteStreamFeature, ZipWrapper, iter_zip from data import \ IdProvider...
__version__ = '1.16.14' from model import BaseModel from feature import Feature, JSONFeature, TextFeature, CompressedFeature, \ PickleFeature from extractor import Node, Graph, Aggregator, NotEnoughData from bytestream import ByteStream, ByteStreamFeature, ZipWrapper, iter_zip from data import \ IdProvider...
Add PickleEncoder to the public API
Add PickleEncoder to the public API
Python
mit
JohnVinyard/featureflow,JohnVinyard/featureflow
d087e0cc47697e6b7f222de90a4143e3bb612a66
radar/models/forms.py
radar/models/forms.py
from sqlalchemy import Column, Integer, ForeignKey, String from sqlalchemy.orm import relationship from sqlalchemy.dialects import postgresql from radar.database import db from radar.models.common import uuid_pk_column, MetaModelMixin, patient_id_column, patient_relationship from radar.models.logs import log_cha...
from sqlalchemy import Column, Integer, ForeignKey, String from sqlalchemy.orm import relationship from sqlalchemy.dialects import postgresql from radar.database import db from radar.models.common import uuid_pk_column, MetaModelMixin, patient_id_column, patient_relationship from radar.models.logs import log_cha...
Add index on patient id
Add index on patient id
Python
agpl-3.0
renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar
e00fb0d87b60a982c2d932864a67a70e7d5b4312
src/apps/rDSN.monitor/rDSN.Monitor.py
src/apps/rDSN.monitor/rDSN.Monitor.py
import sys import os import threading import time sys.path.append(os.getcwd() + '/app_package') from MonitorApp import * def start_dsn(): service_app = ServiceApp() app_dict['monitor'] = MonitorService service_app.register_app('monitor') if len(sys.argv) < 2: #rDSN.Monitor run as an embedded s...
import sys import os import threading sys.path.append(os.getcwd() + '/app_package') from MonitorApp import * def start_dsn(): service_app = ServiceApp() app_dict['monitor'] = MonitorService service_app.register_app('monitor') if len(sys.argv) < 2: #rDSN.Monitor run as an embedded service ...
Replace sleep() with wait() forever after monitor registers, this ensures the python interpreter alive before app starts
Replace sleep() with wait() forever after monitor registers, this ensures the python interpreter alive before app starts
Python
mit
mcfatealan/rDSN.Python,rDSN-Projects/rDSN.Python,mcfatealan/rDSN.Python,mcfatealan/rDSN.Python,rDSN-Projects/rDSN.Python,mcfatealan/rDSN.Python,rDSN-Projects/rDSN.Python,rDSN-Projects/rDSN.Python,rDSN-Projects/rDSN.Python,mcfatealan/rDSN.Python
6a4e16f9afa373233c03cc8f1ede7076e9a44058
basics/utils.py
basics/utils.py
import numpy as np def arctan_transform(array, thresh): return np.arctan(array/thresh)
import numpy as np from functools import partial def arctan_transform(array, thresh): return np.arctan(array/thresh) def dist_uppertri(cond_arr, shape): dist_arr = np.zeros((shape, ) * 2, dtype=cond_arr.dtype) def unrav_ind(i, j, n): return n*j - j*(j+1)/2 + i - 1 - j arr_ind = partial(un...
Convert a condensed distance matrix (pdist) into an upper triangular matrix
Convert a condensed distance matrix (pdist) into an upper triangular matrix
Python
mit
e-koch/BaSiCs
e97dee6ec7c49cf3d33803504c7269a41c4d0a0f
authentication_app/views.py
authentication_app/views.py
from django.shortcuts import render from django.http import HttpResponse from .models import Greeting # Create your views here. def index(request): return HttpResponse('Hello from Python!') def db(request): greeting = Greeting() greeting.save() greetings = Greeting.objects.all() return render...
from rest_framework import permissions, viewsets from authentication_app.models import Account from authentication_app.permissions import IsAccountOwner from authentication_app.serializers import AccountSerializer ''' @name : AccountViewSerializer @desc : Defines the serializer for the account view. ''' class...
Add the view serializer for the account model.
Add the view serializer for the account model.
Python
mit
mvpgomes/shopit-app,mvpgomes/shopit-app,mvpgomes/shopit-app,mvpgomes/shopit-app
261fb861015ee96771e4c387bcd2b2c7d5c369db
hellopython/__init__.py
hellopython/__init__.py
__version__ = '1.0.0' from story.story import BaseStory from . import print_method class Story(BaseStory): name = 'hellopython' adventures = [ print_method ]
__version__ = '1.0.0' from story.story import BaseStory from . import print_method class Story(BaseStory): name = 'hellopython' title = 'Introuction to python' adventures = [ print_method ]
Add a title to the story the story
Add a title to the story the story
Python
mit
pyschool/hipyschool
8d11c6854e9c2309abb74a2e4b960a5206a27a0c
funbox/iterators_ordered.py
funbox/iterators_ordered.py
#! /usr/bin/env python """Functions on iterators, optimised for case when iterators are sorted. Note sift_o is hidden as _sift_o at the moment because it is broken. Please don't use it. Once fixed, I'll remove the leading underscore again. """ import itertools import iterators def partition_o(left_function, items):...
#! /usr/bin/env python """Functions on iterators, optimised for case when iterators are sorted. """ import itertools import iterators def partition_o(left_function, items): """Return a pair of iterators: left and right Items for which left_function returns a true value go into left. Items for which left...
Remove reference in docs to removed function.
Remove reference in docs to removed function.
Python
mit
nmbooker/python-funbox,nmbooker/python-funbox
276df9f8fbb5ad15fd768db6a13040a37037e7d6
service/urls.py
service/urls.py
from django.conf.urls import url, include from rest_framework import routers import service.authors.views import service.friendrequest.views import service.users.views import service.posts.views router = routers.DefaultRouter() router.register(r'users', service.users.views.UserViewSet) router.register(r'nodes', servi...
from django.conf.urls import url, include from rest_framework import routers import service.authors.views import service.friendrequest.views import service.users.views import service.nodes.views import service.posts.views router = routers.DefaultRouter() router.register(r'users', service.users.views.UserViewSet) rout...
Add missing Node view import
Add missing Node view import
Python
apache-2.0
TeamAADGT/CMPUT404-project-socialdistribution,TeamAADGT/CMPUT404-project-socialdistribution,TeamAADGT/CMPUT404-project-socialdistribution
73d22cc63a2a37bd3c99774bf098ca12c81d54ae
funnels.py
funnels.py
import pyglet from levels import GameOver, IntroScreen, TheGame from levels.levels import Levels window = pyglet.window.Window()#fullscreen=True) levels = Levels([IntroScreen(window), TheGame(window), GameOver(window)]) pyglet.clock.schedule(levels.clock) @window.event def on_key_press(symbol, modifiers): levels....
import pyglet import argparse from levels import GameOver, IntroScreen, TheGame from levels.levels import Levels def main(fullscreen): window = pyglet.window.Window(fullscreen=fullscreen) levels = Levels([IntroScreen(window), TheGame(window), GameOver(window)]) pyglet.clock.schedule(levels.clock) @window.eve...
Add argparse to turn on/off fullscreen behavior
Add argparse to turn on/off fullscreen behavior
Python
mit
simeonf/claire
96bcf7f55a50895dead660add9fc949af197f550
networking_sfc/tests/functional/services/sfc/agent/extensions/test_ovs_agent_sfc_extension.py
networking_sfc/tests/functional/services/sfc/agent/extensions/test_ovs_agent_sfc_extension.py
# Copyright (c) 2016 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
# Copyright (c) 2016 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
Fix extension loading functional test
Fix extension loading functional test Call the agent _report_state() before checking the report state itself Change-Id: Idbf552d5ca5968bc95b0a3c395499c3f2d215729 Closes-Bug: 1658089
Python
apache-2.0
openstack/networking-sfc,openstack/networking-sfc
887adb2d388a3cffbc30ec0243a6b1d3797bfeb7
dashboard/src/repositories.py
dashboard/src/repositories.py
"""List of repositories to check.""" repositories = [ "fabric8-analytics-common", "fabric8-analytics-server", "fabric8-analytics-worker", "fabric8-analytics-jobs", "fabric8-analytics-tagger", "fabric8-analytics-stack-analysis", "fabric8-analytics-license-analysis", "fabric8-analytics-da...
"""List of repositories to check.""" repositories = [ "fabric8-analytics-common", "fabric8-analytics-server", "fabric8-analytics-worker", "fabric8-analytics-jobs", "fabric8-analytics-tagger", "fabric8-analytics-stack-analysis", "fabric8-analytics-license-analysis", "fabric8-analytics-da...
Add new repo into repolist
Add new repo into repolist
Python
apache-2.0
tisnik/fabric8-analytics-common,tisnik/fabric8-analytics-common,tisnik/fabric8-analytics-common
ecce15f103b51ece25f33490af5adaa666017a86
booksite/urls.py
booksite/urls.py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.tale_list, name='tale_list'), url(r'^create-book/(?P<tale_id>[0-9]+)$', views.create_book, name='create_book'), ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.tale_list, name='tale_list'), url(r'^create-tale/(?P<tale_id>[0-9]+)$', views.create_tale, name='create_tale'), ]
Rename links from *book* to *tale*
Rename links from *book* to *tale*
Python
apache-2.0
mark-graciov/bookit,mark-graciov/bookit
200523d20333c17117539552ac9fb51c9f677543
irrigator_pro/home/views.py
irrigator_pro/home/views.py
#! /usr/bin/env python2.7 from django.views.generic import TemplateView class HomeView(TemplateView): template_name = 'home.html' def get(self, request, *args, **kwargs): context = { 'some_dynamic_value': 'Now available as a web application!', } return self.render_to_respon...
#! /usr/bin/env python2.7 from django.views.generic import TemplateView class HomeView(TemplateView): template_name = 'home.html' def get(self, request, *args, **kwargs): context = { 'some_dynamic_value': 'Coming soon as a web application!', } return self.render_to_response...
Change subtext on main page
Change subtext on main page
Python
mit
warnes/irrigatorpro,warnes/irrigatorpro,warnes/irrigatorpro,warnes/irrigatorpro
f2e4e7114c61550e5ff6cd690c7a60d71de74ad4
apps/urls.py
apps/urls.py
# -*- coding: utf-8 -*- from django.conf.urls.defaults import patterns, include, url from django.conf import settings from django.contrib.staticfiles.urls import staticfiles_urlpatterns from cronos.announcements.feeds import AnnouncementsFeed feeds = { 'announcements': AnnouncementsFeed, } handler500 = 'cronos.l...
# -*- coding: utf-8 -*- #from apps.announcements.feeds import AnnouncementsFeed from django.conf.urls.defaults import patterns, include, url from django.conf import settings from django.contrib.staticfiles.urls import staticfiles_urlpatterns #feeds = { # 'announcements': AnnouncementsFeed, #} handler500 = 'apps.l...
Disable feeds/announcements temporarily, it should be back alive now
Disable feeds/announcements temporarily, it should be back alive now
Python
agpl-3.0
LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr
a1200d38f4ba1b3f2d4570d9fd4d56c1e006eb83
tests/mpd/protocol/test_connection.py
tests/mpd/protocol/test_connection.py
from __future__ import absolute_import, unicode_literals from mock import patch from tests.mpd import protocol class ConnectionHandlerTest(protocol.BaseTestCase): def test_close_closes_the_client_connection(self): with patch.object(self.session, 'close') as close_mock: self.send_request('clo...
from __future__ import absolute_import, unicode_literals from mock import patch from tests.mpd import protocol class ConnectionHandlerTest(protocol.BaseTestCase): def test_close_closes_the_client_connection(self): with patch.object(self.session, 'close') as close_mock: self.send_request('clo...
Fix typo in mock usage
tests: Fix typo in mock usage The error was made evident by a newer mock version that no longer swallowed the wrong assert as regular use of a spec-less mock.
Python
apache-2.0
jcass77/mopidy,tkem/mopidy,ali/mopidy,mokieyue/mopidy,quartz55/mopidy,hkariti/mopidy,pacificIT/mopidy,quartz55/mopidy,dbrgn/mopidy,dbrgn/mopidy,mokieyue/mopidy,jmarsik/mopidy,pacificIT/mopidy,jodal/mopidy,mopidy/mopidy,bacontext/mopidy,dbrgn/mopidy,diandiankan/mopidy,vrs01/mopidy,bacontext/mopidy,jcass77/mopidy,benceva...
c97dc5e977e57df26962a1f3e7bf0dc4b3440508
kaleo/views.py
kaleo/views.py
from django import http from django.utils import simplejson as json from django.views.decorators.http import require_http_methods from account.models import EmailAddress from kaleo.forms import InviteForm from kaleo.models import JoinInvitation @require_http_methods(["POST"]) def invite(request): if not request...
import json from django import http from django.views.decorators.http import require_POST from account.models import EmailAddress from django.contrib.auth.decorators import login_required from kaleo.forms import InviteForm from kaleo.models import JoinInvitation @login_required @require_POST def invite(request): ...
Update view to use different imports/decorators
Update view to use different imports/decorators 1. We can generally expect the json module to be available now, so no need to use what ships with django 2. require_POST is just simpler and more direct 3. Using login_required is clearer as well instead of using custom logic.
Python
bsd-3-clause
rizumu/pinax-invitations,pinax/pinax-invitations,ntucker/kaleo,jacobwegner/pinax-invitations,eldarion/kaleo,abramia/kaleo,JPWKU/kaleo
3139ae7dceb3605e70db2cbcde0d732dcb68bc2a
serfnode/handler/config.py
serfnode/handler/config.py
import os import uuid from mischief.actors.pipe import get_local_ip import yaml def read_serfnode_yml(): with open('/serfnode.yml') as input: conf = yaml.load(input) or {} return conf.get('serfnode') or {} yml = read_serfnode_yml() role = os.environ.get('ROLE') or yml.get('ROLE') or 'no_role'...
import os import uuid from mischief.actors.pipe import get_local_ip import yaml def read_serfnode_yml(): with open('/serfnode.yml') as input: conf = yaml.load(input) or {} return conf.get('serfnode') or {} yml = read_serfnode_yml() role = os.environ.get('ROLE') or yml.get('role') or 'no_role'...
Make yaml fields lowercase in serfnode section
Make yaml fields lowercase in serfnode section
Python
mit
waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode
2f863726c246982a5ce6f34219b530a7236abcd9
server/adventures/tests.py
server/adventures/tests.py
from django.test import TestCase from .models import Author, Publisher, Edition, Setting, Adventure class AuthorTests(TestCase): def test_create_author(self): gygax = Author.objects.create(name='Gary Gygax') self.assertEqual(Author.objects.first(), gygax) self.assertEqual(Author.objects.co...
from django.test import TestCase from .models import Author, Publisher, Edition, Setting, Adventure class AuthorTests(TestCase): def test_create_author(self): gygax = Author.objects.create(name='Gary Gygax') self.assertEqual(Author.objects.first(), gygax) self.assertEqual(Author.objects.co...
Add Edition model creation test
Add Edition model creation test
Python
mit
petertrotman/adventurelookup,petertrotman/adventurelookup,petertrotman/adventurelookup,petertrotman/adventurelookup
c501bba28d4a77ba03f6f1277be13913307f04e1
clowder/utility/print_utilities.py
clowder/utility/print_utilities.py
"""Print utilities""" import os import emoji from termcolor import colored from clowder.utility.git_utilities import ( git_current_sha, git_current_branch, git_is_detached, git_is_dirty ) def print_project_status(root_directory, path, name): """Print repo status""" repo_path = os.path.join(root...
"""Print utilities""" import os import emoji from termcolor import colored, cprint from clowder.utility.git_utilities import ( git_current_sha, git_current_branch, git_is_detached, git_is_dirty ) def print_project_status(root_directory, path, name): """Print repo status""" repo_path = os.path.j...
Print project name even if it doesn't exist on disk
Print project name even if it doesn't exist on disk
Python
mit
JrGoodle/clowder,JrGoodle/clowder,JrGoodle/clowder
16169dbe2fe392197e9a926e572bb3fc704ef2bd
generator/test/runner.py
generator/test/runner.py
#!/usr/bin/env python3 """ Main entry point to run all tests """ import sys from pathlib import Path from unittest import TestLoader, TestSuite, TextTestRunner PATH = Path(__file__).absolute() sys.path.append(PATH.parents[1].joinpath('rpc_spec/InterfaceParser').as_posix()) sys.path.append(PATH.parents[1].as_posix()) ...
#!/usr/bin/env python3 """ Main entry point to run all tests """ import sys from pathlib import Path from unittest import TestLoader, TestSuite, TextTestRunner PATH = Path(__file__).absolute() sys.path.append(PATH.parents[1].joinpath('rpc_spec/InterfaceParser').as_posix()) sys.path.append(PATH.parents[1].as_posix()) ...
Exit with 1 when the RPC generator tests fail
Exit with 1 when the RPC generator tests fail
Python
bsd-3-clause
smartdevicelink/sdl_android
2dd484154d25351079da5eaa84cb2d1a0224ce53
Instanssi/admin_base/views.py
Instanssi/admin_base/views.py
# -*- coding: utf-8 -*- from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required @login_required(login_url='/control/auth/login/') def index(request): return HttpResponseRedirect("/control/events/") @login_required(login_url='/control/auth/login/') def eventchang...
# -*- coding: utf-8 -*- from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required from Instanssi.admin_base.misc.eventsel import get_selected_event @login_required(login_url='/control/auth/login/') def index(request): # Select latest event as default print get_sele...
Select latest event when logged in.
admin_base: Select latest event when logged in.
Python
mit
Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org
c6fb5b4361101148a300049de862b90a7d74c6be
base/urls.py
base/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin from components.views import SiteView # Uncomment the next two lines to enable the admin: # admin.autodiscover() urlpatterns = patterns('', url(r'^$', name='site-home', view=SiteView.as_view()), url(r'^', include('component...
from django.conf.urls import patterns, include, url from django.contrib import admin from components.views import SiteView # Uncomment the next two lines to enable the admin: # admin.autodiscover() urlpatterns = patterns('', url(r'^$', name='site-home', view=SiteView.as_view()), url(r'^', include('component...
Add people and music to the main URL configuration.
Add people and music to the main URL configuration.
Python
apache-2.0
hello-base/web,hello-base/web,hello-base/web,hello-base/web
a6c991e2519edeb0a644e83b93242c7312b9e700
localore/search/views.py
localore/search/views.py
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.http import JsonResponse from django.shortcuts import render from wagtail.wagtailcore.models import Page from wagtail.wagtailsearch.models import Query def search(request): do_json = 'json' in request.GET search_query = requ...
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.http import JsonResponse from django.shortcuts import render from wagtail.wagtailcore.models import Page from wagtail.wagtailsearch.models import Query def search(request): do_json = 'json' in request.GET search_query = requ...
Add content_type to search results JSON.
Add content_type to search results JSON.
Python
mpl-2.0
ghostwords/localore,ghostwords/localore,ghostwords/localore