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 |
|---|---|---|---|---|---|---|---|---|
83cdd840979dc452f444914a0c40d077e6917c38 | Add DB connector class. | idcodeoverflow/SocialNetworkAnalyzer | DBConnection.py | DBConnection.py | __author__ = 'David'
| mit | Python | |
4ff0e6a4d190d8c1f60903d18dcdaac1edeace8a | Create test.py | bhagirathbhard/redbot,agitatedgenius/redbot | test.py | test.py | import unittest
from mock import patch
import RedDefineBot
class TestBot(unittest.TestCase):
def test_auth_called(self,mock):
self.assertTrue(mock.called)
def test_auth_notcalled(self,mock):
self.assertFalse(mock.called)
if __name__ == '__main__':
unittest.main()
| mit | Python | |
00b04f773b9e2018b08776c5d53ff3dad7ed00d1 | Create test.py | chapman-cpsc-230/hw-0-mckennasheridan,chapman-cpsc-230/hw-0-benav115 | test.py | test.py | """test.py
"""
print "Hello world"
| mit | Python | |
b4b2b80cb1d0c0729e8e98085c2cfc3bc55ddda3 | Solve the Longest Lines challenge using Python3 | TommyN94/CodeEvalSolutions,TommyN94/CodeEvalSolutions | LongestLines.py | LongestLines.py | # Longest Lines
#
# https://www.codeeval.com/open_challenges/2/
#
# Challenge Description: Write a program which reads a file and prints to
# stdout the specified number of the longest lines that are sorted based on
# their length in descending order.
import sys
input_file = sys.argv[1]
with open(input_file, 'r') a... | mit | Python | |
37e674f05547c7b6b93f447477443644865975d1 | Bring back the Root URL config | ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark | urls.py | urls.py | __author__ = 'ankesh'
from django.conf.urls import patterns, include, url
from django.http import HttpResponseRedirect
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'upload.views.home', name='home')... | bsd-2-clause | Python | |
b733f433d797b302c46cb71cf0230b986f630d26 | Create w3_1.py | s40523244/2016fallcp_hw,s40523244/2016fallcp_hw,s40523244/2016fallcp_hw | w3_1.py | w3_1.py | print("你教得真好")
| agpl-3.0 | Python | |
73afce309f0e73b441c0ade49849397cba0fb0c2 | update spec runner to work with invoke's boolean flags to run specs untranslated | kachick/topaz,babelsberg/babelsberg-r,topazproject/topaz,babelsberg/babelsberg-r,kachick/topaz,babelsberg/babelsberg-r,topazproject/topaz,kachick/topaz,topazproject/topaz,babelsberg/babelsberg-r,babelsberg/babelsberg-r,topazproject/topaz | tasks/specs.py | tasks/specs.py | from invoke import task, run as run_
from .base import BaseTest
class Rubyspecs(BaseTest):
def __init__(self, files, options, untranslated=False):
super(Rubyspecs, self).__init__()
self.exe = "`pwd`/bin/%s" % ("topaz_untranslated.py" if untranslated else "topaz")
self.files = files
... | from invoke import task, run as run_
from .base import BaseTest
class Rubyspecs(BaseTest):
def __init__(self, files, options, translated=True):
super(Rubyspecs, self).__init__()
self.exe = "`pwd`/bin/%s" % ("topaz" if translated else "topaz_untranslated.py")
self.files = files
sel... | bsd-3-clause | Python |
90399f50a3f50d9193ae1e6b2042215fb388230f | Create Video Stream program for webcam | SentientCNC/Sentient-CNC | VideoStream.py | VideoStream.py | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
print('Beginning Capture Device opening...\n')
print('Capture device opened?', cap.isOpened())
while True:
ret, frame = cap.read()
gray_image = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame', gray_image)
if cv2.wait... | apache-2.0 | Python | |
1437bb868844731d3fdb13c6dd52dfd706df6f63 | Add a new script to clean up a habitica user given user email | sunil07t/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,shankari/e-mission-server,yw374cornell/e-miss... | bin/ext_service/clean_habitica_user.py | bin/ext_service/clean_habitica_user.py | import argparse
import sys
import logging
import emission.core.get_database as edb
import emission.net.ext_service.habitica.proxy as proxy
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser()
parser.add_argument("user_email",
help="the email addre... | bsd-3-clause | Python | |
b9820246c62733e9e47103d41a07a9a4253be15a | Create weather-script.py | RoryCrispin/epaper-weather-display,RoryCrispin/epaper-weather-display,RoryCrispin/epaper-weather-display | weather-script.py | weather-script.py | #!/usr/bin/python2
#Rory Crispin -- rozzles.com -- 2015
from xml.dom import minidom
import datetime
import codecs
import pywapi
result = pywapi.get_weather_from_yahoo('UKXX3856', 'metric')
iconCodes = ["056", "073", "073", "01e", "01e", "064", "01c", "064", "01c", "01c", "015", "019", "019", "064", "064",
... | mit | Python | |
a9dd25c825bacd03ae358cc153c94ce3960ec0cf | Add serializers | agfor/chipy.org,brianray/chipy.org,chicagopython/chipy.org,bharathelangovan/chipy.org,tanyaschlusser/chipy.org,brianray/chipy.org,tanyaschlusser/chipy.org,tanyaschlusser/chipy.org,chicagopython/chipy.org,bharathelangovan/chipy.org,brianray/chipy.org,bharathelangovan/chipy.org,chicagopython/chipy.org,agfor/chipy.org,chi... | chipy_org/apps/meetings/serializers.py | chipy_org/apps/meetings/serializers.py | from rest_framework import serializers
from .models import Meeting, Topic, Presentor
class PresentorSerializer(serializers.ModelSerializer):
class Meta:
model = Presentor
fields = ('name', 'release')
class TopicSerializer(serializers.ModelSerializer):
presentor = PresentorSerializer()
... | mit | Python | |
55185a7a7402c9d0ce2677b00a329aa4197556c3 | add mediator | xuwei0455/design_patterns | Mediator.py | Mediator.py | # -*- coding: utf-8 -*-
"""
Mediator pattern
"""
class AbstractColleague(object):
"""
AbstractColleague
"""
def __init__(self, mediator):
self.mediator = mediator
class ConcreteColleague(AbstractColleague):
"""
ConcreteColleague
"""
def __init__(self, name, mediator):
... | mit | Python | |
290f990e31a5f732fb054846caea9346946778df | enable import as module | sao-eht/lmtscripts,sao-eht/lmtscripts,sao-eht/lmtscripts,sao-eht/lmtscripts | __init__.py | __init__.py | """
.. module:: lmtscripts
:platform: Unix
:synopsis: useful scripts for EHT observations at LMT
.. moduleauthor:: Lindy Blackburn <lindylam@gmail.com>
.. moduleauthor:: Katie Bouman <klbouman@gmail.com>
"""
| mit | Python | |
19a4c4364d1629cd6bfd7ca27ae4e6441f13747e | Make mygmm a module | khrapovs/mygmm | __init__.py | __init__.py | from .mygmm.mygmm import * | mit | Python | |
a7f4d96becfd1a58794a4dbedb9e9c8f6ac8c1a6 | Create acceptor.py | hgfeaon/simple-paxos | acceptor.py | acceptor.py | #! /usr/bin/env python
import message
import logging
class Acceptor(message.MessageListener):
def __init__(self, config, network):
message.MessageListener.__init__(self,
name = 'AcceptorListenser',
mapping = {
message.MSG_PROPOSAL_REQ : self.on_proposal_reques... | mit | Python | |
1265e6ce2e6f8423e13f5fb5d54328369cfaa3ec | add geojsonloader tester | codefortokyo/data-processing-tools,codefortokyo/data | tests/geojson/geojsonloader.py | tests/geojson/geojsonloader.py | # -*- coding: utf-8 -*-
import sys
import os
import unittest
import uuid
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
sys.path.insert(0, PROJECT_ROOT)
class GeoJSONLoaderTester(unittest.TestCase):
def setUp(self):
pass
def test__init__(self):
... | mit | Python | |
13b94129947cbfab4b7870e130a2efbbf41bfbb7 | Add missing file | kislyuk/rehash | rehash/__init__.py | rehash/__init__.py | from __future__ import absolute_import, division, print_function, unicode_literals
import os, sys, hashlib
from ctypes import cast, c_void_p, POINTER, Structure, c_int, c_ulong, c_char, c_size_t, c_ssize_t, py_object, memmove
from ssl import OPENSSL_VERSION
PyObject_HEAD = [
('ob_refcnt', c_size_t),
('ob_type... | apache-2.0 | Python | |
72d19081bea1dba061c7bf1f57c305f427be1e28 | Implement the SQUIT server command | Heufneutje/txircd,ElementalAlchemist/txircd | txircd/modules/server/squit.py | txircd/modules/server/squit.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.utils import ircLower
from zope.interface import implements
class ServerQuit(ModuleData):
implements(IModuleData)
name = "ServerQuit"
co... | bsd-3-clause | Python | |
5bb387947ac13bcd3949c6b17839033231c05e2d | Add unittests for cupy.testing.array | truongdq/chainer,benob/chainer,wkentaro/chainer,jnishi/chainer,okuta/chainer,hvy/chainer,cupy/cupy,ktnyt/chainer,cupy/cupy,niboshi/chainer,ktnyt/chainer,sinhrks/chainer,chainer/chainer,tkerola/chainer,jnishi/chainer,aonotas/chainer,okuta/chainer,hvy/chainer,ronekko/chainer,AlpacaDB/chainer,kiyukuta/chainer,chainer/chai... | tests/cupy_tests/testing_tests/test_array.py | tests/cupy_tests/testing_tests/test_array.py | import copy
import unittest
import numpy
import six
import cupy
from cupy import testing
@testing.parameterize(
*testing.product({
'assertion': ['assert_allclose', 'assert_array_almost_equal',
'assert_array_almost_equal_nulp',
'assert_array_max_ulp', 'assert_a... | mit | Python | |
6891c9e635cbe9ba663ac7f72bdff653bb8c8220 | make sure we can call commit | bank-netforce/netforce,anastue/netforce,anastue/netforce,anastue/netforce,anastue/netforce,anastue/netforce,bank-netforce/netforce,bank-netforce/netforce,bank-netforce/netforce,bank-netforce/netforce,anastue/netforce,bank-netforce/netforce | netforce_general/netforce_general/controllers/root.py | netforce_general/netforce_general/controllers/root.py | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | mit | Python |
21d7e6f83f34e66167d7452998f2c7622a90e46c | Create test_parser.py | zeffii/small_csv_onetouch_parser | test_parser.py | test_parser.py | import os
import csv
import json
import collections
from collections import defaultdict
filename = "C:/Users/zeffi/Documents/Export_482016.csv"
some_dict = defaultdict(list)
def sanedate(date):
MM, DD, YYYY = date.split('/')
return '/'.join([DD, MM, YYYY])
def formatted_time(gtime):
HH, MM, SS = gtime.sp... | mit | Python | |
fabf4e8bd93155101d459716b35c10b32a3dfd16 | add tests/utils.py | nirs/yappi,nirs/yappi | tests/utils.py | tests/utils.py | import sys
import yappi
import unittest
class YappiUnitTestCase(unittest.TestCase):
def setUp(self):
if yappi.is_running():
yappi.stop()
yappi.clear_stats()
yappi.set_clock_type('cpu') # reset to default clock type
def tearDown(self):
fstats = yappi.get_... | mit | Python | |
21a9ca4487d0d3ef9f2aa2ba5909b37c735c18e6 | Fix linter errors in test_tftrt.py | dongjoon-hyun/tensorflow,gunan/tensorflow,hfp/tensorflow-xsmm,ppwwyyxx/tensorflow,caisq/tensorflow,theflofly/tensorflow,dendisuhubdy/tensorflow,paolodedios/tensorflow,petewarden/tensorflow,Xeralux/tensorflow,ghchinoy/tensorflow,apark263/tensorflow,xzturn/tensorflow,zasdfgbnm/tensorflow,allenlavoie/tensorflow,gautam1858... | tensorflow/contrib/tensorrt/test/test_tftrt.py | tensorflow/contrib/tensorrt/test/test_tftrt.py | # Copyright 2018 The TensorFlow Authors. 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 applica... | # Copyright 2018 The TensorFlow Authors. 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 applica... | apache-2.0 | Python |
a333a5c15ffd2b775ad4d854c7accd32b898d2fb | Add encryptor_python3.py compatible with Python 3 | Caleydo/caleydo_security_flask,Caleydo/caleydo_security_flask,Caleydo/caleydo_security_flask | encryptor_python3.py | encryptor_python3.py | from __future__ import print_function
__author__ = 'Samuel Gratzl'
if __name__ == '__main__':
import uuid
import hashlib
password = input('enter password: ').encode('utf-8')
salt = uuid.uuid4().hex.encode('utf-8')
hashed_password = hashlib.sha512(password + salt).hexdigest()
print(password)
print(salt)... | bsd-3-clause | Python | |
5a634b9b837726a595a4450c8b1f46dd24b282a0 | Add generic Python context template | AgalmicVentures/Environment,AgalmicVentures/Environment,AgalmicVentures/Environment | scripts/Context.py | scripts/Context.py |
# Copyright (c) 2015-2019 Agalmic Ventures LLC (www.agalmicventures.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to u... | mit | Python | |
a7b25e343623f41b0466c8cea852ecc07ffab359 | Create marsLanderLevelTwo.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | Codingame/Python/Medium/marsLanderLevelTwo.py | Codingame/Python/Medium/marsLanderLevelTwo.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
surface_n = int(input()) # the number of points used to draw the surface of Mars.
surface = []
for i in range(surface_n):
# land_x: X coordinate of a surface point. (0 to 6999)
... | mit | Python | |
ac2f517f15816277dd808ac473c4581212b8e841 | add migration for meta | WebArchivCZ/Seeder,WebArchivCZ/Seeder,WebArchivCZ/Seeder,WebArchivCZ/Seeder,WebArchivCZ/Seeder | Seeder/www/migrations/0004_auto_20170223_1457.py | Seeder/www/migrations/0004_auto_20170223_1457.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-23 14:57
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('www', '0003_auto_20170216_2204'),
]
operations = [
migrations.AlterModelOptions(
... | mit | Python | |
0a8af4a4f5e9fa711e9e4b1b14cc639d5ff166a0 | Create beta_dog_recommendation_system.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/beta/beta_dog_recommendation_system.py | Solutions/beta/beta_dog_recommendation_system.py | from itertools import takewhile
def find_similar_dogs(breed):
compare = dogs[breed]
scores = sorted((
[
dog,
sum(1 if q in compare else 0 for q in dogs[dog])
]
for dog in dogs if dog != breed
), key = lambda x: x[1], reverse... | mit | Python | |
8a293ddc633730a6c2323392b1ac9083e5a45ad4 | Create lora_test_recv.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/test/lora_test_recv.py | device/src/test/lora_test_recv.py | # lora_test_recv.py
#Communication module: LoRa.
#Communication method with gateway via LoRa.
#Uart port drive LoRa module.
#Parse JSON between device and gateway via LoRa channel.
#LoRa module: E32-TTL-100
#Pin specification:
#Module MCU
#M0(IN) <--> GPIO(X3)(OUT) #mode setting, can not hang
#M1(IN) ... | mit | Python | |
d19a36fda0bfc9d221d65bde1612ff6181fca66d | add proposed setup.py file | shimpe/pyvectortween,shimpe/pyvectortween | setup.py | setup.py | from distutils.core import setup
setup(
name='vectortween',
version='0.0.1',
packages=['vectortween'],
url='',
license='MIT',
author='stefaan himpe',
author_email='stefaan.himpe@gmail.com',
description='some tweening for use with libraries like gizeh and moviepy'
)
| mit | Python | |
f96686735db03abdc2470c27ff8d7a04643c7727 | Add Exercise 9.8. | skidzo/pydy,skidzo/pydy,Shekharrajak/pydy,jcrist/pydy,jcrist/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,Shekharrajak/pydy,oliverlee/pydy,skidzo/pydy,oliverlee/pydy,jcrist/pydy,jcrist/pydy,skidzo/pydy,jcrist/pydy,Shekharrajak/pydy,oliverlee/pydy | Kane1985/Chapter5/Ex9.8.py | Kane1985/Chapter5/Ex9.8.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 9.8 from Kane 1985."""
from __future__ import division
from sympy import simplify, solve, symbols, Matrix
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import inertia, RigidBody
from sympy.physics.mechanics import cross,... | bsd-3-clause | Python | |
a57d39e7f63e6c034644a158aabb5ff6e6f04ae9 | add response test to testing module | karec/oct,TheGhouls/oct,TheGhouls/oct,karec/oct,TheGhouls/oct | oct/testing/response.py | oct/testing/response.py | # This file is fit for containing basic response status check
# All functions have to take a response object in param
def check_response_status(resp, status):
"""
This will check is the response_code is equal to the status
:param resp: a response object
:param status: the expected status
:type st... | mit | Python | |
2f1b12a6f173c01f9631d0ad5a4d3c3f411983cb | add file notification platform | maddox/home-assistant,kennedyshead/home-assistant,jawilson/home-assistant,vitorespindola/home-assistant,tchellomello/home-assistant,pschmitt/home-assistant,kennedyshead/home-assistant,shaftoe/home-assistant,theolind/home-assistant,tmm1/home-assistant,DavidLP/home-assistant,shaftoe/home-assistant,Duoxilian/home-assistan... | homeassistant/components/notify/file.py | homeassistant/components/notify/file.py | """
homeassistant.components.notify.file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File notification service.
Configuration:
To use the File notifier you will need to add something like the following
to your config/configuration.yaml
notify:
platform: file
path: PATH_TO_FILE
filename: FILENAME
timestamp: 1 or 0
... | apache-2.0 | Python | |
a9893fc562c9131fdaebaa842f587f415b7fdfda | Add second test. | fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python | oommfmif/test_basics.py | oommfmif/test_basics.py | import oommfmif as o
def test_get_oommf_version_return_type():
assert isinstance(o.get_version(), str)
def test_get_oommf_version():
assert o.get_version()[0:4] == "1.2."
| import oommfmif as o
def test_get_oommf_version():
assert isinstance(o.get_version(), str)
| bsd-2-clause | Python |
99389c1f863592c8c56c8dca415155536abbd0fd | Create new.py | wulidexixilian/iotprototype,wulidexixilian/iotprototype | simple_mqtt/new.py | simple_mqtt/new.py | mit | Python | ||
0ec30eb8bcf0e7688182f827bea24fd0ceb33501 | add models | fwilson42/dchacks2015,fwilson42/dchacks2015,fwilson42/dchacks2015 | models.py | models.py | from peewee import *
from config import db
class BaseModel(Model):
class Meta:
database = db
class HistoricalTrainPosition(BaseModel):
cars = IntegerField()
line_code = CharField()
next_station = CharField()
dest_station = CharField()
time = IntegerField()
timestamp = DateTimeField... | mit | Python | |
5c02d902753327b3413e994d6edc089b8ca72749 | Add create_flipper step | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/workflow/steps/create_flipper.py | dbaas/workflow/steps/create_flipper.py | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from dbaas_flipper.provider import FlipperProvider
LOG = logging.getLogger(__name__)
class CreateFlipper(BaseStep):
def __unicode__(self):
return "Creating Flipper"
def do(self, workflow_dict):
try:
if workflow_di... | bsd-3-clause | Python | |
cf99929c923cb31782a192f108c735bfcc9cde2f | Add render module, this will be the interface to manage rendering state files into high state data | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/render.py | salt/render.py | '''
Render is a module used to parse the render files into high salt state data
structures.
The render system uses render modules which are plugable interfaces under the
render directory.
'''
# Import salt modules
import salt.loader
class Render(object):
'''
Render state files.
'''
def __init__(self, ... | apache-2.0 | Python | |
773efcb6aec427034263d550c600da0654031fa4 | Add simpleTestCondition.py script to test condition notification framework w/o using full Django unit test infrastucture | xgds/xgds_basalt,xgds/xgds_basalt,xgds/xgds_basalt,xgds/xgds_basalt | apps/basaltApp/scripts/simpleTestCondition.py | apps/basaltApp/scripts/simpleTestCondition.py | #! /usr/bin/env python
#__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this fi... | apache-2.0 | Python | |
c735935c983cc7ccd72b2c71733e6f785a8a3ae3 | Create urls.py | IEEEDTU/CMS | Assessment/urls.py | Assessment/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^getAssignmentByCode', views.getAssignmentByCode, name='getAssignmentByCode'),
url(r'^retrieveAssignments', views.retrieveAssignments, name='retrieveAssignments'),
]
| mit | Python | |
1bfbd397e3b3c805aa29f407915e1d10ca7eb179 | Create rbgLib.py | RoryCrispin/Rpi-RGB-LED-Library | rbgLib.py | rbgLib.py | from __future__ import division
import time
import RPi.GPIO as GPIO
# noinspection PyPep8Naming
class rgbColour(object):
red = 0
green = 0
blue = 0
def __init__(self, red, green, blue):
self.red = red
self.green = green
self.blue = blue
def hexToColour(r,g,b):
hex_constan... | mit | Python | |
83d4ac6c3565044727c9b3fcbada9966d529a80e | Add forgotten font leader lib | Nadeflore/dakara-player-vlc | lib/font_loader.py | lib/font_loader.py | import os
import sys
import logging
FONT_FILE_NAME_LIST = (
"fontawesome-webfont.ttf",
)
FONT_DIRECTORY = "share"
FONT_DIRECTORY_SYSTEM = "/usr/share/fonts"
FONT_DIRECTORY_USER = os.path.join(os.environ['HOME'], ".local/share/fonts")
class FontLoader:
def __init__(self):
self.fonts_loaded... | mit | Python | |
d8f7cb58e7f760ccbb839aafeda4dbf7204d7d82 | Add r_latestagecapitalism | Fillll/reddit2telegram,Fillll/reddit2telegram | channels/r_latestagecapitalism/app.py | channels/r_latestagecapitalism/app.py | #encoding:utf-8
subreddit = 'latestagecapitalism'
t_channel = '@r_latestagecapitalism'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| mit | Python | |
151e8fc71e5ef2e31db13730bff57bc8fd915c30 | Add test case for list invoice | andela-sjames/paystack-python | paystackapi/tests/test_invoice.py | paystackapi/tests/test_invoice.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.invoice import Invoice
class TestInvoice(BaseTestCase):
@httpretty.activate
def test_create_invoice(self):
"""Method defined to test create Invoice."""
httpretty.register_uri(
httpretty.PO... | mit | Python | |
dcd1d962feec4f3cd914677545f74924ad9e6351 | Add test for file creation of low level library | mindriot101/fitsio-cffi | testing/test_direct_wrapper.py | testing/test_direct_wrapper.py | import os
from cffitsio._cfitsio import ffi, lib
def test_create_file(tmpdir):
filename = str(tmpdir.join('test.fits'))
f = ffi.new('fitsfile **')
status = ffi.new('int *')
lib.fits_create_file(f, filename, status)
assert status[0] == 0
assert os.path.isfile(filename)
| mit | Python | |
2ccd94f9fb6f4a64976124ca82ac4c5ef585d64b | add serializer field | silverlogic/dj-bitcoin | djbitcoin/serializers.py | djbitcoin/serializers.py | from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from .utils import is_bitcoin_address_valid
class BitcoinAddressField(serializers.CharField):
default_error_messages = {
'invalid': _('Invalid bitcoin address.')
}
def to_internal_value(self, data):
... | mit | Python | |
dddc76173a5150939535b2c506aa967fe17ee000 | Fix #12 : env implementation | oleiade/Elevator | elevator/env.py | elevator/env.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from ConfigParser import ConfigParser
from utils.patterns import Singleton
from utils.decorators import lru_cache
from utils.snippets import items_to_dict
class Environment(object):
"""
Unix shells like environment class. Implements add,
get, load, flush met... | mit | Python | |
01b42c531f7ab0ca81768b6e9833062f9e31ba95 | Update train_tagger script | banglakit/spaCy,raphael0202/spaCy,raphael0202/spaCy,spacy-io/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,Gregory-Howard/spaCy,Gregory-Howard/spaCy,raphael0202/spaCy,aikramer2/spaCy,banglakit/spaCy,spacy-io/spaCy,recognai/spaCy,explosion/spaCy,raphael0202/spaCy,explosion/spaCy,spacy-io/spaCy,Gregory-Howard/spaCy... | examples/training/train_tagger.py | examples/training/train_tagger.py | """A quick example for training a part-of-speech tagger, without worrying
about the tokenization, or other language-specific customizations."""
from __future__ import unicode_literals
from __future__ import print_function
import plac
from pathlib import Path
from spacy.vocab import Vocab
from spacy.tagger import Tag... | mit | Python | |
8fc4fdc96c07432f87b49676b4ba9ca92a0f3385 | Add tool.parser module | liorvh/grab,giserh/grab,DDShadoww/grab,SpaceAppsXploration/grab,istinspring/grab,huiyi1990/grab,subeax/grab,pombredanne/grab-1,kevinlondon/grab,liorvh/grab,codevlabs/grab,alihalabyah/grab,huiyi1990/grab,giserh/grab,subeax/grab,lorien/grab,DDShadoww/grab,raybuhr/grab,raybuhr/grab,maurobaraldi/grab,lorien/grab,SpaceAppsX... | grab/tools/parser.py | grab/tools/parser.py | def parse_int(val):
if val is None:
return None
else:
return int(val)
| mit | Python | |
e426afbe9ccbc72a1aa0d00032144e8b9b2b8cdc | Implement utility for colored, tabular output using fabric's color controls. | locationlabs/gusset | gusset/colortable.py | gusset/colortable.py | """
Pretty table generation.
"""
from itertools import cycle
from string import capwords
from fabric.colors import red, green, blue, magenta, white, yellow
class ColorRow(dict):
"""
Ordered collection of column values.
"""
def __init__(self, table, **kwargs):
super(ColorRow, self).__init__(sel... | apache-2.0 | Python | |
af61c9a44871b1da8a939470492c18a45ab373e1 | Create lineValueDisp.py | task123/AutoTT,task123/AutoTT,task123/AutoTT | lineValueDisp.py | lineValueDisp.py |
import TCP
import Motor
import Steering
import Status
import time
import Cameras
import Lights
import Modes
import os
try:
trip_meter = Motor.TripMeter()
motors = Motor.Motor(trip_meter)
follow_line = Steering.FollowLine(motors, start_speed = 0)
while True:
time.sleep(10)
except:
motors.turn_off()
fo... | mit | Python | |
3660c183ba1ddec8033ceae21b1b06fd0ab9a8b7 | Add Signal class | sonusz/PhasorToolBox | phasortoolbox/signal.py | phasortoolbox/signal.py | class Signal(object):
run = False | mit | Python | |
913bb348938c2b54ab7a76c7e16ce9b3fb999dbe | Copy fail. | DMOJ/site,Phoenix1369/site,DMOJ/site,monouno/site,monouno/site,Phoenix1369/site,Minkov/site,Phoenix1369/site,Phoenix1369/site,DMOJ/site,monouno/site,monouno/site,monouno/site,Minkov/site,Minkov/site,Minkov/site,DMOJ/site | judge/management/commands/render_pdf.py | judge/management/commands/render_pdf.py | import os
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.template import Context
from django.template.loader import get_template
from django.utils import translation
from judge.models import Problem, ProblemTranslation
from judge.pdf_problems import WebKitP... | import os
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.template import Context
from django.template.loader import get_template
from django.utils import translation
from judge.models import Problem, ProblemTranslation
from judge.pdf_problems import WebKitP... | agpl-3.0 | Python |
b31e15d12dbff8eaab71ec523ec16d5f1afe908b | add sharpen pic tool | congminghaoxue/learn_python | sharpen_pic.py | sharpen_pic.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#function: 锐化图像
import os
import os.path
import sys, getopt, argparse
from PIL import Image, ImageEnhance
def sharpenPic(filein,fileout):
im02 =Image.open(filein)
im_30 =ImageEnhance.Sharpness (im02).enhance(2.0)
im_30.save(fileout)
def main():
argc = len(sys.arg... | apache-2.0 | Python | |
ca53fcbba66dd4999f68f3523367c20a6b5e1e47 | Create script.py | McKay1717/Matrix-polygon-modification | script.py | script.py | import math
def getMatrix():
L = [None] * 3
for j in range(3):
print "Ligne "+str(j)+ "\n"
L[j] = [None] * 3
for i in range(3):
L[j][i] = input("Terme "+str(i)+"\n")
return L
def getPoint():
L = [None] * 3
for j in range(2):
L[j] = input("Terme "+str(j)+"\n")
L[2] = 1
return L
def PrintPoint(L):
s ... | apache-2.0 | Python | |
98e086696ea36d6050de9f23d2380b704fee305d | Create chatbot3.py | wannaphongcom/code-python3-blog | ai/chatbot3.py | ai/chatbot3.py | # ทำ Chat Bot ง่าย ๆ ในภาษา Python
# เขียนโดย นาย วรรณพงษ์ ภัททิยไพบูลย์
# https://python3.wannaphong.com/2015/07/ทำ-chat-bot-ง่าย-ๆ-ในภาษา-python.html
from tinydb import TinyDB, where # เรียกใช้งานโมดูล tinydb
import random
db = TinyDB('db.json') # เรียกใช้ฐานข้อมูลจากไฟล์ db.json
def addword():
print("ไม่พบประโยคนี... | mit | Python | |
0882c8885b88618ea55b97ace256cdf833a1547d | Add tests for pylama isort | PyCQA/isort,PyCQA/isort | tests/test_pylama_isort.py | tests/test_pylama_isort.py | import os
from isort.pylama_isort import Linter
class TestLinter:
instance = Linter()
def test_allow(self):
assert not self.instance.allow("test_case.pyc")
assert not self.instance.allow("test_case.c")
assert self.instance.allow("test_case.py")
def test_run(self, src_dir, tmpdir... | mit | Python | |
8a7ea0e8d29d443676c8893790625cbeb9d973ad | Test addByUniqueID Survey model | uzh/msregistry | tests/test_survey_model.py | tests/test_survey_model.py | # Copyright (C) 2016 University of Zurich. All rights reserved.
#
# This file is part of MSRegistry Backend.
#
# MSRegistry Backend is free software: you can redistribute it and/or
# modify it under the terms of the version 3 of the GNU Affero General
# Public License as published by the Free Software Foundation, or a... | agpl-3.0 | Python | |
280e72331d99a8c49783196951287627a933a659 | Add py solution for 459. Repeated Substring Pattern | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/repeated-substring-pattern.py | py/repeated-substring-pattern.py | class Solution(object):
def repeatedSubstringPattern(self, s):
"""
:type s: str
:rtype: bool
"""
for i in xrange(1, len(s) / 2 + 1):
if len(s) % i == 0 and len(set(s[j:j+i] for j in xrange(0, len(s), i))) == 1:
return True
return False
| apache-2.0 | Python | |
75dc32ef71fd32c7728269b01a74faf840690473 | Add a slow bot to test timeout feature | Dentosal/python-sc2 | examples/too_slow_bot.py | examples/too_slow_bot.py | import random
import asyncio
import sc2
from sc2 import Race, Difficulty
from sc2.constants import *
from sc2.player import Bot, Computer
from proxy_rax import ProxyRaxBot
class SlowBot(ProxyRaxBot):
async def on_step(self, state, iteration):
await asyncio.sleep(random.random())
await super().on_... | mit | Python | |
7c865c63d5debcf7463ad1b81470d2f044ec4738 | Add lab result models | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/patients/lab_results/models.py | radar/patients/lab_results/models.py | from sqlalchemy import Column, Integer, String, ForeignKey, Numeric, Date, Boolean
from sqlalchemy.orm import relationship
from radar.database import db
from radar.models import PatientMixin, UnitMixin, CreatedModifiedMixin, DataSource
class LabOrderDefinition(db.Model):
__tablename__ = 'lab_order_definitions'
... | agpl-3.0 | Python | |
36d8a0e091ec1dd4ff451031810c75cd0431ac44 | add admins.py file | skitoo/aligot,aligot-project/aligot,aligot-project/aligot,aligot-project/aligot | aligot/admin.py | aligot/admin.py | # coding: utf-8
from django.contrib import admin
from .models import Note, NoteBook, NoteRevision, User
admin.site.register(User)
admin.site.register(NoteBook)
admin.site.register(Note)
admin.site.register(NoteRevision)
| mit | Python | |
4e4b23ebae9274511fa3fad438b198c19b38c98d | Add a breakpad / content_shell integration test | littlstar/chromium.src,M4sse/chromium.src,krieger-od/nwjs_chromium.src,M4sse/chromium.src,axinging/chromium-crosswalk,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,axinging/chromium-crosswalk,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium... | content/shell/tools/breakpad_integration_test.py | content/shell/tools/breakpad_integration_test.py | #!/usr/bin/env python
#
# Copyright 2014 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.
"""Integration test for breakpad in content shell.
This test checks that content shell and breakpad are correctly hooked up, as
well... | bsd-3-clause | Python | |
f85a5954d337eca9b577664b1ba04e580fdf9b5c | Add slice01.py | devlights/try-python | trypython/basic/slice01.py | trypython/basic/slice01.py | # coding: utf-8
"""
slice 関数についてのサンプルです。
"""
import itertools
from trypython.common.commoncls import SampleBase
class Sample(SampleBase):
def exec(self):
#############################################################
# slice 関数
# - https://docs.python.jp/3/library/functions.html#slice
... | mit | Python | |
cf93f84dd794b63dd373cf59d802000799e32232 | Create main.py | subpath/TelegramBot | example/main.py | example/main.py | mit | Python | ||
4efc45499d1736933691b9de39090b86526ea4e1 | Create 217_contain_duplicates.py | jsingh41/algos | 217_contain_duplicates.py | 217_contain_duplicates.py | """
https://leetcode.com/problems/contains-duplicate/description/
Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least twice in the array, and it should return false if every element
is distinct.
"""
class Solution(object):
def conta... | mit | Python | |
7ab2298f22de79cd14fae9f3add1417a76bcbcd0 | Add package file. | lucasb/iris-machine-learning | app/__init__.py | app/__init__.py | #!/usr/bin/env python
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__all__ = [
'data_visualization',
'knn_prediction',
'load_dataset',
'model_visualization',
'select_model',
'svm_prediction',
'validate_dataset',
]
| mit | Python | |
f622255dc2c6695b785213c8d69cb57ae5d8a5e9 | Add pebble sdk version for detecting sdk features | jiangege/pebblejs-project,youtux/PebbleShows,bkbilly/Tvheadend-EPG,bkbilly/Tvheadend-EPG,pebble/pebblejs,fletchto99/pebblejs,sunshineyyy/CatchOneBus,fletchto99/pebblejs,pebble/pebblejs,carlo-colombo/dublin-bus-pebble,youtux/PebbleShows,jsfi/pebblejs,daduke/LMSController,jiangege/pebblejs-project,sunshineyyy/CatchOneBus... | waftools/pebble_sdk_version.py | waftools/pebble_sdk_version.py | from waflib.Configure import conf
@conf
def compare_sdk_version(ctx, platform, version):
target_env = ctx.all_envs[platform] if platform in ctx.all_envs else ctx.env
target_version = (int(target_env.SDK_VERSION_MAJOR or 0x5) * 0xff +
int(target_env.SDK_VERSION_MINOR or 0x19))
other_v... | mit | Python | |
79fdfaceee84321bb802f9f99ee500f400f38780 | Add admin to credentials | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/integrations/credentials/admin/__init__.py | dbaas/integrations/credentials/admin/__init__.py | # -*- coding:utf-8 -*-
from django.contrib import admin
from .. import models
admin.site.register(models.IntegrationType, )
admin.site.register(models.IntegrationCredential, )
| bsd-3-clause | Python | |
acf0ab67db2856c71440093d0b686650e70e58e1 | Create network_class.py | joelrieger/SmithChartPy | network_class.py | network_class.py | """
Author: Joel Rieger
October 29, 2016
Description: Classes and functions to perform basic network abstraction and plotting.
"""
from numpy import pi as pi
class network(object):
"""Class for one dimension network (i.e. a matching network)."""
element_array=[]
def __init__(self,*args):
pass
... | mit | Python | |
58627bd4cbe100a7cbd526be38cd69e8605984cd | Add json-encoder example | nullism/pycnic,nullism/pycnic | examples/json-encoder.py | examples/json-encoder.py | #!/usr/bin/env python3
from pycnic.core import WSGI, Handler
import datetime
import json
class DateTimeEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime.datetime):
return o.isoformat()
return json.JSONEncoder.default(self, o)
class Hello(Handler):
def get... | mit | Python | |
ebfe2faa5fcf66f3f1ece597922d4a72b59c3e43 | Create B_Averages_ocean.py | Herpinemmanuel/Oceanography | Cas_1/B_Averages_ocean.py | Cas_1/B_Averages_ocean.py | #Averages of U,V,W,T,S and ETA
import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
dir0 = '/homedata/bderembl/runmit/test_southatlgyre' #Case 1 : 38 iterations
ds0 = open_mdsdataset(dir0,prefix=['Eta','U','V','W','T','S'])
pr... | mit | Python | |
9afe19676cbb87985939bd0099301a7003a38b7f | check for monitoring file and directory count | site24x7/plugins,site24x7/plugins,site24x7/plugins | samples/folder_check.py | samples/folder_check.py | #!/usr/bin/env python
import json,os,time
PLUGIN_VERSION="1"
HEARTBEAT="true"
#set this value to 1 if the file count needs to be recursive
INCLUDE_RECURSIVE_FILES=None
FOLDER_NAME="/"
THRESHOLD_COUNT=10
def get_data():
folder_checks_data = {}
folder_checks_data['plugin_version'] = PLUGIN_VERSION
fold... | bsd-2-clause | Python | |
d881ee2866bb422a266871c1b426d76c669025da | Test for CASSANDRA-8741 | iamaleksey/cassandra-dtest,snazy/cassandra-dtest,carlyeks/cassandra-dtest,beobal/cassandra-dtest,thobbs/cassandra-dtest,krummas/cassandra-dtest,bdeggleston/cassandra-dtest,mambocab/cassandra-dtest,iamaleksey/cassandra-dtest,aweisberg/cassandra-dtest,beobal/cassandra-dtest,stef1927/cassandra-dtest,snazy/cassandra-dtest,... | nodetool_test.py | nodetool_test.py | from ccmlib.node import NodetoolError
from dtest import Tester
from tools import require
class TestNodetool(Tester):
@require("8741")
def test_decommission_after_drain_is_invalid(self):
"""
@jira_ticket CASSANDRA-8741
Running a decommission after a drain should generate
an un... | apache-2.0 | Python | |
72cbdd0c1cf804eecb8f503f86e6be237719bf99 | add echo client for testing | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | network/echo-server/echo-client/main.py | network/echo-server/echo-client/main.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright... | bsd-2-clause | Python | |
be96a2f7e3aeb59727ba88913cc6fda97bf8a423 | Add some unit tests | SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree | InvenTree/company/test_views.py | InvenTree/company/test_views.py | """ Unit tests for Company views (see views.py) """
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from .models import SupplierPart
class CompanyViewTest(TestCase):
fixtures = [
... | mit | Python | |
725832be85b7b0455cb735ce8a054007209d9645 | test scan scraper | BilalDev/HolyScrap | src/hsimage.py | src/hsimage.py | import sys
from PIL import Image
img = Image.open(sys.argv[1])
width, height = img.size
xblock = 5
yblock = 5
w_width = width / xblock
w_height = height / yblock
blockmap = [(xb*w_width, yb*w_height, (xb+1)*w_width, (yb+1)*w_height)
for xb in xrange(xblock) for yb in xrange(yblock)]
newblockmap = list(bloc... | apache-2.0 | Python | |
dede46a2d5ad1504991b05b8edab4d1ffd781f46 | fix out of range error in tracker remover plugin | jcherqui/searx,jcherqui/searx,dalf/searx,asciimoo/searx,jcherqui/searx,dalf/searx,asciimoo/searx,asciimoo/searx,jcherqui/searx,asciimoo/searx,dalf/searx,dalf/searx | searx/plugins/tracker_url_remover.py | searx/plugins/tracker_url_remover.py | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | agpl-3.0 | Python |
a6fb8c86e14722527ff004ca1378458df252f8c0 | add doxygen module | dozymoe/fireh_runner | modules/doxygen.py | modules/doxygen.py | """Doxygen module.
Create project's documentation.
Website: http://www.doxygen.org
"""
import os
import shlex
def doxygen(loader, variant=None, *args):
if len(args) == 1:
args = shlex.split(args[0])
if variant is None:
variant = os.environ.get('PROJECT_VARIANT',
loader.config... | mit | Python | |
7a74f85fc76af2df62bb92ff2997ab1b84caa3a0 | Test dummy IRC bot | homeworkprod/syslog2irc | tests/test_irc_bot_dummy.py | tests/test_irc_bot_dummy.py | """
:Copyright: 2007-2021 Jochen Kupperschmidt
:License: MIT, see LICENSE for details.
"""
import pytest
from syslog2irc.irc import create_bot, IrcChannel, IrcConfig
from syslog2irc.signals import irc_channel_joined
@pytest.fixture
def config():
channels = {IrcChannel('#one'), IrcChannel('#two')}
return Ir... | mit | Python | |
3be6fadffbce4cdf5d45f4b34035b55db6abe2fc | add script for creating otu-tree table | kcranston/ottreeindex,OpenTreeOfLife/otindex,OpenTreeOfLife/ottreeindex,OpenTreeOfLife/ottreeindex,OpenTreeOfLife/otindex | ottreeindex/scripts/create_otu_table.py | ottreeindex/scripts/create_otu_table.py | # Collects the OTU - tree relationships across phylesystem
# Prints to file which is then inserted into postgres with COPY
# This is much faster than many inserts
from peyotl.api.phylesystem_api import PhylesystemAPI
from peyotl.phylesystem.phylesystem_umbrella import Phylesystem
from peyotl import gen_otu_dict, iter_... | bsd-2-clause | Python | |
a8ec11719ccc158fd457ed02f2b8459d1b452975 | Create tweets.py | lvmb/Dissent.in | tweets.py | tweets.py | import sqlite3
def main(cursor):
cursor.execute("select * from tweets")
for tweet in cursor.fetchall():
tid = tweet[0]
tdate = tweet[1]
text = tweet[2]
geo = tweet[3]
t = str(tdate + text + geo)
print '-----tweet: %s ' % text
print '------date: %... | unlicense | Python | |
0fa30986e1f97331f96444e0b3b0f86cbe20c68a | Add tests for JsonBackend __init__ and commit methods | jeffkinnison/shadho,jeffkinnison/shadho | shadho/backend/json/tests/test_db.py | shadho/backend/json/tests/test_db.py | import pytest
from shadho.backend.base.tests.test_db import TestBaseBackend
from shadho.backend.json.db import JsonBackend
import json
import os
import shutil
class TestJsonBackend(object):
def test_init(self):
"""Ensure that initialization sets up the db and filepath."""
# Test default initial... | mit | Python | |
871f79a0b2bd235df457e3a1dc502d5c18bd934a | Add some generic python utilities as a basis for scripts | Oletus/gameutils.js,Oletus/gameutils.js | tools/build/common_utils.py | tools/build/common_utils.py | from __future__ import print_function
import os
def game_root_path():
file_path = os.path.dirname(os.path.abspath(__file__))
return os.path.abspath(os.path.join(file_path, '..', '..'))
def files_with_type(root, type):
all_files = [os.path.join(root, filename) for filename in os.listdir(root)]
typed_f... | mit | Python | |
7d22c38348ccd411871942ef0dd43ed57794de16 | include benchmark code | bndl/cyheapq | bench.py | bench.py | from statistics import mean
import heapq
import importlib
import time
import numpy as np
r = np.random.random(1000*1000)
mergers = {
'heapq': ('merge', 'nlargest', 'nsmallest'),
'cyheapq': ('merge', 'nlargest', 'nsmallest'),
'cytoolz': ('merge_sorted', 'topk', None),
}
mods = list(mergers.keys())
name... | apache-2.0 | Python | |
5b2aebb9b9f9fafe291f0890f03c44abd661ca68 | add celery_work | 8cbx/OnlineJudge_Web,8cbx/OnlineJudge_Web,8cbx/OnlineJudge_Web,8cbx/OnlineJudge_Web | celery_work.py | celery_work.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from celery import Celery, platforms
from app import create_app
def make_celery(app):
"""Create the celery process."""
# Init the celery object via app's configuration.
celery = Celery(
app.import_name,
backend=app.config['CELERY_RE... | agpl-3.0 | Python | |
9c53e59ee0c4e5418b54d47c932454b7b907dc03 | Revert escape nickname, desc, etc in user profile | madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,miurahr/seahub,cloudcopy/seahub,Chilledheart/seahub,miurahr/seahub,madflow/seahub,madflow/seahub,madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub | seahub/profile/forms.py | seahub/profile/forms.py | # encoding: utf-8
from django import forms
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, username):
nickname = self.cleaned_... | # encoding: utf-8
from django import forms
from django.utils.html import escape
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, userna... | apache-2.0 | Python |
b23ec502b89ab70b9e8edd1868f4e9717392b7b2 | Add missing migrations | pinax/django-user-accounts,pinax/django-user-accounts,GeoNode/geonode-user-accounts,GeoNode/geonode-user-accounts | account/migrations/0004_auto_20170416_1821.py | account/migrations/0004_auto_20170416_1821.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-16 18:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0003_passwordexpiry_passwordhistory'),
]
operations = [
migrations.AlterMo... | mit | Python | |
9a691ae746c5b501ed37792383600da1ba381b20 | Add exitcode.py | pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus | bin/exitcode.py | bin/exitcode.py | #!/usr/bin/env python
#
# Copyright 2010 University Of Southern California
#
# 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 b... | apache-2.0 | Python | |
ae94990bc8b790b5307ccaee992f09fefc045692 | add Tester lockedNormal | sol-ansano-kim/medic,sol-ansano-kim/medic,sol-ansano-kim/medic | python/medic/plugins/Tester/lockedNormal.py | python/medic/plugins/Tester/lockedNormal.py | from medic.core import testerBase
from maya import OpenMaya
class LockedNormal(testerBase.TesterBase):
Name = "LockedNormal"
Description = "vertex(s) which has locked normal"
Fixable = True
def __init__(self):
super(LockedNormal, self).__init__()
def Match(self, node):
return nod... | mit | Python | |
088ec16cf33d4be4b396976d9e9ab1a5f17045fc | make contrib an app | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | adhocracy4/contrib/apps.py | adhocracy4/contrib/apps.py | from django.apps import AppConfig
class OrganisationsConfig(AppConfig):
name = 'adhocracy4.contrib'
label = 'a4contrib'
| agpl-3.0 | Python | |
e020f81593268899a04cce726823c512b8b54762 | copy over the PlotContainerEditor to the more appropriately named and located ComponentEditor. | tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable | enthought/enable2/component_editor.py | enthought/enable2/component_editor.py | """ Defines a Traits editor for displaying an Enable component.
"""
#-------------------------------------------------------------------------------
# Written by: David C. Morrill
# Date: 01/26/2007
# (c) Copyright 2007 by Enthought, Inc.
#-----------------------------------------------------------------------... | bsd-3-clause | Python | |
06164dbeb1ec113b24ca25a41e624793d878875f | implement a transferrable voting algorithm | julzhk/codekata | instant_runoff_voting.py | instant_runoff_voting.py | from collections import defaultdict, Counter
def runoff(voters):
"""
a function that calculates an election winner from a list of voter selections using an
Instant Runoff Voting algorithm. https://en.wikipedia.org/wiki/Instant-runoff_voting
Each voter selects several candidates in order of preference.
... | mit | Python | |
5d6ef1cf969bac9fb53db0224eebdeb4a1bb6ff0 | Update app/exceptions/__init__.py | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | app/exceptions/__init__.py | app/exceptions/__init__.py |
class BadConfigurationError(Exception):
pass
class ClientUnavailableError(Exception):
pass
class ClusterNotConfiguredError(Exception):
pass
| mit | Python | |
0efb59e8d1bef5a1d8e5e3eb7ffddf09f5b8943a | Add tests to LoadCommand | datasciencebr/jarbas,datasciencebr/jarbas,datasciencebr/jarbas,datasciencebr/serenata-de-amor,Guilhermeslucas/jarbas,Guilhermeslucas/jarbas,marcusrehm/serenata-de-amor,marcusrehm/serenata-de-amor,rogeriochaves/jarbas,marcusrehm/serenata-de-amor,Guilhermeslucas/jarbas,datasciencebr/jarbas,marcusrehm/serenata-de-amor,dat... | jarbas/core/tests/test_load_command.py | jarbas/core/tests/test_load_command.py | from unittest.mock import Mock, patch
from django.test import TestCase
from jarbas.core.management.commands import LoadCommand
from jarbas.core.models import Activity
from jarbas.core.tests import sample_activity_data
class TestStaticMethods(TestCase):
def setUp(self):
self.cmd = LoadCommand()
def ... | mit | Python | |
8affeda715b1facf12de1dab1d445bbe54616306 | Fix JSON serialisation problem with AJAX basket | jmt4/django-oscar,jmt4/django-oscar,dongguangming/django-oscar,lijoantony/django-oscar,kapt/django-oscar,okfish/django-oscar,vovanbo/django-oscar,bnprk/django-oscar,Bogh/django-oscar,sasha0/django-oscar,ahmetdaglarbas/e-commerce,solarissmoke/django-oscar,bnprk/django-oscar,spartonia/django-oscar,WillisXChen/django-osca... | oscar/core/ajax.py | oscar/core/ajax.py | import six
from django.contrib import messages
from six.moves import map
class FlashMessages(object):
"""
Intermediate container for flash messages.
This is useful as, at the time of creating the message, we don't know
whether the response is an AJAX response or not.
"""
def __init__(self):
... | import six
from django.contrib import messages
from six.moves import map
class FlashMessages(object):
"""
Intermediate container for flash messages.
This is useful as, at the time of creating the message, we don't know
whether the response is an AJAX response or not.
"""
def __init__(self):
... | bsd-3-clause | Python |
63d22058d15a11fad7232683630976d472997c33 | Add planetary time recipe | flatangle/flatlib | recipes/planetarytime.py | recipes/planetarytime.py | """
Author: João Ventura <flatangleweb@gmail.com>
This recipe shows sample code for handling
planetary times.
"""
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.tools import planetarytime
# Build a date and location
date = Datetime('2015/03/13', '17:00', ... | mit | Python | |
92c8afbb5131374611fb21b4da0b0af1a2f37a45 | add dummy test | pyannote/pyannote-database | tests/dummy.py | tests/dummy.py | import pytest
from pyannote.database import get_databases
def test_dummy():
assert isinstance(get_databases(), list)
| mit | Python | |
0c8b7fa865df535f5baa33025c184bbf4234b7b1 | Create script to transform shapefile into csv distance matrix | tayden-hakai/Island_MST | shp_to_csv_distances.py | shp_to_csv_distances.py | """Create a csv matrix of distances between shapefile geometry objects.
Requirements: fiona, shapely
Written by: Taylor Denouden
Date: November 25, 2015
"""
import random
import fiona
from shapely.geometry import shape
from scripts.printer import print_progress
def main():
"""Main script execution."""
outf... | mit | Python | |
9a4dd1c0c51cf2732b50d5594b2a4bf661b8262f | Add geoip_lookup.py | aaaaalbert/repy-doodles | geoip_lookup.py | geoip_lookup.py | import sys
if len(sys.argv) < 2:
print """geoip_lookup.py ---
"resolve" IP addresses to approximate geo-information
Usage:
python geoip_lookup.py IP [ GEOIP_SERVER ]
where IP is the address to resolve, and
GEOIP_SERVER is an optional GeoIP server to contact.
(The Seattle network testbed provides two GeoIP ser... | unlicense | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.