commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
e7e51333133dd561e8a746144c29c6635d8a982a | Add migration to add column for proposal image filename | fairdemocracy/vilfredo-core | migrations/versions/320f4eb0698b_add_proposal_image.py | migrations/versions/320f4eb0698b_add_proposal_image.py | """add proposal image
Revision ID: 320f4eb0698b
Revises: 26ef95fc6f2c
Create Date: 2015-03-31 15:55:20.062624
"""
# revision identifiers, used by Alembic.
revision = '320f4eb0698b'
down_revision = '26ef95fc6f2c'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alemb... | agpl-3.0 | Python | |
2233b8cb2e59e4304492b60eb9842962130e14c2 | Create NoisyNeighborsClosedForm.py | laichunpongben/CodeJam | NoisyNeighborsClosedForm.py | NoisyNeighborsClosedForm.py | # Google Code Jam
# Google Code Jam 2015
# Round 1B
# Problem B. Noisy Neighbors
# Closed form solution O(1)
from math import ceil
testCaseFile = open("NoisyNeighbors_B-large-practice.in", "r")
lines = testCaseFile.read().split('\n')
n = int(lines[0])
testCases = [0 for x in range(n)]
class TestCase:
def __init... | apache-2.0 | Python | |
f39947677bc2eaf15a0a9d5ef976a29905b23339 | Add AirQuality notification | irrrze/Scripts | PushAirQuality.py | PushAirQuality.py | from twitter import *
from pushbullet import PushBullet
import config
CONSUMER_KEY = config.twitter_consumer_key
CONSUMER_SECRET = config.twitter_consumer_secret
OAUTH_TOKEN = config.twitter_oauth_token
OAUTH_SECRET = config.twitter_oauth_secret
pb_api_key = config.pb_api_key
twitter = Twitter(auth=OAuth(
OAUTH_TOKE... | apache-2.0 | Python | |
d4b86bc3b4440d665eb8119828a9ffe241b321a6 | Update 24-game.py | yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-lu... | Python/24-game.py | Python/24-game.py | # Time: O(n^3 * 4^n), n = 4
# Space: O(n^2)
from fractions import Fraction
from operator import *
class Solution(object):
def judgePoint24(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
def dfs(nums):
if len(nums) == 1:
return nums[0] =... | # Time: O(n^3 * 4^n)
# Space: O(n^2)
from fractions import Fraction
from operator import *
class Solution(object):
def judgePoint24(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
def dfs(nums):
if len(nums) == 1:
return nums[0] == 24
... | mit | Python |
aa212ffb28d48835c788199ec9f5a09bf83fb443 | Add a utility to reduce GlobalISel tests | apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen... | utils/bugpoint_gisel_reducer.py | utils/bugpoint_gisel_reducer.py | #!/usr/bin/env python
"""Reduces GlobalISel failures.
This script is a utility to reduce tests that GlobalISel
fails to compile.
It runs llc to get the error message using a regex and creates
a custom command to check that specific error. Then, it runs bugpoint
with the custom command.
"""
from __future__ import pr... | apache-2.0 | Python | |
fcf0ed3c4e2deb9ce1d6a758dc18e6a03542eb59 | Add a script to find parties with multiple emblems (logos) from the EC | mysociety/yournextmp-popit,mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,datamade/yournextmp-popit,neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,YoQui... | candidates/management/commands/candidates_parties_with_multiple_emblems.py | candidates/management/commands/candidates_parties_with_multiple_emblems.py | from django.core.management.base import BaseCommand
from candidates.popit import create_popit_api_object, popit_unwrap_pagination
class Command(BaseCommand):
def handle(self, *args, **options):
api = create_popit_api_object()
for org in popit_unwrap_pagination(
api.organizations,
... | agpl-3.0 | Python | |
c06a72515cf2fddc604641b70b497f74d9ef5d78 | use vlc to set clips | Dennovin/videoscripts,Dennovin/videoscripts,Dennovin/videoscripts | vlc.py | vlc.py | #!/usr/bin/env python
import dbus
import Tkinter
import os
import pprint
import yaml
videofiles = {}
def format_time(s, fmt="{m:02d}:{s:02.0f}"):
return fmt.format(m=int(s/60), s=float(s)%60)
def current_filename():
current_video_file = props.Get("org.mpris.MediaPlayer2.Player", "Metadata")["xesam:url"].repl... | mit | Python | |
0f6e065a70bcd1f9dd64dfa04c13cb0065e33c13 | Add basic test for navigator | atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot | src/autobot/src/navigator_test.py | src/autobot/src/navigator_test.py | #!/usr/bin/env python
import unittest
import mock
from autobot.msg import detected_object
from navigator import *
def fake_stopCar():
return True
def fake_srvTogglePathFinder(state):
return
def fake_setWallDist(dist, wall):
return
class NavigatorTest(unittest.TestCase):
@mock.patch('navigator.se... | mit | Python | |
d11d7c38edef63e50dbd1da78a8829905a86c2a5 | Add forgotten file | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/assignments/states.py | bluebottle/assignments/states.py | from bluebottle.activities.states import ActivityStateMachine, ContributionStateMachine
from bluebottle.assignments.models import Assignment, Applicant
class AssignmentStateMachine(ActivityStateMachine):
model = Assignment
class ApplicantStateMachine(ContributionStateMachine):
model = Applicant
| bsd-3-clause | Python | |
98f26afc012b1ab25360738776c36b58229d0b3a | Add CLI interface. | btimby/fulltext,btimby/fulltext | fulltext/__main__.py | fulltext/__main__.py | """
Fulltext CLI interface.
"""
from __future__ import absolute_import
import sys
import logging
from docopt import docopt
import fulltext
def _handle_open(path):
with open(path, 'rb') as f:
return fulltext.get(f)
def main(args=sys.argv[1:]):
"""
Extract text from a file.
Usage:
... | mit | Python | |
5666161f59a8c3efa5b3f884912f9777c9a12edd | Add the ability to get template variables from the CLI | rgreinho/saliere,TeamLovely/Saliere,rgreinho/saliere,rgreinho/saliere,rgreinho/saliere,TeamLovely/Saliere | saliere/main.py | saliere/main.py | #!/usr/bin/python3
"""Creates a skeleton for various projects based on Jinja2 templates.
Example:
$ main.py mysql -t salt-formula
$ main.py mysql-django -t django
$ main.py mysql -t salt-formula -o my-formula-directory
$ main.py mysql -t ~/my/custom/template -o my-template-directory
"""
import argpar... | #!/usr/bin/python3
"""Creates a skeleton for various projects based on Jinja2 templates.
Example:
$ main.py mysql -t salt-formula
$ main.py mysql-django -t django
$ main.py mysql -t salt-formula -o my-formula-directory
$ main.py mysql -t ~/my/custom/template -o my-template-directory
"""
import argpar... | mit | Python |
1dc11286b21d8a84e3d1d9a194cc49275be4d97d | Add core models example factories | Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel | apps/core/factories.py | apps/core/factories.py | from factory import Faker, Iterator, SubFactory
from factory.django import DjangoModelFactory
from apps.data.factories import EntryFactory, RepositoryFactory
from . import models
class SpeciesFactory(DjangoModelFactory):
name = Faker('word')
reference = SubFactory(EntryFactory)
repository = SubFactory(R... | bsd-3-clause | Python | |
6ffeadb02f751e27ab78216ea2932f9b540210b5 | Create subbytes.py | nvandervoort/PyRTL,deekshadangwal/PyRTL,deekshadangwal/PyRTL,nvandervoort/PyRTL,UCSBarchlab/PyRTL,UCSBarchlab/PyRTL | research/aes/subbytes.py | research/aes/subbytes.py | # subbytes.py
import pyrtl
from pyrtl import *
# S-box table.
sbox_data = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x3... | bsd-3-clause | Python | |
b27a5127c8a98df0cdbe8715587b3d40415e32c7 | add unit tests | mhcomm/pypeman,mhcomm/pypeman,mhcomm/pypeman | pypeman/tests/test_ctx_nodes.py | pypeman/tests/test_ctx_nodes.py | """
tests for pypeman.contrib.ctx
"""
import asyncio
import pytest
from pypeman.contrib.ctx import CombineCtx
from pypeman.nodes import NodeException
from pypeman.tests.pytest_helpers import clear_graph # noqa: F401
from pypeman.tests.common import generate_msg
# TODO: might refactor to another file?
from pypeman.... | apache-2.0 | Python | |
38e231076209f0d71ee64bd4d60e1769aac8ce93 | add raspberry pi receiver script | zerog2k/power_meter_cs5460a,zerog2k/power_meter_cs5460a | power_monitor_rf24.py | power_monitor_rf24.py | #!/usr/bin/env python
# receive values from CS5460A power monitor via NRF24L01
# may need to run as sudo
# see https://github.com/zerog2k/power_meter_cs5460a for arduino transmitter code
import time as time
from RF24 import *
import RPi.GPIO as GPIO
import binascii
import struct
from datetime import datetime, date... | mit | Python | |
3b33a9410bac5b710a52e603fd40ed88765b7414 | Create colecoes.py | FelipeGomesSan/poo-python,gomesfelipe/poo-python | colecoes/colecoes.py | colecoes/colecoes.py | from aula5.pessoa import import Pessoa
from aula6.pessoas_tipos import Homem, Mulher
if __name__=='__main__':
gomes = Homem('Gomes')
gomes_igual = Homem('Gomes')
gomes_identico=gomes
selina=Mulher('Selina')
print(gomes is gomes_igual)
print(gomes is gomes_identico)
print(gomes == gomes_ig... | mit | Python | |
0f06b139ecfbdb05dee86b4cbda5b23c9af4379a | test private name | xupeixiang/dive_into_python | chap5/test_private_name_coven.py | chap5/test_private_name_coven.py | #!/usr/bin/python
# -*- indent-tabs-mode: nil; tab-width: 4 -*-
# vi: et ts=4 sts=4 sw=4
class Foo:
def __priv(self):
print "I'm private"
def main():
foo = Foo()
getattr(Foo, '_Foo__priv')(foo)
if __name__ == '__main__':
main()
| apache-2.0 | Python | |
c48bf268ec7e077443ad347f007d7477d841cc04 | Add ds_binary_heap.py | bowen0701/algorithms_data_structures | ds_binary_heap.py | ds_binary_heap.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class BinaryHeap(object):
def __init__(self):
pass
def main():
pass
if __name__ == '__main__':
main()
| bsd-2-clause | Python | |
7b9023dc5dcdd4ad8e1ea9c7803e81a13da42a5b | Add MNIST dataset | niboshi/chainer,delta2323/chainer,cupy/cupy,chainer/chainer,keisuke-umezawa/chainer,wkentaro/chainer,jnishi/chainer,niboshi/chainer,wkentaro/chainer,cupy/cupy,chainer/chainer,keisuke-umezawa/chainer,ronekko/chainer,keisuke-umezawa/chainer,hvy/chainer,cupy/cupy,pfnet/chainer,okuta/chainer,kiyukuta/chainer,ktnyt/chainer,... | chainer/dataset/datasets/mnist.py | chainer/dataset/datasets/mnist.py | import gzip
import os
import struct
import numpy
import six
from six.moves.urllib import request
from chainer.dataset.datasets import tuple_dataset
from chainer.dataset import download
def get_mnist_training(withlabel=True, ndim=1, dtype=numpy.float32, scale=1.):
"""Gets the MNIST training set.
`MNIST <htt... | mit | Python | |
d0cfb59819cdb1f55115616e3600c8483f54d43f | add viz.py file | ijstokes/bokeh-blaze-tutorial,chdoig/scipy2015-blaze-bokeh,kcompher/scipy2015-blaze-bokeh,kunalj101/scipy2015-blaze-bokeh,kunalj101/scipy2015-blaze-bokeh,zhenxu66/scipy2015-blaze-bokeh,jnovinger/scipy2015-blaze-bokeh,chdoig/scipy2015-blaze-bokeh,jnovinger/scipy2015-blaze-bokeh,kcompher/scipy2015-blaze-bokeh,ijstokes/bo... | viz.py | viz.py | # -*- coding: utf-8 -*-
import math
from collections import OrderedDict
import pandas as pd
import netCDF4
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import DatetimeTickFormatter, ColumnDataSource, HoverTool, Plot, Range1d
from bokeh.palettes import RdBu11
from bokeh.models.glyphs impo... | mit | Python | |
cd1c67c34768bdef0cc4649573e2541558e648ad | Add : Basic client implementation | oleiade/Elevator | elevator/client.py | elevator/client.py | #!/usr/bin/env python
#Copyright (c) 2011 Fabula Solutions. All rights reserved.
#Use of this source code is governed by a BSD-style license that can be
#found in the license.txt file.
# leveldb client
import zmq
import threading
import time
import ujson as json
class Elevator(object):
def __init__(self, host="tc... | mit | Python | |
fc40c3f740f9f5dedbcddd4dcbd274c76aaba529 | Add ToS script | sebastienvercammen/ptc-acc-gen,sebastienvercammen/ptc-acc-gen,FrostTheFox/ptc-acc-gen,FrostTheFox/ptc-acc-gen,sebastienvercammen/ptc-acc-gen,FrostTheFox/ptc-acc-gen | output/tos.py | output/tos.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""tos.py - Accept PokemonGo ToS for multiple accounts using file."""
from pgoapi import PGoApi
from pgoapi.utilities import f2i
from pgoapi import utilities as util
from pgoapi.exceptions import AuthException
import pprint
import time
import threading
import sys,... | mit | Python | |
db4f449be99d7b66bd7c46a1a3af8b46424421c6 | Add tests for DummyCurrentPlaylistController.get_by_{id,uri} | rawdlite/mopidy,kingosticks/mopidy,bacontext/mopidy,glogiotatidis/mopidy,jodal/mopidy,bacontext/mopidy,SuperStarPL/mopidy,jmarsik/mopidy,mopidy/mopidy,priestd09/mopidy,woutervanwijk/mopidy,pacificIT/mopidy,diandiankan/mopidy,glogiotatidis/mopidy,dbrgn/mopidy,adamcik/mopidy,SuperStarPL/mopidy,hkariti/mopidy,bacontext/mo... | tests/backends/get_test.py | tests/backends/get_test.py | import unittest
from mopidy.backends.dummy import DummyBackend, DummyCurrentPlaylistController
from mopidy.models import Playlist, Track
class CurrentPlaylistGetTest(unittest.TestCase):
def setUp(self):
self.b = DummyBackend()
self.c = self.b.current_playlist
def test_get_by_id_returns_unique... | apache-2.0 | Python | |
069a031ce871125fb727a5ec43f406539be0150f | add .mdown ext in check_ext | tankywoo/simiki,tankywoo/simiki,tankywoo/simiki,zhaochunqi/simiki,9p0le/simiki,9p0le/simiki,zhaochunqi/simiki,9p0le/simiki,zhaochunqi/simiki | simiki/utils.py | simiki/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033... | mit | Python |
f68c673273acbc62259213ceb47bb34e7d3f87fd | Create combination_test.py | BrahmsPotato/PlayWithPrettyFat | test/combination_test.py | test/combination_test.py |
def loop(array_input, com_len, head, array_output):
n= com_len-1;sign=range(head+1,head+com_len)
while(sign[n-1]<=len(array_input)-n):
core(head,sign, n,array_input,array_output)
sign=[x + 1 for x in sign]
def core(head, sign, n, array_input,array_output):
fetch=sign[n-1]
... | mit | Python | |
d4d5ef52cf7ac9f40bb8ada199b6c035690eacfa | Add tests for transmission | Gr1N/rpihelper,Gr1N/rpihelper | rpihelper/transmission/tests.py | rpihelper/transmission/tests.py | # -*- coding: utf-8 -*-
import transmissionrpc
from unittest import TestCase
from unittest.mock import patch, MagicMock
from rpihelper.transmission.logic import (
transmissionrpc_client, transmissionrpc_add_torrent,
)
__all__ = (
'TransmissionrpcClientLogicTests',
'TransmissionrpcAddTorrentLogicTests',
... | mit | Python | |
cb1e797c6039a1677024a563852b117b581faaf2 | Add solution of problem 1 in Python | tborisova/euler,nerd-life/euler,nerd-life/euler,tborisova/euler,tborisova/euler,nerd-life/euler,tborisova/euler,nerd-life/euler,tborisova/euler,nerd-life/euler,nerd-life/euler,tborisova/euler,nerd-life/euler,tborisova/euler | problem1/rumen.py | problem1/rumen.py | sum(filter(lambda x: x % 3 == 0 or x % 5 == 0, range(1, 1000)))
| mit | Python | |
cb82fd05c02b97bfc82668164fe3f3bb22faaade | Add fair and square | laichunpongben/CodeJam | 2013/qualification_round/fair_and_square.py | 2013/qualification_round/fair_and_square.py | #!/usr/bin/env python
# Need solve time complexity
from __future__ import print_function
from collections import deque
def count_fair_and_square_numbers(a, b):
count = 0
n = a
while n <= b:
if is_fair_and_square(n):
count += 1
n += 1
return count
def is_fair_and_square(n):... | apache-2.0 | Python | |
463b20a1fa6740e6db2c8abac3861fa9a30f9a2e | Add Django 1.4.1 as a support version to suppress warning. | MikeAmy/django-reversion,cbrepo/django-reversion,fladi/django-reversion,fladi/django-reversion,Beauhurst/django-reversion,pydanny/django-reversion,ixc/django-reversion,blag/django-reversion,adonm/django-reversion,lutoma/django-reversion,Beauhurst/django-reversion,matllubos/django-reversion,MikeAmy/django-reversion,etia... | src/reversion/__init__.py | src/reversion/__init__.py | """
Transactional version control for Django models.
Developed by Dave Hall.
<http://www.etianen.com/>
"""
import django, warnings
from reversion.revisions import default_revision_manager, revision_context_manager, VersionAdapter
from reversion.admin import VersionAdmin
from reversion.models import pre_revision_com... | """
Transactional version control for Django models.
Developed by Dave Hall.
<http://www.etianen.com/>
"""
import django, warnings
from reversion.revisions import default_revision_manager, revision_context_manager, VersionAdapter
from reversion.admin import VersionAdmin
from reversion.models import pre_revision_com... | bsd-3-clause | Python |
0b445c9606d30f31a6df1d99ef4d564f931014f2 | use unittest | vottie/lang | python/calc/calc_test.py | python/calc/calc_test.py | import unittest
from calc import Calc
class CalcTest(unittest.TestCase):
def setUp(self):
print "Calc Test"
def test_add(self):
c = Calc()
x = 100
y = 200
result = 0
result = c.add(x,y)
print '{0} + {1} = {2}'.format(x, y, result)
self.assertEqual... | mit | Python | |
4972930bb42ed6d7ebc1bad2909ede1a3c213cec | Add preprocessing functions. | prasanna08/MachineLearning | preprocess.py | preprocess.py | import numpy as np
"""This file contains some functions related to preprocessing."""
def get_output_array_from_labels(output_labels, labels_encoding=None):
labels = np.unique(output_labels)
labels = labels.reshape(len(labels), 1)
outputs = np.zeros((output_labels.shape[0], labels.shape[0]))
if not labels_encodin... | mit | Python | |
c1d66909a6ce9903aa0a856d80721c756bc54806 | test for neo4j | clemsos/mitras,clemsos/mitras,clemsos/mitras | test/test_neo4j_graph.py | test/test_neo4j_graph.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# from py2neo import neo4j, node, rel
from bulbs.config import DEBUG
from bulbs.neo4jserver import Graph, Config, NEO4J_URI
from message import Message, IsRetweet # models
from datetime import datetime
# setup
config = Config(NEO4J_URI, "james", "secret")
g = Graph(confi... | mit | Python | |
09f1cf984a456a4a452f1a1c0a0ff6fd09b7b415 | add code.py | onjs/Album | code.py | code.py | print 'Hello GitHub' | artistic-2.0 | Python | |
a5012c9fb81768e85b555b52264baa11efc17ba1 | Add unittest for select_taxa that runs main and selects a single genome | ODoSE/odose.nl | test/test_select_taxa.py | test/test_select_taxa.py | import logging
import os
import tempfile
import unittest
import select_taxa
class Test(unittest.TestCase):
def setUp(self):
self.longMessage = True
logging.root.setLevel(logging.DEBUG)
def test_main(self):
'''
Select a single genome and assert the download log file contains ... | mit | Python | |
b5207cfcee8bd3f1a41fc87f3e9afcfe94646314 | Add example of how to list of codecs. | gmarco/mlt-orig,wideioltd/mlt,ttill/MLT-roto-tracking,zzhhui/mlt,zzhhui/mlt,ttill/MLT,wideioltd/mlt,zzhhui/mlt,xzhavilla/mlt,zzhhui/mlt,j-b-m/mlt,j-b-m/mlt,ttill/MLT-roto,zzhhui/mlt,anba8005/mlt,siddharudh/mlt,ttill/MLT-roto-tracking,zzhhui/mlt,zzhhui/mlt,mltframework/mlt,ttill/MLT,siddharudh/mlt,anba8005/mlt,siddharud... | src/swig/python/codecs.py | src/swig/python/codecs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import required modules
import mlt
# Start the mlt system
mlt.Factory().init( )
# Create the consumer
c = mlt.Consumer( mlt.Profile(), "avformat" )
# Ask for video codecs supports
c.set( 'vcodec', 'list' )
# Start the consumer to generate the list
c.start()
# Get th... | lgpl-2.1 | Python | |
872e2a38845d8a9d321435092f808e2eb79a26e3 | test case for issue #9 | chfw/pyexcel-ods,chfw/pyexcel-ods | tests/test_formatters.py | tests/test_formatters.py | import os
from unittest import TestCase
from textwrap import dedent
import pyexcel as pe
class TestAutoDetectInt(TestCase):
def setUp(self):
self.content = [[1,2,3.1]]
self.test_file = "test_auto_detect_init.ods"
pe.save_as(array=self.content, dest_file_name=self.test_file)
def test_... | bsd-3-clause | Python | |
5692f64619bf009cf92bf0a8c6f77bf82f0e3d02 | Add a new regression testing module | FactoryBoy/factory_boy | tests/test_regression.py | tests/test_regression.py | # Copyright: See the LICENSE file.
"""Regression tests related to issues found with the project"""
import datetime
import typing as T
import unittest
import factory
# Example objects
# ===============
class Author(T.NamedTuple):
fullname: str
pseudonym: T.Optional[str] = None
class Book(T.NamedTuple):
... | mit | Python | |
58354f477decff942a3063a12fb72684beca8233 | Add singleton tests | 3ptscience/properties,aranzgeo/properties | tests/test_singletons.py | tests/test_singletons.py | # coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import properties
from properties.extras import Singleton
class TestSingleton(unittest.TestCase):
def test_singleton(self):
... | mit | Python | |
b93b8d96114338809e6a082f819291144eedd4af | add an utils to reduce the original dataset to a choosen class samples size | plabadille/image_classifier | reduce_dataset.py | reduce_dataset.py | import sys, os
from shutil import copyfile
supplied_args = sys.argv[1:]
DATA_DIRECTORY = "data_dir"
NEW_DATA_DIRECTORY = supplied_args[0] if supplied_args else sys.exit("You need to supplied a new data directory name : $python reduce_dataset.py <new data directory name> <max sample by class>")
MAX_SAMPLE_BY_CLASS = i... | mit | Python | |
ab164307310474625926bbc9ea7fae03b99c99cf | Create architecture core models | YACOWS/opps,williamroot/opps,opps/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,jeanmask/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps | opps/core/models/__init__.py | opps/core/models/__init__.py | # -*- coding: utf-8 -*-
from opps.core.models.channel import *
from opps.core.models.publisher import *
| mit | Python | |
c488befd6f27a6576a2f6f34c46f29f63d5505dc | add BAM module report | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | sequana/modules_report/bamqc.py | sequana/modules_report/bamqc.py | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
# Rachel Lege... | bsd-3-clause | Python | |
9fde684095ba34300fcade827dfb17eae99f4daa | add advanced.py | ianzhengnan/learnpy,ianzhengnan/learnpy | renew/advanced.py | renew/advanced.py |
def fib(max):
a, b, n = 0, 1, 0
while n < max:
yield b
a, b = b, a + b
n += 1
print('done')
for i in fib(20):
print(i)
| apache-2.0 | Python | |
fab91baa976693f89c6001a0e09e0f351d30ccfe | add decorator timeout test | ResolveWang/WeiboSpider,ResolveWang/WeiboSpider,yzsz/weibospider,yzsz/weibospider | test/test_decorator.py | test/test_decorator.py | # coding=utf-8
import unittest
from decorators.decorator import *
import time
class TestDecorator(unittest.TestCase):
def test_timeout(self):
@timeout(1)
def test_timeout_no_params():
time.sleep(2)
self.assertTrue()
test_timeout_no_params()
@timeout(1)
... | mit | Python | |
db85c1a9aca124ef4cf45c61244c6cf556138d77 | Add cmd.py script | ruslo/configs | python/cmd.py | python/cmd.py | #!/usr/bin/env python3
# Copyright (c) 2014, Ruslan Baratov
# All rights reserved.
import argparse
import os
import stat
import subprocess
import sys
import detail.os
import detail.command
assert(sys.version_info.major == 3)
parser = argparse.ArgumentParser(description='Start windows cmd')
args = parser.parse_args... | bsd-2-clause | Python | |
48faf04cfcd40739e2a0ddfc593f2320f1aeef65 | Create re_install.py | mic100/RPi_recovery | re_install.py | re_install.py | # -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------#
# #
# import libs #
# ... | mit | Python | |
4411c676426fb580d33ae09682444c093ab2c204 | Add multi-processing tests | vbkaisetsu/clopure | test/test_mp.py | test/test_mp.py | import unittest
import time
from clopure.core import ClopureRunner
from clopure.parser import ClopureParser
class TestMultiprocessing(unittest.TestCase):
def setUp(self):
self.parser = ClopureParser()
self.runner = ClopureRunner(procs=4)
def test_pmap(self):
code = "(defimport time ... | mit | Python | |
122eb3c6eb9f8467fc5d3325f0e5c58cc285cb50 | Add a script to convert hex formatted key to token using random partitioner | bharatendra/ctools | token-hexkey.py | token-hexkey.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) 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... | apache-2.0 | Python | |
b35a0d2415cfc8d8d5d4060f1cf411a42c90a9a0 | add leetcode Pascal's Triangle. | Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code | leetcode/PascalTriangle/solution.py | leetcode/PascalTriangle/solution.py | # -*- coding:utf-8 -*-
class Solution:
# @return a list of lists of integers
def generate(self, numRows):
ret = []
if numRows == 0:
return []
if numRows == 1:
ret.append([1])
return ret
if numRows == 2:
ret.extend([[1], [1,1]])
... | mit | Python | |
8b5f09708eb79abdcde730727f6788881a3a68a3 | Initialize P4_textToExcel | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | # Write a program to read in the contents of several text files (you can make
# the text files yourself) and insert those contents into a spreadsheet, with
# one line of text per row. The lines of the first text file will be in the
# cells of column A, the lines of the second text file will be in the cells of
# column ... | mit | Python | |
ed17414ed09e117b33f8407517e2a69fa839452e | add edit-keps.py | kubernetes/enhancements,kubernetes/enhancements,kubernetes/enhancements | hack/edit-keps.py | hack/edit-keps.py | #!/usr/bin/env python3
# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 | Python | |
c50e072c5e79083ec3ec4104789a64223c2f63f8 | Create tao.py | taofengno1/wechatcron | tao.py | tao.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from apscheduler.schedulers.blocking import BlockingScheduler
import itchat, time
itchat.auto_login()
def task():
chatroomList = itchat.get_chatrooms(False);
for m in chatroomList:
NickName = m['NickName'].encode('utf-8')
if NickName == u'测试'.encode('utf-8'):
... | mit | Python | |
7e757d24bff5758350dd2bc92b9e2b1e2f919c12 | Add compute synth (#3830) | googleapis/google-cloud-java,googleapis/google-cloud-java,googleapis/google-cloud-java | java-compute/google-cloud-compute/synth.py | java-compute/google-cloud-compute/synth.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python | |
2d88daf10d11033bfd597112fb6484783c5a852a | Create xyz.py | bskinn/opan,bskinn/opan | xyz.py | xyz.py | #...
| mit | Python | |
e61840020820af4e7a625e472c060e8396b24055 | add migrations | praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem | gem/migrations/0013_gemsettings_moderator_name.py | gem/migrations/0013_gemsettings_moderator_name.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-09 13:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gem', '0012_partner_credit'),
]
operations = [
migrations.AddField(
... | bsd-2-clause | Python | |
955ae619a6502a68f9a8d34022a4a8b1ebeb5ce2 | Create 20.py | Pouf/CodingCompetition,Pouf/CodingCompetition | E/20.py | E/20.py | # Problem 20 - Factorial digit sum
# n! means n × (n − 1) × ... × 3 × 2 × 1
# For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
# and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27
# Find the sum of the digits in the number 100!
from math import factorial as f
print(sum(int(c) for c in s... | mit | Python | |
81f983c833d9858ad23f589367bf601babddf858 | Add some useful activation functions. | mmohaveri/DeepNetTookKit | elements/activation_functions.py | elements/activation_functions.py | import theano
import theano.tensor as T
"""
A set of activation functions for Neural Network layers.
They're in the form of class so we can take advantage of constructor
to set initial value for some parameters.
"""
def tanh(x):
"""
tanh function (-1 to 1)
@input: x, theano shared variable.
@output: element-wise... | mit | Python | |
b8e7f5381abcf15d07cac07c20c671ec7cc64c90 | Add missing migration. | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ideascube/mediacenter/migrations/0013_auto_20170323_1525.py | ideascube/mediacenter/migrations/0013_auto_20170323_1525.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-23 15:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mediacenter', '0012_auto_20170210_0940'),
]
operations = [
migrations.Alter... | agpl-3.0 | Python | |
6585ca91a399a06094636a505fe813a0425c1a35 | add auth module (split from server mod.) | word-killers/mark2down,word-killers/mark2down,word-killers/mark2down | auth.py | auth.py | from urllib import urlencode
from requests import post
auth_url = 'https://github.com/login/oauth/authorize'
access_token_url = 'https://github.com/login/oauth/access_token'
def generate_auth_link(client_id, scopes):
# append the client_id and scopes list to the url query string
return auth_url + '?' + urle... | mit | Python | |
dbc20f37c7fb1dd00c90ac54d2021fb1ba3b5eda | Add some end-to-end functional tests | rhgrant10/Groupy | exam.py | exam.py | import time
import sys
from groupy.client import Client
def read_token_from_file(filename):
with open(filename) as f:
return f.read().strip()
def test_groups(groups):
for group in groups:
print(group)
print('Members:')
for member in group.members[:5]:
print(memb... | apache-2.0 | Python | |
64139e0a41c1b1da81e9b5e244b2d7095c4a7a2b | Add delete old sessions command | nanuxbe/djangopackages,QLGu/djangopackages,nanuxbe/djangopackages,QLGu/djangopackages,pydanny/djangopackages,QLGu/djangopackages,pydanny/djangopackages,pydanny/djangopackages,nanuxbe/djangopackages | core/management/commands/delete_old_sessions.py | core/management/commands/delete_old_sessions.py | from datetime import datetime
from django.core.management.base import BaseCommand
from django.contrib.sessions.models import Session
"""
>>> def clean(count):
... for idx, s in enumerate(Session.objects.filter(expire_date__lt=now)[:count+1]):
... s.delete()
... if str(idx).endswith('000'): print idx
... p... | mit | Python | |
bb0cff292f1931b52bf05a3a0630dda9a508023f | Add basic wrapper for gym env | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/src/syft/lib/gym/env.py | packages/syft/src/syft/lib/gym/env.py | # third party
import gym
# syft relative
from ...generate_wrapper import GenerateWrapper
from ...proto.lib.gym.env_pb2 import Env as Env_PB
gym_env_type = type(gym.Env())
def object2proto(obj: gym.Env) -> Env_PB:
return Env_PB(id=obj.unwrapped.spec.id)
def proto2object(proto: Env_PB) -> gym.Env:
return gy... | apache-2.0 | Python | |
05bf0cd188d4666c9c0aeb56a95d7867f25952c2 | Add a script for dqn continuous task demo | toslunar/chainerrl,toslunar/chainerrl | demo_dqn_continuous.py | demo_dqn_continuous.py | import argparse
import chainer
from chainer import serializers
import gym
import numpy as np
import random_seed
import env_modifiers
import q_function
def eval_single_run(env, model, phi):
test_r = 0
obs = env.reset()
done = False
while not done:
s = chainer.Variable(np.expand_dims(phi(obs),... | mit | Python | |
a2cb69b40daa7ab7b222e7d670dd1022571395a1 | add aiohttp demon | snower/torpeewee,snower/torpeewee | demos/aiohttp_demon.py | demos/aiohttp_demon.py | # -*- coding: utf-8 -*-
# 18/5/22
# create by: snower
import datetime
from torpeewee import *
from aiohttp import web
db = MySQLDatabase("test", host="127.0.0.1", user="root", passwd="123456")
class BaseModel(Model):
class Meta:
database = db
class Test(BaseModel):
id = IntegerField(primary_key= Tru... | mit | Python | |
6d43946db5b672ca875c793417f1fb7894387f73 | Add Ycm Config | guoxiao/skiplist | tests/.ycm_extra_conf.py | tests/.ycm_extra_conf.py | import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Weffc++',
'-pedantic',
#'-Wc++98-compat',
'... | mit | Python | |
3b88f0a96b60734374656e290845fc826f988850 | add dumpprices | joequant/bitcoin-price-api | scripts/dumpprices.py | scripts/dumpprices.py | #!/bin/python3
import requests
import grequests
assets = ['USD', 'USDT', 'EUR', 'BTC', 'XRP', 'ETH', 'HKD', 'LTC', 'RUR']
#btce
def btc_e(assets):
retval = []
r = requests.get('https://btc-e.com/api/3/info').json()
urls=[]
pairs = []
for k, v in r['pairs'].items():
k1, k2 = k.upper().split... | mit | Python | |
f61570297ef56e94b104aff42c822ea82a66030b | Add tests for database | sanchopanca/rcblog,sanchopanca/rcblog,sanchopanca/rcblog | tests/test_database.py | tests/test_database.py | import unittest
from rcblog import db
class TestDataBase(unittest.TestCase):
@classmethod
def setUpClass(cls):
db.DB_NAME = 'test'
date_base = db.DataBase()
try:
db.r.table_drop('languages').run(date_base.connection)
except Exception as e:
print(e)
... | mit | Python | |
054c71e88a5fb278ffcdac2ce85a59843f5e3ac0 | add new tests for oop | ratnania/pyccel,ratnania/pyccel | tests/scripts/oop/ex1.py | tests/scripts/oop/ex1.py | # coding: utf-8
#$ header class Point(public)
#$ header method __init__(Point, double, double)
#$ header method __del__(Point)
#$ header method translate(Point, double, double)
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __del__(self):
pass
def transl... | mit | Python | |
8d280e5a464a9ca75ac7c35e02d8de6bddbaaa7e | Add reaction tests | iwi/linkatos,iwi/linkatos | tests/test_reaction.py | tests/test_reaction.py | import pytest
import linkatos.reaction as react
def test_positive_reaction():
reaction = '+1'
assert react.positive_reaction(reaction) is True
def test_not_positive_reaction():
reaction = '-1'
assert react.positive_reaction(reaction) is False
def test_known_reaction_neg():
reaction = '-1'
a... | mit | Python | |
c0f7be02fb1dc294a9bac2867fc695e353ea3445 | Test Resource. | soasme/electro | tests/test_resource.py | tests/test_resource.py | # -*- coding: utf-8 -*-
from unittest import TestCase
from electro.resource import Resource
class TestResource(TestCase):
def assert_parser(self, assert_value, values):
resource = Resource()
value = resource._parse_response(values)
self.assertEqual(value, assert_value)
def test_empty... | mit | Python | |
5adf35b9131ea6c0a16f6765cf44c50767ddc3f3 | add testanalyzing | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | tests/testanalyzing.py | tests/testanalyzing.py | from timeside.decoder import *
from timeside.analyzer import *
from unit_timeside import *
import os.path
__all__ = ['TestAnalyzing']
class TestAnalyzing(TestCase):
"Test all analyzers"
def setUp(self):
self.source = os.path.join (os.path.dirname(__file__), "samples/sweep.wav")
def testDC(self... | agpl-3.0 | Python | |
b2a083e1531134ec82a70ca581fca31db7867566 | add test for data with no coincidences | simomarsili/ndd | tests/test_singletons.py | tests/test_singletons.py | # -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
"""Test ref results for data with no coincidences."""
import numpy
import pytest
from pytest import approx
from ndd.estimators import NSB, AsymptoticNSB, Plugin
from ndd.exceptions import NddError
N = (10, 10)
K = (10, ... | bsd-3-clause | Python | |
d8470858316f260a1801d7113f2eee6a0595b9d1 | add tool.py | cleverhans-lab/cleverhans,cleverhans-lab/cleverhans,cleverhans-lab/cleverhans,openai/cleverhans | examples/adversarial_asr/tool.py | examples/adversarial_asr/tool.py | from tensorflow.python import pywrap_tensorflow
import numpy as np
import tensorflow as tf
from lingvo.core import asr_frontend
from lingvo.core import py_utils
def _MakeLogMel(audio, sample_rate):
audio = tf.expand_dims(audio, axis=0)
static_sample_rate = 16000
mel_frontend = _CreateAsrFrontend()
with tf.con... | mit | Python | |
7ac29357f9bd022a5d1bc68a0a7aa589a7ff5790 | add server crypto example | aliyun/aliyun-oss-python-sdk | examples/object_server_crypto.py | examples/object_server_crypto.py | # -*- coding: utf-8 -*-
import os
import shutil
import oss2
from oss2.headers import requestHeader
# 以下代码展示了其用服务端加密功能的各项操作
# 首先初始化AccessKeyId、AccessKeySecret、Endpoint等信息。
# 通过环境变量获取,或者把诸如“<你的AccessKeyId>”替换成真实的AccessKeyId等。
#
# 以杭州区域为例,Endpoint可以是:
# http://oss-cn-hangzhou.aliyuncs.com
# https://oss-cn-hangzh... | mit | Python | |
ad54db707004dd2b6e445c72462c1e937417d046 | test viz lib on fibonacci numbers | egorhm/algo | algopy/fib_gcd.py | algopy/fib_gcd.py | from rcviz import viz, callgraph
@viz
def fib1(num):
assert num >= 0
if num <= 1:
return num
fb1 = fib1(num - 1)
fb2 = fib1(num - 2)
res = fb1 + fb2
return res
@viz
def fib2(num):
assert num >= 0
return num if num <= 1 else fib2(num - 1) + fib2(num - 2)
def gcd(a, b):
... | mit | Python | |
8510352580ac6f39d706b6a4ace8426f9b45ca6c | Add unit tests for security_group_rules_client | bigswitch/tempest,cisco-openstack/tempest,Tesora/tesora-tempest,Tesora/tesora-tempest,rakeshmi/tempest,openstack/tempest,zsoltdudas/lis-tempest,vedujoshi/tempest,Juniper/tempest,sebrandon1/tempest,izadorozhna/tempest,zsoltdudas/lis-tempest,LIS/lis-tempest,masayukig/tempest,xbezdick/tempest,vedujoshi/tempest,openstack/t... | tempest/tests/services/compute/test_security_group_rules_client.py | tempest/tests/services/compute/test_security_group_rules_client.py | # Copyright 2015 NEC Corporation. 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 required ... | apache-2.0 | Python | |
0d32be58f5145c067e012a9d314be3f688bcbc2a | Add tests for view | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/scheduler/tests/test_views.py | go/scheduler/tests/test_views.py | import datetime
from go.vumitools.tests.helpers import djangotest_imports
with djangotest_imports(globals()):
from django.core.urlresolvers import reverse
from django.template import defaultfilters
from django.conf import settings
from go.base.tests.helpers import GoDjangoTestCase, DjangoVumiApiHelper
... | bsd-3-clause | Python | |
c39b95eebb402d1d0137448b3f0efd9b6d7ec169 | Test if repository manager if retrieving a repository when we lookup after one | shawkinsl/pyolite,PressLabs/pyolite | tests/managers/test_repository.py | tests/managers/test_repository.py | from unittest import TestCase
from mock import MagicMock, patch
from nose.tools import eq_
from pyolite.managers.repository import RepositoryManager
class TestRepositoryManager(TestCase):
def test_get_repository(self):
mocked_repository = MagicMock()
mocked_repository.get_by_name.return_value = 'my_repo'
... | bsd-2-clause | Python | |
9ad755263fe12fa16c0b27381893c380626c85d8 | Add unittest for string_view conversion | olifre/root,olifre/root,karies/root,olifre/root,zzxuanyuan/root,karies/root,olifre/root,root-mirror/root,karies/root,zzxuanyuan/root,olifre/root,root-mirror/root,zzxuanyuan/root,karies/root,karies/root,root-mirror/root,root-mirror/root,zzxuanyuan/root,karies/root,olifre/root,root-mirror/root,zzxuanyuan/root,root-mirror... | bindings/pyroot/test/conversions.py | bindings/pyroot/test/conversions.py | import unittest
import ROOT
cppcode = """
void stringViewConv(std::string_view) {};
"""
class ListInitialization(unittest.TestCase):
@classmethod
def setUpClass(cls):
ROOT.gInterpreter.Declare(cppcode)
def test_string_view_conv(self):
ROOT.stringViewConv("pyString")
if __name__ == '__mai... | lgpl-2.1 | Python | |
8f02faec76c9b8cb7468934a4981fe1fe3ed30b5 | add client | fivejjs/crosscat,poppingtonic/BayesDB,probcomp/crosscat,fivejjs/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,mit-probabilistic-computing-project/crosscat,JDReutt/BayesDB,probcomp/crosscat,fivejjs/crosscat,JDReutt/BayesDB,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,mit-proba... | jsonrpc_http/Client.py | jsonrpc_http/Client.py | import tabular_predDB.python_utils.api_utils as au
from tabular_predDB.jsonrpc_http.MiddlewareEngine import MiddlewareEngine
middleware_engine = MiddlewareEngine()
class Client(object):
def __init__(self, hostname='localhost', port=8008):
if hostname == None:
self.online = False
else:
... | apache-2.0 | Python | |
6cfca819bbefab1f38904fc73b46dae80e03b32e | Create __init__.py | alex-kooper/knockoutpy | knockoutpy/__init__.py | knockoutpy/__init__.py | mit | Python | ||
9eb5f67a954888c4e14789b5b8acc785c789a77c | Add a command for creating rsa key. | juanifioren/django-oidc-provider,wojtek-fliposports/django-oidc-provider,nmohoric/django-oidc-provider,nmohoric/django-oidc-provider,ByteInternet/django-oidc-provider,juanifioren/django-oidc-provider,wojtek-fliposports/django-oidc-provider,bunnyinc/django-oidc-provider,bunnyinc/django-oidc-provider,wayward710/django-oi... | oidc_provider/management/commands/creatersakey.py | oidc_provider/management/commands/creatersakey.py | from Crypto.PublicKey import RSA
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Randomly generate a new RSA key for the OpenID server'
def handle(self, *args, **options):
try:
key = RSA.generate(1024)... | mit | Python | |
aaddd474b8e17164c59f445d14b75b9f20a95948 | add post install | gsmafra/py-aasp-casa | setup_post_install.py | setup_post_install.py | import urllib2
import zipfile
import re
import sys
from glob import glob
from os import chdir, mkdir, rename, getcwd
from os.path import exists
from resample_all import resample_all
def run_post_install():
# Double check modules
modules = set(['numpy', 'scipy', 'librosa', 'sklearn'])
for module in modules:
try... | mit | Python | |
11c4fe68be160caba706fab05767238396e8d25b | Add files via upload | moranzcw/Computer-Networking-A-Top-Down-Approach-NOTES | SocketProgrammingAssignment/作业3-邮件客户端/TSL和发送混合类型email.py | SocketProgrammingAssignment/作业3-邮件客户端/TSL和发送混合类型email.py |
from socket import *
import base64
endmsg = ".\r\n"
mail_t='1254516725@qq.com'
#chose qq mail smtp server
mailserver = 'smtp.qq.com'
fromaddr='2634081011@qq.com'
toaddr='galliumwang@163.com'
user='MjYzNDA4MTAxMUBxcS5jb20='
passw='aXFvcm1ncGd2aHp2ZWNnaQ=='
serverPort=25
serverPort_TLS=587
clientSocke... | mit | Python | |
45140f281ac8df0a8f325e99d2cc17385eabbcf4 | Create fizzbuzz.py | Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects | solutions/fizzbuzz.py | solutions/fizzbuzz.py | def fizzbuzz(number):
for i in range(number):
if i%15 == 0:
print "FizzBuzz"
elif i%5 == 0:
print "Buzz"
elif i%3 == 0:
print "Fizz"
else:
print i
def main():
fizzbuzz(101)
if __name__ == '__main__':
main()
| mit | Python | |
2ea891fd99eb50f58abb6cf1dba55950916742ab | Clear solution for roman-numerals. | mknecht/checkio-attempts | roman-numerals.py | roman-numerals.py | # I 1 (unus)
# V 5 (quinque)
# X 10 (decem)
# L 50 (quinquaginta)
# C 100 (centum)
# D 500 (quingenti)
# M 1,000 (mille)
place2symbol = {
0: "I",
1: "X",
2: "C",
3: "M",
}
replacements = [
("I" * 9, "IX"),
("I" * 5, "V"),
("I" * 4, "IV"),
("X" * 9, "XC"),
("X" * 5, "L"),
("X" *... | mit | Python | |
d0c4ff9461144e9608c30c8d5a43381282912cc0 | Add builtin/github/writer.py | samjabrahams/anchorhub | anchorhub/builtin/github/writer.py | anchorhub/builtin/github/writer.py | """
File that initializes a Writer object designed for GitHub style markdown files.
"""
from anchorhub.writer import Writer
from anchorhub.builtin.github.wstrategies import MarkdownATXWriterStrategy, \
MarkdownSetextWriterStrategy, MarkdownInlineLinkWriterStrategy
import anchorhub.builtin.github.switches as ghswit... | apache-2.0 | Python | |
ed19693800bbe50121fead603a3c645fdc1ed81a | Add migration | City-of-Helsinki/smbackend,City-of-Helsinki/smbackend | services/migrations/0059_add_unit_count_related_name.py | services/migrations/0059_add_unit_count_related_name.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-17 11:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('services', '0058_add_servicenodeunitcount'),
]
op... | agpl-3.0 | Python | |
d46374388596fee83be8aa850afc961579b71a22 | add basic settings.py | openatx/uiautomator2,openatx/uiautomator2,openatx/uiautomator2 | uiautomator2/settings.py | uiautomator2/settings.py | # coding: utf-8
#
from typing import Any
import uiautomator2 as u2
class Settings(object):
def __init__(self, d: u2.Device = None):
self._d = d
self._defaults = {
"post_delay": 0,
"implicitly_wait": 20.0,
}
self._props = {
"post_delay": [float, ... | mit | Python | |
4dac5069084e90a0c4b0fd12e763e92df79f31c5 | rename ds_justification_reason to justification_reason - add migration | unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal | backend/unpp_api/apps/project/migrations/0017_auto_20170915_0734.py | backend/unpp_api/apps/project/migrations/0017_auto_20170915_0734.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-15 07:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('project', '0016_remove_application_agency'),
]
operations = [
migrations.RenameFiel... | apache-2.0 | Python | |
d7f024bc47c362afc6930510dea3bc425d5b554a | create example_fabfile | DNX/pg_fabrep | pg_fabrep/example_fabfile.py | pg_fabrep/example_fabfile.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from fabric.api import env, task
from pg_fabrep.tasks import *
@task
def example_cluster():
# name of your cluster - no spaces, no special chars
env.cluster_name = 'example_cluster'
# always ask user for confirmation when run any tasks
# default: True
... | bsd-3-clause | Python | |
c4243483052ec7eec2f1f88ea72fafc953d35648 | Add ptxgen sample | nvidia-compiler-sdk/pynvvm | samples/ptxgen.py | samples/ptxgen.py | # Copyright (c) 2013 NVIDIA Corporation
#
# 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, ... | mit | Python | |
ebc417be95bcec7b7a25dc1ad587f17b1bfa521d | Add download_student_forms | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | scripts/download_student_forms.py | scripts/download_student_forms.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | apache-2.0 | Python | |
3b67d7919affb47e79a8b7cd5dab5f226e96eb86 | Update IDTools (#1547) | artefactual/archivematica,artefactual/archivematica,artefactual/archivematica,artefactual/archivematica | src/dashboard/src/fpr/migrations/0033_update_idtools.py | src/dashboard/src/fpr/migrations/0033_update_idtools.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration_up(apps, schema_editor):
"""Update identification tools FIDO and Siegfried to current
versions, allowing for integration of PRONOM 96.
"""
idtool = apps.get_model("fpr", "IDTool")
... | agpl-3.0 | Python | |
013d793c6ebe7a4d426d6c2d823510f90b84d19e | Add a landmine to get rid of obselete test netscape plugins | bright-sparks/chromium-spacewalk,chuan9/chromium-crosswalk,bright-sparks/chromium-spacewalk,mohamed--abdel-maksoud/chromium.src,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,jaruba/chromium.src,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,ltilve/chromium,l... | build/get_landmines.py | build/get_landmines.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import optparse
i... | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import optparse
i... | bsd-3-clause | Python |
5401eb7b463dfd9a807b86b7bdfa4079fc0cb2ac | Define basic regular expressions | Spirotot/taskwiki,phha/taskwiki | autoload/vimwiki_pytasks.py | autoload/vimwiki_pytasks.py | import vim
import re
from tasklib.task import TaskWarrior, Task
# Building blocks
BRACKET_OPENING = re.escape('* [')
BRACKET_CLOSING = re.escape('] ')
EMPTY_SPACE = r'(?P<space>\s*)'
TEXT = r'(?P<text>.+)'
UUID = r'(?P<uuid>[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})'
DUE = r'(?P<due>... | import vim
import re
from tasklib import task
"""
How this plugin works:
1.) On startup, it reads all the tasks and syncs info TW -> Vimwiki file. Task is identified by their
uuid.
2.) When saving, the opposite sync is performed (Vimwiki -> TW direction).
a) if task is marked as subtask by ind... | mit | Python |
08402e98f9eb56ab3b103e5bf36004638461f903 | Add koi7-to-utf8 script. | sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-o... | languages/python/koi7-to-utf8.py | languages/python/koi7-to-utf8.py | #!/usr/bin/python
# -*- encoding: utf-8 -*-
#
# Перекодировка из семибитного кода КОИ-7 Н2
# (коды дисплея Videoton-340) в кодировку UTF-8.
# Copyright (C) 2016 Serge Vakulenko <vak@cronyx.ru>
#
import sys
if len(sys.argv) != 2:
print "Usage: koi7-to-utf8 file"
sys.exit (1)
translate = {
'`':'Ю', 'a':'А',... | apache-2.0 | Python | |
815845fd98627fe9df0b0444ee31fe337d1c63da | Add celery worker module | jmlong1027/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,mitre/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,awest1339/multiscanner,awest1339/multiscanner,MITRECND/multiscanner | utils/celery_worker.py | utils/celery_worker.py | import os
import sys
# Append .. to sys path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import multiscanner
from celery import Celery
from celery.contrib.batches import Batches
app = Celery('celery_worker', broker='pyamqp://guest@localhost//')
@app.task(base=Batches, flush_every=100... | mpl-2.0 | Python | |
60e37ece40e96ecd9bba16b72cdb64e1eb6f8f77 | Fix purge_cluster script | enthought/distarray,enthought/distarray,RaoUmer/distarray,RaoUmer/distarray | utils/purge_cluster.py | utils/purge_cluster.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | bsd-3-clause | Python |
43629166927a0e6e7f4648a165ce12e22b32508d | Add missing migration for DiscoveryItem (#15913) | bqbn/addons-server,bqbn/addons-server,wagnerand/addons-server,bqbn/addons-server,mozilla/olympia,mozilla/olympia,mozilla/olympia,mozilla/addons-server,diox/olympia,wagnerand/addons-server,mozilla/addons-server,mozilla/addons-server,mozilla/olympia,diox/olympia,wagnerand/addons-server,diox/olympia,mozilla/addons-server,... | src/olympia/discovery/migrations/0010_auto_20201104_1424.py | src/olympia/discovery/migrations/0010_auto_20201104_1424.py | # Generated by Django 2.2.16 on 2020-11-04 14:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('discovery', '0009_auto_20201027_1903'),
]
operations = [
migrations.RemoveField(
model_name='discoveryitem',
name='custom_a... | bsd-3-clause | Python | |
c5f91aa604ccca0966be3076c46385d6019b65f2 | Add utils refresh_db | odtvince/APITaxi,openmaraude/APITaxi,odtvince/APITaxi,odtvince/APITaxi,l-vincent-l/APITaxi,odtvince/APITaxi,l-vincent-l/APITaxi,openmaraude/APITaxi | APITaxi/utils/refresh_db.py | APITaxi/utils/refresh_db.py | # -*- coding: utf-8 -*-
#Source: http://dogpilecache.readthedocs.org/en/latest/usage.html
from sqlalchemy import event
from sqlalchemy.orm import Session
def cache_refresh(session, refresher, *args, **kwargs):
"""
Refresh the functions cache data in a new thread. Starts refreshing only
after the session w... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.