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 |
|---|---|---|---|---|---|---|---|---|
4a3b779c58a9f498bf352f76f8a1253bf1ca101f | Add migration again | stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide | froide/foirequest/migrations/0047_auto_20200823_1300.py | froide/foirequest/migrations/0047_auto_20200823_1300.py | # Generated by Django 3.0.8 on 2020-08-23 11:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('foirequest', '0046_foievent_message'),
]
operations = [
migrations.AlterField(
model_name='foirequest',
name='visibi... | mit | Python | |
ef1ef99b1cee4ebb62b7dcd8705e6190962aa68a | Implement server side. | MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogSamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples,MasuqaT-NET/BlogExamples | Web/gRPC/python_unittest/server/server_main.py | Web/gRPC/python_unittest/server/server_main.py | import time
from concurrent import futures
import grpc
import calculator_pb2_grpc
from calculator_service import CalculatorService
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
calculator_pb2_grpc.add_CalculatorServicer_to_server(Calculator... | mit | Python | |
0d661bec00b1053148ac089d8347b5e242823ad2 | Add admin user | porduna/appcomposer,go-lab/appcomposer,morelab/appcomposer,morelab/appcomposer,porduna/appcomposer,go-lab/appcomposer,porduna/appcomposer,go-lab/appcomposer,go-lab/appcomposer,morelab/appcomposer,morelab/appcomposer,porduna/appcomposer | alembic/versions/9cb5a6027a6_add_admin_user.py | alembic/versions/9cb5a6027a6_add_admin_user.py | """Add admin user
Revision ID: 9cb5a6027a6
Revises: 247238952b94
Create Date: 2013-11-06 13:15:39.032871
"""
# revision identifiers, used by Alembic.
revision = '9cb5a6027a6'
down_revision = '247238952b94'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.execute("INSERT INTO Users (login, name... | bsd-2-clause | Python | |
5cd419341807d8ae23fec7bd9bb7025a8a2dcb3c | add user ID | gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme | lang/python/examples/howto/add-userid.py | lang/python/examples/howto/add-userid.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
# Copyright (C) 2018 Ben McGinnes <ben@gnupg.org>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free S... | lgpl-2.1 | Python | |
00582b3fe35d07a154be343cfd981124655dc5c3 | Create poorlytrained.py Implement argument parsing. | nanovad/poorlytrained | poorlytrained.py | poorlytrained.py | import markovify
import sys
import argparse
def main():
arg_parser = argparse.ArgumentParser(description="Generate text with Markov chains based on a source corpus.")
subparser = arg_parser.add_subparsers(dest="subparser_name")
subparser_train = subparser.add_parser("train")
subparser_train.add_argument("corpus",... | mit | Python | |
07dc78f39a16077fe5fc134a99789a25ab5b4cf3 | Add unfuck-email.py script to unescape =XX characters and remove inserted newlines | DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk | unfuck-email.py | unfuck-email.py | #!/usr/bin/env python3
import sys, os
def unfuck(s):
s = s.replace('=\n', '')
for c in range(ord(' '), ord('~')):
s = s.replace('=%.2X' % c, chr(c))
return s
def main():
for file in sys.argv[1:]:
print(unfuck(open(file, 'r').read()))
if __name__ == '__main__':
main()
| mit | Python | |
80f9ed82cfedcca494aa7e960d546f992f2d6c60 | Add Supernova report parser script | jgruselius/standalone_scripts,jgruselius/standalone_scripts | supernova_report_parser.py | supernova_report_parser.py | import sys
import re
import json
import fileinput
import argparse
def print_json(files):
samples = {}
for line in fileinput.input(files=files):
m = re.search(r"P\d{4}_\d{3}", line)
if m:
s = m.group()
else:
l = line.split("=")
if len(l) > 2:
d = [x.strip(" -") for x in l]
samples.setdefault(s,... | mit | Python | |
823d333e848efabeccf18fd08e635dda926dd6f0 | Add lc0072_edit_distance.py | bowen0701/algorithms_data_structures | lc0072_edit_distance.py | lc0072_edit_distance.py | """Leetcode 72. Edit Distance
Hard
URL: https://leetcode.com/problems/edit-distance/
Given two words word1 and word2, find the minimum number of operations
required to convert word1 to word2.
You have the following 3 operations permitted on a word:
- Insert a character
- Delete a character
- Replace a character
Ex... | bsd-2-clause | Python | |
54fcb832e2885dafe66adfc8435b4b6a612add90 | Build Home | webbers/dongle.js,webbers/dongle.js,webbers/dongle.js | bld/build-ci-home.py | bld/build-ci-home.py | import os
import sys
import re
import setlibspath
from mainbuild import *
from steps.incrementbuildversionstep import *
from steps.svncommitdirstep import *
from steps.svnimportdirstep import *
from steps.runcommandstep import *
from filters.pythonfilefilter import *
from filters.csbinaryfilefiltertests import *
from... | mit | Python | |
c76ee9d0906162e514c7d20cc483fbf2ac6ba999 | Create LongComPrefix_001.py | Chasego/codirit,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/algo,Chasego/codirit,Chasego/codirit,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/cod,Chasego/cod,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/codirit,Chasego/codi,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,Chasego/codi,Ch... | leetcode/014-Longest-Common-Prefix/LongComPrefix_001.py | leetcode/014-Longest-Common-Prefix/LongComPrefix_001.py | class Solution:
# @param {string[]} strs
# @return {string}
def longestCommonPrefix(self, strs):
prefix = ''
if len(strs) == 0:
return prefix
if len(strs) == 1:
return strs[0]
num = len(strs)
mi = len(strs[0])
... | mit | Python | |
bc684c3bacfc3c260d4711c184ca93ba7cf77c8c | add sign function | VeryCB/jos | jos/__init__.py | jos/__init__.py | import hashlib
def sign(secret, params):
'''
params目前只支持字典类型
'''
keys = parameters.keys()
keys.sort()
p_string = "%s%s%s" % (secret, \
''.join('%s%s' % (key, params[key]) for key in keys), \
secret)
sign = hashlib.md5(p_string).hexdigest().upper()
return ... | mit | Python | |
508c4cdc979d6595eba92d1a354b34df10d177b1 | add management command to output features in use by domain | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/accounting/management/commands/get_minimum_features_by_domain.py | corehq/apps/accounting/management/commands/get_minimum_features_by_domain.py | from django.core.management import BaseCommand
from corehq.apps.accounting.models import DefaultProductPlan
from corehq.apps.accounting.subscription_changes import DomainDowngradeStatusHandler
from corehq.apps.domain.models import Domain
class Command(BaseCommand):
help = 'Print out a CSV containing a table of w... | bsd-3-clause | Python | |
fc760828001f0ad402d9bce7de9bd0957b38a07c | add a photo organizing python script | ijanos/dotfiles,ijanos/dotfiles | scripts/.local/bin/increment-exif-date.py | scripts/.local/bin/increment-exif-date.py | from glob import glob
from subprocess import run
from sys import argv
num = 1
for photo in glob("*.jpg"):
cmd = ["jhead", "-ta+0:00:{}".format(num), photo]
if len(argv) > 1 and argv[1] == "ok":
run(cmd, check=True)
else:
print("DRY RUN " + ' '.join(cmd))
num += 1
| cc0-1.0 | Python | |
332a0f03d0976767aca414ce073657ae329185a9 | fix puppetdb test class name | gg7/diamond,Ssawa/Diamond,bmhatfield/Diamond,jriguera/Diamond,tuenti/Diamond,Nihn/Diamond-1,joel-airspring/Diamond,Basis/Diamond,signalfx/Diamond,janisz/Diamond-1,anandbhoraskar/Diamond,Netuitive/netuitive-diamond,MichaelDoyle/Diamond,thardie/Diamond,EzyInsights/Diamond,gg7/diamond,acquia/Diamond,Clever/Diamond,metamx/... | src/collectors/puppetdb/test/testpuppetdb.py | src/collectors/puppetdb/test/testpuppetdb.py | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from puppetdb import PuppetDBCollector
#################################################################... | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from puppetdb import PuppetDBCollector
#################################################################... | mit | Python |
5a7773da253a66178cbdb3192efc9c5bb1747149 | Add lc069_sqrt_x.py | bowen0701/algorithms_data_structures | lc069_sqrt_x.py | lc069_sqrt_x.py | """Leetcode 69. Sqrt(x)
Easy
URL: https://leetcode.com/problems/sqrtx/
Implement int sqrt(int x).
Compute and return the square root of x, where x is guaranteed to be a
non-negative integer.
Since the return type is an integer, the decimal digits are truncated and
only the integer part of the result is returned.
... | bsd-2-clause | Python | |
f1c928ec7a8816966d09f5d0e1200d468123ad08 | Test runner | Grokzen/redisco,heckj/redisco,Grokzen/redisco | redisco/tests/__main__.py | redisco/tests/__main__.py | import unittest
if __name__ == "__main__":
from . import all_tests
suite = all_tests()
unittest.TextTestRunner(verbosity=2).run(suite) | mit | Python | |
d0af2bbd73b71bbdc6bb16e4066c2b4d3a86efb5 | Create Lemmatization.py | FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code,FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code,FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code | luowang/Data_Processing/Lemmatization.py | luowang/Data_Processing/Lemmatization.py | # -*- coding: utf-8 -*-
from treetaggerwrapper import TreeTagger
from nltk.corpus import PlaintextCorpusReader
from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
from nltk.book import FreqDist
def load_corpus(c_root, file_name=None):
"""
function: load ourself corpus
c_root: the root... | apache-2.0 | Python | |
dcbeb0d4469cf4ff3c7b6f21da4b20010b8b8650 | Add tests | sklam/numba,IntelLabs/numba,numba/numba,IntelLabs/numba,gmarkall/numba,stuartarchibald/numba,numba/numba,sklam/numba,seibert/numba,cpcloud/numba,stuartarchibald/numba,gmarkall/numba,jriehl/numba,seibert/numba,stonebig/numba,stonebig/numba,jriehl/numba,stuartarchibald/numba,sklam/numba,IntelLabs/numba,gmarkall/numba,jri... | numba/cuda/tests/cudapy/test_cuda_array_interface.py | numba/cuda/tests/cudapy/test_cuda_array_interface.py | import numpy as np
from numba import cuda
from numba.cuda.testing import unittest, CUDATestCase
from numba.cuda.testing import skip_on_cudasim
class MyArray(object):
def __init__(self, arr):
self._arr = arr
self.__cuda_array_interface__ = arr.__cuda_array_interface__
@skip_on_cudasim('CUDA Memo... | bsd-2-clause | Python | |
8accd764b72299f6ed7be35104f9a2b958b0fce6 | Add unit tests on commands. | gdraynz/nyuki,optiflows/nyuki,optiflows/nyuki,gdraynz/nyuki | tests/commands_test.py | tests/commands_test.py | from unittest import TestCase
from mock import Mock, patch
from nyuki.commands import (_update_config, _merge_config, parse_init,
exhaustive_config)
class TestUpdateConfig(TestCase):
def test_001_call(self):
source = {'a': 1, 'b': {'c': 2}}
# Update
_update_co... | apache-2.0 | Python | |
5ae6334e9d49f0373ddffb6bbd863fb3daad564c | add cache tests | sn6uv/gmpy_cffi | tests/test_cache.py | tests/test_cache.py | import pytest
from gmpy_cffi import set_cache, get_cache, mpz, mpq, mpfr, mpc
class TestCache(object):
def test_get_set_cache(self):
assert get_cache() == (100, 128)
set_cache(101, 128)
assert get_cache() == (101, 128)
with pytest.raises(ValueError):
set_cache(-1, 128)... | bsd-3-clause | Python | |
98e23c5b2e11b79dd3ca1da52c24ae5b53e04410 | Create utils.py | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | syft/core/frameworks/pandas/utils.py | syft/core/frameworks/pandas/utils.py | import pandas
import pandas as pd
import json
class Serialiser():
"""#TODO Hook the pandas functions here and remove all the pandas
functions from the Workers class, so that you could add more to the
pandas functions"""
def __init__(self):
pass
def serialise(self, pandas_obj):
"""... | apache-2.0 | Python | |
6abd35347c8e55ae3e6c797008288a2239d0ea0c | Create merge_quants.py | macmanes-lab/general,macmanes-lab/general | merge_quants.py | merge_quants.py | #this is originally from Lisa Cohen as part of ANGUS 2016
#USAGE: python merge_counts.py
import os
from os import path
import pandas as pd
# get txp names as index
listofsamples = os.listdir("dry/")
quants = {}
data = None
for sample in listofsamples:
if os.path.isdir("dry/"+sample):
if os.path.isfile("... | mit | Python | |
38e6d4c5a2527ea2cfc3271577de3dd59116bb6e | implement rBO profiling class | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/profile.py | mint/profile.py | #
# Copyright (c) 2006 rPath, Inc.
#
# All Rights Reserved
#
import os
import time
class Profile(object):
def __init__(self, logFile = None):
if logFile:
self.logFile = open(logFile, "a")
def __del__(self):
self.logFile.close()
def write(self, formatString, *args):
if... | apache-2.0 | Python | |
5dfdda3face2fe9dacb0a47155928614104a03ca | Add a script to call a service | xapi-project/message-switch,xapi-project/message-switch,xapi-project/message-switch | dbus/vm/python/dbus-call.py | dbus/vm/python/dbus-call.py | #!/usr/bin/env python
# Wrapper around single-shot resource attach/detach scripts.
#
# The 'resource' interface allows storage and networks to be attached
# and detached by single-shot scripts. All operations are asynchronous,
# 'attach' and 'detach' return a 'task' object which has a 'cancel'
# operation. When 'cance... | isc | Python | |
425a570859f06c8f7b0f3e4803ceb983d6fae17e | make specs | mick-d/nipype,mick-d/nipype,mick-d/nipype,mick-d/nipype | nipype/interfaces/tests/test_auto_BIDSDataGrabber.py | nipype/interfaces/tests/test_auto_BIDSDataGrabber.py | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..bids_utils import BIDSDataGrabber
def test_BIDSDataGrabber_inputs():
input_map = dict(base_dir=dict(mandatory=True,
),
output_query=dict(),
raise_on_empty=dict(usedefault=True,
),
return_type=d... | bsd-3-clause | Python | |
aa29d64ada307e081a47cc04d7e9487f33832b93 | Create geotiff_process.py | leiii/urban-boundary | geotiff_process.py | geotiff_process.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Lei Dong
"""
本脚本将GeoTiff格式的文件,按band的value筛选后,以{(lon, lat): value}形式输出
More about GDAL library, see:
http://www.gdal.org/gdal_tutorial.html
https://pcjericks.github.io/py-gdalogr-cookbook/raster_layers.html
"""
import numpy as np
from osgeo import gdal
dataset = gdal.Op... | apache-2.0 | Python | |
6f369490433d3f35f3195c64e1c3dedbddfca0b2 | Add github plugin | tomleese/smartbot,Muzer/smartbot,thomasleese/smartbot-old,Cyanogenoid/smartbot | plugins/github.py | plugins/github.py | import requests
import sys
class Plugin:
def on_command(self, bot, msg):
if len(sys.argv) >= 2:
action = sys.argv[1]
if "status".startswith(action):
url = "https://status.github.com/api/last-message.json"
headers = {"User-Agent": "SmartBot"}
... | mit | Python | |
64be453e86c8e1a9461c901028078a12deaa4c32 | Add integration test covering basic functionality | jitseniesen/spyder-unittest | spyder_unittesting/widgets/tests/test_unittestinggui.py | spyder_unittesting/widgets/tests/test_unittestinggui.py | # -*- coding: utf-8 -*-
#
# Copyright © 2016- The Spyder Development Team
# Licensed under the terms of the MIT License
# (see ../../LICENSE for details)
"""Tests for unittestinggui.py"""
import os
from qtpy.QtCore import Qt
from spyder.utils.qthelpers import qapplication
MAIN_APP = qapplication() # without this li... | mit | Python | |
5af6c594b5ccc2350c95d90b7fb49cb7c1adf6f5 | Add teleop node for PTZ. | clearpathrobotics/axis_camera,ros-drivers/axis_camera,tradr-project/axis_camera | nodes/teleop.py | nodes/teleop.py | #!/usr/bin/python
import roslib; roslib.load_manifest('clearpath_teleop')
import rospy
from sensor_msgs.msg import Joy
from axis_camera.msg import Axis
class Teleop:
def __init__(self):
rospy.init_node('axis_ptz_teleop')
self.enable_button = rospy.get_param('~enable_button', 1)
self.cmd ... | bsd-3-clause | Python | |
6cc5ba7306646f7b3cb93373765b99a897370be4 | add link th the group | moranmo29/ShareLink,moranmo29/ShareLink,moranmo29/ShareLink | api/add_link_group.py | api/add_link_group.py | from google.appengine.ext.webapp import template
import webapp2
import json
from models.user import User
from models.link import Link
from models.group import Group
class addLinkToTheGroup(webapp2.RequestHandler):
def get(self):
des=self.request.get('des')
url_link=self.request.get('url_link')
user = None
if... | mit | Python | |
dec6ccd331673d5a43030b011b0b2a416cd4a15a | Update __init__.py | rishubhjain/commons,r0h4n/commons,Tendrl/commons | tendrl/commons/objects/__init__.py | tendrl/commons/objects/__init__.py | import abc
import six
from tendrl.commons.central_store import utils as cs_utils
@six.add_metaclass(abc.ABCMeta)
class BaseObject(object):
def __init__(
self,
attrs=None,
enabled=None,
obj_list=None,
obj_value=None,
atoms=None,
fl... | import abc
import six
from tendrl.commons.central_store import utils as cs_utils
@six.add_metaclass(abc.ABCMeta)
class BaseObject(object):
def __init__(
self,
attrs=None,
enabled=None,
obj_list=None,
obj_value=None,
atoms=None,
fl... | lgpl-2.1 | Python |
332a1d777a5205886a7bd941155ba178a577e601 | Add py solution for 637. Average of Levels in Binary Tree | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/average-of-levels-in-binary-tree.py | py/average-of-levels-in-binary-tree.py | from collections import defaultdict
from Queue import Queue
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def averageOfLevels(self, root):
"""
:type ro... | apache-2.0 | Python | |
9bcedcb7ce07a0436b5b27d5f76bde69b4103f3f | Add hero to press release listing | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-press-releases,ic-labs/icekit-press-releases,ic-labs/django-icekit,ic-labs/django-icekit | press_releases/migrations/0008_auto_20161128_1049.py | press_releases/migrations/0008_auto_20161128_1049.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('icekit_press_releases', '0007_auto_20161117_1201'),
]
operations = [
migrations.AlterField(... | mit | Python | |
29ddb78124294658b1a1d744d7da591a9a93f73e | Add test | angr/angr,iamahuman/angr,tyb0807/angr,schieb/angr,tyb0807/angr,schieb/angr,tyb0807/angr,angr/angr,iamahuman/angr,schieb/angr,iamahuman/angr,angr/angr | tests/test_keystone.py | tests/test_keystone.py | import os
import logging
import nose
import angr
l = logging.getLogger("angr.tests")
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))
target_addrs = {
'i386': [ 0x080485C9 ],
'x86_64': [ 0x4006ed ],
'armel': [ 0x85F0 ],
}
def run_keystone(arch):
p... | bsd-2-clause | Python | |
f940c8adc372106e8fecc6fe1e7a027581266423 | Create singleton utility. | eddieantonio/ad-hoc-miner,naturalness/sensibility,naturalness/sensibility,naturalness/sensibility,eddieantonio/ad-hoc-miner,naturalness/sensibility,eddieantonio/ad-hoc-miner,eddieantonio/ad-hoc-miner | sensibility/util.py | sensibility/util.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright 2017 Eddie Antonio Santos <easantos@ualberta.ca>
#
# 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/licens... | apache-2.0 | Python | |
5f38319bcc2cad3f7d8ea1985379b51e89e32f44 | Add tests for RabbitMQ backend | csarcom/python-pubsub,WeLikeAlpacas/python-pubsub,WeLikeAlpacas/Qpaca | tests/test_rabbitmq.py | tests/test_rabbitmq.py | import mock
from pubsub.backend.rabbitmq import RabbitMQ, RabbitMQPublisher
class TestRabbitMQ(object):
def setup_class(self):
self.backend = RabbitMQ()
@mock.patch('pubsub.backend.rabbitmq.RabbitMQPublisher.start')
def test_call_start_publisher(self, mocked_function):
self.backend.star... | mit | Python | |
3243879f71ea74f57d8cd428b74f836e22579ddf | Add unit tests. | learningequality/ricecooker,learningequality/ricecooker,learningequality/ricecooker,learningequality/ricecooker | tests/test_settings.py | tests/test_settings.py | import sys
from mock import patch
from ricecooker import chefs
settings = {
'generate-missing-thumbnails': True,
'compress-videos': True
}
def test_settings_unset_default():
chef = chefs.SushiChef()
for setting in settings:
assert chef.get_setting(setting) is None
assert chef.get_... | mit | Python | |
c4067060fa4a99247206b9aa47e6ada97005cc9c | Create python_logging.py | gerbill/gerbill.github.io | python_logging.py | python_logging.py | # Simple logging config that will output all logging.info() messages to stdout
# and right out these messages to "app.log" as well. Neat! :D
import logging
logging.basicConfig(
format='%(asctime)s | %(levelname)s | %(message)s',
filename='app.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S',
)
lo... | mit | Python | |
64cbcc160dd3f7a6f8e59592afda302522314404 | Add unittest for the Lambda Function | andrewdefilippis/aws-lambda | Functions/Python/template/test/test_lambda_function.py | Functions/Python/template/test/test_lambda_function.py | """Created By: Andrew Ryan DeFilippis"""
import contextlib
import re
import unittest
from io import StringIO
import context
import lambda_function
class TestLambdaFunction(unittest.TestCase):
"""Test all the Lambda Function things!
"""
def test_cwlogs_event_format(self):
"""Verify the format of... | apache-2.0 | Python | |
f4497826cd445f473a11ad41c45461ac59d7b08a | Enable Cluster Serving message encrytpion (#3560) | yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL | python/dllib/src/test/bigdl/test_encryption_utils.py | python/dllib/src/test/bigdl/test_encryption_utils.py | #
# Copyright 2018 Analytics Zoo 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 applicable law or agreed to... | apache-2.0 | Python | |
8edb58cb33d6694c321ddb0a34d3b0757348cdb6 | Create 5 band algorithm file | dgaiero/Resistor-Band-Picture-Creator | resistorAlgorithm5Band.py | resistorAlgorithm5Band.py | # 2 DECIMAL POINT
#9-3-17
# Initialize resistor colors
BLACK = ['black', 0, 0, 0, 1, None]
BROWN = ['brown', 1, 1, 1, 10, "1%"]
RED = ['red', 2, 2, 2, 100, "2%"]
ORANGE = ['orange', 3, 3, 3, 1000, "3%"]
YELLOW = ['yellow', 4, 4, 4, 10000, "4%"]
GREEN = ['green', 5, 5, 5, 100000, "0.5%"]
BLUE = ['blue', 6, 6, 6... | mit | Python | |
cf732aaebfd4ed3f7ac2e8475a52e59934d193d6 | Add Wav2Vec2 unit test to Python | JohnSnowLabs/spark-nlp,JohnSnowLabs/spark-nlp,JohnSnowLabs/spark-nlp,JohnSnowLabs/spark-nlp | python/test/annotator/audio/wav2vec2_for_ctc_test.py | python/test/annotator/audio/wav2vec2_for_ctc_test.py | # Copyright 2017-2022 John Snow Labs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | apache-2.0 | Python | |
876711bfc174d529db3a03a9d731801425efa1a2 | add deeplearning pyunit | madmax983/h2o-3,madmax983/h2o-3,YzPaul3/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,kyoren/https-github.com-h2oai-h2o-3,tarasane/h2o-3,brightchen/h2o-3,PawarPawan/h2o-v3,junwucs/h2o-3,nilbody/h2o-3,tarasane/h2o-3,h2oai/h2o-dev,datachand/h2o-3,YzPaul3/h2o-3,h2oai/h2o-3,mrgloom/h2o-3,bospetersen/h2o-3,h2oai/h2o-3,kyoren/htt... | h2o-py/tests/testdir_algos/deeplearning/pyunit_imbalance_largeDeepLearning.py | h2o-py/tests/testdir_algos/deeplearning/pyunit_imbalance_largeDeepLearning.py | import sys
sys.path.insert(1,"../../../")
import h2o
def imbalance(ip, port):
h2o.init(ip, port)
print "Test checks if Deep Learning works fine with an imbalanced dataset"
covtype = h2o.upload_file(h2o.locate("smalldata/covtype/covtype.20k.data"))
covtype[54] = covtype[54].asfactor()
hh_imbalance... | apache-2.0 | Python | |
5bfc44f140b0d8a16c88aa98205bee71e08fc372 | Add tasks to anonymize past opt outs | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | studygroups/management/commands/anonymize-opt-outs.py | studygroups/management/commands/anonymize-opt-outs.py | from django.core.management.base import BaseCommand, CommandError
from studygroups.models import Application
class Command(BaseCommand):
help = 'Anonymize applications that previously opted out'
def handle(self, *args, **options):
applications = Application.objects.filter(deleted_at__isnull=False)
... | mit | Python | |
93d499afce845a1a0ecc2422e8c58db018f76159 | add workflowleve1 to approval autorhity #18 | toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity | workflow/migrations/0003_auto_20170529_0231.py | workflow/migrations/0003_auto_20170529_0231.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-05-29 09:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workflow', '0002_auto_20170522_0819'),
]
operations = [
migrations.AlterMode... | apache-2.0 | Python | |
4e57f963d11dc66bb2bee46324121f1f229cb685 | Add open url (web page) script | rawswift/python-collections | url/cli-open-url.py | url/cli-open-url.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
response = urllib2.urlopen("https://www.python.org/")
html = response.read()
# print out the HTML response
print(html)
| mit | Python | |
79e06c8e07ff0b945145a2a29e3133e0714f9415 | Add simplest integration test ever for dump | gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty | tests/integration/cli/dump_test.py | tests/integration/cli/dump_test.py | from ...testcases import DustyIntegrationTestCase
class TestDumpCLI(DustyIntegrationTestCase):
def test_dump(self):
result = self.run_command('dump')
self.assertInSameLine(result, 'COMMAND', 'Dusty Version')
| mit | Python | |
e23e28bd6e77ce93a66ea30d64402c0ed0ca24f5 | Add test for MemoryObject | CybOXProject/python-cybox | cybox/test/objects/memory_test.py | cybox/test/objects/memory_test.py | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.objects.memory_object import Memory
from cybox.test.common.hash_test import EMPTY_MD5
from cybox.test.objects import ObjectTestCase
class TestMemory(ObjectTestCase, unittest.TestCase):
... | bsd-3-clause | Python | |
728c18bce41277781b2981c8a446100da19c0070 | Add test file for lesson 0. | thejessleigh/test_driven_python,thejessleigh/test_driven_python,thejessleigh/test_driven_python | tests/test_lesson_0_hello_world.py | tests/test_lesson_0_hello_world.py | # This lesson teaches you how to define a Python method. Try running the tests for this file before doing anything!
# Here's a python script you can use to run your tests from the top level directory of this project
# `python -m unittest -vf tests.test_lesson_0_hello_world`
# That command looks like a lot at first. Le... | mit | Python | |
cd3e42384a3161e2d2c732f8a59a02cf0d65116f | Add a SQLAlchemy config | viniciuschiele/central | central/config/database.py | central/config/database.py | """
SQLAlchemy config implementation.
"""
from .core import BaseDataConfig
from ..compat import string_types
from ..exceptions import LibraryRequiredError
from ..structures import IgnoreCaseDict
try:
import sqlalchemy
except:
sqlalchemy = None
__all__ = [
'SQLAlchemyConfig',
]
class SQLAlchemyConfig(... | mit | Python | |
6d3ff9d0a2e6a1c4ad33ba7e8980cbe45a5c5307 | fix imports for error handling | Austin503/pyglet,mpasternak/pyglet-fix-issue-552,mpasternak/michaldtz-fix-552,kmonsoor/pyglet,gdkar/pyglet,Alwnikrotikz/pyglet,mpasternak/pyglet-fix-issue-518-522,mpasternak/pyglet-fix-issue-552,google-code-export/pyglet,Alwnikrotikz/pyglet,google-code-export/pyglet,mpasternak/michaldtz-fixes-518-522,kmonsoor/pyglet,sh... | pyglet/GL/info.py | pyglet/GL/info.py | #!/usr/bin/env python
'''Cached information about version and extensions of current GL
implementation.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import warnings
# We have to wait until a context is created (with a window) until any
# information is available.
_have_context = False
# The informa... | #!/usr/bin/env python
'''Cached information about version and extensions of current GL
implementation.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import warnings
# We have to wait until a context is created (with a window) until any
# information is available.
_have_context = False
# The informa... | bsd-3-clause | Python |
f5c1ca4d759481133131669e47b8fd576bbeb07f | Create rebin package. | sbrisard/rebin | rebin/__init__.py | rebin/__init__.py | """Package-level doc"""
from .rebin import rebin
| bsd-3-clause | Python | |
68d4baf256d41e5cbd4fdfe4ed00d55e2735ab47 | Ajoute un petit script de statistiques. | dezede/dezede,dezede/dezede,dezede/dezede,dezede/dezede | scripts/stats.py | scripts/stats.py | # coding: utf-8
from __future__ import unicode_literals
import datetime
from django.contrib.auth import get_user_model
from django.db.models import Count, Min, Max
from reversion.models import Revision
def run():
User = get_user_model()
headers = 'username', 'n_revisions', 'start'
data = User.objects.ann... | bsd-3-clause | Python | |
44405c6e0b815ec9edd814ae02cc3a6d490b2074 | Update third_party/mkl_dnn/build_defs.bzl | yongtang/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gautam1858/tensorflow,paolodedios/tensorflow,gautam1858/tensorflow,annarev/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_saved_model,... | third_party/mkl_dnn/build_defs.bzl | third_party/mkl_dnn/build_defs.bzl | def if_mkl_open_source_only(if_true, if_false = []):
"""Returns `if_true` if MKL-DNN v0.x is used.
Shorthand for select()'ing on whether we're building with
MKL-DNN v0.x open source library only, without depending on MKL binary form.
Returns a select statement which evaluates to if_true if we're build... | def if_mkl_open_source_only(if_true, if_false = []):
"""Returns `if_true` if MKL-DNN v0.x is used.
Shorthand for select()'ing on whether we're building with
MKL-DNN v0.x open source library only, without depending on MKL binary form.
Returns a select statement which evaluates to if_true if we're build... | apache-2.0 | Python |
06c78c6f721f79ae5d72e4da0b6b966bbcb99fbf | Add beginnings of some gizmo test coverage | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation | test/test_gizmo_request.py | test/test_gizmo_request.py | from unittest import TestCase
from groundstation.transfer.request import Request
class TestGizmoRequest(TestCase):
def test_loadable_after_serializing(self):
gizmo = Request("LISTALLOBJECTS")
def test_rejects_invalid_verbs(self):
with self.assertRaises(Exception):
gizmo = Request(... | mit | Python | |
14b0af75ee6b94f0501c8abe455a7a698cab8f85 | add import script for Mansfield | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_mansfield.py | polling_stations/apps/data_collection/management/commands/import_mansfield.py | from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = 'E07000174'
addresses_name = 'parl.2017-06-08/Version 1/polling_station_export-2017-06-05 2.csv'
stations_name = 'parl.2017-06-08/Version 1/polling_station_export-2017-06-05 ... | bsd-3-clause | Python | |
9378f4b9517044f498bdc7bf2a82b31a2d089fc0 | Add file actually containing the web server. | NMisko/monkalot,ghostduck/monkalot | bot/web.py | bot/web.py | """Allows to control the bot via REST calls."""
from bottle import route, run, ServerAdapter, request, abort
from os import listdir
import threading
import json
class StoppableWSGIRefServer(ServerAdapter):
"""Allows to programmatically shut down bottle server."""
def run(self, handler):
"""Start the... | mit | Python | |
5723b988e9643fa71f58e4175480bb956489f091 | Move distance to primitive in new utils file, to use it in different projects | NUAAXXY/globOpt,amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt | evaluation/packages/utils.py | evaluation/packages/utils.py |
# Compute the distance between points of cloud assigned to a primitive
# Return an array with len=len(assign)
def distanceToPrimitives(cloud, assign, primitives):
return [ [primVar.distanceTo(cloud[a[0]]) for primVar in primitives if primVar.uid == a[1]][0] for a in assign]
| apache-2.0 | Python | |
c1af7034dbcf2a5d3c4109579f0974b441ff3212 | Create __init__.py | bigdig/vnpy,msincenselee/vnpy,msincenselee/vnpy,vnpy/vnpy,bigdig/vnpy,andrewchenshx/vnpy,msincenselee/vnpy,msincenselee/vnpy,andrewchenshx/vnpy,bigdig/vnpy,bigdig/vnpy,andrewchenshx/vnpy,andrewchenshx/vnpy,vnpy/vnpy,andrewchenshx/vnpy | vnpy/gateway/bitfinex/__init__.py | vnpy/gateway/bitfinex/__init__.py | from .bitfinex_gateway import BitfinexGateway
| mit | Python | |
aaca0950b239f1759faa82a1e394aa21b547d51e | Add a module test_field.py to tests subpackage. | showa-yojyo/dqutils | dqutils/tests/test_field.py | dqutils/tests/test_field.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for dqutils.database.field module."""
import unittest
from dqutils.database.field import make_field
from dqutils.database.field import BitField
from dqutils.database.field import ByteField
from dqutils.database.field import WordField
from dqutils.database.field im... | mit | Python | |
845d091eaaacdbbfe3d39a405c66043a678a4ddb | add team, servicestatus and propertytype | jordanbettis/chipy-mentorship,jordanbettis/chipy-mentorship,jordanbettis/chipy-mentorship | chipyprj/chipyapp/migrations/0008_auto_20151124_0208.py | chipyprj/chipyapp/migrations/0008_auto_20151124_0208.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('chipyapp', '0007_auto_20151111_0223'),
]
operations = [
migrations.CreateModel(
name='PropertyType',
... | bsd-2-clause | Python | |
7e1cb599af980075459d47cbcabbde0fe1db1e81 | Remove flake noqa exception | trungdong/cookiecutter-django,trungdong/cookiecutter-django,trungdong/cookiecutter-django,pydanny/cookiecutter-django,pydanny/cookiecutter-django,ryankanno/cookiecutter-django,pydanny/cookiecutter-django,pydanny/cookiecutter-django,luzfcb/cookiecutter-django,ryankanno/cookiecutter-django,ryankanno/cookiecutter-django,t... | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/storages.py | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/storages.py | {% if cookiecutter.cloud_provider == 'AWS' -%}
from storages.backends.s3boto3 import S3Boto3Storage
class StaticRootS3Boto3Storage(S3Boto3Storage):
location = "static"
default_acl = "public-read"
class MediaRootS3Boto3Storage(S3Boto3Storage):
location = "media"
file_overwrite = False
{%- elif cookie... | {% if cookiecutter.cloud_provider == 'AWS' -%}
from storages.backends.s3boto3 import S3Boto3Storage # noqa E402
class StaticRootS3Boto3Storage(S3Boto3Storage):
location = "static"
default_acl = "public-read"
class MediaRootS3Boto3Storage(S3Boto3Storage):
location = "media"
file_overwrite = False
{%... | bsd-3-clause | Python |
6ee1612e73efc2209c8399a54cebb7cba7965c7d | Add level generation test util fn | MoyTW/RL_Arena_Experiment | tests/level/level_utils.py | tests/level/level_utils.py | from hunting.level.map import LevelMap, LevelTile
def generate_5x3_long_c():
level_map = LevelMap([[LevelTile() for _ in range(0, 3)] for _ in range(0, 5)])
for x in range(1, 5):
level_map[x][1].blocks = True
return level_map | mit | Python | |
28efbe2a98bce25710ed77ba8868880ae4fed4dd | Add ZeroMQ Plugin message format as json-schema | wheeler-microfluidics/zmq-plugin | zmq_plugin/schema.py | zmq_plugin/schema.py | # ZeroMQ Plugin message format as [json-schema][1] (inspired by
# [IPython messaging format][2]).
#
# [1]: https://python-jsonschema.readthedocs.org/en/latest/
# [2]: http://jupyter-client.readthedocs.org/en/latest/messaging.html#messaging
MESSAGE_SCHEMA = {
'definitions':
{'header' :
{'type': 'object',
... | lgpl-2.1 | Python | |
50afe5a6c21e79cf8471271bf6f0513f8af40f99 | Fix `ConfigParser` deprecation warnings. | punchagan/zulip,hackerkid/zulip,timabbott/zulip,timabbott/zulip,showell/zulip,hackerkid/zulip,jackrzhang/zulip,mahim97/zulip,tommyip/zulip,verma-varsha/zulip,dawran6/zulip,rht/zulip,rht/zulip,dhcrzf/zulip,zulip/zulip,PhilSk/zulip,aakash-cr7/zulip,shubhamdhama/zulip,susansls/zulip,j831/zulip,Galexrt/zulip,vabs22/zulip,s... | zilencer/management/commands/sync_api_key.py | zilencer/management/commands/sync_api_key.py | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from django.core.management.base import BaseCommand
from zerver.models import get_user_profile_by_email, UserProfile
import os
from six.moves.configparser import ConfigParser
class Command(BaseCommand):
help = """... | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from django.core.management.base import BaseCommand
from zerver.models import get_user_profile_by_email, UserProfile
import os
from six.moves.configparser import SafeConfigParser
class Command(BaseCommand):
help =... | apache-2.0 | Python |
56b67d8cb5574d0174302173ff5a6a7fe2b45424 | Create py-装饰器.py | ganmk/python-prctice | py-装饰器.py | py-装饰器.py | def login(func):
print 'login'
return func#只返回func函数的内存地址,不调用func
def tv(name):
print '%s to tvpage' % name
f = login(tv)
f('ahaii')
| mit | Python | |
81cdfe01f2291e33ca91f921d5e184833cb82301 | Add migrations | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0017_auto_20160601_1320.py | fellowms/migrations/0017_auto_20160601_1320.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-01 13:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0016_auto_20160601_1317'),
]
operations = [
migrations.AlterFiel... | bsd-3-clause | Python | |
d6882abd2a96a2a1ba1cdbe0b2074f86b2cd4db6 | Add migration | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0049_auto_20160720_1528.py | fellowms/migrations/0049_auto_20160720_1528.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-20 15:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0048_auto_20160720_1107'),
]
operations = [
migrations.AlterFiel... | bsd-3-clause | Python | |
28b707002745f971ed7ca6dff6972c4a26c6ecda | add new decision module | Salman-H/mars-search-robot | code/decision_new.py | code/decision_new.py | """
Module for rover decision-handling.
Used to build a decision tree for determining throttle, brake and
steer commands based on the output of the perception_step() function
in the perception module.
"""
__author__ = 'Salman Hashmi'
__license__ = 'BSD License'
import time
import numpy as np
import states
import... | bsd-2-clause | Python | |
132f8093d9b6590e7c1caf95acbfdcc2433a9233 | add copy_case mgmt command | puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoft... | corehq/apps/domainsync/management/commands/copy_case.py | corehq/apps/domainsync/management/commands/copy_case.py | from couchdbkit import Database
from django.core.management.base import LabelCommand, CommandError
from casexml.apps.case.models import CommCareCase
from couchforms.models import XFormInstance
class Command(LabelCommand):
help = "Copy a case and all related forms"
args = '<sourcedb> <case_id>'
def handle... | bsd-3-clause | Python | |
5d9e6839bded9089ccc713fd72bf5ca74475cb57 | Add files via upload | Innixma/dex,bhillmann/dex | scripts/ConvertToPolar.py | scripts/ConvertToPolar.py | def polar2cart(r, theta, center):
x = r * np.cos(theta) + center[0]
y = r * np.sin(theta) + center[1]
return x, y
def img2polar(img, center, final_radius, initial_radius = None, phase_width = 3000):
if initial_radius is None:
initial_radius = 0
theta , R = np.meshgrid(np.lin... | mit | Python | |
06c7b56a6196871829bd32f31d0bc68f1c159a43 | add phone_book_2.py, dict realization | pepincho/Python101-and-Algo1-Courses,pepincho/HackBulgaria,pepincho/HackBulgaria,pepincho/Python101-and-Algo1-Courses | Algo-1/week3/4-Phone-Book-2/phone_book_2_2.py | Algo-1/week3/4-Phone-Book-2/phone_book_2_2.py | class PhoneBook:
def __init__(self):
self.numbers = dict()
def insert(self, name, number):
self.numbers[name] = number
def remove(self, name):
del self.numbers[name]
def lookup(self, name):
if name in self.numbers:
return self.numbers[name]
else:
... | mit | Python | |
6d3806665ea5dbd6e6f8c1f0161fa6aa5be4cdef | Add avahi-alias script to publish local cname entries. | scorpiovn/dotfiles,blueyed/dotfiles,scorpiovn/dotfiles,blueyed/dotfiles,scorpiovn/dotfiles,scorpiovn/dotfiles,blueyed/dotfiles,blueyed/dotfiles,blueyed/dotfiles,scorpiovn/dotfiles | usr/bin/avahi-alias.py | usr/bin/avahi-alias.py | #! /usr/bin/env python
# avahi-alias.py
# Source: http://www.avahi.org/wiki/Examples/PythonPublishAlias
import avahi, dbus
from encodings.idna import ToASCII
# Got these from /usr/include/avahi-common/defs.h
CLASS_IN = 0x01
TYPE_CNAME = 0x05
TTL = 60
def publish_cname(cname):
bus = dbus.SystemBus()
server =... | mit | Python | |
ab585446700d4d07262e98f8867a5c37b83001b1 | Test PackageData | fedora-python/pyp2rpm,joequant/pyp2rpm,pombredanne/pyp2rpm,MichaelMraka/pyp2rpm,mcyprian/pyp2rpm,yuokada/pyp2rpm,henrysher/spec4pypi | tests/test_package_data.py | tests/test_package_data.py | import time
import pytest
from flexmock import flexmock
from pyp2rpmlib.package_data import *
class TestPackageData(object):
@pytest.mark.parametrize(('s', 'expected'), [
('Spam.', 'Spam'),
('Spam', 'Spam'),
])
def test_summary_with_dot(self, s, expected):
pd = PackageDat... | mit | Python | |
f2fe5afd47f04ccea151a384f9e0e5f909d6270a | add unittests for start.py configuration | yngcan/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor | test/test_configuration.py | test/test_configuration.py | #!/usr/bin/env python
import sys
import unittest
sys.path.append('..')
sys.path.append('../lib')
from start import get_year_list
class Test_Configuration(unittest.TestCase):
def setUp(self):
pass
def test_get_year1(self):
yearstring = '2013'
expected = [2013]
years = get_ye... | bsd-2-clause | Python | |
b29575e6af8c6f7dbd64697b235ff5596e0d8c22 | Add tests for xsd:token | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | test/test_tokendatatype.py | test/test_tokendatatype.py | import unittest
from rdflib import Literal, XSD
class TokenDatatypeTest(unittest.TestCase):
def test1(self):
lit2 = Literal("\two\nw", datatype=XSD.normalizedString)
lit = Literal("\two\nw", datatype=XSD.string)
self.assertFalse(str(lit) == str(lit2))
def test2(self):
lit = ... | bsd-3-clause | Python | |
563676f33b68710efe30b811c2f5306d50e1cc57 | add minion submodule | zibraproject/zika-pipeline,zibraproject/zika-pipeline,zibraproject/zika-pipeline,zibraproject/zika-pipeline | scripts/minion.py | scripts/minion.py | #Written by Nick Loman (@pathogenomenick)
import os
import sys
from Bio import SeqIO
from clint.textui import colored, puts, indent
def get_nanopolish_header(ref):
recs = list(SeqIO.parse(open(ref), "fasta"))
if len (recs) != 1:
print >>sys.stderr, "FASTA has more than one sequence"
raise SystemExit
return "... | mit | Python | |
a389b1172880db069e1a12ba75665e5366699b95 | Add tests for wind_turbine module | wind-python/windpowerlib | tests/test_wind_turbine.py | tests/test_wind_turbine.py | import pandas as pd
from pandas.util.testing import assert_series_equal
import pytest
from windpowerlib.wind_turbine import read_turbine_data, WindTurbine
class TestWindTurbine:
def test_error_raising(self):
self.test_turbine_data = {'hub_height': 100,
'rotor_diameter': ... | mit | Python | |
8297f421a793d4a537e77529d608da280155a38d | Change AutoStart to take a serial argument | google/openhtf,ShaperTools/openhtf,ShaperTools/openhtf,jettisonjoe/openhtf,grybmadsci/openhtf,grybmadsci/openhtf,fahhem/openhtf,fahhem/openhtf,grybmadsci/openhtf,ShaperTools/openhtf,google/openhtf,amyxchen/openhtf,jettisonjoe/openhtf,grybmadsci/openhtf,google/openhtf,jettisonjoe/openhtf,fahhem/openhtf,ShaperTools/openh... | openhtf/exe/triggers.py | openhtf/exe/triggers.py | # Copyright 2014 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | # Copyright 2014 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | apache-2.0 | Python |
5a3dde1b917f6cd0f57b07f370bf49c4379ac78e | Add admin pages for teams models (#22284) | edx-solutions/edx-platform,mitocw/edx-platform,eduNEXT/edunext-platform,edx-solutions/edx-platform,arbrandes/edx-platform,cpennington/edx-platform,msegado/edx-platform,arbrandes/edx-platform,msegado/edx-platform,stvstnfrd/edx-platform,appsembler/edx-platform,appsembler/edx-platform,eduNEXT/edx-platform,stvstnfrd/edx-pl... | lms/djangoapps/teams/admin.py | lms/djangoapps/teams/admin.py | """
Admin registration for Course Teams.
"""
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from .models import CourseTeam, CourseTeamMembership
@admin.register(CourseTeam)
class CourseTeamAdmin(admin.ModelAdmin):
"""
Admin config for course teams.
"""
list... | agpl-3.0 | Python | |
1fe3c7009ab19d5536d7aee9576d442d017c5bb8 | work on adding unit test for avoiding bug possibly caused due to thread unsafeness of RMQ | radical-cybertools/radical.ensemblemd,radical-cybertools/radical.ensemblemd | tests/test_synchronizer.py | tests/test_synchronizer.py | from radical.entk import AppManager, Pipeline, Stage, Task
import threading
import pika
if __name__ == '__main__':
amgr = AppManager()
mq_connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
mq_channel = mq_connection.channel()
# Setup the RabbitMQ system in order to test... | mit | Python | |
9738d7e46b1f2f99334b32cadcc448024c4aee1b | add basic-basic tests | fitnr/fleetmonger | tests/fleetmonger_tests.py | tests/fleetmonger_tests.py | import sys
from fleetmonger import Fleetmonger
import unittest
class FleetMongerTestCase(unittest.TestCase):
def setUp(self):
self.f = Fleetmonger(user, key)
def test_fleet(self):
fleet = self.f.myfleet()
assert fleet
assert len(fleet) > 0
if __name__ == '__main__':
unit... | mit | Python | |
04e6981f6ed4a69166248d7590c9bb46f9ecc1d3 | Add scheme to js converter. | johnfn/Caffeine,johnfn/Caffeine,johnfn/Caffeine,johnfn/Caffeine | scheme2js.py | scheme2js.py | import re
input = """
(fn (arglist)
(var a)
(= a (fn (arglist x y) (do
(return (+ x y))
)))
)
"""
class Node:
def __init__(self, name, args):
assert isinstance(args, list)
self.name = name
self.args = args
def tostr(self, indent):
indentation = indent * " "
result = ""
re... | mit | Python | |
53bc6d39e1ad228a0b7ba0a2086e3314f58293ec | Create sentiment.py | jigarkb/Twitter-Sentiment-Analysis | sentiment.py | sentiment.py | tweet_item = []
tweet_score=0
tweet_dict={}
j=0
for line in tweet_file:
data=simplejson.loads(line)
if not data.has_key('text'):
continue
text.append(data['text'].lower())
tweet.append(text[j])
tweets_location.append(data['user']['location'].lower())
j+=1
for item in tweet:
twe... | apache-2.0 | Python | |
9658908118df99bdd0fbcf793947cc4ed86989f5 | Fix style | untitaker/vdirsyncer,hobarrera/vdirsyncer,untitaker/vdirsyncer,hobarrera/vdirsyncer,untitaker/vdirsyncer | vdirsyncer/__init__.py | vdirsyncer/__init__.py | # -*- coding: utf-8 -*-
'''
Vdirsyncer synchronizes calendars and contacts.
'''
from __future__ import print_function
PROJECT_HOME = 'https://github.com/pimutils/vdirsyncer'
BUGTRACKER_HOME = PROJECT_HOME + '/issues'
DOCS_HOME = 'https://vdirsyncer.pimutils.org/en/stable'
try:
from .version import version as __v... | # -*- coding: utf-8 -*-
'''
Vdirsyncer synchronizes calendars and contacts.
'''
from __future__ import print_function
PROJECT_HOME = 'https://github.com/pimutils/vdirsyncer'
BUGTRACKER_HOME = PROJECT_HOME + '/issues'
DOCS_HOME = 'https://vdirsyncer.pimutils.org/en/stable'
try:
from .version import version as __v... | mit | Python |
607d9296e430841af7726936505ade7e80f1c6a6 | Create ucsc_create_sp_from_spt.py | jocook/s3260-python | ucsc_create_sp_from_spt.py | ucsc_create_sp_from_spt.py | import sys
import json
import csv
if __name__ == "__main__":
try:
if len(sys.argv) < 3:
print "Usage: %s <JSON settings file> <csv file>" % sys.argv[0]
print " <settings file>: access settings (IP/user/password)"
print " <csv file>: settings for service profi... | apache-2.0 | Python | |
bd8e307e82be0d8240f34b7c27d7cdd538045293 | Add py-sanic (#19174) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-sanic/package.py | var/spack/repos/builtin/packages/py-sanic/package.py | # Copyright 2013-2020 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 PySanic(PythonPackage):
"""Sanic is a Flask-like Python 3.5+ web server that is written to... | lgpl-2.1 | Python | |
5d15ca3b908891e9a9d514448510651484c1c207 | Add a script that runs cov-build, cov-analyze, and cov-commit-defects on a Chromium tree. | hujiajie/pa-chromium,mogoweb/chromium-crosswalk,anirudhSK/chromium,jaruba/chromium.src,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,rogerwang/chromium,Just-D/chromium-1,dushu1203/chromium.src,mogoweb/chromium-crosswalk,robclark/chromium,Fireblend/chromium-crosswalk,patrickm/chromium.src,TheTypoMaster... | tools/coverity/coverity.py | tools/coverity/coverity.py | #!/usr/bin/python
# Copyright (c) 2009 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.
"""
Runs Coverity Prevent on a build of Chromium.
This script should be run in a Visual Studio Command Prompt, so that the
INCLUDE, LI... | bsd-3-clause | Python | |
0c0807f8f2d897ab26f4c60b9a8d4b3734007c79 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/sorting/easy/intro/py/solution.py | hackerrank/algorithms/sorting/easy/intro/py/solution.py | #!/bin/python
def bsearch(L, target):
lo = 0
hi = len(L)
while lo < hi:
mid = lo + (hi - lo) // 2
if L[mid] > target:
hi = mid
elif L[mid] < target:
lo = mid + 1
else:
return mid
return -1
target = int(raw_input())
size = int(... | mit | Python | |
15e87f5d7cee27310695977bacccc98be035de6d | Implement sink calculating entropy | akaIDIOT/Digestive | digestive/entropy.py | digestive/entropy.py | from collections import Counter
from math import log2
from digestive import Sink
# TODO: stash intermediate histograms in multiple Counters?
# TODO: output as a spark
# TODO: output as plot
class Entropy(Sink):
def __init__(self):
super().__init__('entropy')
self.length = 0
self.counter =... | isc | Python | |
3099161325dfd99f1bf32d62218e2aaed41f32cd | Test if there is a pattern in sparsity structure | charanpald/APGL | exp/sandbox/SparseSVDExp.py | exp/sandbox/SparseSVDExp.py |
"""
Some code to see if there is any pattern in the SVD of a matrix with fixed
sparisty structure.
"""
import sys
import logging
import scipy.sparse
import numpy
from sparsesvd import sparsesvd
from exp.util.SparseUtils import SparseUtils
numpy.random.seed(21)
logging.basicConfig(stream=sys.stdout, level=logging.... | bsd-3-clause | Python | |
95a47ff81963d276838939b71824ac7f44befa8c | Add plugin for Vk.com | regosen/gallery_get | gallery_plugins/plugin_vk.py | gallery_plugins/plugin_vk.py | # Plugin for gallery_get.
import re
# Each definition can be one of the following:
# - a string
# - a regex string
# - a function that takes source as a parameter and returns an array or a string. (You may assume that re and urllib are already imported.)
# If you comment out a parameter, it will use the default defin... | mit | Python | |
3dc209c36d50d99c2ada3e19975af9960d782dc1 | refactor store | Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup | usermanage/models/Store.py | usermanage/models/Store.py | from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
# Create your models here.
class Store(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
store_name = models.CharField(max_length=30)
tel = models.CharFiel... | mit | Python | |
921ae6b7d8efe702e157bebdcb17a9a9a1b69893 | add load_devices.py | daveg999/automation_class | class8/ex3/load_devices.py | class8/ex3/load_devices.py |
from net_system.models import NetworkDevice
import django
def main():
django.setup()
pynet_rtr1 = NetworkDevice(
device_name='pynet-rtr1',
device_type='cisco_ios',
ip_address='184.105.247.70',
port=22,
)
pynet_rtr1.save()
pynet_rtr2 = NetworkDevice.objects.get_or_... | apache-2.0 | Python | |
2005e62dd2e4e5b2d967f06b97569b679b115856 | Create __init__.py | jumphone/servercraft | html_model/__init__.py | html_model/__init__.py | from base_html import *
from index_html import *
from handler_html import *
| apache-2.0 | Python | |
25b57c099d0e6cb12ee1bb7a94a7b413717c84d9 | Create HR_pythonList.py | bluewitch/Code-Blue-Python | HR_pythonList.py | HR_pythonList.py | #pythonList.py
if __name__ == '__main__':
N = int(input())
result = []
for n in range(N):
x = input().split(" ")
command = x[0]
if command == 'append':
result.append(int(x[1]))
if command == 'print':
print(result)
if command == 'insert':
... | mit | Python | |
e7bf40f600983147153b3e11dfc41b28b256bcd2 | Add 0126_remove_languages_without_list.py | lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public | ielex/lexicon/migrations/0126_remove_languages_without_list.py | ielex/lexicon/migrations/0126_remove_languages_without_list.py | # -*- coding: utf-8 -*-
# Inspired by:
# https://github.com/lingdb/CoBL/issues/223#issuecomment-256815113
from __future__ import unicode_literals, print_function
from django.db import migrations
def forwards_func(apps, schema_editor):
LanguageListOrder = apps.get_model("lexicon", "LanguageListOrder")
Language... | bsd-2-clause | Python | |
21af4c377b341ed7e2a6be1d585ebfd3d8bbbfa2 | Add a basic demo that prints FQN of methods | cscorley/changeset-feature-location,cscorley/changeset-feature-location,cscorley/doc2vec-feature-location,cscorley/doc2vec-feature-location | src/demo.py | src/demo.py | from __future__ import print_function
from antlr4 import *
#from src.grammars.Java8Lexer import Java8Lexer as JavaLexer
#from src.grammars.Java8Parser import Java8Parser as JavaParser
#from src.grammars.JavaLexer import JavaLexer
#from src.grammars.JavaParser import JavaParser
import src.grammars.JavaLexer as JavaLexe... | bsd-3-clause | Python | |
a73e2975d74a3a15a4180974fc6dd75789bc8e78 | Add simple function for outputting statistics for use with munin | ericzhou2008/zulip,calvinleenyc/zulip,wavelets/zulip,littledogboy/zulip,Jianchun1/zulip,praveenaki/zulip,bssrdf/zulip,noroot/zulip,bluesea/zulip,jimmy54/zulip,timabbott/zulip,bluesea/zulip,SmartPeople/zulip,natanovia/zulip,karamcnair/zulip,aliceriot/zulip,nicholasbs/zulip,SmartPeople/zulip,amallia/zulip,mdavid/zulip,xu... | zephyr/lib/stats.py | zephyr/lib/stats.py | import os
import logging
STATS_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "stats")
def update_stat(name, value):
try:
os.mkdir(STATS_DIR)
except OSError:
pass
base_filename = os.path.join(STATS_DIR, name)
tmp_filename = base_filename + ".new"
try:
with file... | apache-2.0 | Python | |
561fa74a6e2572df913140a0cf9f57857a9eaddd | Set default ordering for ContributorRank | JaredKerim-Mozilla/leaderboard-server,JaredKerim-Mozilla/leaderboard-server,mozilla-services/location-leaderboard,mozilla-services/location-leaderboard,mozilla-services/location-leaderboard,mozilla-services/location-leaderboard,JaredKerim-Mozilla/leaderboard-server,JaredKerim-Mozilla/leaderboard-server,mozilla-services... | leaderboard/contributors/migrations/0007_auto_20151113_2229.py | leaderboard/contributors/migrations/0007_auto_20151113_2229.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contributors', '0006_auto_20151013_2148'),
]
operations = [
migrations.AlterModelOptions(
name='contributorrank'... | mpl-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.