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 |
|---|---|---|---|---|---|---|---|---|
501cc5bc17cadea8ea587cf6bed328e83a039ac9 | add tests | klahnakoski/mo-dots | tests/test_list.py | tests/test_list.py | # encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __f... | mpl-2.0 | Python | |
648da400a78d7904e2388707add806db71bb0626 | fix verification for a test which is sensitive to line-endings. | aep/clay,mario-campos/clay,aep/clay,jckarter/clay,mario-campos/clay,jckarter/clay,aep/clay,jckarter/clay,mario-campos/clay,iamrekcah/clay,jckarter/clay,jckarter/clay,iamrekcah/clay,mario-campos/clay,aep/clay,aep/clay,iamrekcah/clay,iamrekcah/clay,jckarter/clay,mario-campos/clay,iamrekcah/clay,aep/clay | test/uncategorized/7/config.py | test/uncategorized/7/config.py | def match(output) :
refoutput = open("out.txt").read()
return output.replace('\r', '') == refoutput.replace('\r', '')
| bsd-2-clause | Python | |
4c38a3a58ff3b57aff9c3ea5f9f632505dbfbdeb | fix broken references in podcast-states objects | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/maintenance/management/commands/fix-podcast-states.py | mygpo/maintenance/management/commands/fix-podcast-states.py | from optparse import make_option
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from mygpo.core.models import Podcast
from mygpo.decorators import repeat_on_conflict
from mygpo.users.models import PodcastUserState
from mygpo.maintenance.merge import merge_podcast_state... | agpl-3.0 | Python | |
44e891a189cf443cb89cbf461587ef3f49218c02 | Create Stored Procedure for retrieving the API un/key combo (#98) | intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre | chroma-manager/chroma_core/migrations/0033_api_key_procedure.py | chroma-manager/chroma_core/migrations/0033_api_key_procedure.py | # -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
db.execute("""
CREATE OR REPLACE FUNCTION api_key(
OUT username text,
OUT key text
) AS
$func$
BEGIN
SELECT ta.key, au.username
INTO key, usernam... | mit | Python | |
902606e281a6f9a4be3311b074d370f4cd3ba811 | Add tests for lustre cmd library | intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre | tests/test_cmds/test_lustre.py | tests/test_cmds/test_lustre.py | from hydra_agent.cmds import lustre
import unittest
class TestLustreMkfsCommand(unittest.TestCase):
def test_mdt_mkfs(self):
cmd = lustre.mkfs(device='/dev/foo',
target_types=['mdt'])
assert cmd == "mkfs.lustre --mdt /dev/foo"
def test_mgs_mkfs(self):
cmd = lu... | mit | Python | |
fefbfc19847bd337f094cafe07900b0981b3d3b3 | Create tar.py | Zuckonit/tar.py | tar.py | tar.py | #!/usr/bin/env python
# encoding: utf-8
"""
wrapper for tarfile
~~~~~~~~
tar.py
"""
import os.path as osp
from zipfile import ZipFile, ZIP_DEFLATED
from tarfile import TarFileCompat, TAR_PLAIN, TAR_GZIPPED
class Tar(object):
"""
compress files as tar
"""
suffix = ('TAR', 'tar')
comp... | mit | Python | |
8e314c477503caf6264af1632e2edb0af9195fee | Solve task #1021 | Zmiecer/leetcode,Zmiecer/leetcode | 1021.py | 1021.py | class Solution:
def removeOuterParentheses(self, S: str) -> str:
answer = []
brackets = 0
prev_index = 0
for index, ch in enumerate(S):
if ch == '(':
brackets += 1
else:
brackets -= 1
if brackets == 0:
... | mit | Python | |
b19cd7ec8a7c4a6a18bdcc1571812d51da7d74d5 | Create time_keeper.py | JamesKBowler/fxcmminer | fxcmminer_v1.0/time_keeper.py | fxcmminer_v1.0/time_keeper.py | from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.executors.pool import ProcessPoolExecutor
import Queue as queue
import settings as s
from event import GetLiveEvent
import logging
from logging import DEBUG
class LiveEventTimer(object):
"""
Creates time based event for collecti... | mit | Python | |
7d90b256bcdcd6bebec2b0a78300675aefea10d3 | Create Apul.py | GrautDevelopes/Apul.py | Apul.py | Apul.py | #Main page for Apul.py http://github.com/GrautDevlopes/Apul.py/
#Very alpha. Expect bugs!
#Only use redirectors that go to blobar and don't go to clickvalidator.net. Examples:
#http://youtuber.com/ << Redirects to clickvalidator
#http://pete.com/ << The only one that seems to work
#http://youtibe.com/ << Redirects to c... | mit | Python | |
9eac60c2d6707a7f762c74d118e5292d2af7a3c1 | Initialize P02_great | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter06/P02_great.py | books/AutomateTheBoringStuffWithPython/Chapter06/P02_great.py | # This program asks how you're doing and responds
print('How are you?')
feeling = input()
if feeling.lower() == 'great':
print('I feel great too.')
else:
print('I hope the rest of your day is good.')
| mit | Python | |
8f060226614491db703ec18fb5cebb8626b4e9b2 | Create mqtt_test.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | gateway/src/test/mqtt_test.py | gateway/src/test/mqtt_test.py | #Use hbmqtt.
#pip install hbmqtt
| mit | Python | |
31a721248c0e6f4c115e4315e5fb795c26d1e96c | Add own parser | sneaksnake/z5bot | parser.py | parser.py | class Parser(object):
"""
The Parser class returns corresponding
functions for matching keywords.
"""
def __init__(self):
"""Creates an empty self._commands dictionary"""
self._commands = {}
def add_command(self, command, function):
"""Associates a command with a corresponding function"""
... | mit | Python | |
3b3eee368877473b4103d711ffe5b05675e09891 | move parser to separate file | puhitaku/slackmojicode | parser.py | parser.py | from rply import ParserGenerator
from rply.token import BaseBox
import lexer
class ParserState(object):
def __init__(self):
self.variables = {}
class Integer(BaseBox):
def __init__(self, value):
self.value = value
def eval(self):
return self.value
class Float(B... | unlicense | Python | |
fc25d095c95a7d4a6cd9f7a5dc05fce1f55ca438 | add part 9 | f0lie/basic_python_workshop | part_9.py | part_9.py | # Lets attempt to draw two points and have them move also
pos_1 = 0
velo_1 = 1
pos_2 = 9
velo_2 = -1
line = 10*[' ']
for i in range(10):
line[pos_1] = '*'
line[pos_2] = '*'
print("".join(line))
line[pos_1] = ' '
line[pos_2] = ' '
pos_1 += velo_1
pos_2 += velo_2
# Note that if we used th... | mit | Python | |
69f35d6a233b7b9d85bcdfc2d6e668c14cbfa03a | Add adcs module | byt3bl33d3r/CrackMapExec | cme/modules/adcs.py | cme/modules/adcs.py | import re
from impacket.ldap import ldap, ldapasn1
from impacket.ldap.ldap import LDAPSearchError
class CMEModule:
'''
Find PKI Enrollment Services in Active Directory.
Module by Tobias Neitzel (@qtc_de)
'''
name = 'adcs'
description = 'Find PKI Enrollment Services in Active Directory'
su... | bsd-2-clause | Python | |
65532b1babaed53fb5a56fa61bfcbedef64c5713 | use cvmfs.py for openCatalog.py | cvmfs-testing/cvmfs,reneme/cvmfs,cvmfs-testing/cvmfs,alhowaidi/cvmfsNDN,DrDaveD/cvmfs,Moliholy/cvmfs,cvmfs/cvmfs,Moliholy/cvmfs,trshaffer/cvmfs,Gangbiao/cvmfs,trshaffer/cvmfs,trshaffer/cvmfs,MicBrain/cvmfs,trshaffer/cvmfs,trshaffer/cvmfs,Gangbiao/cvmfs,cvmfs/cvmfs,cvmfs/cvmfs,DrDaveD/cvmfs,cvmfs-testing/cvmfs,reneme/cv... | add-ons/tools/openCatalog.py | add-ons/tools/openCatalog.py | #!/usr/bin/python
import cvmfs
import sys
def usage():
print sys.argv[0] + " <catalog path | catalog url>"
print "This script decompresses the given catalog file to a temporary storage"
print "and opens it directly with sqlite3."
print "WARNING: changes to this database will not persist, as it is only a temp"
de... | #!/usr/bin/python
import sys
import zlib
import tempfile
import subprocess
def decompressCatalog(filename, destination):
str_object1 = open(filename, 'rb').read()
str_object2 = zlib.decompress(str_object1)
f = open(destination, 'wb')
f.write(str_object2)
f.close()
def openCatalog(filename):
subprocess.call(['s... | bsd-3-clause | Python |
567893ec81759e626c5fa3428246c3020392a301 | Create Server.py | saifeldinhesham/ClientServerModel | Server.py | Server.py | import socket
import sys
from thread import *
c= raw_input('ENTER T for tcp , U for UDP servers\n')
if c=='T':
HOST = '' # Symbolic name meaning all available interfaces
PORT = 5558 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
... | unlicense | Python | |
778bffe35c38331b381dc8f289198a098106b273 | Add honeybadger_deployment module | thaim/ansible,thaim/ansible | lib/ansible/modules/extras/monitoring/honeybadger_deployment.py | lib/ansible/modules/extras/monitoring/honeybadger_deployment.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014 Benjamin Curtis <benjamin.curtis@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versi... | mit | Python | |
31525d83ea74852709b1dd1596854a74c050f9f2 | Add script to add requests | frinder/frinder-app,frinder/frinder-app,frinder/frinder-app | scripts/add_requests.py | scripts/add_requests.py | from google.cloud import firestore
import argparse
import datetime
import names
import random
def queryUsers(db):
users_ref = db.collection(u'users')
docs = users_ref.get()
docList = list()
for doc in docs:
docList.append(doc)
return docList
def queryRequests(db):
requests_ref = db.collection(u'requests')
do... | mit | Python | |
ea2bae8b9a529a091e21f656f3cac85c4ae8694e | add command to cook a list of packages on the devel branch of a repository | sassoftware/mirrorball,sassoftware/mirrorball | scripts/cookpackages.py | scripts/cookpackages.py | #!/usr/bin/python
#
# Copryright (c) 2008 rPath, Inc.
#
"""
Script for cooking groups defined in the updatebot config.
"""
import os
import sys
sys.path.insert(0, os.environ['HOME'] + '/hg/rpath-xmllib')
sys.path.insert(0, os.environ['HOME'] + '/hg/conary')
sys.path.insert(0, os.environ['HOME'] + '/hg/mirrorball')
... | apache-2.0 | Python | |
e5716c90e97d1364c551701f3bae772f08c9c561 | Add management command to do one-off imports. | opencivicdata/opencivicdata.org,opencivicdata/opencivicdata.org,opencivicdata/opencivicdata.org | upload/management/commands/import_sheet.py | upload/management/commands/import_sheet.py | import csv
from django.contrib.auth.models import User
from opencivicdata.models import Jurisdiction, Division
from upload.backend.parser import import_stream
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
args = '<csv> <jurisdiction> <source> <user>'
help = 'Lo... | bsd-3-clause | Python | |
74384bb332f7c2a8c5a4afc70276e74d67dc206a | Create binance_futures_change_leverage.py | ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt | examples/py/binance_futures_change_leverage.py | examples/py/binance_futures_change_leverage.py | # Change Initial Leverage (TRADE)
# Example - Set Leverage of 40 for symbol 'ADAUSDT'
# Assumes you know how to set exchange object
symbol = 'ADAUSDT'
leverage = 40
lev = exchange.fapiPrivate_post_leverage({
'symbol': symbol,
'leverage': leverage
})
| mit | Python | |
b16dd2a549bf0558b02d02cb731b42c85bb12f44 | Test stuff to see if git is as irritating as mercurial | quozl/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,sugarlabs/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,gusDuarte/sugar-toolkit-gtk3,tchx84/sugar-toolkit-gtk3,puneetgkaur/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit,puneetgkaur/backup_sugar_sugartoolkit,tchx84/debian-pkg-sugar-toolkit,tchx84/sugar-... | sugar/shell/Owner.py | sugar/shell/Owner.py | from sugar import env
from sugar.presence import Service
from sugar.presence import Buddy
from sugar.presence import PresenceService
from sugar.p2p import Stream
import pwd
import os
import random
import base64
class ShellOwner(object):
"""Class representing the owner of this machine/instance. This class
runs in t... | from sugar import env
from sugar.presence import Service
from sugar.presence import Buddy
from sugar.presence import PresenceService
from sugar.p2p import Stream
import pwd
import os
import random
import base64
class ShellOwner(object):
"""Class representing the owner of this machine/instance. This class
runs in ... | lgpl-2.1 | Python |
a8a9a8ca902b20c6bc593b5a56780d4a38f7341b | Create anharm.py | bskinn/opan,bskinn/opan | anharm.py | anharm.py | #NOhting
| mit | Python | |
ffd125c09d4fadade6b2736621dc40c4acd69d70 | Create directory for Historian-Cloudant | ibm-messaging/iot-device-samples,ibm-messaging/iot-device-samples,amprasanna/iot-device-samples,amprasanna/iot-device-samples,amprasanna/iot-device-samples,ibm-messaging/iot-device-samples | historian-cloudant/query-1.py | historian-cloudant/query-1.py | epl-1.0 | Python | ||
207468eeed520e5aeef68aa146ad2988c9970f88 | add management command for the ECD rollout | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/reports/management/commands/rollout_ecd_preview.py | corehq/apps/reports/management/commands/rollout_ecd_preview.py | from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from six.moves import input
from django.core.management import BaseCommand
from django.db.models import Q
from corehq.apps.accounting.models import (
Subscription,
SoftwarePlanEdition,
)
from corehq... | bsd-3-clause | Python | |
94c87f959baaa49501e5f081ce7c470576ffff0a | add update_autoload.py script | ferreum/distanceutils,ferreum/distanceutils | update_autoload.py | update_autoload.py | #!/usr/bin/env python
import os
def main():
os.environ['DISTANCEUTILS_AUTOLOAD'] = "0"
import distance
distance._core.write_autoload_modules()
if __name__ == '__main__':
exit(main())
# vim:set sw=4 et:
| mit | Python | |
b9f6bd533df6e7d32b9c4588655c16a9fbb2e357 | add ip2location | coolkang/cmcweb,coolkang/cmcweb | cmcprj/cmcprj/ip2location.py | cmcprj/cmcprj/ip2location.py | # -*- coding: utf-8 -*-
import struct
import socket
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, BigInteger, String, Float
from sqlalchemy import desc
from urllib import quote_plus as u... | apache-2.0 | Python | |
5a621c5f041f6fa238f30b0c8fd91d69b988ed69 | Move AccountPermission from py2 to py3 (#2964) | the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blue-alliance | src/backend/common/consts/account_permission.py | src/backend/common/consts/account_permission.py | import enum
from dataclasses import dataclass
from typing import Dict
@enum.unique
class AccountPermission(enum.IntEnum):
"""
Permissions available for Accounts (see Account.permissions)
"""
REVIEW_MEDIA = 1
REVIEW_OFFSEASON_EVENTS = 2
REVIEW_APIWRITE = 3
REVIEW_DESIGNS = 4
REVIEW_EV... | mit | Python | |
7ef10042cb6931a08b3b042b70d4ad429aa28cea | add collector for openstack swift | Clever/Diamond,Slach/Diamond,disqus/Diamond,cannium/Diamond,rtoma/Diamond,datafiniti/Diamond,ramjothikumar/Diamond,jriguera/Diamond,datafiniti/Diamond,szibis/Diamond,MichaelDoyle/Diamond,tusharmakkar08/Diamond,Netuitive/netuitive-diamond,socialwareinc/Diamond,krbaker/Diamond,eMerzh/Diamond-1,tusharmakkar08/Diamond,sign... | src/collectors/openstackswift/openstackswift.py | src/collectors/openstackswift/openstackswift.py | # coding=utf-8
"""
Openstack swift collector.
#### Dependencies
* swift-dispersion-report commandline tool (for dispersion report)
if using this, make sure swift.conf and dispersion.conf are reable by diamond
also get an idea of the runtime of a swift-dispersion-report call and make sure
the collect interv... | mit | Python | |
b9fe885c7135305858f912931a05da5b7da7f1bc | set up module for site variables | astrodsg/django-stock-up,astrodsg/django-stock-up | stock_up/settings/site_variables.py | stock_up/settings/site_variables.py | #!/usr/bin/env python
"""
PURPOSE: This contains settings parameters associated with variables in the webpage
"""
# ########################################################################### #
from stock_up.settings.base import *
from stock_up.site_variables import Link, Namespace
from collections import OrderedDict
... | mit | Python | |
3e3ab4417ccd977054d77ff52865762bca8d7549 | add prod urls | IQSS/milestone-reader,IQSS/milestone-reader,IQSS/milestone-reader | milestone_reader/milestone_reader/urls_prod.py | milestone_reader/milestone_reader/urls_prod.py | from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^... | mit | Python | |
746d69759e942871f5f7a5bd50302b6c3462bb13 | Test importing | woxcab/scrapy_rss | tests/test_import.py | tests/test_import.py | # -*- coding: utf-8 -*-
import unittest
class TestImport(unittest.TestCase):
def test_module_level(self):
from scrapy_rss import RssItem
from scrapy_rss import ExtendableItem
from scrapy_rss import RssedItem
import scrapy_rss
def test_elements(self):
from scrapy_rss.e... | bsd-3-clause | Python | |
d57cac82083ab1ef4ac9f0584c56aaa825aaafef | add testcase | yoon-gu/Mozart | tests/test_sample.py | tests/test_sample.py | import unittest
import mozart as mz
import numpy as np
class TestStocMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_test(self):
self.assertTrue(True) | mit | Python | |
ef81887073f7f77f850d48356f43a467f738df27 | Create cops.py | simondankelmann/LED-Server,simondankelmann/LED-Server | cops.py | cops.py | import RPi.GPIO as GPIO
import time
import pigpio
from thread import start_new_thread
RED_PIGPIO = 17
GREEN_PIGPIO = 22
BLUE_PIGPIO = 24
pi = pigpio.pi()
def setRGB(r,g,b):
pi.set_PWM_dutycycle(RED_PIGPIO, r)
pi.set_PWM_dutycycle(GREEN_PIGPIO, g)
pi.set_PWM_dutycycle(BLUE_PIGPIO, b)
r... | apache-2.0 | Python | |
3c18280b71a3566cad7d0a2aa7427dc286234c61 | Create seed_NearBeach.py | robotichead/NearBeach,robotichead/NearBeach,robotichead/NearBeach | tests/django_seed/seed_NearBeach.py | tests/django_seed/seed_NearBeach.py | mit | Python | ||
276e89303d4d1fd6f000cf0a794a266ebe4f9fa5 | add script to rework asciidoc files | unseenlaser/machinekit,Cid427/machinekit,ArcEye/MK-Qt5,araisrobo/machinekit,araisrobo/machinekit,ArcEye/MK-Qt5,bobvanderlinden/machinekit,araisrobo/machinekit,Cid427/machinekit,mhaberler/machinekit,RunningLight/machinekit,EqAfrica/machinekit,mhaberler/machinekit,Cid427/machinekit,ArcEye/MK-Qt5,strahlex/machinekit,strah... | docs/src/troff-to-asciidoc.py | docs/src/troff-to-asciidoc.py | import os, sys, re
SourceFilePath = sys.argv[1]
TargetFilePath = sys.argv[2]
print "source = " + SourceFilePath
print "target = " + TargetFilePath
# open the source file
SourceLines = open(SourceFilePath, 'rU').readlines()
# new content
ComponentTitle = []
AsciidocLines = []
IndexLines = []
#if the first characte... | lgpl-2.1 | Python | |
127dbd5779280fc62f56f06f8ef2733b7aa4cdd9 | Add test setup for registry case search | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/case_search/tests/test_case_search_registry.py | corehq/apps/case_search/tests/test_case_search_registry.py | import uuid
from django.test import TestCase
from casexml.apps.case.mock import CaseBlock
from corehq.apps.case_search.models import CaseSearchConfig
from corehq.apps.domain.shortcuts import create_user
from corehq.apps.es.tests.utils import (
case_search_es_setup,
case_search_es_teardown,
es_test,
)
fro... | bsd-3-clause | Python | |
009146886ef4c4270ac6fed5353ae75adfcedc28 | Add demo.py from mwoauth-flask | CristianCantoro/mwoauth-test | demo.py | demo.py | import os
from flask import Flask
from flask_mwoauth import MWOAuth
app = Flask(__name__)
app.secret_key = os.urandom(24)
print """
NOTE: The callback URL you entered when proposing an OAuth consumer
probably did not match the URL under which you are running this development
server. Your redirect back will therefore ... | mit | Python | |
fb66a305390ebb9221c321e3a5315b8f0825e487 | Add jax model test | explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc | thinc/tests/model/test_jax_model.py | thinc/tests/model/test_jax_model.py | import pytest
from numpy.testing import assert_allclose
import thinc.api
from thinc.api import has_jax
from thinc.backends import jax_jit
def get_batch(ops, nB, nO, nI):
X = ops.xp.zeros((nB, nI), dtype="f")
X += ops.xp.random.uniform(-1, 1, X.shape)
Y = ops.xp.zeros((nB, nO), dtype="f")
Y += ops.xp.r... | mit | Python | |
62a1d5254820b82db777f5f4aaa7f361d3d60577 | add model migration for Proxy | mercycorps/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,mercycorps/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,mercycorps/TolaActivity,mercycorps/TolaActivity | activitydb/migrations/0029_tolauserproxy.py | activitydb/migrations/0029_tolauserproxy.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-11-02 05:21
class Migration(migrations.Migration):
dependencies = [
('activitydb', '0028_auto_20161024_0131'),
]
operations = [
migrations.CreateModel(
name='TolaUserProxy',
fields=[
],
... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-11-02 05:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('activitydb', '0028_auto_20161024_0131'),
]
operations = [
migrations.CreateModel(
... | apache-2.0 | Python |
20085267748b2c49a95a51bec80e10710ce27359 | add rock_you_test.py | tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets | tensorflow_datasets/structured/rock_you_test.py | tensorflow_datasets/structured/rock_you_test.py | # coding=utf-8
# Copyright 2019 The TensorFlow Datasets 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 | |
f9291e0ea4b096c34ea47628395ab339d09e1c3c | Add Cache tests | Blechhirn/TileStache,jbants/TileStache,mapzen/TileStache,jbants/TileStache,Blechhirn/TileStache,MetGIS/TileStache,moskvax/TileStache,mojodna/TileStache,MetGIS/TileStache,SEL-Columbia/TileStache,mojodna/TileStache,Kosta-Github/TileStache,Billups/TileStache,Kosta-Github/TileStache,MetGIS/TileStache,TileStache/TileStache,... | tests/cache_tests.py | tests/cache_tests.py | from unittest import TestCase
from . import utils
import memcache
class CacheTests(TestCase):
'''Tests various Cache configurations that reads from cfg file'''
def setUp(self):
self.mc = memcache.Client(['127.0.0.1:11211'], debug=0)
self.mc.flush_all()
def test_memcache(self):
'''... | bsd-3-clause | Python | |
c27d657bfbcea44bb28bed1481ad284b6e3dc1f0 | change s3 media permissions | qlands/onadata,sounay/flaminggo-test,hnjamba/onaclone,GeoODK/onadata,sounay/flaminggo-test,kobotoolbox/kobocat,kobotoolbox/kobocat,jomolinare/kobocat,kobotoolbox/kobocat,hnjamba/onaclone,smn/onadata,spatialdev/onadata,spatialdev/onadata,mainakibui/kobocat,kobotoolbox/kobocat,smn/onadata,awemulya/fieldsight-kobocat,spat... | odk_logger/management/commands/change_s3_media_permissions.py | odk_logger/management/commands/change_s3_media_permissions.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
from django.core.management.base import BaseCommand, CommandError
from django.core.files.storage import get_storage_class
from django.utils.translation import ugettext as _, ugettext_lazy
class Command(BaseCommand):
help = ugettext_lazy("Makes all s... | bsd-2-clause | Python | |
e37ea39ec5afcc2f142573061622dc5b2ae36abb | Add a gallery example for logo (#823) | GenericMappingTools/gmt-python,GenericMappingTools/gmt-python | examples/gallery/plot/logo.py | examples/gallery/plot/logo.py | """
Logo
----
The :meth:`pygmt.Figure.logo` method allows to place the GMT logo on a map.
"""
import pygmt
fig = pygmt.Figure()
fig.basemap(region=[0, 10, 0, 2], projection="X6c", frame=True)
# add the GMT logo in the Top Right corner of the current map,
# scaled up to be 3 cm wide and offset by 0.3 cm in X direc... | bsd-3-clause | Python | |
3f3f6e2e3a7f62e7fcaa24c4260a0f09e0800b6a | Add simple animation example from pygame tutorial | caseyc37/pygame_cffi,CTPUG/pygame_cffi,CTPUG/pygame_cffi,CTPUG/pygame_cffi,GertBurger/pygame_cffi,GertBurger/pygame_cffi,caseyc37/pygame_cffi,caseyc37/pygame_cffi,GertBurger/pygame_cffi,GertBurger/pygame_cffi | tests/test_bounce.py | tests/test_bounce.py | import sys, pygame
pygame.init()
size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0
screen = pygame.display.set_mode(size)
#ball = pygame.image.load("ball.bmp")
ball = pygame.surface.Surface((100, 100))
ball.fill(pygame.Color(0, 0, 255, 255))
ballrect = ball.get_rect()
clock = pygame.time.Clock()
while ... | lgpl-2.1 | Python | |
264b4112ccfdebeb7524036b6f32d49fa38bb321 | Create test for sandboxing via Heroku | berkeley-cocosci/Wallace,suchow/Wallace,Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,suchow/Wallace,berkeley-cocosci/Wallace,jcpeterson/Dallinger,suchow/Wallace,jcpeterson/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,berkeley-cocosci/Wallace,Dallinger/Dallinger,Dallinger/Dalli... | tests/test_heroku.py | tests/test_heroku.py | """Tests for the Wallace API."""
import subprocess
import re
import requests
class TestHeroku(object):
"""The Heroku test class."""
def test_sandbox(self):
"""Launch the experiment on Heroku."""
sandbox_output = subprocess.check_output(
"cd examples/bartlett1932; wallace sandbox... | mit | Python | |
c20b1b8c2362f2484baacd15acd9d72ae1e2b6d7 | Add a tool for determining active SVN committers. | teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,jasonmccampbell/numpy-refactor-sprint,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,teoliphant/numpy-refactor,Ademan/NumPy-GSoC,Ademan/NumPy-GSoC,Ademan/Num... | tools/commitstats.py | tools/commitstats.py |
# Run svn log -l <some number>
import re
import numpy as np
import os
names = re.compile(r'r\d+\s[|]\s(.*)\s[|]\s200')
def get_count(filename, repo):
mystr = open(filename).read()
result = names.findall(mystr)
u = np.unique(result)
count = [(x,result.count(x),repo) for x in u]
return count
... | bsd-3-clause | Python | |
2086e36d68db88e922281456c4e203ab5e19cf18 | Fix bug #735 - Scheduler fails to start on newly installed instance | Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | lava_scheduler_app/migrations/0003_populate_master_node.py | lava_scheduler_app/migrations/0003_populate_master_node.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from lava_scheduler_app import utils
def forwards_func(apps, schema_editor):
Worker = apps.get_model("lava_scheduler_app", "Worker")
db_alias = schema_editor.connection.alias
# Identify master node an... | agpl-3.0 | Python | |
857890c435da150fdca4ce77491223b42e9bd18e | Create LongestCommonPrefix_002.py | cc13ny/algo,Chasego/codi,cc13ny/algo,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/cod,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/cod,cc13ny/Allin,cc13ny/Allin,Chasego/codi,cc13ny/Allin,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/codirit,Chasego/cod,Chasego/codirit,cc1... | leetcode/LongestCommonPrefix/py/LongestCommonPrefix_002.py | leetcode/LongestCommonPrefix/py/LongestCommonPrefix_002.py | class Solution:
# @param {string[]} strs
# @return {string}
def longestCommonPrefix(self, strs):
res = ''
if strs == []:
return res
lens = [len(s) for s in strs]
mi = min(lens)
for i in range(mi):
a = set([s[i] for s in strs])
... | mit | Python | |
d79fa873890df1c92fe67b73c29cdb8ff653e553 | Add http.JsonishHttpResponse | bwesterb/tkbd | http.py | http.py | # vim: et:sta:bs=2:sw=4:
import json
import msgpack
from django.http import HttpResponse
JSONISH_FORMATS = ['json', 'prettyJson', 'msgpack']
class JsonishHttpResponse(HttpResponse):
def __init__(self, obj, *args, **kwargs):
fmt = 'json'
if 'format' in kwargs:
if kwargs['format'] in J... | agpl-3.0 | Python | |
86776f1171821e75242a2ef7fbaf95974ad4e76f | Create LoRa_test.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | gateway/src/test/LoRa_test.py | gateway/src/test/LoRa_test.py | # LoRa_test.py
| mit | Python | |
cf0de1042c404f88db770a87eaa83706dec807a3 | add SigmaThresholdEventPlotter | w495/python-video-shot-detector,w495/python-video-shot-detector | shot_detector/plotters/event/sigma_threshold_event_plotter.py | shot_detector/plotters/event/sigma_threshold_event_plotter.py | # -*- coding: utf8 -*-
from __future__ import (absolute_import,
division,
print_function,
unicode_literals)
import logging
from shot_detector.filters import (
FFMpegLikeTresholdSWFilter,
ShiftSWFilter,
DelayFilter,
NormFilter,
... | bsd-3-clause | Python | |
d3df6283db7e9ed56c41f4e7a866c8622743da40 | Add script to set markdown template | facelessuser/SublimeRandomCrap,facelessuser/SublimeRandomCrap | set_markdown_template.py | set_markdown_template.py | import sublime
import sublime_plugin
from os.path import exists, join
TEMPLATE_NAME = "custom-template.html"
def set_template():
path = join(sublime.packages_path(), "User", TEMPLATE_NAME)
settings = sublime.load_settings("MarkdownPreview.sublime-settings")
if settings.get("html_template") != path:
... | mit | Python | |
53b17d83300d5d1607e0124229bf830cb1eb8a31 | Add an XML-RPC downloader for bugzilla | jleclanche/bugzilla-to-github | xmlrpc_download.py | xmlrpc_download.py | #!/usr/bin/env python
import json
import sys
import xmlrpc.client
# XXX Edit this to your liking
MAX_BUG_ID = 3210
EXPORT_FILE = "bugzilla.json"
BLACKLIST = [489, 3188]
class RPCEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, xmlrpc.client.DateTime):
return o.value
raise NotImplementedErr... | mit | Python | |
a8cd7f72477be88f6e73385c6309cefe89e5a4bf | Add test1() function to show how commits are done. | niekas/Hack4LT | src/hack4lt/tmp.py | src/hack4lt/tmp.py | def test1():
pass
| bsd-3-clause | Python | |
0157071d8068f67a170bfee1d74bf086b6342275 | Add simpler video playback example. | oktayacikalin/pyglet,mammadori/pyglet,oktayacikalin/pyglet,oktayacikalin/pyglet,mammadori/pyglet,oktayacikalin/pyglet,mammadori/pyglet,theblacklion/pyglet,theblacklion/pyglet,theblacklion/pyglet,theblacklion/pyglet,theblacklion/pyglet,mammadori/pyglet,oktayacikalin/pyglet | examples/video.py | examples/video.py | #!/usr/bin/env python
'''Simple example of video playback.
Usage::
video.py <filename>
See the Programming Guide for a partial list of supported video formats.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import sys
import pyglet
if len(sys.argv) < 2:
print __doc__
sys.exit(1)
source ... | bsd-3-clause | Python | |
56708f6bc07d28bf5aa449aa0d39f136cc179172 | add Ted driver | samboiki/smap-data,samboiki/smap-data,samboiki/smap-data,samboiki/smap-data,samboiki/smap-data | python/smap/drivers/ted.py | python/smap/drivers/ted.py |
import re
from twisted.python import log
from twisted.internet import reactor
from twisted.web.client import getPage
from smap import util
from smap.driver import SmapDriver
from smap.contrib import dtutil
from BeautifulSoup import BeautifulSoup as bs
class Ted5000Driver(SmapDriver):
def setup(self, opts):
... | bsd-2-clause | Python | |
94661c57d5fa67f413b83a877ef59835c13dc95f | Update impl.py | candango/python-oauth2,mygola/python-oauth2,mygola/python-oauth2,gcd0318/python-oauth2,candango/python-oauth2,gcd0318/python-oauth2,mygola/python-oauth2,CoolCloud/python-oauth2,wndhydrnt/python-oauth2,wndhydrnt/python-oauth2,wndhydrnt/python-oauth2,CoolCloud/python-oauth2,CoolCloud/python-oauth2,gcd0318/python-oauth2,c... | docs/examples/pyramid/impl.py | docs/examples/pyramid/impl.py |
from pyramid.view import view_config
from oauth2.error import UserNotAuthenticated, UserNotExist
from oauth2.web import SiteAdapter
from oauth2.store.redisdb import TokenStore, ClientStore
from oauth2.grant import ResourceOwnerGrant
from base import BaseAuthController
import os
import sys
import pyramid
class OAut... | __author__ = 'Bhoomit'
from pyramid.view import view_config
from oauth2.error import UserNotAuthenticated, UserNotExist
from oauth2.web import SiteAdapter
from oauth2.store.redisdb import TokenStore, ClientStore
from oauth2.grant import ResourceOwnerGrant
from base import BaseAuthController
import os
import sys
imp... | mit | Python |
16c03007224f0378fea32b51d548f45a89418dd4 | Add tag info to import cluster flows | Tendrl/node-agent,r0h4n/node-agent,r0h4n/node-agent,Tendrl/node_agent,r0h4n/node-agent,Tendrl/node_agent,Tendrl/node-agent,Tendrl/node-agent | tendrl/node_agent/gluster_integration/flows/import_cluster.py | tendrl/node_agent/gluster_integration/flows/import_cluster.py | import json
import socket
import uuid
from tendrl.node_agent.flows.flow import Flow
class ImportCluster(Flow):
def run(self):
node_list = self.parameters['Node[]']
if len(node_list) > 1:
# This is the master node for this flow
for node in node_list:
if self... | import json
import socket
import uuid
from tendrl.node_agent.flows.flow import Flow
class ImportCluster(Flow):
def run(self):
node_list = self.parameters['Node[]']
if len(node_list) > 1:
# This is the master node for this flow
for node in node_list:
if self... | lgpl-2.1 | Python |
d1afa600338bb0d9c1c040a42b6de5504e48d699 | Store names of similar photos into sqlite database | aysent/yelp-photo-explorer | similar_photos_sqlite.py | similar_photos_sqlite.py | import graphlab
import sqlite3
def main():
# load photos with their deep features
photos = graphlab.SFrame('photos_deep_features.gl')
# train a nearest neighbors model on deep features of photos
nn_model = graphlab.nearest_neighbors.create(photos, features=['deep_features'], label='path')
# ... | mit | Python | |
49f380d6a0f91967e65c53668c484374af7d37cd | Add 202-happy-number.py | mvj3/leetcode | 202-happy-number.py | 202-happy-number.py | """
Question:
Happy Number
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will st... | mit | Python | |
ec10f26e375c750533b6611030b248603a957b7f | add puzzle source material | li3n3/toybox,li3n3/toybox | fogcreekpuzzle.py | fogcreekpuzzle.py | alphastring = "abcdefghijklmnopqrstuvwxyz_"
bigblob = "epqiiqwdiwgyka_vsqtsujeqqicnhyivo_sigwasmkwgsih_akl_gtnkhgikgveidpmt
qybpxpnnpbxkwpisgjmdzgh_ojysbtsnsvxvuhguocp_qc_vouxqmg_cetlpmounxnvg
ldcpem_jodnmklgonocekdkjwkdoilajk_nxujykigsolengqmnqofpseqaamvpsooga
spyhoojennefwvljpvsqtgnc... | mit | Python | |
309877088d81dcac3ed4e45327ab83a99957e93b | Build Julia | tmerrick1/spack,matthiasdiener/spack,skosukhin/spack,tmerrick1/spack,EmreAtes/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,TheTimmy/spack,lgarren/spack,TheTimmy/spack,iulian787/spack,skosukhin/spack,mfherbst/spack,iulian787/spack,lgarren/spack,krafczyk/spack,matthiasdiener/spack,LLNL/spack,skosukhin/spack,LLNL/... | var/spack/packages/julia/package.py | var/spack/packages/julia/package.py | from spack import *
class Julia(Package):
"""The Julia Language: A fresh approach to technical computing"""
homepage = "http://julialang.org"
url = "http://github.com/JuliaLang/julia/releases/download/v0.4.2/julia-0.4.2.tar.gz"
version('0.4.2', 'ccfeb4f4090c8b31083f5e1ccb03eb06')
# Build-tim... | lgpl-2.1 | Python | |
272b2238ce9d0d8d1424a470bb7f4f7b41edd9e0 | Add unarchiver of the forecast | nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN | script/unarchive-forecast.py | script/unarchive-forecast.py | #!/usr/bin/env python3
import pickle
import sys
class Forecast:
pass
for fn in sys.argv:
with open(fn,"rb") as fp:
forecast = pickle.load(fp)
print(dir(forecast))
| mit | Python | |
733726467c397ff530a556e9a624466994e7c13c | Add tests for new command | rkhleics/wagtailmenus,rkhleics/wagtailmenus,ababic/wagtailmenus,rkhleics/wagtailmenus,ababic/wagtailmenus,ababic/wagtailmenus | wagtailmenus/tests/test_commands.py | wagtailmenus/tests/test_commands.py | from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from django.core.management import call_command
from wagtail.wagtailcore.models import Site
from wagtailmenus import app_settings
class TestAutoPopulateMainMenus(TestCase):
fixtures = ['test.json']
def setUp(self):
... | mit | Python | |
577fd1445235ed46e520d569ac4918cb64ac8a8c | add solution for Rotate Image | zhyu/leetcode,zhyu/leetcode | src/rotateImage.py | src/rotateImage.py | class Solution:
# @param matrix, a list of lists of integers
# @return a list of lists of integers
def rotate(self, matrix):
n = len(matrix)
m = mm = n/2
if n % 2:
mm += 1
n -= 1
for i in xrange(m):
for j in xrange(mm):
(matrix... | mit | Python | |
770e3885246552bfc76fc7ab7d0c3930ef5e9321 | Add libjpeg.gyp that wraps third_party/externals/libjpeg/libjpeg.gyp Review URL: https://codereview.appspot.com/5848046 | mrobinson/skia,mrobinson/skia,mrobinson/skia,Cue/skia,mrobinson/skia,Cue/skia,mrobinson/skia,Cue/skia,metajack/skia,metajack/skia,Cue/skia,metajack/skia,metajack/skia | gyp/libjpeg.gyp | gyp/libjpeg.gyp | # Copyright 2012 The Android Open Source Project
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Depend on this wrapper to pick up libjpeg from third_party
{
'targets': [
{
'target_name': 'libjpeg',
'type': 'none',
'dependencies': [
... | bsd-3-clause | Python | |
1d3995727962f55f128b42b9ed7db32b593e6b39 | Add K-Fold ensemble | derekgreene/topic-ensemble | generate-kfold.py | generate-kfold.py | #!/usr/bin/env python
"""
python generate-kfold.py sample.pkl -f 10 -r 2 -k 4 --maxiters 100 -o folds-nmf
"""
import os, sys, random
import logging as log
from optparse import OptionParser
import numpy as np
import scipy.sparse
import text.util, unsupervised.nmf, unsupervised.rankings, unsupervised.util
# ------------... | apache-2.0 | Python | |
96f8f4f466e9d5e086cdec41a79444db4963190d | Create judge-route-circle.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/Lee... | Python/judge-route-circle.py | Python/judge-route-circle.py | # Time: O(n)
# Space: O(1)
# Initially, there is a Robot at position (0, 0). Given a sequence of its moves,
# judge if this robot makes a circle, which means it moves back to the original place.
#
# The move sequence is represented by a string. And each move is represent by a character.
# The valid robot moves are R ... | mit | Python | |
66b33a6a5bc107e251bb30d0fb304ed44da469d8 | Create 6kyu_rot13_variant_cipher.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/6kyu/6kyu_rot13_variant_cipher.py | Solutions/6kyu/6kyu_rot13_variant_cipher.py | from string import ascii_lowercase as AL
ABC = "nopqrstuvwxyzabcdefghijklm"
def encrypter(strng):
return (strng.translate(str.maketrans(AL,ABC))).translate(str.maketrans(AL,AL[::-1]))
| mit | Python | |
885c56f82391f8e8a37fa87bc9bfdd909dd75e22 | Create getFriendsList.py | mwhuhn/congress-friendship-networks | getFriendsList.py | getFriendsList.py | # This takes people's ids in and outputs a csv
# of the ids and their friends' ids. Each friend
# is matched with the person.
import tweepy
import os
import csv
import time
import sys
ACCESS_TOKEN = # COPY FROM YOUR PROFILE
ACCESS_SECRET = # COPY FROM YOUR PROFILE
CONSUMER_KEY = # COPY FROM YOUR PROFILE
CONSUMER_SECR... | mit | Python | |
f6a4f6bda7fc47521178dfc45b2cf2ff06ee0bd7 | add new package (#26522) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/mpl/package.py | var/spack/repos/builtin/packages/mpl/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Mpl(CMakePackage):
"""A C++17 message passing library based on MPI."""
homepage = ... | lgpl-2.1 | Python | |
2ed1ce9c2b116497af1b1c2a97b7382d760cadca | Implement basic setup.py with cookiecutter variables | hackebrot/cookiedozer,hackebrot/cookiedozer | {{cookiecutter.repo_name}}/setup.py | {{cookiecutter.repo_name}}/setup.py | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "{{cookiecutter.repo_name}}",
version = "{{cookiecutter.version}}",
author = "{{cookiecutter.full_name}}",
author_email = "{{cookiecutter.email}}",
descripti... | mit | Python | |
4cb37cabb3aa171391958f4d6e6d0eb5b8731989 | Add migration which updates field / model metadata. | qubs/data-centre,qubs/climate-data-api,qubs/data-centre,qubs/climate-data-api | climate_data/migrations/0022_auto_20170623_0236.py | climate_data/migrations/0022_auto_20170623_0236.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-23 02:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('climate_data', '0021_auto_20170619_2053'),
]
opera... | apache-2.0 | Python | |
a8f798879fc3d400f51d49e23c3d075190232987 | add mw200 evaluation | selentd/pythontools | pytools/src/oldsrc/evalcallmw200.py | pytools/src/oldsrc/evalcallmw200.py | '''
Created on 13.12.2014
@author: diesel
'''
from evalindexdata import EvalIndexDataBuy
from evalindexdata import EvalIndexDataSell
class EvalCallMW200MeanBuy( EvalIndexDataBuy ):
def updateState(self, indexData, lastBuy):
pass
class EvalCallMW200MeanMeanSell( EvalIndexDataSell ):
def updat... | apache-2.0 | Python | |
c284d595a34a16d76e18fa4e8654b4c14ea327fd | Fix binary builds (#3840) | Kriechi/mitmproxy,mitmproxy/mitmproxy,mhils/mitmproxy,mhils/mitmproxy,Kriechi/mitmproxy,mitmproxy/mitmproxy,Kriechi/mitmproxy,mitmproxy/mitmproxy,Kriechi/mitmproxy,mhils/mitmproxy,mitmproxy/mitmproxy,vhaupert/mitmproxy,vhaupert/mitmproxy,vhaupert/mitmproxy,vhaupert/mitmproxy,mitmproxy/mitmproxy,mhils/mitmproxy,mhils/mi... | release/hooks/hook-pkg_resources.py | release/hooks/hook-pkg_resources.py | # flake8: noqa
# temporary fix for https://github.com/pypa/setuptools/issues/1963
# can be removed when we upgrade to PyInstaller 3.7.
hiddenimports = collect_submodules('pkg_resources._vendor')
hiddenimports.append('pkg_resources.py2_warn')
excludedimports = ['__main__']
| mit | Python | |
f3d2e3806572479e1b33285694685368f46c4027 | add simple factor store | xclxxl414/rqalpha,xclxxl414/rqalpha | rqalpha/data/simple_factor_store.py | rqalpha/data/simple_factor_store.py | # -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... | apache-2.0 | Python | |
52f8d53f8edabd183e66143f913511ac3df094fe | add new tool file to mv grid | openego/dingo,openego/dingo | dingo/grid/mv_grid/tools.py | dingo/grid/mv_grid/tools.py |
def set_circuit_breakers(mv_grid, debug=False):
""" Calculates the optimal position of a circuit breaker on all routes of mv_grid, adds and connects them to graph.
Args:
mv_grid: MVGridDingo object
debug: If True, information is printed during process
Returns:
nothing
Notes
... | agpl-3.0 | Python | |
65937a6e9a90ba57c87cbeb5d85bbd8cb85ddbcb | Add stupid sample client that does one thing | drkitty/arise | client.py | client.py | # encoding=utf-8
from __future__ import unicode_literals
import socket
import time
def mount(s, at, uuid=None, label=None, name=None):
for name, value in ((b'uuid', uuid), (b'label', label), (b'name', name)):
if value is not None:
value = value.encode('utf_8')
at = at.encode('utf_... | mit | Python | |
1030f93d81649d6230ac47a5b0c6f3a8b2972890 | remove the campaign slug column | unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome | datapoints/migrations/0007_remove_campaign_slug.py | datapoints/migrations/0007_remove_campaign_slug.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('datapoints', '0006_indicator_source_name'),
]
operations = [
migrations.RunSQL('''
alter table campaign drop column ... | agpl-3.0 | Python | |
953229fa470185fb2359fc588045c7f8d62ae109 | Create Accounting dashboard from General Ledger Report | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/accounts/dashboard.py | erpnext/accounts/dashboard.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
from itertools import groupby
from operator import itemgetter
import frappe
from erpnext.accounts.report.general_ledger.general_ledger import execute
... | agpl-3.0 | Python | |
32525203ee392be60c0ea32a817323ccf5cace12 | Add simple test for item dump. | jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu | kirppu/tests/test_itemdump.py | kirppu/tests/test_itemdump.py | from django.test import Client, TestCase
from ..models import Item
from .factories import EventFactory, EventPermissionFactory, ItemFactory, ItemTypeFactory, UserFactory, VendorFactory
class ItemDumpTest(TestCase):
def _addPermission(self):
EventPermissionFactory(event=self.event, user=self.user, can_see... | mit | Python | |
a7570dcf9a103c2b6f535a793cfda68333831017 | Add test for slave_hosts.cfg Review URL: https://codereview.appspot.com/7058079 | google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Ti... | site_config/slave_hosts_cfg_test.py | site_config/slave_hosts_cfg_test.py | #!/usr/bin/env python
# Copyright (c) 2012 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 test verifies that the slave_hosts.cfg and slaves.cfg files are sane
and compatible. """
import os
import posixpath
imp... | bsd-3-clause | Python | |
26ae6c32859ebdcd2f2bea8f41684a8ce0d82725 | add checkUpdate script | Michael-Tu/tools,Michael-Tu/tools,Michael-Tu/tools,Michael-Tu/tools | web-updates-checker/checkUpdates.py | web-updates-checker/checkUpdates.py | '''
This script checks if a given website has new updates.
It works by comparing the website at the time of checking
against the cache file of past website archive, saved as "archive"
@author Gan Tu
@version Python 3
'''
import urllib.request
def getArchive():
try:
backup = open("archive", "r")
a... | mit | Python | |
71c74fb68378b1097130d556a84af35b9b717d40 | Create easy_login.py | erstis-go-botting/sexy-bot | examples/easy_login.py | examples/easy_login.py | import requests
data = dict()
login_url = "http://en.ogame.gameforge.com/main/login"
data["kid"] = ""
data["uni"] = "s124-en.ogame.gameforge.com"
data["login"] = "alskgj"
data["pass"] = "nid12345"
r = requests.post(login_url, data)
print(r.text) # gets the whole sourcecode and prints it
#########################... | mit | Python | |
22dd8d6291372a21a655c22f39b01d5d2b437393 | write a response | andymckay/docker-utils,kumar303/docker-utils | docker_utils/cmds/server.py | docker_utils/cmds/server.py | import BaseHTTPServer
import json
import logging
import requests
from utils import get_images
log = logging.getLogger(__name__)
class handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
content_len = int(self.headers.getheader('content-length', 0))
data = json.loads(self.rfile.rea... | import BaseHTTPServer
import json
import logging
import requests
from utils import get_images
log = logging.getLogger(__name__)
class handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
content_len = int(self.headers.getheader('content-length', 0))
data = json.loads(self.rfile.re... | apache-2.0 | Python |
8eee7f7eca905e765bb451ace55f3331861a5be9 | Add rename tables for django CMS 3+ | brente/djangocms_twitter,nephila/djangocms_twitter,nephila/djangocms_twitter,brente/djangocms_twitter | djangocms_twitter/migrations/0004_rename_tables.py | djangocms_twitter/migrations/0004_rename_tables.py | # -*- coding: utf-8 -*-
from distutils.version import LooseVersion
import cms
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
if LooseVersion(cms.__ver... | bsd-3-clause | Python | |
bb09d28575390a130ffcac2d7d47f6406e7436de | Create shethreshold.py | bbcdli/xuexi,bbcdli/xuexi,bbcdli/xuexi,bbcdli/xuexi,bbcdli/xuexi | audio/shethreshold.py | audio/shethreshold.py | #!/usr/bin/env python3
import numpy as np
import sounddevice as sd
import requests
import argparse
#a simplified version
#receive sound source sent via ip and specified port
#signal is thresholded
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--ip", help="ip address of the target", required=True)
pars... | apache-2.0 | Python | |
6ad50ab4ada91cf2b2518a683abb88c79ad4f8bf | Add lc0102_binary_tree_level_order_traversal.py | bowen0701/algorithms_data_structures | lc0102_binary_tree_level_order_traversal.py | lc0102_binary_tree_level_order_traversal.py | """Leetcode 102. Binary Tree Level Order Traversal
Medium
URL: https://leetcode.com/problems/binary-tree-level-order-traversal/
Given a binary tree, return the level order traversal of its nodes' values.
(ie, from left to right, level by level).
For example:
Given binary tree [3,9,20,null,null,15,7],
3
/ \
... | bsd-2-clause | Python | |
9c13ad8baaec75193c55594e647dde0e08856ccf | Create eval.py | Vlek/plugins | HexChat/eval.py | HexChat/eval.py | import hexchat
__module_name__ = 'Eval'
__module_version__ = '0.0.1'
__module_description__ = "Evals and prints what's thrown to the '?' command"
__module_author__ = 'Vlek'
throwchair = "(╯°□°)╯︵ ┻━┻"
cry = "(╥﹏╥)"
lenny = "( ͡° ͜ʖ ͡°)"
shrug = "¯_(ツ)_/¯"
rifle = "︻デ═一"
def evaluate(word, word_to_eol, userdata):
... | mit | Python | |
e5e068c5fa94d68aa81dbcd3e498ba17dae37d2c | Simplify tests to new format. | emmagordon/Axelrod,uglyfruitcake/Axelrod,kathryncrouch/Axelrod,emmagordon/Axelrod,mojones/Axelrod,drvinceknight/Axelrod,bootandy/Axelrod,uglyfruitcake/Axelrod,bootandy/Axelrod,risicle/Axelrod,risicle/Axelrod,mojones/Axelrod,kathryncrouch/Axelrod | axelrod/tests/test_reflex.py | axelrod/tests/test_reflex.py | """
Test suite for Reflex Axelrod PD player.
"""
import axelrod
from test_player import TestPlayer
class Reflex_test(TestPlayer):
name = "Reflex"
player = axelrod.Reflex
stochastic = False
def test_strategy(self):
""" First response should always be cooperation. """
p1 = axelrod.Ref... | """
Test suite for Reflex Axelrod PD player.
"""
import axelrod
from test_player import TestPlayer
class Reflex_test(TestPlayer):
def test_initial_nice_strategy(self):
""" First response should always be cooperation. """
p1 = axelrod.Reflex()
p2 = axelrod.Player()
self.assertEqual... | mit | Python |
357067b0cfe6fd781813404ba7d587f5bd00917a | Add utility function to retrieve default price list and to create a product from a good | evonove/django-bazaar,meghabhoj/NEWBAZAAR,meghabhoj/NEWBAZAAR,meghabhoj/NEWBAZAAR,evonove/django-bazaar,evonove/django-bazaar | bazaar/goods/utils.py | bazaar/goods/utils.py | from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from .models import Product, PriceList
def get_default_price_list():
"""
Return the default price list
"""
try:
return PriceList.objects.get(default=True)
except PriceList.DoesNotExist:
... | bsd-2-clause | Python | |
88d5cde769af5e2e5509c7c229b35ec990b95c64 | Create find-bottom-left-tree-value.py | kamyu104/LeetCode,jaredkoontz/leetcode,jaredkoontz/leetcode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,yiwen-luo/LeetCode,kamyu10... | Python/find-bottom-left-tree-value.py | Python/find-bottom-left-tree-value.py | # Time: O(n)
# Space: O(h)
# Given a binary tree, find the leftmost value in the last row of the tree.
#
# Example 1:
# Input:
#
# 2
# / \
# 1 3
#
# Output:
# 1
# Example 2:
# Input:
#
# 1
# / \
# 2 3
# / / \
# 4 5 6
# /
# 7
#
# Output:
# 7
# Note: You may a... | mit | Python | |
efe5cfbc545a54a84b150a0022319b63379371b3 | Create alphabetDict.py | flynnpc/CSV-to-KML | alphabetDict.py | alphabetDict.py | import string
def alphabet():
alphabet = string.ascii_letters
alpha = alphabet[:26]
alphaDict = {}
num = 0
x = 0
while len(alphaDict) < 26:
alphaDict[alpha[x]] = num
num += 1
x += 1
return(alphaDict
| mit | Python | |
df7b172344c2401e6ff01fd35e322d6b771715f8 | Create 6kyu_base_reduction.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/6kyu/6kyu_base_reduction.py | Solutions/6kyu/6kyu_base_reduction.py | import sys
sys.setrecursionlimit(150)
def basereduct(x):
x=int(baseconvert(x))
try: return x if x<10 else basereduct(x)
except (RuntimeError): return -1
def baseconvert(x):
x=list(map(int,str(x)))[::-1]
base=max(x)+1
if base==10: base=11
return str(sum(pow(base,i)*j for i,j in enumera... | mit | Python | |
b49eaebf22ce4a0fc5742b148e1097b0dd0901b0 | Use assert_array_is_int to ensure arrays are int. | RondaStrauch/landlab,landlab/landlab,laijingtao/landlab,laijingtao/landlab,ManuSchmi88/landlab,amandersillinois/landlab,csherwood-usgs/landlab,Carralex/landlab,cmshobe/landlab,SiccarPoint/landlab,amandersillinois/landlab,Carralex/landlab,ManuSchmi88/landlab,Carralex/landlab,decvalts/landlab,decvalts/landlab,cmshobe/lan... | landlab/grid/tests/test_raster_funcs/test_find_nearest_node.py | landlab/grid/tests/test_raster_funcs/test_find_nearest_node.py | import numpy as np
from numpy.testing import assert_array_equal
from nose import with_setup
try:
from nose.tools import assert_is, assert_is_instance
except ImportError:
from landlab.testing.tools import assert_is, assert_is_instance
from nose.tools import (assert_equal, assert_raises)
from landlab.grid import... | import numpy as np
from numpy.testing import assert_array_equal
from nose import with_setup
try:
from nose.tools import assert_is, assert_is_instance
except ImportError:
from landlab.testing.tools import assert_is, assert_is_instance
from nose.tools import (assert_equal, assert_raises)
from landlab.grid import... | mit | Python |
e3ef36c57cdbcf8757e38d7ce0ce8e488dbf3ca3 | Add helper script | WojciechMula/pyahocorasick,pombredanne/pyahocorasick,pombredanne/pyahocorasick,pombredanne/pyahocorasick,WojciechMula/pyahocorasick,WojciechMula/pyahocorasick,pombredanne/pyahocorasick,WojciechMula/pyahocorasick | tests/generate_random_words.py | tests/generate_random_words.py | import sys
import os
import random
import gzip
import pickle
import optparse
import time
from optparse import OptionParser
def main():
options = parse_args()
app = TestApplication(options)
app.run()
chars = 'abcdefghijklmnopqestuvwxyzABCDEFGHIJKLMNOPQESTUVWXYZ0123456789.,;:-'
class TestApplication(obj... | bsd-3-clause | Python | |
f561fc82b3082567a528be00bdd99cc7ea74519e | add z3 as supported tool | sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,IljaZakharov/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,sosy-lab/benchexec,IljaZakharov/benchexec,IljaZakharov/benchexec,ultimate-pa/benchexec,dbeyer/benchexe... | benchexec/tools/z3.py | benchexec/tools/z3.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | apache-2.0 | Python | |
576c2a1565fe9860c1188a9862b54e24aab64ed4 | Add tests for update_languages utility | caleb531/youversion-suggest,caleb531/youversion-suggest | tests/test_update_languages.py | tests/test_update_languages.py | # tests.test_update_languagess
# coding=utf-8
from __future__ import unicode_literals
import nose.tools as nose
from mock import patch
import utilities.update_languages as update_langs
from tests import set_up, tear_down
from tests.decorators import redirect_stdout_unicode
@nose.with_setup(set_up, tear_down)
@patc... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.