commit stringlengths 40 40 | old_file stringlengths 4 264 | new_file stringlengths 4 264 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 624 | message stringlengths 15 4.7k | lang stringclasses 3
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
cd2e527f86427257de0686269e6b3a9d74314249 | thunderdome_logging/utils.py | thunderdome_logging/utils.py | # Copyright (c) 2012-2013 SHIFT.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, dist... | Add Utility Method For Retrieving Error Vertices | Add Utility Method For Retrieving Error Vertices
| Python | mit | StartTheShift/thunderdome-logging,StartTheShift/thunderdome-logging | |
8f72e083e436198adcf113cb0abaa8af96f8caf1 | vigir_ltl_specification/test/unit/ts_specification_test.py | vigir_ltl_specification/test/unit/ts_specification_test.py | #!/usr/bin/env python
import unittest
from vigir_ltl_specification.ts_specification import *
class SpecificationConstructionTests(unittest.TestCase):
"""Test the generation of Activation-Outcomes formulas"""
def setUp(self):
"""Gets called before every test case."""
self.spec_name = 'test'
... | Add unit tests for ts_specification | [vigir_ltl_specification][test] Add unit tests for ts_specification
| Python | bsd-3-clause | team-vigir/vigir_behavior_synthesis,team-vigir/vigir_behavior_synthesis | |
4601de20b49245f088bdab69d5e7d429841cf345 | popit/migrations/0058_auto_20170418_0745.py | popit/migrations/0058_auto_20170418_0745.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-04-18 07:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('popit', '0057_auto_20170315_0222'),
]
operations = ... | Add forgotten migration for relation related_name change | Add forgotten migration for relation related_name change
| Python | agpl-3.0 | Sinar/popit_ng,Sinar/popit_ng | |
e0d71d17ef62bb4e515462c2a53a5dd7172cd15d | DilipadTopicModelling/experiment_number_of_topics.py | DilipadTopicModelling/experiment_number_of_topics.py | import logging
import glob
from multiprocessing import Process
from CPTCorpus import CPTCorpus
from CPT_Gibbs import GibbsSampler
def run_sampler(corpus, nTopics, nIter, beta, out_dir):
sampler = GibbsSampler(corpus, nTopics=nTopics, nIter=nIter,
alpha=(50.0/n), beta=beta, beta_o=beta,... | Add script to run a series of experiments | Add script to run a series of experiments
The script does Gibbs sampling for different values of nTopics.
| Python | apache-2.0 | NLeSC/cptm,NLeSC/cptm | |
fafb2c00597a99947f3e7a344e97551a390bda08 | alembic/versions/5563ca9e7626_create_request_searc.py | alembic/versions/5563ca9e7626_create_request_searc.py | """Create request search column and trigger.
Revision ID: 5563ca9e7626
Revises: 30d3af507801
Create Date: 2014-03-06 13:13:52.831868
"""
# revision identifiers, used by Alembic.
revision = '5563ca9e7626'
down_revision = '30d3af507801'
from alembic import op
import sqlalchemy as sa
def upgrade():
# TODO(cj@post... | Create a searchable index on the request text field. | Create a searchable index on the request text field.
| Python | apache-2.0 | CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords | |
67153408c30726728a1bf9ec9e03ff869b306174 | conf_site/proposals/tests/test_proposal_management.py | conf_site/proposals/tests/test_proposal_management.py | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils.crypto import get_random_string
from symposion.speakers.models import Speaker
from conf_site.proposals.tests import ProposalTestCase
class ProposalSpeakerManageViewTestCase(ProposalTestCase):
"""Automated test cases... | Add automated tests for proposal_speaker_manage. | Add automated tests for proposal_speaker_manage.
| Python | mit | pydata/conf_site,pydata/conf_site,pydata/conf_site | |
1fa31c04dbd323af36a5b0cb606aa49e0b1c0359 | genome_designer/debug/modify_jbrowse_track_config.py | genome_designer/debug/modify_jbrowse_track_config.py | """Functions for manipulating JBrowse configs.
NOTE: User responsible for managing backups / not breaking anything.
"""
import json
TRACK_LIST_CONFIG = '/dep_data/temp_data/projects/3bc32fc9/ref_genomes/01166f51/jbrowse/trackList.json'
def main():
with open(TRACK_LIST_CONFIG) as fh:
config_json = json.loads(f... | Debug script to modify jbrowse track config manually. | Debug script to modify jbrowse track config manually.
| Python | mit | churchlab/millstone,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone,woodymit/millstone,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone,churchlab/millstone,churchlab/millstone,woodymit/millstone | |
d0435bdd72576b84b1add45e6871c2647706b728 | scrape-10k.py | scrape-10k.py | import csv
import time
import requests
import lxml.html
top10k = {}
for page_index in range(1, 201):
print('Requesting page {}'.format(page_index))
url = 'https://osu.ppy.sh/p/pp/'
payload = {
'm': 0, # osu! standard gamemode
'o': 1, # descending order
'page': page_index,
}
... | Add script to scrape top 10k players | Add script to scrape top 10k players
| Python | mit | Cyanogenoid/osu-modspecific-rank | |
2bda9d0e746d4abe64f0a21803fbc07e244bc96b | djconnectwise/migrations/0008_auto_20170215_1430.py | djconnectwise/migrations/0008_auto_20170215_1430.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djconnectwise', '0007_auto_20170215_1918'),
]
operations = [
migrations.AlterModelOptions(
name='company',
... | Add a migration for model meta options that should have been added earlier | Add a migration for model meta options that should have been added earlier
| Python | mit | AparatTechnologies/django-connectwise,KerkhoffTechnologies/django-connectwise,KerkhoffTechnologies/django-connectwise | |
505671b698490918fe0ea6c6dfdab8c0b25339be | tests/basics/subclass_native_containment.py | tests/basics/subclass_native_containment.py | # test containment operator on subclass of a native type
class mylist(list):
pass
class mydict(dict):
pass
class mybytes(bytes):
pass
l = mylist([1, 2, 3])
print(0 in l)
print(1 in l)
d = mydict({1:1, 2:2})
print(0 in l)
print(1 in l)
b = mybytes(b'1234')
print(0 in b)
print(b'1' in b)
| Add test for containment of a subclass of a native type. | tests/basics: Add test for containment of a subclass of a native type.
| Python | mit | MrSurly/micropython,dmazzella/micropython,infinnovation/micropython,bvernoux/micropython,selste/micropython,pfalcon/micropython,bvernoux/micropython,pozetroninc/micropython,kerneltask/micropython,torwag/micropython,infinnovation/micropython,ryannathans/micropython,pfalcon/micropython,swegener/micropython,dmazzella/micr... | |
7d998deb5cfc5dafe24f0ba21e120020ba695447 | project/scripts/data_generator.py | project/scripts/data_generator.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Add functions for generating missing data in worst case scenario absence of previous data | Add functions for generating missing data in worst case scenario absence of previous data
| Python | apache-2.0 | googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks | |
26d5b3964bbe2a42702dd90cb9274287b402d944 | labmanager/tests/integration/util.py | labmanager/tests/integration/util.py | import unittest
import time
import re
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
class IntegrationTestCase(unittest.TestCase):
"""
This class wraps Selenium. So the se... | Add first skeleton of selenium-based test | Add first skeleton of selenium-based test
| Python | bsd-2-clause | gateway4labs/labmanager,go-lab/labmanager,morelab/labmanager,morelab/labmanager,labsland/labmanager,gateway4labs/labmanager,morelab/labmanager,labsland/labmanager,labsland/labmanager,labsland/labmanager,go-lab/labmanager,porduna/labmanager,morelab/labmanager,go-lab/labmanager,go-lab/labmanager,porduna/labmanager,pordun... | |
773003b45d472807b17b41db3a96ea1795571ddf | python/ember/examples/example_cylindrical_outward.py | python/ember/examples/example_cylindrical_outward.py | #!/usr/bin/env python
"""
Outwardly-propagating cylindrical geometry for a strained lean methane flame.
The converged axial velocity profile is plotted. The stagnation point is
located at r=0.
"""
from ember import *
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
output = 'run/ex_cylindrical_... | Add example for outwardly-propagating cylindrical flame | Add example for outwardly-propagating cylindrical flame
| Python | mit | speth/ember,speth/ember,speth/ember | |
4b5650b57c28e33003795075c439632f4b2dd1e8 | user_management/models/tests/test_admin.py | user_management/models/tests/test_admin.py | from django.contrib.admin.sites import AdminSite
from django.test import TestCase
from ..admin import VerifyUserAdmin
from .factories import UserFactory
from .models import User
class VerifyUserAdminTest(TestCase):
def setUp(self):
self.site = AdminSite()
def test_create_fieldsets(self):
exp... | Add tests for VerifyUserAdmin fieldsets | Add tests for VerifyUserAdmin fieldsets
| Python | bsd-2-clause | incuna/django-user-management,incuna/django-user-management | |
5d394aa1f2df7a36a90b3dee2436ae3b5742d60e | vumi/transports/httprpc/tests/test_auth.py | vumi/transports/httprpc/tests/test_auth.py | # -*- coding: utf-8 -*-
"""Tests for vumi.transports.httprpc.auth."""
from twisted.web.resource import IResource
from twisted.cred.credentials import UsernamePassword
from twisted.cred.error import UnauthorizedLogin
from vumi.tests.helpers import VumiTestCase
from vumi.transports.httprpc.auth import HttpRpcRealm, St... | Add tests for authentication helpers. | Add tests for authentication helpers.
| Python | bsd-3-clause | harrissoerja/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,TouK/vumi,TouK/vumi,TouK/vumi | |
92bbe67fe2e5528e8d87c3f9897b8791f022f6a5 | tests/test_fileparse_api.py | tests/test_fileparse_api.py | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvnamer
#repository:http://github.com/dbr/tvnamer
#license:Creative Commons GNU GPL v2
# http://creativecommons.org/licenses/GPL/2.0/
"""Tests the FileParser API
"""
from tvnamer.utils import FileParser, EpisodeInfo, DatedEpisodeInfo, NoSeasonEpisodeInfo
... | Test FileParser returns correct object type | Test FileParser returns correct object type | Python | unlicense | m42e/tvnamer,dbr/tvnamer,lahwaacz/tvnamer | |
ab88061c78cd17913faf6249f4d70a48779b4e56 | tests/unit_test_xmile2py.py | tests/unit_test_xmile2py.py | import os
import unittest
import tempfile
from io import StringIO
from pysd.py_backend.xmile.xmile2py import translate_xmile
class TestEquationStringParsing(unittest.TestCase):
def test_multiline_equation():
with open('tests/test-models/tests/game/test_game.stmx', 'r') as stmx:
contents = s... | Test to ensure equations with line breaks are parsed correctly | Test to ensure equations with line breaks are parsed correctly
| Python | mit | JamesPHoughton/pysd | |
debcc4d639945e676fb4579f71bfa711e29e343f | src/project/word_cloud.py | src/project/word_cloud.py | import sys
from os.path import isdir, isfile
from corpus import Corpus
from lda_corpus import LDACorpus
class WordCloud(object):
def __init__(self, lda_corpus):
self.corpus = lda_corpus
def draw_topics(self):
print self.corpus
topics = self.corpus.print_topics()
print topics... | Add framework for wordcloud visualisation | Add framework for wordcloud visualisation
| Python | mit | PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project | |
8a4f814630ffd106f9711a2fb339c12c4df3efb0 | 328-Odd_Even_Linked_List.py | 328-Odd_Even_Linked_List.py | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def oddEvenList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None:
retu... | Solve 328 wtf so easy | Solve 328 wtf so easy
| Python | apache-2.0 | HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode | |
1b57a7263b4a3a5f0f124cac27d9b1324ccfe4a6 | tunacell/tests/test_simu.py | tunacell/tests/test_simu.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import print_function
import pytest
import numpy as np
import itertools
from tunacell.simu.main import SimuParams, DivisionParams, SampleInitialSize
#from tunacell.simu.ou import OUSimulation, run_ou_simulation
@pytest.fixture
def simu_params():... | Add test (work on progress) | Add test (work on progress)
| Python | mit | LeBarbouze/tunacell | |
79724ffb33766eb2b71ab6571564cc7dd77c401f | test_async.py | test_async.py | import unittest
import chainer
import chainer.links as L
import numpy as np
import async
class TestAsync(unittest.TestCase):
def setUp(self):
pass
def test_shared_link(self):
"""Check interprocess parameter sharing works if models share links
"""
head = L.Linear(2, 2)
... | Add a test for paramter sharing | Add a test for paramter sharing
| Python | mit | toslunar/chainerrl,toslunar/chainerrl | |
8c400038b02bb6d57ef27617962823023710c40a | migrations/versions/1e529bad1e38_.py | migrations/versions/1e529bad1e38_.py | """empty message
Revision ID: 1e529bad1e38
Revises: 3364d1466fac
Create Date: 2015-05-20 17:42:07.580213
"""
# revision identifiers, used by Alembic.
revision = '1e529bad1e38'
down_revision = '3364d1466fac'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | Fix FK issue in distributions table for alembic migrations | Fix FK issue in distributions table for alembic migrations
Squashed commit of the following:
commit b8cf7592d73981236df528f964c20d80f8498cea
Author: Olivier Yiptong <olivier@olivieryiptong.com>
Date: Wed May 20 17:43:05 2015 -0400
fix FK issue in distributions table
Closes #67
| Python | mpl-2.0 | tkiethanom/splice,mostlygeek/splice,oyiptong/splice,ncloudioj/splice,mostlygeek/splice,rlr/splice,mozilla/splice,oyiptong/splice,mostlygeek/splice,mozilla/splice,tkiethanom/splice,ncloudioj/splice,mozilla/splice,tkiethanom/splice,ncloudioj/splice,tkiethanom/splice,mostlygeek/splice,rlr/splice,rlr/splice,ncloudioj/splic... | |
9e7aa9ca8b4301be8c219f4ce37edb271e6cb1ba | p1tr/helpers.py | p1tr/helpers.py | """Generally useful helper functions, possibly for use in plugins."""
def humanize_time(delta):
"""
Converts a timespan provided as a datetime object into a human-readable
format.
"Inspired" by the time_ago_in_words function in P1tr Legacy.
"""
days = delta.days
minutes = delta.seconds // 6... | Add helper module with humanize_time function | Add helper module with humanize_time function
| Python | mit | howard/p1tr-tng,howard/p1tr-tng | |
fa08499661cbc92a87ff7c91c76d6227fd882617 | catalog/migrations/0017_remove_empty_orphan_courses.py | catalog/migrations/0017_remove_empty_orphan_courses.py | from django.db import migrations, models
from django.db.models import Count
def forwards(apps, schema_editor):
Course = apps.get_model("catalog", "Course")
empty_orphans = Course.objects.annotate(
docs=Count("document", distinct=True), cats=Count("categories", distinct=True)
).filter(docs=0, cats=... | Remove empty orphans while migrating | Remove empty orphans while migrating
| Python | agpl-3.0 | UrLab/DocHub,UrLab/DocHub,UrLab/beta402,UrLab/beta402,UrLab/DocHub,UrLab/DocHub,UrLab/beta402 | |
cebb99ca378bd9048351bc8f1aa25b282b21186f | client/python/samples/basic/LoggingSample.py | client/python/samples/basic/LoggingSample.py | from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from modeldb.thrift.modeldb import ModelDBService
# create connection to thrift client
host = "localhost"
port = 6543
transport = TSocket.TSocket(host, port)
# Buffering is critical. Raw sockets are... | Create sample for new functions | Create sample for new functions
| Python | mit | mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb | |
7c8dac37d4e9cfced65e1c7ec5655c3e78c8de2a | accelerator/migrations/0074_update_url_to_community.py | accelerator/migrations/0074_update_url_to_community.py | # Generated by Django 2.2.10 on 2021-11-05 12:29
from django.db import migrations
def update_url_to_community(apps, schema_editor):
people_url = "/people"
mentor_url = "/directory"
community_url = "/community"
SiteRedirectPage = apps.get_model('accelerator', 'SiteRedirectPage')
for siteredirectpage in Site... | Remove migrations that arenot relevant to the work | [AC-9046] Remove migrations that arenot relevant to the work
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | |
67f82f569dbf75ee5555862e21bd1bafbaa5464b | corehq/apps/userreports/management/commands/find_datasource_mismatches.py | corehq/apps/userreports/management/commands/find_datasource_mismatches.py | from __future__ import absolute_import
from __future__ import print_function
import csv
from datetime import datetime
from django.core.management.base import BaseCommand
from corehq.apps.userreports.document_stores import get_document_store
from corehq.apps.userreports.models import get_datasource_config
from corehq... | Add command to find datasource mismatches | Add command to find datasource mismatches
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | |
84f824495793eaa780b6681be691fe4d5a10fc28 | py/fizz-buzz.py | py/fizz-buzz.py | import sys
class Solution(object):
def fizzBuzz(self, n):
"""
:type n: int
:rtype: List[str]
"""
ret = []
for i in xrange(1, n + 1):
s = ''
if i % 3 == 0:
s += 'Fizz'
if i % 5 == 0:
s += 'Buzz'
... | Add py solution for 412. Fizz Buzz | Add py solution for 412. Fizz Buzz
412. Fizz Buzz: https://leetcode.com/problems/fizz-buzz/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | |
d9330450854e5fd7b7e9d038283c8fb80058cc2e | scripts/ensure_tilesize.py | scripts/ensure_tilesize.py | #!/usr/bin/python
#
# This is a helper script to ensure an image has the correct tile size.
# It uses pgmagick[1] to read and (if needed) correct the image. To use
# it on a number of files one could use e.g. the find command:
#
# find <data-folder> -name *.jpg -exec scripts/ensure_tilesize.py {} 256 \;
#
# [1] http:... | Add script to ensure the correct tile size of a file | Add script to ensure the correct tile size of a file
| Python | agpl-3.0 | htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID | |
16c9303ecc06c282eb15082b99f8eefa76fd4f18 | bindings/py/tests/temporal_memory_test.py | bindings/py/tests/temporal_memory_test.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | Add test to exercise code snippet known to cause segfault | Add test to exercise code snippet known to cause segfault
| Python | agpl-3.0 | neuroidss/nupic.core,scottpurdy/nupic.core,breznak/nupic.core,rhyolight/nupic.core,subutai/nupic.core,breznak/nupic.core,subutai/nupic.core,neuroidss/nupic.core,breznak/nupic.core,numenta/nupic.core,numenta/htmresearch-core,ywcui1990/nupic.core,utensil/nupic.core,neuroidss/nupic.core,subutai/nupic.core,numenta/htmresea... | |
e7d60f59e5bedc3a0893185303746c1cbb0d15af | app/api/cruds/weekday_crud.py | app/api/cruds/weekday_crud.py | from django.core.exceptions import ValidationError
import graphene
from graphene_django import DjangoObjectType
from app.timetables.models import Weekday
from .utils import get_errors
class WeekdayNode(DjangoObjectType):
original_id = graphene.Int()
class Meta:
model = Weekday
filter_fields... | Create weekday node and createweekday class | Create weekday node and createweekday class
| Python | mit | teamtaverna/core | |
4e29832d5a6ace0bc0adc44a2525872f47dc9b03 | scripts/plot_config.py | scripts/plot_config.py | #!/usr/bin/env python
import logging
import sys
import os
import inspect
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
cmd_folder = os.path.realpath(os.path.join(cmd_folder, ".."))
if cmd_folder not in sys.path:
sys.path.insert(0,cmd_folder)
import pic... | ADD a prototype for a plotting script of the learned model | ADD a prototype for a plotting script of the learned model | Python | bsd-2-clause | mlindauer/AutoFolio | |
1b0e6966d6bd73598e3f9ec49a73a78b0478da10 | discover_road_runner/famishius/tests/test_vulgaris.py | discover_road_runner/famishius/tests/test_vulgaris.py | from django.test import SimpleTestCase
class OtherTest(SimpleTestCase):
"""
In reality, apps often can have so many tests this is a more practical
organising pattern.
"""
def test_success(self):
self.assertEqual(1 + 1, 2)
| Document from the reality that while breaking apps down is a good idea, even then you often have a sufficient number of topic areas to cover that can't be easily split into more apps, i.e. TestCase classes are insufficient to group the relevant tests together, and a 5k tests.py file is almost certainly a bad idea. | Document from the reality that while breaking apps down is a good idea, even then you often have a sufficient number of topic areas to cover that can't be easily split into more apps, i.e. TestCase classes are insufficient to group the relevant tests together, and a 5k tests.py file is almost certainly a bad idea.
| Python | mit | pzrq/discover-road-runner | |
aedf1819edd0bf1668e530cbdb7f6998410e5ada | fellowms/tests_urls.py | fellowms/tests_urls.py | import unittest
from django.test import Client
from django.contrib.auth.models import User
ADMIN_PASSWORD = '123456'
class SimpleTest(unittest.TestCase):
@classmethod
def setUpClass(self):
User.objects.create_superuser('admin',
'admin@fake.software.ac.uk',
... | Add some tests for url. | Add some tests for url.
| Python | bsd-3-clause | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | |
7561e95b6fc12852c82ce4d16c38bcb223514358 | parallel.py | parallel.py | from IPython import parallel
from sklearn.datasets import fetch_20newsgroups_vectorized
def get_results():
# get data
data = fetch_20newsgroups_vectorized(remove=('headers',
'footers',
'quotes'))
alphas = [1E... | Create load balanced function to perform cross validation. Use main block to display best result | Create load balanced function to perform cross validation. Use main block to display best result
| Python | mit | MikeDelaney/sentiment | |
00997a5416447ecfb00565bface9ee109a187b61 | tests/test_experiment_groups/test_search_managers.py | tests/test_experiment_groups/test_search_managers.py | from django.test import override_settings
from polyaxon_schemas.settings import SettingsConfig
from experiment_groups.iteration_managers import (
HyperbandIterationManager,
get_search_iteration_manager
)
from experiment_groups.models import ExperimentGroupIteration
from experiment_groups.search_managers import... | Add experiment groups search managers tests | Add experiment groups search managers tests
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | |
6a7f25bd6303fd932632b2bd9dfe9ca010522c00 | cache_analysis/cache_model.py | cache_analysis/cache_model.py | # Copyright 2015, Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | Add model/simulation of cache eviction with a Bit-Pseudo-LRU cache | Add model/simulation of cache eviction with a Bit-Pseudo-LRU cache
| Python | apache-2.0 | kevinmel2000/rowhammer-test,shekkbuilder/rowhammer-test,kevinmel2000/rowhammer-test,kevinmel2000/rowhammer-test,kevinmel2000/rowhammer-test,shekkbuilder/rowhammer-test,shekkbuilder/rowhammer-test,shekkbuilder/rowhammer-test | |
5fdbb45c38c2bf542184ed8e7d750b3cfaa6fbb4 | plugins/raw_data_filter.py | plugins/raw_data_filter.py | """Show how to add a custom raw data filter for the TraceView and Waveform View
Use Alt+R in the GUI to toggle the filter.
"""
import numpy as np
from scipy.signal import butter, lfilter
from phy import IPlugin
class RawDataFilterPlugin(IPlugin):
def attach_to_controller(self, controller):
b, a = butt... | Add raw data filter plugin | Add raw data filter plugin
| Python | bsd-3-clause | kwikteam/phy,kwikteam/phy,kwikteam/phy | |
e22173b8492fefe3d562f7efe684aa560772d757 | insertion_sort_list.py | insertion_sort_list.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param head, a ListNode
# @return a ListNode
def insertionSortList(self, head):
if None == head:
ret... | Sort a linked list using insertion sort | Sort a linked list using insertion sort
| Python | apache-2.0 | don7hao/leetcode_oj,don7hao/leetcode_oj | |
6df2413f0207bf800697c430c4e6f1b1c46bbac9 | python/ellipsoid3DShape.py | python/ellipsoid3DShape.py | '''
Copyright (c) 2016 Abhishek Agrawal (abhishek.agrawal@protonmail.com)
Distributed under the MIT License.
See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
'''
# Set up modules and packages
# I/O
import csv
from pprint import pprint
# Numerical
import numpy as np
import pandas as pd
#... | Add directory to story python plotting scripts. Add script to plot a 3D ellipsoid. | Add directory to story python plotting scripts. Add script to plot a 3D ellipsoid.
| Python | mit | agrawalabhishek/NAOS,agrawalabhishek/NAOS,agrawalabhishek/NAOS | |
df48f6b57dd2fff8e22c0df95247afb0a630dd76 | infrastructure/utils/utils.py | infrastructure/utils/utils.py | import contextlib
from openerp import exceptions
@contextlib.contextmanager
def synchronize_on_config_parameter(env, parameter):
param_model = env['ir.config_parameter']
param = param_model.search([('key', '=', parameter)])
if param:
try:
env.cr.execute(
'''select *
... | Create context manager to lock on ir.config_paramter record | Create context manager to lock on ir.config_paramter record
| Python | agpl-3.0 | ingadhoc/infrastructure,ingadhoc/odoo-infrastructure,online-sanaullah/odoo-infrastructure | |
1818959519207eb1bd888d8abed096c32bb85b96 | pybtex/tests/bibtex_parser_test.py | pybtex/tests/bibtex_parser_test.py | from pybtex.database import BibliographyData
from pybtex.core import Entry
from pybtex.database.input.bibtex import Parser
from cStringIO import StringIO
test_data = [
(
'''
''',
BibliographyData(),
),
(
'''@ARTICLE{
test,
title={Polluted
... | Add a regression test for whitespace normalization in the BibTeX parser. | Add a regression test for whitespace normalization in the BibTeX parser.
| Python | mit | live-clones/pybtex | |
f3c546afd159d9a4ba006f448faec1653d974342 | mozillians/users/migrations/0038_auto_20180815_0108.py | mozillians/users/migrations/0038_auto_20180815_0108.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-15 08:08
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
def add_missing_employee_vouches(apps, schema_editor):
UserProfile = apps.get_model('users', 'UserProfile')
IdpProfile = apps.get... | Add missing vouches to employees. | Add missing vouches to employees.
| Python | bsd-3-clause | akatsoulas/mozillians,mozilla/mozillians,mozilla/mozillians,mozilla/mozillians,akatsoulas/mozillians,akatsoulas/mozillians,mozilla/mozillians,akatsoulas/mozillians | |
3a75f01d6ece9eec332dff1ca7518af4f7c7f462 | test/hoomd_script/test_barrier.py | test/hoomd_script/test_barrier.py | # -*- coding: iso-8859-1 -*-
# Maintainer: jglaser
from hoomd_script import *
init.setup_exec_conf();
import unittest
import os
# unit test to run a simple polymer system with pair and bond potentials
class replicate(unittest.TestCase):
def test_barrier(self):
comm.barrier();
def test_barrier_all(sel... | Add unit test for barrier | Add unit test for barrier
| Python | bsd-3-clause | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | |
c8bff113f85738f783fd00dcb1b9dacfa24cf589 | auth0/v2/test/test_emails.py | auth0/v2/test/test_emails.py | import unittest
import mock
from ..emails import Emails
class TestEmails(unittest.TestCase):
@mock.patch('auth0.v2.emails.RestClient')
def test_get(self, mock_rc):
mock_instance = mock_rc.return_value
e = Emails(domain='domain', jwt_token='jwttoken')
e.get()
args, kwargs = m... | Add unit tests for Emails() | Add unit tests for Emails()
| Python | mit | auth0/auth0-python,auth0/auth0-python | |
db11120077783fc3cc539fa919f822004d3ff355 | pari/user/management/commands/bulk_mailer.py | pari/user/management/commands/bulk_mailer.py | from django.core.management.base import BaseCommand
from django.core.mail import EmailMessage, get_connection
from django.template import Template, Context
from mezzanine.pages.models import Page
import csv
class Command(BaseCommand):
args = "<csv_file_path> [<from>]"
help = "Send mails to contacts on a CSV... | Send mails to contacts referenced in a csv file. | Send mails to contacts referenced in a csv file.
| Python | bsd-3-clause | RuralIndia/pari,RuralIndia/pari,RuralIndia/pari,RuralIndia/pari | |
ebcc9aef51d6244e69b5241b49359f8e8d2c0f85 | estmator_project/estmator_project/test_functional.py | estmator_project/estmator_project/test_functional.py | from django.contrib.staticfiles.testing import LiveServerTestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client, TestCase
from splinter import Browser
from time import sleep
from .factories import (
UserFactory, ClientFactory, CompanyFactor... | Add beginning of splinter tests | Add beginning of splinter tests
| Python | mit | Estmator/EstmatorApp,Estmator/EstmatorApp,Estmator/EstmatorApp | |
5a88660c98511f8cc0a8c210490a60b4805bdc58 | tests/unit/anchore_engine/services/policy_engine/engine/policy/test_gate.py | tests/unit/anchore_engine/services/policy_engine/engine/policy/test_gate.py | import pytest
from anchore_engine.services.policy_engine.engine.policy.gates import PackageCheckGate
from anchore_engine.services.policy_engine.engine.policy.gates.dockerfile import (
EffectiveUserTrigger,
)
from anchore_engine.services.policy_engine.engine.policy.gates.npms import (
PkgMatchTrigger,
)
from an... | Add unit test for the BaseTrigger.parameters() method | Add unit test for the BaseTrigger.parameters() method
Signed-off-by: Samuel Dacanay <600ff55f21d6ff32f29d8ef60f49bc6b12380523@anchore.com>
| Python | apache-2.0 | anchore/anchore-engine,anchore/anchore-engine,anchore/anchore-engine | |
3f2ae3d0efe05389ef5f269f7e3d926d64da8e3e | sqlobject/tests/test_NoneValuedResultItem.py | sqlobject/tests/test_NoneValuedResultItem.py | '''Test that selectResults handle NULL values
from, for example, outer joins.'''
from sqlobject import *
from sqlobject.tests.dbtest import *
class TestComposer(SQLObject):
name = StringCol()
class TestWork(SQLObject):
class sqlmeta:
idName = "work_id"
composer = ForeignKey('TestComposer')
t... | Test that query results with None IDs (e.g. some outer join cases) are handled correctly, i.e. return None for that object. | Test that query results with None IDs (e.g. some outer join cases)
are handled correctly, i.e. return None for that object.
git-svn-id: fe2f45b2405132b4a9af5caedfc153c2e6f542f4@777 95a46c32-92d2-0310-94a5-8d71aeb3d4b3
| Python | lgpl-2.1 | drnlm/sqlobject,drnlm/sqlobject,sqlobject/sqlobject,sqlobject/sqlobject | |
e1132fb8642a572eb674b69160db6bbd83b52cab | resolwe_bio/migrations/0007_sample_descriptor_dirty.py | resolwe_bio/migrations/0007_sample_descriptor_dirty.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-03 10:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resolwe_bio', '0006_alter_versionfield'),
]
operations = [
migrations.AddFi... | Add migration for descriptor_dirty field in Sample | Add migration for descriptor_dirty field in Sample
| Python | apache-2.0 | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | |
e3fdf6c03420cd95da33f4e36a0721308107687e | suppress_classifier.py | suppress_classifier.py | #!/usr/bin/env python3
import argparse
import subprocess
from itertools import combinations
from sys import executable
parser = argparse.ArgumentParser()
parser.add_argument('classifier', help='path to the classifier module')
parser.add_argument('feature_count', help='the number of features', type=int)
parser.add_ar... | Add automated script for determining which features to suppress | Add automated script for determining which features to suppress
| Python | mit | pdarragh/MinSem | |
80f9ed82cfedcca494aa7e960d546f992f2d6c60 | supernova_report_parser.py | supernova_report_parser.py | import sys
import re
import json
import fileinput
import argparse
def print_json(files):
samples = {}
for line in fileinput.input(files=files):
m = re.search(r"P\d{4}_\d{3}", line)
if m:
s = m.group()
else:
l = line.split("=")
if len(l) > 2:
d = [x.strip(" -") for x in l]
samples.setdefault(s,... | Add Supernova report parser script | Add Supernova report parser script
| Python | mit | jgruselius/standalone_scripts,jgruselius/standalone_scripts | |
8accd764b72299f6ed7be35104f9a2b958b0fce6 | tests/commands_test.py | tests/commands_test.py | from unittest import TestCase
from mock import Mock, patch
from nyuki.commands import (_update_config, _merge_config, parse_init,
exhaustive_config)
class TestUpdateConfig(TestCase):
def test_001_call(self):
source = {'a': 1, 'b': {'c': 2}}
# Update
_update_co... | Add unit tests on commands. | Add unit tests on commands.
| Python | apache-2.0 | gdraynz/nyuki,optiflows/nyuki,optiflows/nyuki,gdraynz/nyuki | |
64be453e86c8e1a9461c901028078a12deaa4c32 | spyder_unittesting/widgets/tests/test_unittestinggui.py | spyder_unittesting/widgets/tests/test_unittestinggui.py | # -*- coding: utf-8 -*-
#
# Copyright © 2016- The Spyder Development Team
# Licensed under the terms of the MIT License
# (see ../../LICENSE for details)
"""Tests for unittestinggui.py"""
import os
from qtpy.QtCore import Qt
from spyder.utils.qthelpers import qapplication
MAIN_APP = qapplication() # without this li... | Add integration test covering basic functionality | Add integration test covering basic functionality
| Python | mit | jitseniesen/spyder-unittest | |
332a1d777a5205886a7bd941155ba178a577e601 | py/average-of-levels-in-binary-tree.py | py/average-of-levels-in-binary-tree.py | from collections import defaultdict
from Queue import Queue
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def averageOfLevels(self, root):
"""
:type ro... | Add py solution for 637. Average of Levels in Binary Tree | Add py solution for 637. Average of Levels in Binary Tree
637. Average of Levels in Binary Tree: https://leetcode.com/problems/average-of-levels-in-binary-tree/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | |
9bcedcb7ce07a0436b5b27d5f76bde69b4103f3f | press_releases/migrations/0008_auto_20161128_1049.py | press_releases/migrations/0008_auto_20161128_1049.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('icekit_press_releases', '0007_auto_20161117_1201'),
]
operations = [
migrations.AlterField(... | Add hero to press release listing | Add hero to press release listing
| Python | mit | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-press-releases,ic-labs/icekit-press-releases,ic-labs/django-icekit,ic-labs/django-icekit | |
5f38319bcc2cad3f7d8ea1985379b51e89e32f44 | tests/test_rabbitmq.py | tests/test_rabbitmq.py | import mock
from pubsub.backend.rabbitmq import RabbitMQ, RabbitMQPublisher
class TestRabbitMQ(object):
def setup_class(self):
self.backend = RabbitMQ()
@mock.patch('pubsub.backend.rabbitmq.RabbitMQPublisher.start')
def test_call_start_publisher(self, mocked_function):
self.backend.star... | Add tests for RabbitMQ backend | Add tests for RabbitMQ backend
We are testing here RabbitMQ Backend and RabbitMQ publisher class.
I'm not sure yet how to implement Subscriber class
| Python | mit | csarcom/python-pubsub,WeLikeAlpacas/python-pubsub,WeLikeAlpacas/Qpaca | |
64cbcc160dd3f7a6f8e59592afda302522314404 | Functions/Python/template/test/test_lambda_function.py | Functions/Python/template/test/test_lambda_function.py | """Created By: Andrew Ryan DeFilippis"""
import contextlib
import re
import unittest
from io import StringIO
import context
import lambda_function
class TestLambdaFunction(unittest.TestCase):
"""Test all the Lambda Function things!
"""
def test_cwlogs_event_format(self):
"""Verify the format of... | Add unittest for the Lambda Function | Add unittest for the Lambda Function
| Python | apache-2.0 | andrewdefilippis/aws-lambda | |
cf732aaebfd4ed3f7ac2e8475a52e59934d193d6 | python/test/annotator/audio/wav2vec2_for_ctc_test.py | python/test/annotator/audio/wav2vec2_for_ctc_test.py | # Copyright 2017-2022 John Snow Labs
#
# 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... | Add Wav2Vec2 unit test to Python | Add Wav2Vec2 unit test to Python
| Python | apache-2.0 | JohnSnowLabs/spark-nlp,JohnSnowLabs/spark-nlp,JohnSnowLabs/spark-nlp,JohnSnowLabs/spark-nlp | |
5bfc44f140b0d8a16c88aa98205bee71e08fc372 | studygroups/management/commands/anonymize-opt-outs.py | studygroups/management/commands/anonymize-opt-outs.py | from django.core.management.base import BaseCommand, CommandError
from studygroups.models import Application
class Command(BaseCommand):
help = 'Anonymize applications that previously opted out'
def handle(self, *args, **options):
applications = Application.objects.filter(deleted_at__isnull=False)
... | Add tasks to anonymize past opt outs | Add tasks to anonymize past opt outs
| Python | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | |
4e57f963d11dc66bb2bee46324121f1f229cb685 | url/cli-open-url.py | url/cli-open-url.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
response = urllib2.urlopen("https://www.python.org/")
html = response.read()
# print out the HTML response
print(html)
| Add open url (web page) script | Add open url (web page) script
| Python | mit | rawswift/python-collections | |
79e06c8e07ff0b945145a2a29e3133e0714f9415 | tests/integration/cli/dump_test.py | tests/integration/cli/dump_test.py | from ...testcases import DustyIntegrationTestCase
class TestDumpCLI(DustyIntegrationTestCase):
def test_dump(self):
result = self.run_command('dump')
self.assertInSameLine(result, 'COMMAND', 'Dusty Version')
| Add simplest integration test ever for dump | Add simplest integration test ever for dump
| Python | mit | gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty | |
728c18bce41277781b2981c8a446100da19c0070 | tests/test_lesson_0_hello_world.py | tests/test_lesson_0_hello_world.py | # This lesson teaches you how to define a Python method. Try running the tests for this file before doing anything!
# Here's a python script you can use to run your tests from the top level directory of this project
# `python -m unittest -vf tests.test_lesson_0_hello_world`
# That command looks like a lot at first. Le... | Add test file for lesson 0. | Add test file for lesson 0.
| Python | mit | thejessleigh/test_driven_python,thejessleigh/test_driven_python,thejessleigh/test_driven_python | |
06c78c6f721f79ae5d72e4da0b6b966bbcb99fbf | test/test_gizmo_request.py | test/test_gizmo_request.py | from unittest import TestCase
from groundstation.transfer.request import Request
class TestGizmoRequest(TestCase):
def test_loadable_after_serializing(self):
gizmo = Request("LISTALLOBJECTS")
def test_rejects_invalid_verbs(self):
with self.assertRaises(Exception):
gizmo = Request(... | Add beginnings of some gizmo test coverage | Add beginnings of some gizmo test coverage
| Python | mit | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation | |
6ee1612e73efc2209c8399a54cebb7cba7965c7d | tests/level/level_utils.py | tests/level/level_utils.py | from hunting.level.map import LevelMap, LevelTile
def generate_5x3_long_c():
level_map = LevelMap([[LevelTile() for _ in range(0, 3)] for _ in range(0, 5)])
for x in range(1, 5):
level_map[x][1].blocks = True
return level_map | Add level generation test util fn | Add level generation test util fn
Maybe just create a general test util unless you're gonna build a
lotta these.
| Python | mit | MoyTW/RL_Arena_Experiment | |
a389b1172880db069e1a12ba75665e5366699b95 | tests/test_wind_turbine.py | tests/test_wind_turbine.py | import pandas as pd
from pandas.util.testing import assert_series_equal
import pytest
from windpowerlib.wind_turbine import read_turbine_data, WindTurbine
class TestWindTurbine:
def test_error_raising(self):
self.test_turbine_data = {'hub_height': 100,
'rotor_diameter': ... | Add tests for wind_turbine module | Add tests for wind_turbine module
| Python | mit | wind-python/windpowerlib | |
3099161325dfd99f1bf32d62218e2aaed41f32cd | exp/sandbox/SparseSVDExp.py | exp/sandbox/SparseSVDExp.py |
"""
Some code to see if there is any pattern in the SVD of a matrix with fixed
sparisty structure.
"""
import sys
import logging
import scipy.sparse
import numpy
from sparsesvd import sparsesvd
from exp.util.SparseUtils import SparseUtils
numpy.random.seed(21)
logging.basicConfig(stream=sys.stdout, level=logging.... | Test if there is a pattern in sparsity structure | Test if there is a pattern in sparsity structure | Python | bsd-3-clause | charanpald/APGL | |
a73e2975d74a3a15a4180974fc6dd75789bc8e78 | zephyr/lib/stats.py | zephyr/lib/stats.py | import os
import logging
STATS_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "stats")
def update_stat(name, value):
try:
os.mkdir(STATS_DIR)
except OSError:
pass
base_filename = os.path.join(STATS_DIR, name)
tmp_filename = base_filename + ".new"
try:
with file... | Add simple function for outputting statistics for use with munin | Add simple function for outputting statistics for use with munin
Eventually we will want to replace this with statsd.
(imported from commit 64246e9f2d13d72f53d009a5e3e456bc6be6296b)
| Python | apache-2.0 | ericzhou2008/zulip,calvinleenyc/zulip,wavelets/zulip,littledogboy/zulip,Jianchun1/zulip,praveenaki/zulip,bssrdf/zulip,noroot/zulip,bluesea/zulip,jimmy54/zulip,timabbott/zulip,bluesea/zulip,SmartPeople/zulip,natanovia/zulip,karamcnair/zulip,aliceriot/zulip,nicholasbs/zulip,SmartPeople/zulip,amallia/zulip,mdavid/zulip,xu... | |
561fa74a6e2572df913140a0cf9f57857a9eaddd | leaderboard/contributors/migrations/0007_auto_20151113_2229.py | leaderboard/contributors/migrations/0007_auto_20151113_2229.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contributors', '0006_auto_20151013_2148'),
]
operations = [
migrations.AlterModelOptions(
name='contributorrank'... | Set default ordering for ContributorRank | Set default ordering for ContributorRank
| Python | mpl-2.0 | JaredKerim-Mozilla/leaderboard-server,JaredKerim-Mozilla/leaderboard-server,mozilla-services/location-leaderboard,mozilla-services/location-leaderboard,mozilla-services/location-leaderboard,mozilla-services/location-leaderboard,JaredKerim-Mozilla/leaderboard-server,JaredKerim-Mozilla/leaderboard-server,mozilla-services... | |
2f0145b59be4a251b31223d44fdca7f3fb211fa8 | svm_train.py | svm_train.py | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import SGDClassifier
from sklearn.externals import joblib
print "Grabbing data..."
training_text_collection_f = open("training_text_collection.pkl", "rb")
training_text_collection = joblib.load(training_text_collection_f)
training_t... | Create Support Vector Machine vectorizer and classifier pickles | Create Support Vector Machine vectorizer and classifier pickles
| Python | mit | npentella/CuriousCorpus,npentella/CuriousCorpus,npentella/CuriousCorpus | |
c0685e9257af79e9ea2393611e7ad00a00a3734e | pyweaving/tests/test_draft.py | pyweaving/tests/test_draft.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from unittest import TestCase
from .. import Draft, Color
class TestDraft(TestCase):
def test_basic_tabby(self):
draft = Draft(num_shafts=2, num_treadles=2)
black = Color((0, 0, 0))
... | Add a trivially basic test | Add a trivially basic test
| Python | mit | storborg/pyweaving | |
41fcb60868f0551603cf25c8616f942fcfd008f4 | scripts/restore_node.py | scripts/restore_node.py | """Restores a deleted node.
NOTE: Only use this for nodes that have no addons except for OSFStorage and Wiki.
"""
import logging
import sys
from framework.transactions.context import TokuTransaction
from website.models import Node, NodeLog
from website.app import init_app
from scripts import utils as script_utils
log... | Add script to restore a deleted node | Add script to restore a deleted node
| Python | apache-2.0 | alexschiller/osf.io,cwisecarver/osf.io,erinspace/osf.io,CenterForOpenScience/osf.io,Nesiehr/osf.io,leb2dg/osf.io,emetsger/osf.io,chrisseto/osf.io,caneruguz/osf.io,binoculars/osf.io,alexschiller/osf.io,Johnetordoff/osf.io,mluo613/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,caneruguz/osf.io,laurenrevere/osf.io,sloria/osf.i... | |
2e73497a0f1a417f1b047b3857bd72117c2a33d3 | closure_default_parameter.py | closure_default_parameter.py | #!/usr/bin/env python3
def create_multipliers_late_binding():
""" https://www.toptal.com/python/top-10-mistakes-that-python-programmers-make create closure
with late binding effect. """
return [lambda x: i * x for i in range(5)]
def create_multipliers():
""" https://www.toptal.com/python/top-10-mis... | Use closue default parameter for set arguments correctly in list comprehension. | Use closue default parameter for set arguments correctly in list comprehension.
| Python | apache-2.0 | sjh/python | |
dc26ebcd2437f4ade2a0692ebe79af0f4f664097 | elpiwear/Rpi/gpio.py | elpiwear/Rpi/gpio.py | # The MIT License (MIT)
#
# Copyright (c) 2015 Frederic Jacob
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mo... | Add the GPIO proxy class for the Raspberry Pi | Add the GPIO proxy class for the Raspberry Pi
| Python | mit | fjacob21/pycon2015 | |
aff608fcd354bad4a2637f6cad6a6f90b1971bf8 | test_echo.py | test_echo.py | # -*- coding: utf-8 -*-
import subprocess
import pytest
def test_basic(string="This is a test."):
process = subprocess.Popen(['./echo_client.py', string],
stdout=subprocess.PIPE)
assert string == process.stdout.readline()
def test_unicode():
with pytest.raises(AssertionErr... | Write tests for socket: short, long and exact. | Write tests for socket: short, long and exact.
| Python | mit | bm5w/network_tools | |
9bce03d89dad6b69a88632d95988fc42af19557a | st2common/st2common/util/versioning.py | st2common/st2common/util/versioning.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... | Add custom uility function which knows how to compare and match complex semver version specifiers. | Add custom uility function which knows how to compare and match complex semver
version specifiers.
| Python | apache-2.0 | nzlosh/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,tonybaloney/st2,StackStorm/st2,Plexxi/st2,peak6/st2,Plexxi/st2,lakshmi-kannan/st2,lakshmi-kannan/st2,tonybaloney/st2,Plexxi/st2,peak6/st2,tonybaloney/st2,peak6/st2,StackStorm/st2,lakshmi-kannan/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2 | |
7903336bf1190814c04f73ade3e19f0ed5fadef4 | icekit/management/commands/truncate_postgres_dbdump.py | icekit/management/commands/truncate_postgres_dbdump.py | import sys # Needed to output unicode see https://code.djangoproject.com/ticket/21933
import re
from django.core.management.base import BaseCommand, CommandError
COPY_TABLENAME_RE = re.compile(r'^COPY ([^ ]+) .* FROM stdin;$')
class Command(BaseCommand):
help = ("Truncate unwanted table data in PostgreSQL DB ... | Add command to truncate table data in PostgreSQL db dump files | Add command to truncate table data in PostgreSQL db dump files
Example usage:
manage.py truncate_postgres_dbdump \
big.sql big_table_name1 big_table_name2 \
> small.sql
| Python | mit | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit | |
fce66218e682d80076ef744b9206b9cc042891b2 | corehq/apps/commtrack/management/commands/populate_site_code.py | corehq/apps/commtrack/management/commands/populate_site_code.py | from django.core.management.base import BaseCommand
from corehq.apps.locations.models import Location
class Command(BaseCommand):
help = 'Generate missing site codes for locations'
def handle(self, *args, **options):
self.stdout.write("Populating site codes...\n")
relevant_ids = set([r['id']... | Add management command to populate site codes | Add management command to populate site codes
| Python | bsd-3-clause | SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttara... | |
a5712ad442de5eb9e68e111436049a50fa72505d | tests/conftest.py | tests/conftest.py | """Global test configuration"""
import os
import betamax
# Ensure cassete dir
CASSETE_DIR = 'tests/cassetes/'
if not os.path.exists(CASSETE_DIR):
os.makedirs(CASSETE_DIR)
with betamax.Betamax.configure() as config:
config.cassette_library_dir = CASSETE_DIR
| Configure betamax for pytest usage | Configure betamax for pytest usage
| Python | agpl-3.0 | khardix/mccurse | |
f44805d8673bdf1382a48962e46ba4e2a7ec7e79 | delete_node.py | delete_node.py | """
Write a function to delete a node (except the tail)
in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4 and
you are given the third node with value 3,
the linked list should become 1 -> 2 -> 4 after calling your function.
"""
def delete_node(node):
if node is... | Add check for None values in node or node.next | Add check for None values in node or node.next
We raise a ValueError if the rules of the API are broken (passing a null node or the tail node) | Python | mit | keon/algorithms,amaozhao/algorithms | |
16654e7c02831e1d8daede1a3d83cbcfa0d5f92b | tests/test_stacks_file.py | tests/test_stacks_file.py | import json
from dmaws.stacks import Stack
from dmaws.context import Context
def is_true(x):
assert x
def is_in(a, b):
assert a in b
def valid_stack_json(stack):
text = stack.build('stage', 'env', {}).template_body
template = json.loads(text)
assert 'Parameters' in template
assert set(te... | Add tests for the stacks.yml file | Add tests for the stacks.yml file
| Python | mit | alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws | |
f3f94fc218220e91197e639b0b3e5514741623f0 | lib/awx_cli/commands/JobLaunchCommand.py | lib/awx_cli/commands/JobLaunchCommand.py | # Copyright 2013, AnsibleWorks Inc.
# Michael DeHaan <michael@ansibleworks.com>
# Chris Church <cchurch@ansibleworks.com>
#
# 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.ap... | Add joblaunch command to source control | Add joblaunch command to source control
| Python | apache-2.0 | jangsutsr/tower-cli,tomfotherby/tower-cli,ansible/tower-cli,AlanCoding/tower-cli,docschick/tower-cli,ansible/tower-cli,cedub/tower-cli,nitzmahone/tower-cli,AlanCoding/tower-cli,chrismeyersfsu/tower-cli | |
dcecd21f8237f9e455fa2aaf4862530470e7ffa8 | migrations/versions/0114_drop_monthly_billing_cols.py | migrations/versions/0114_drop_monthly_billing_cols.py | """
Revision ID: 0014_drop_monthly_billing_cols
Revises: 0113_job_created_by_nullable
Create Date: 2017-07-27 13:36:37.304344
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0014_drop_monthly_billing_cols'
down_revision = '0113_job_created_by_nullable'
def ... | Drop unused month and year columns from monthlybilling | Drop unused month and year columns from monthlybilling
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | |
924de7e93a8d73932253b10699ab0f481761586e | seacat/spdy/vle.py | seacat/spdy/vle.py | import struct
def spdy_add_vle_string(frame, string):
buf = bytes(string, 'utf-8')
buf_len = len(buf)
if buf_len >= 0xFA:
struct.pack_into('!BH', frame.data, frame.position, 0xFF, buf_len)
frame.position += struct.calcsize('!BH')
else:
struct.pack_into('!B', frame.data, frame.position, buf_len)
frame.pos... | Add functions to build and parse variable-length (VLE) strings | Add functions to build and parse variable-length (VLE) strings
| Python | bsd-3-clause | TeskaLabs/SeaCat-Client-Python3 | |
13cb9144047b0aa24260ff4b2bdbc5d2fcd8b82b | util/ublox_pkt.py | util/ublox_pkt.py | #
# Copyright (c) Michael Tharp <gxti@partiallystapled.com>
#
# This file is distributed under the terms of the MIT License.
# See the LICENSE file at the top of this tree, or if it is missing a copy can
# be found at http://opensource.org/licenses/MIT
#
import struct
import sys
msg_cls = int(sys.argv[1], 16)
msg_id... | Add tool for generating ublox config packets | Add tool for generating ublox config packets
| Python | mit | mtharp/laureline-firmware,mtharp/laureline-firmware,mtharp/laureline-firmware,mtharp/laureline-firmware | |
cb815258413d8ff22a677663be57238b8f8f3654 | fpr/migrations/0019_fix_gs_command.py | fpr/migrations/0019_fix_gs_command.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration(apps, schema_editor):
"""Fix the Ghostscript normalization command "Command Transcoding to pdfa
with Ghostscript" so that it documents its true output format as PDF/A 1b
(fmt/354) and not P... | Fix the Ghostscript normalization output format | Fix the Ghostscript normalization output format
Adds a migration to fix the Ghostscript normalization command "Command
Transcoding to pdfa with Ghostscript" so that it documents its true output
format as PDF/A 1b (fmt/354) and not PDF/A 1a (fmt/95).
Contributes to fixing https://github.com/artefactual/archivematica/i... | Python | agpl-3.0 | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | |
bb3573ce7b0eb93e202a7dba13f2c1eedcca1275 | moderation_queue/migrations/0003_auto_20150301_2035.py | moderation_queue/migrations/0003_auto_20150301_2035.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('moderation_queue', '0002_auto_20150213_0838'),
]
operations = [
migrations.AlterField(
model_name='queuedimage',... | Add a forgotten migration for QueuedImage | Add a forgotten migration for QueuedImage
This should have been generated when blank=True was added to the
justification_for_use field, but I forgot.
| Python | agpl-3.0 | neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,datamade/yournextmp-popit,DemocracyClub/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,datamade/yournext... | |
d8b396db59199f9221a3bf7ac9d75f1edfd07d4c | spec/image_spec.py | spec/image_spec.py | from spec.helper import *
from pygame import Surface
from pygametemplate import Image
with description("pygametemplate.Image"):
with it("should initialise correctly, without loading a Surface object"):
self.image = Image("test")
expect(self.image.name).to(equal("test"))
expect(self.image... | Add unit tests for upcoming pygametemplate.Image class | Add unit tests for upcoming pygametemplate.Image class
| Python | mit | AndyDeany/pygame-template | |
6fca9da8cbf5318a2f7cdee16d4136b7b54088a5 | src/cron/migrations/0004_auto_20210831_1159.py | src/cron/migrations/0004_auto_20210831_1159.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-08-31 11:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cron', '0003_auto_20171121_1115'),
]
operations = [
migrations.AlterField(... | Add migration for reminder update | Add migration for reminder update
| Python | agpl-3.0 | BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway | |
a6c3622ffbe6f02bab8a9be2c8949771d8729d95 | fibonacci_message_encoding/main.py | fibonacci_message_encoding/main.py | import string
# Pseudocode
## Encode
def encode(secret_string, wordlist=[]):
# TODO: wordlist is not intended for production
message = []
# Generate fibo values V_m_n using m_0
# TODO: add possibility of calculating closed-form fibo numbers using starting position
fibonacci_values = [1, 1, 2, 3, ... | Add basic proof of concept: encode and decode | Add basic proof of concept: encode and decode
| Python | mit | Telkkar/fibonacci_message_encoding | |
bc293b675b067574f8c9da0e18d5d958e4ca568b | stationspinner/sde/migrations/0008_auto_20150715_1544.py | stationspinner/sde/migrations/0008_auto_20150715_1544.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sde', '0007_remove_invtype_chanceofduplicating'),
]
operations = [
migrations.RemoveField(
model_name='invcatego... | Migrate SDE to remove redundant fields | Migrate SDE to remove redundant fields
| Python | agpl-3.0 | kriberg/stationspinner,kriberg/stationspinner | |
0c1a0a70154ddf107a6174d49793e369d28f1beb | openstack_dashboard/views.py | openstack_dashboard/views.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | Fix default get_user_home with dynamic dashboards | Fix default get_user_home with dynamic dashboards
The existing get_user_home implementation expects both the 'admin'
and 'project' dashboards to exist and throws an exception if they
are missing. With the inclusion of configurable dashboard loading,
we can no longer count on certain dashboards being loaded.
Closes-B... | Python | apache-2.0 | bigswitch/horizon,tsufiev/horizon,froyobin/horizon,NeCTAR-RC/horizon,kfox1111/horizon,NeCTAR-RC/horizon,yjxtogo/horizon,RudoCris/horizon,watonyweng/horizon,philoniare/horizon,philoniare/horizon,noironetworks/horizon,eayunstack/horizon,CiscoSystems/avos,Dark-Hacker/horizon,zouyapeng/horizon,nvoron23/avos,mrunge/horizon,... |
085d280f450b6516d377bd7f7dbdbbd5004cd963 | oscar/apps/payment/utils.py | oscar/apps/payment/utils.py | import warnings
from . import models
def Bankcard(card_number, expiry_date, name=None,
cvv=None, start_date=None, issue_number=None):
# This odd looking thing is to handle backwards compatibility with Oscar
# 0.5 where the Bankcard class wasn't a model and lived in this utils
# module. As o... | Add backkwards-compatible Bankcard class factory | Add backkwards-compatible Bankcard class factory
This provides a way for extensions that need to work with Oscar 0.5 and
0.6 to consistently load the Banckard class (even though it was moved
and had its API changed between versions).
| Python | bsd-3-clause | QLGu/django-oscar,kapt/django-oscar,Idematica/django-oscar,anentropic/django-oscar,Bogh/django-oscar,nickpack/django-oscar,saadatqadri/django-oscar,jmt4/django-oscar,michaelkuty/django-oscar,bnprk/django-oscar,sonofatailor/django-oscar,thechampanurag/django-oscar,kapari/django-oscar,nfletton/django-oscar,nickpack/djang... | |
a1e5ebded1a44480dd71bdb267087683cf330a67 | webvtt/generic.py | webvtt/generic.py |
class Caption(object):
def __init__(self, start, end, lines=None):
self.start = start
self.end = end
self.lines = lines or []
def add_line(self, line):
self.lines.append(line) | Add class to store caption data | Add class to store caption data
| Python | mit | glut23/webvtt-py,sampattuzzi/webvtt-py | |
aea4f35e51f244ad191de37ca0f634b4917ae78d | 07/test_address.py | 07/test_address.py | import unittest
from address import has_reflection, is_compatible
class TestAddress(unittest.TestCase):
def test_has_reflection(self):
assert has_reflection(['mnop']) == False
assert has_reflection(['abba', 'qrst']) == True
def test_is_compatible(self):
assert is_compatible('abba[mno... | Test part 1 of day 7. | Test part 1 of day 7.
| Python | mit | machinelearningdeveloper/aoc_2016 | |
329c3d31b76b22c481278a7c0994c9a7ba3f2852 | migrations/versions/1020_add_buyer_email_domain_table.py | migrations/versions/1020_add_buyer_email_domain_table.py | """Add buyer email domain table
Revision ID: 1020
Revises: 1010
Create Date: 2017-10-10 15:18:22.683693
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1020'
down_revision = '1010'
def upgrade():
op.create_table(
'buyer_email_domains',
sa... | Add new buyer email domain table | Add new buyer email domain table
A simple table to store the email domain (currently held in a text
file).
The domain_name field has a uniqueness constraint.
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | |
a812d3054e25768c19a470bf090b298e11786ed3 | openstack/common/sslutils.py | openstack/common/sslutils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM
#
# 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... | Support for SSL in wsgi.Service | Support for SSL in wsgi.Service
Enable support for SSL as well using code from glance. We
have some new options for configuring the SSL support.
test_app starts wsgi.Service with a test app, then creates
a url to make sure the http requests are actually served
properly
test_app_using_router adds wsgi.Router and Mapp... | Python | apache-2.0 | poznyakandrey/oslo.service,eezhova/oslo.service,openstack/oslo.service,citrix-openstack-build/oslo.service | |
da466b391470333492a56395569812653ed6658f | compose/cli/__init__.py | compose/cli/__init__.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import subprocess
import sys
# Attempt to detect https://github.com/docker/compose/issues/4344
try:
# We don't try importing pip because it messes with package imports
# on some Linux distros (... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import subprocess
import sys
# Attempt to detect https://github.com/docker/compose/issues/4344
try:
# We don't try importing pip because it messes with package imports
# on some Linux distros (... | Change docker-py dependency error to a warning, update fix command | Change docker-py dependency error to a warning, update fix command
Signed-off-by: Joffrey F <2e95f49799afcec0080c0aeb8813776d949e0768@docker.com>
| Python | apache-2.0 | thaJeztah/compose,shin-/compose,vdemeester/compose,sdurrheimer/compose,sdurrheimer/compose,schmunk42/compose,hoogenm/compose,jrabbit/compose,dnephin/compose,dnephin/compose,schmunk42/compose,swoopla/compose,funkyfuture/docker-compose,shin-/compose,thaJeztah/compose,hoogenm/compose,funkyfuture/docker-compose,jrabbit/com... |
004e5411e94ed3a2f372f8a66b4683eebb5da11a | python_version_compat_test.py | python_version_compat_test.py | #!/usr/bin/env python
import subprocess
import unittest
class TestPy2Py3Compat(unittest.TestCase):
"""We need to be compatible with both python2 and 3.
Test that we can at least import runlint.py under both.
"""
def test_python2_compat(self):
subprocess.check_call(['python2', '-c', 'import ... | Add a test that imports runlint under both python2 and python3 | Add a test that imports runlint under both python2 and python3
Summary:
khan-linter now runs under both python2 and python3, but it's going to be easy
to break that. This commit adds a test that checks that runlint.py can be
imported in both python2 and python3. This won't catch everything, but will
prevent a few co... | Python | apache-2.0 | Khan/khan-linter,Khan/khan-linter,Khan/khan-linter,Khan/khan-linter | |
09c48a690958502568b76dc10bce751614a63f38 | udpSender.py | udpSender.py | import socket
UDP_IP = "192.168.1.1"
UDP_PORT = 1234
MESSAGE = "Hello, World!"
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
| Add udp sender for debug purpose | Add udp sender for debug purpose
| Python | mit | baptistelabat/orgie |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.