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 |
|---|---|---|---|---|---|---|---|---|
b22cfb4c6b8c0c0c3751078b720313d0e2baff1d | Test API call | SaishRedkar/FilmyBot | src/filmyBot.py | src/filmyBot.py | import time,json,requests
import os
from slackclient import SlackClient
# get the Slack API token as an environment variable
SLACK_BOT_TOKEN = os.environ["SLACK_BOT_TOKEN"]
CHANNEL_NAME = "test2"
BOT_ID = "U53TE8XSS"
SLACK_BOT_NAME = "<@" + BOT_ID + ">"
def main():
print(SLACK_BOT_NAME)
# Create the slackcli... | mit | Python | |
6f2ab55d0b83c33fad322101e7214425efd10829 | add colors to module | adrn/GaiaPairsFollowup | comoving_rv/plot.py | comoving_rv/plot.py | colors = dict()
colors['line_marker'] = '#3182bd'
colors['gp_model'] = '#ff7f0e'
colors['not_black'] = '#333333'
colors['fit'] = '#2ca25f'
| mit | Python | |
963b1ab24767acb5253b9fe2f29749d8656b2918 | index file added | ryanrdetzel/Mental-Cache,ryanrdetzel/Mental-Cache | index.py | index.py | #!/usr/bin/env python
import web
import page
import upload
import utils
#from google.appengine.ext import db
import logging
from Cheetah.Template import Template
import os
urls = (
'/page', page.app_page,
'/upload', upload.app_upload,
'/login', "login",
'/(\d+)-(?:[\w|-]+)\.html', "index",
"/(.*)",... | mit | Python | |
b91eb0b8b5bd66ea0bf090e6c6e71232c81d6e7a | Add mount.py | jakogut/KiWI | kiwi/mount.py | kiwi/mount.py | def mountpoint(path):
try:
subprocess.check_call(['mountpoint', path],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except subprocess.CalledProcessError:
return False
return True
def unmount(path):
subprocess.check_call(['umount', path])
def mount(src, dst, mkdir=False,... | mit | Python | |
cc1a799da671fbbbdd0406eeebc8c5a801a099d5 | Add extension test | Hardtack/Flask-Swag,Hardtack/Flask-Swag,Hardtack/Flask-Swag | tests/test_extension.py | tests/test_extension.py | """
tests.test_extension
====================
Tests for extension
"""
import json
from flask import Flask
from flask_swag import Swag
def test_extension():
"""Basic test for flask extension."""
app = Flask(__name__)
app.config['SWAG_TITLE'] = "Test application."
app.config['SWAG_API_VERSION'] = '1.... | mit | Python | |
4181f69bda52c4cbec7ac1d7529d44e26ede61d1 | create object base classes. | christophreimer/pygeobase | pygeobase/object_base.py | pygeobase/object_base.py | # Copyright (c) 2015, Vienna University of Technology, Department of Geodesy
# and Geoinformation. 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... | bsd-3-clause | Python | |
88ec4243ff78fe511331461b7563bd49f7124fe2 | Add tuple. | Vayne-Lover/Python | tuple/tuple.py | tuple/tuple.py | #!/usr/local/bin/python
x=(42,)
print x
y=3*(3,)
print y
z=tuple("hello")
i=1,2,3
print i[2]
print i[0:2]
| apache-2.0 | Python | |
24788b106b9cdd70e7240dc3eccac82fba290c85 | Add test for yaml enviroment | lukas-hetzenecker/home-assistant,LinuxChristian/home-assistant,molobrakos/home-assistant,sffjunkie/home-assistant,titilambert/home-assistant,ewandor/home-assistant,emilhetty/home-assistant,mikaelboman/home-assistant,nkgilley/home-assistant,robbiet480/home-assistant,jawilson/home-assistant,molobrakos/home-assistant,devd... | tests/util/test_yaml.py | tests/util/test_yaml.py | """Test Home Assistant yaml loader."""
import io
import unittest
import os
from homeassistant.util import yaml
class TestYaml(unittest.TestCase):
"""Test util.yaml loader."""
def test_simple_list(self):
"""Test simple list."""
conf = "config:\n - simple\n - list"
with io.StringIO(c... | """Test Home Assistant yaml loader."""
import io
import unittest
from homeassistant.util import yaml
class TestYaml(unittest.TestCase):
"""Test util.yaml loader."""
def test_simple_list(self):
"""Test simple list."""
conf = "config:\n - simple\n - list"
with io.StringIO(conf) as f:... | mit | Python |
2b0a96791ad43ef1f27b610233dd34027cf83c75 | Create currency-style.py | Pouf/CodingCompetition,Pouf/CodingCompetition | CiO/currency-style.py | CiO/currency-style.py | import re
def checkio(text):
numbers = re.findall('(?<=\$)[^ ]*\d', text)
for old in numbers:
new = old.replace('.', ',')
if ',' in new and len(new.split(',')[-1]) == 2:
new = '.'.join(new.rsplit(',', 1))
text = text.replace(old, new)
return text
| mit | Python | |
a46f960e811123a137e4e5fe4350f6a850e9b33e | Create average-of-levels-in-binary-tree.py | yiwen-luo/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/Lee... | Python/average-of-levels-in-binary-tree.py | Python/average-of-levels-in-binary-tree.py | # Time: O(n)
# Space: O(h)
# Given a non-empty binary tree,
# return the average value of the nodes on each level in the form of an array.
#
# Example 1:
# Input:
# 3
# / \
# 9 20
# / \
# 15 7
# Output: [3, 14.5, 11]
# Explanation:
# The average value of nodes on level 0 is 3,
# on level 1 is 14.5... | mit | Python | |
ee076055f11638b8711658972dda8c4d4b40f666 | Enforce max length on project name (#3982) | beeftornado/sentry,gencer/sentry,jean/sentry,ifduyue/sentry,JackDanger/sentry,BuildingLink/sentry,BuildingLink/sentry,jean/sentry,mvaled/sentry,gencer/sentry,beeftornado/sentry,gencer/sentry,fotinakis/sentry,looker/sentry,ifduyue/sentry,JackDanger/sentry,alexm92/sentry,ifduyue/sentry,jean/sentry,JamesMura/sentry,looker... | src/sentry/web/forms/add_project.py | src/sentry/web/forms/add_project.py | from __future__ import absolute_import
from django import forms
from django.utils.translation import ugettext_lazy as _
from sentry.models import AuditLogEntry, AuditLogEntryEvent, Project
from sentry.signals import project_created
from sentry.utils.samples import create_sample_event
BLANK_CHOICE = [("", "")]
cla... | from __future__ import absolute_import
from django import forms
from django.utils.translation import ugettext_lazy as _
from sentry.models import AuditLogEntry, AuditLogEntryEvent, Project
from sentry.signals import project_created
from sentry.utils.samples import create_sample_event
BLANK_CHOICE = [("", "")]
cla... | bsd-3-clause | Python |
96f224a6b80720a88fefc8530aea113f975ef110 | Add new layout window command | shaochuan/sublime-plugins | new_layout.py | new_layout.py | import sublime, sublime_plugin
class NewLayoutCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
self.view.window().run_command("set_layout", args)
self.view.window().run_command("focus_group", { "group": 0 })
self.view.window().run_command("move_to_group", { "group": 1 } )
| mit | Python | |
62ff128888bce33cf87e083a921ddac65a2f1879 | Add regression test for #3951 | explosion/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy | spacy/tests/regression/test_issue3951.py | spacy/tests/regression/test_issue3951.py | # coding: utf8
from __future__ import unicode_literals
import pytest
from spacy.matcher import Matcher
from spacy.tokens import Doc
@pytest.mark.xfail
def test_issue3951(en_vocab):
"""Test that combinations of optional rules are matched correctly."""
matcher = Matcher(en_vocab)
pattern = [
{"LOWE... | mit | Python | |
8436253648c67205de23db8797c9fcc7c2172b3e | add the actual test | thomasvs/pychecker,thomasvs/pychecker | test/test_slice.py | test/test_slice.py | # -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
'''
Tests related to slices.
'''
import unittest
import common
class SliceTestCase:#(common.TestCase):
'''
test that slices work.
'''
def test_slice(self):
self.check('test_slice')
if __name__ == '__main__':
unittest.main()
| bsd-3-clause | Python | |
8ca0e88b7df79461f401e7c46c822f16223ddd0b | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/implementation/easy/between_two_sets/py/solution.py | hackerrank/algorithms/implementation/easy/between_two_sets/py/solution.py | #!/bin/python3
import sys
# Hackerrank Python3 environment does not provide math.gcd
# as of the time of writing. We define it ourselves.
def gcd(n, m):
while m > 0:
n, m = m, n % m
return n
def lcm(x, y):
return (x * y) // gcd(x, y)
def between(s1, s2):
import functools
cd = functools.... | mit | Python | |
325465d18e963400b427f259547d4292a47368c9 | Use Django nose for tests. | 1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow | oneflow/settings/snippets/common_development.py | oneflow/settings/snippets/common_development.py | #
# Include your development machines hostnames here.
#
# NOTE: this is not strictly needed, as Django doesn't enforce
# the check if DEBUG==True. But Just in case you wanted to disable
# it temporarily, this could be a good thing to have your hostname
# here.
#
# If you connect via http://localhost:8000/, everything i... | #
# Include your development machines hostnames here.
#
# NOTE: this is not strictly needed, as Django doesn't enforce
# the check if DEBUG==True. But Just in case you wanted to disable
# it temporarily, this could be a good thing to have your hostname
# here.
#
# If you connect via http://localhost:8000/, everything i... | agpl-3.0 | Python |
df69df55cdf51da60e62226c16b30c76e2836c20 | Add initial test suite | adamjstewart/fiscalyear | test_fiscalyear.py | test_fiscalyear.py | import fiscalyear
import pytest
class TestFiscalYear:
@pytest.fixture(scope='class')
def a(self):
return fiscalyear.FiscalYear(2016)
@pytest.fixture(scope='class')
def b(self):
return fiscalyear.FiscalYear(2017)
@pytest.fixture(scope='class')
def c(self):
return fisc... | mit | Python | |
3e9289f142efd0769beff97cddfcbcbede40f85a | add a half written Qkkk | farseerfc/pacvis,farseerfc/pacvis,farseerfc/pacvis,farseerfc/pacvis | pacfiles/Qkkk.py | pacfiles/Qkkk.py | #!/usr/bin/env python3
import pyalpm
import pycman
import tarfile
import sys, os, os.path
pacmanconf = pycman.config.init_with_config("/etc/pacman.conf")
rootdir = pacmanconf.rootdir
def local_database():
handle = pacmanconf
localdb = handle.get_localdb()
packages = localdb.pkgcache
syncdbs = handle.get_syncdbs()... | mit | Python | |
701acbccc764101e00eef35dfff81dda5c5437a3 | Create pages_in_dict.py | nevmenandr/thai-language | pages_in_dict.py | pages_in_dict.py | import codecs
import os
import re
letters = []
no_letters = []
number_of = {}
pages = os.listdir(".")
for page in pages:
if page.endswith('.html'):
if page[0:3] not in letters:
letters.append(page[0:3])
f = codecs.open(page, 'r', 'utf-8-sig')
text = f.read()
#n = re.f... | cc0-1.0 | Python | |
39bf0b2ab6f89cfe3450102699a5bbeaf235011a | Create 4.py | gotclout/PythonJunk | 4.py | 4.py | #!/usr/bin/env python
MAX_TRI = 999999L
triangles = []
def next_pos(mn, pos):
if mn > triangles[MAX_TRI - 1]:
return -1
else:
maxv = MAX_TRI - 1
minv = 0
mid = minv + (maxv - minv) / 2
while triangles[mid] != mn and minv < maxv:
if triangles[mid] < mn :
minv = mid + 1
else... | mit | Python | |
ac357bc1ccefe55e25bb34021772301726ceec0e | Complete P4 | medifle/python_6.00.1x | Quiz/Problem4_defMyLog.py | Quiz/Problem4_defMyLog.py | def myLog(x, b):
'''
x: a positive integer
b: a positive integer; b >= 2
returns: log_b(x), or, the logarithm of x relative to a base b.
'''
if x < b:
return 0
else:
return 1 + myLog(x / b, b) | mit | Python | |
e6ea8ad5b94b51d8b07dea238f2545eacba3abfe | Create Elentirmo_GUI_V0.1.py | kellogg76/ArduinoTelescopeDustCover | Elentirmo_GUI_V0.1.py | Elentirmo_GUI_V0.1.py | #!/usr/bin/python
from Tkinter import *
root = Tk()
root.title("Elentirmo Observatory Controller v0.1")
dust_cover_text = StringVar()
dust_cover_text.set('Cover Closed')
flat_box_text = StringVar()
flat_box_text.set('Flat Box Off')
def dust_cover_open():
print "Opening"
## Open a serial connection with Ardu... | mit | Python | |
51feabbc27821c5acb7f0ceb932d19c0d79f16d1 | test ssl version check functions as expected in python 2.6 | psf/requests | tests/test_help.py | tests/test_help.py | # -*- encoding: utf-8
import sys
import pytest
from requests.help import info
@pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6")
def test_system_ssl_py26():
"""OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't
blow up in this case.
"""
assert info... | apache-2.0 | Python | |
ca27dc71bd814fe42282521edd97ae444d6c714b | Add test of PlotData | pfi/maf,pfi/maf | tests/test_plot.py | tests/test_plot.py | from maflib.plot import *
import unittest
class TestPlotData(unittest.TestCase):
inputs = [
{ 'x': 1, 'y': 2, 'z': 50, 'k': 'p' },
{ 'x': 5, 'y': 3, 'z': 25, 'k': 'q' },
{ 'x': 3, 'y': 5, 'z': 10, 'k': 'q' },
{ 'x': 7, 'y': 4, 'z': 85, 'k': 'p' }
]
def test_empty_inputs(sel... | bsd-2-clause | Python | |
63804c534f23ffbe16ff539087048d99f9fcaf17 | Implement test_encoder_decoder | kenkov/seq2seq | test_encoder_decoder.py | test_encoder_decoder.py | #! /usr/bin/env python
# coding:utf-8
if __name__ == "__main__":
import sys
import argparse
from seq2seq import decode
from util import load_dictionary
import configparser
import os
from chainer import serializers
# GPU config
parser = argparse.ArgumentParser()
parser.add_arg... | mit | Python | |
8eeb4c2db613c1354c38696ac6691cf79f66a383 | Add spider for Brookdale Senior Living | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/brookdale.py | locations/spiders/brookdale.py | # -*- coding: utf-8 -*-
import scrapy
import json
from locations.items import GeojsonPointItem
URL = 'https://www.brookdale.com/bin/brookdale/community-search?care_type_category=resident&loc=&finrpt=&state='
US_STATES = (
"AL", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
"ID", "IL", "IN", "IA", "KS"... | mit | Python | |
47893c708f3b63f79a01d5ee927f4c7d3f6dff27 | Create script to delete untitled and unpublished projects | akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr | akvo/rsr/management/commands/delete_untitled_and_unpublished_projects.py | akvo/rsr/management/commands/delete_untitled_and_unpublished_projects.py | # -*- coding: utf-8 -*-
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
import datetime
from tablib imp... | agpl-3.0 | Python | |
03c837b0da9d7f7a6c6c54286631e9a403da3e60 | Add network scan python script - Closes #7 | OpenSecTre/sword,OpenSecTre/sword,OpenSecTre/sword | backend/net_scan.py | backend/net_scan.py | #!/usr/bin/python
import sys, getopt, nmap
def usage():
print 'sword_nmap.py -t <target> -p <port range>'
def main(argv):
target=''
port_range=''
try:
opts, args = getopt.getopt(argv,'ht:p:',['target=','ports='])
except getopt.GetoptError:
usage()
sys.exit(2)
for opt, ... | mit | Python | |
24e4ed9f26f9803d54d37202d0d71e8f47b18aa3 | Add swix create functionality and make verifyswix test use it | aristanetworks/swi-tools,aristanetworks/swi-tools | swixtools/create.py | swixtools/create.py | #!/usr/bin/env python3
# Copyright ( c ) 2021 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
'''
This module is responsible for packaging a SWIX file.
'''
import argparse
import hashlib
import os
import shutil
import subprocess
import sys... | apache-2.0 | Python | |
4699c1c301f1cb99f6c9e616b31769c01bc291d5 | change datafiles in v1.* to make it work in v2.* | heyrict/exam | v1_to_v2.py | v1_to_v2.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import optparse, pickle, exam
def main():
opt = optparse.OptionParser()
(options, args) = opt.parse_args()
for i in args:
with open(i,'rb') as f: data = pickle.load(f)
data = exam.QuestForm(data)
with open('v3.'.join(i.split('.')),'wb... | apache-2.0 | Python | |
0403d6f78189be3f3b22f068dad1db0c53687ef7 | Add ptch module and base PatchFile class. This class can unpack RLE-compressed patchfiles. | jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow | ptch/__init__.py | ptch/__init__.py | # -*- coding: utf-8 -*-
"""
PTCH files are a container format for Blizzard patch files.
They begin with a 72 byte header containing some metadata, immediately
followed by a RLE-packed BSDIFF40.
The original BSDIFF40 format is compressed with bzip2 instead of RLE.
"""
#from hashlib import md5
from struct import unpack
... | cc0-1.0 | Python | |
8533c93505a733980406ce655372c7742dfcfdfc | Add update policy that allows for in place upgrade of ES cluster (#1537) | cloudtools/troposphere,cloudtools/troposphere,ikben/troposphere,ikben/troposphere | troposphere/policies.py | troposphere/policies.py | from . import AWSProperty, AWSAttribute, validate_pausetime
from .validators import positive_integer, integer, boolean
class AutoScalingRollingUpdate(AWSProperty):
props = {
'MaxBatchSize': (positive_integer, False),
'MinInstancesInService': (integer, False),
'MinSuccessfulInstancesPercent... | from . import AWSProperty, AWSAttribute, validate_pausetime
from .validators import positive_integer, integer, boolean
class AutoScalingRollingUpdate(AWSProperty):
props = {
'MaxBatchSize': (positive_integer, False),
'MinInstancesInService': (integer, False),
'MinSuccessfulInstancesPercent... | bsd-2-clause | Python |
2a6527c60d09c0cbb2f1902b57ae02ddade213eb | Create communicati.py | mncmilan/eZ430-Chronos | libs/communicati.py | libs/communicati.py | # communications.py
# Mónica Milán (@mncmilan)
# mncmilan@gmail.com
# http://steelhummingbird.blogspot.com.es/
# Library that contains all necessary methods in order to enable communications between PC and eZ430-Chronos.
import serial
s = serial.Serial('COM4', baudrate=115200,timeout=None) # open serial port
clas... | apache-2.0 | Python | |
e5293f7e33740f210ab58c3c05db18829db1474d | add docstrings [skip ci] | eugene-eeo/mailthon,krysros/mailthon,ashgan-dev/mailthon | mailthon/helpers.py | mailthon/helpers.py | """
mailthon.helpers
~~~~~~~~~~~~~~~~
Implements various helper functions/utilities.
:copyright: (c) 2015 by Eeo Jun
:license: MIT, see LICENSE for details.
"""
import sys
import mimetypes
from collections import MutableMapping
from email.utils import formataddr
if sys.version_info[0] == 3:
... | """
mailthon.helpers
~~~~~~~~~~~~~~~~
Implements various helper functions/utilities.
:copyright: (c) 2015 by Eeo Jun
:license: MIT, see LICENSE for details.
"""
import sys
import mimetypes
from collections import MutableMapping
from email.utils import formataddr
if sys.version_info[0] == 3:
... | mit | Python |
ea652c892219d1ed08a0453a3b2ede3efb452e23 | Create __init__.py | bistaray/odoo-8.0-public,raycarnes/odoo-8.0-public,raycarnes/odoo-8.0-public,bistaray/odoo-8.0-public | ui_techmenu/__init__.py | ui_techmenu/__init__.py | # -*- coding: utf-8 -*-
######################################################################
#
# ui_techmenu - Explode Technical Menu for Odoo
# Copyright (C) 2012 - TODAY, Ursa Information Systems (<http://ursainfosystems.com>)
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>)
# contact@ursainfosystems.co... | agpl-3.0 | Python | |
841e8fe236eab35b803cb9d8bec201306ce4642e | Add script to generate big RUM_* files | itmat/rum,itmat/rum,itmat/rum | util/repeat_rum_file.py | util/repeat_rum_file.py | from rum_mapping_stats import aln_iter
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument('--times', type=int)
parser.add_argument('--max-seq', type=int)
parser.add_argument('rum_file', type=file)
args = parser.parse_args()
alns = list(aln_iter(args.rum_file))
for t in range(args.tim... | mit | Python | |
3ab98baaf2b81ffa1afef808f27608f06bc946d3 | Create commands.py | anvanza/invenavi,anvanza/invenavi,anvanza/invenavi | web/commands.py | web/commands.py | #
# Commands for RPC interface
#
from twisted.protocols.amp import AMP, Boolean, Integer, String, Float, Command
class Sum(Command):
arguments = [('a', Integer()),
('b', Integer())]
response = [('status', Integer())]
class HeartbeatCmd(Command):
arguments = [('enabled', Boolean())]
r... | mit | Python | |
b5f8299cbe539cf2a01988ca25e0c7638400bc8c | Create stuff.py | danshorstein/cpatoolz,danshorstein/cpatoolz,danshorstein/cpatoolz,dtiz/bottomline | bottomline/stuff.py | bottomline/stuff.py | # Testing
print 'heck yeah!'
| mit | Python | |
5777877d1ed71ed21f67e096b08ad495ff844ed8 | add testexample/simpleTestwithPython.py | light940929/niagadsofinquery,light940929/niagadsofinquery,light940929/niagadsofinquery,light940929/niagadsofinquery | testexample/simpleTestwithPython.py | testexample/simpleTestwithPython.py | import os
import re
import json
import sys
import getopt
import argparse
from docopt import docopt
from urllib2 import urlopen, Request
import urllib
import urllib2
import requests
url_phenotypes = 'http://localhost:9000/api/phenotypes'
url_genotypes = 'http://localhost:9000/api/genotypes'
token = 'Bearer eyJhbGciOiJI... | mit | Python | |
606020fbb7c3e608c8eab19ca143919003ea4f7d | add some first tests. | alexanderjulo/triptan | test_triptan.py | test_triptan.py | import os
from unittest import TestCase
from tempfile import TemporaryDirectory
from triptan.core import Triptan
class TriptanInitializationTest(TestCase):
"""
Asserts that triptan can setup the necessary data correctly.
"""
def test_init_file_structure(self):
"""
Assert the ... | mit | Python | |
1803ec42e2eaad689dd51d3afb0b943e411f10d5 | Add breath first search algorithm | tobegit3hub/tobe-algorithm-manual | breath_first_search/breath_first_search.py | breath_first_search/breath_first_search.py | #!/usr/bin/env python
from collections import deque
class BreathFirstSearchGame(object):
def __init__(self):
# The node index are from 0 to 7, such as 0, 1, 2, 3, 4
self.node_number = 8
# The edges to connect each node
self.edges = [(0, 1), (0, 3), (1, 2), (1, 5), (2, 7), (3, 4), (3, 6),
... | apache-2.0 | Python | |
c98eff8545c90563246a53994fe8f65faaf76b0a | Add fetch recipe for the open source infra repo. | svn2github/chromium-depot-tools,svn2github/chromium-depot-tools,svn2github/chromium-depot-tools | recipes/infra.py | recipes/infra.py | # 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.
import sys
import recipe_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
cla... | bsd-3-clause | Python | |
5b3b5bb145eea8a71c81a383d2bdac7ecf13f98e | Add sys module tests | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/sysmod.py | tests/integration/modules/sysmod.py | # Import python libs
import os
# Import salt libs
import integration
class SysModuleTest(integration.ModuleCase):
'''
Validate the sys module
'''
def test_list_functions(self):
'''
sys.list_functions
'''
funcs = self.run_function('sys.list_functions')
self.asser... | apache-2.0 | Python | |
7d800a0fc2d94cad14e825faa27e1f5b2d2cbed8 | Create new package (#6648) | matthiasdiener/spack,krafczyk/spack,mfherbst/spack,EmreAtes/spack,LLNL/spack,krafczyk/spack,mfherbst/spack,EmreAtes/spack,EmreAtes/spack,iulian787/spack,matthiasdiener/spack,iulian787/spack,mfherbst/spack,matthiasdiener/spack,LLNL/spack,tmerrick1/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,matthiasdiener/spack,... | var/spack/repos/builtin/packages/breseq/package.py | var/spack/repos/builtin/packages/breseq/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
19cf7a2833ba2ffcff46bd4543ed93fd80c1d8ea | fix trying to run configure on an already configured directory fixes #2959 (#2961) | EmreAtes/spack,krafczyk/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,tmerrick1/spack,LLNL/spack,mfherbst/spack,LLNL/spack,iulian787/spack,krafczyk/spack,skosukhin/spack,TheTimmy/spack,skosukhin/spack,krafczyk/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,matthiasdiener/spack,lgarren/spack,EmreAtes/s... | var/spack/repos/builtin/packages/libmng/package.py | var/spack/repos/builtin/packages/libmng/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
94f2ea927d9e218f2b5065456275d407164ddf0a | Add anidub.com tracker support | idlesign/deluge-updatorr,idlesign/deluge-updatorr | updatorr/tracker_handlers/handler_anidub.py | updatorr/tracker_handlers/handler_anidub.py | from updatorr.handler_base import BaseTrackerHandler
from updatorr.utils import register_tracker_handler
import urllib2
class AnidubHandler(BaseTrackerHandler):
"""This class implements .torrent files downloads
for http://tr.anidub.com tracker."""
logged_in = False
# Stores a number of login attempts... | bsd-3-clause | Python | |
b02ec9a16689bf2814e85f0edb01c7f4a5926214 | Add pre-migration script for account module. | bwrsandman/OpenUpgrade,hifly/OpenUpgrade,pedrobaeza/OpenUpgrade,Endika/OpenUpgrade,mvaled/OpenUpgrade,OpenUpgrade-dev/OpenUpgrade,kirca/OpenUpgrade,pedrobaeza/OpenUpgrade,sebalix/OpenUpgrade,OpenUpgrade-dev/OpenUpgrade,grap/OpenUpgrade,csrocha/OpenUpgrade,csrocha/OpenUpgrade,bwrsandman/OpenUpgrade,mvaled/OpenUpgrade,mv... | addons/account/migrations/8.0.1.1/pre-migration.py | addons/account/migrations/8.0.1.1/pre-migration.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Akretion (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the... | agpl-3.0 | Python | |
07841312d062fd0dd48baa0d3bc0d92989e05841 | add script mp3-file-renamer.py | charlesbos/my-scripts,charlesbos/my-scripts | mp3-file-renamer.py | mp3-file-renamer.py | #!/usr/bin/python
#Python script to rename mp3 files according to the format
#"Track-number Track-name.mp3", for example: 02 Self Control.mp3
#Note: Tracks must have valid ID3 data for this to work - python-mutagen is required.
#By Charles Bos
import os
import sys
from mutagen.id3 import ID3, ID3NoHeaderError
def usa... | agpl-3.0 | Python | |
cc76c00efa919f8532e21365606f38431093cc22 | Write inversion counting algorithm | stephtzhang/algorithms | count_inversions.py | count_inversions.py | def count_inversions(list, inversion_count = 0):
"""
recursively counts inversions of halved lists
where inversions are instances where a larger el occurs before a smaller el
merges the halved lists and increments the inversion count at each level
:param list list: list containing comparable elements
:para... | mit | Python | |
3331a9a6b8ada075aaefef021a8ad24a49995931 | Add test for prepare_instance_slug #92 | Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django | derrida/books/tests/test_search_indexes.py | derrida/books/tests/test_search_indexes.py | from unittest.mock import patch
from django.test import TestCase
from derrida.books.models import Reference, Instance
from derrida.books.search_indexes import ReferenceIndex
class TestReferenceIndex(TestCase):
fixtures = ['test_references.json']
def setUp(self):
'''None of the Instacefixtures have sl... | apache-2.0 | Python | |
451799f126afcdda70138dc348b9e1f276b1f86f | Add setting file for later use. | aocks/ox_herd,aocks/ox_herd,aocks/ox_herd | ox_herd/settings.py | ox_herd/settings.py | """Module to represent basic settings for ox_herd package.
"""
| bsd-2-clause | Python | |
ec5136b86cce92a49cf2eea852f1d8f2d7110cf0 | Create element_search.py | lcnodc/codes,lcnodc/codes | 09-revisao/practice_python/element_search.py | 09-revisao/practice_python/element_search.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Exercise 20: Element Search
Write a function that takes an ordered list of numbers (a list where the
elements are in order from smallest to largest) and another number. The
function decides whether or not the given number is inside the list and
returns (then prints) an... | mit | Python | |
cc06421fb4250640b2c9eef75480a3627a339473 | Add a script to normalize Gerrit ACLs | anbangr/osci-project-config,coolsvap/project-config,openstack-infra/project-config,dongwenjuan/project-config,citrix-openstack/project-config,Tesora/tesora-project-config,dongwenjuan/project-config,citrix-openstack/project-config,open-switch/infra_project-config,noorul/os-project-config,osrg/project-config,coolsvap/pro... | tools/normalize_acl.py | tools/normalize_acl.py | #!/usr/bin/env python
# Usage: normalize_acl.py acl.config [transformation [transformation [...]]]
#
# Transformations:
# 0 - dry run (default, print to stdout rather than modifying file in place)
# 1 - strip/condense whitespace and sort (implied by any other transformation)
# 2 - get rid of unneeded create on refs/ta... | apache-2.0 | Python | |
7060b82030d719cdcbdcecdb5eb7d34b405aa805 | Make the migration for previous commit | Turupawn/website,lutris/website,lutris/website,Turupawn/website,Turupawn/website,lutris/website,lutris/website,Turupawn/website | platforms/migrations/0003_auto_20150718_0050.py | platforms/migrations/0003_auto_20150718_0050.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('platforms', '0002_auto_20150718_0042'),
]
operations = [
migrations.AlterField(
model_na... | agpl-3.0 | Python | |
3b42e348987294602440c3c1d4aa4361afcdc298 | Add problem 14 | dimkarakostas/matasano-cryptochallenges | problem_14.py | problem_14.py | from problem_12 import new_encryption_oracle, find_blocksize
import random
from string import printable
RANDOM_PREFIX = ''.join(random.choice(printable) for _ in range(random.randrange(0, 20)))
# print len(RANDOM_PREFIX)
def oracle(adversary_input):
return new_encryption_oracle(RANDOM_PREFIX + adversary_input)
... | mit | Python | |
49b1de4a68133e618723f96f2dc922b311bdd982 | Add Script to encode raw RGB565 | SmartArduino/openmv,SmartArduino/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,tianzhihen/openmv,kwagyeman/openmv,SmartArduino/openmv,openmv/openmv,openmv/openmv,tianzhihen/openmv,iabdalkader/openmv,kwagyeman/openmv,tianzhihen/openmv,iabdalkader/openmv,iabdalkader/openmv,SmartArduino/openmv,openmv/openmv,... | util/encode_raw.py | util/encode_raw.py | #!/usr/bin/env python
# Converts raw RGB565 video to MP4/AVI
from sys import argv, exit
from array import array
from subprocess import call
buf=None
TMP_FILE = "/tmp/video.raw"
if (len(argv) != 4):
print("Usage: encode_raw input.raw output.avi fps")
exit(1)
with open(argv[1], "rb") as f:
buf = array("H"... | mit | Python | |
5dba86b3a68c27a01eb143a6dfdb35d01c3c99e8 | add app_test | wecatch/app-turbo,tao12345666333/app-turbo,tao12345666333/app-turbo,tao12345666333/app-turbo | turbo/test/app_test.py | turbo/test/app_test.py | from __future__ import absolute_import, division, print_function, with_statement
import os
import signal
import sys
import unittest
import random
import time
import threading
import logging
import requests
import multiprocessing
from turbo import app
from turbo.conf import app_config
from turbo import register
app_c... | apache-2.0 | Python | |
be0331e64726d659b824187fbc91b54ce0405615 | add initial implementation of weighted EM PCA | jakevdp/wpca | wpca/test/test_empca.py | wpca/test/test_empca.py | import numpy as np
from numpy.testing import assert_allclose
from ..empca import orthonormalize, random_orthonormal, pca, empca
def norm_sign(X):
i_max_abs = np.argmax(abs(X), 0)
sgn = np.sign(X[i_max_abs, range(X.shape[1])])
return X * sgn
def assert_columns_allclose_upto_sign(A, B, *args, **kwargs):
... | bsd-3-clause | Python | |
7ccfc89a51a76764c36b009dd9b5fc55570e3f56 | Add forgot password test | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | api/radar_api/tests/test_forgot_password.py | api/radar_api/tests/test_forgot_password.py | import json
from radar_api.tests.fixtures import get_user
from radar.database import db
def test_forgot_password(app):
user = get_user('admin')
client = app.test_client()
assert user.reset_password_token is None
assert user.reset_password_date is None
response = client.post('/forgot-password',... | agpl-3.0 | Python | |
b4bf757a15c404080679335bcce04ba45a7e4eae | Update fix_nonwarehouse_ledger_gl_entries_for_transactions.py | indictranstech/erpnext,indictranstech/erpnext,indictranstech/erpnext,njmube/erpnext,gsnbng/erpnext,Aptitudetech/ERPNext,gsnbng/erpnext,gsnbng/erpnext,njmube/erpnext,geekroot/erpnext,indictranstech/erpnext,geekroot/erpnext,geekroot/erpnext,geekroot/erpnext,njmube/erpnext,gsnbng/erpnext,njmube/erpnext | erpnext/patches/v7_0/fix_nonwarehouse_ledger_gl_entries_for_transactions.py | erpnext/patches/v7_0/fix_nonwarehouse_ledger_gl_entries_for_transactions.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
if not frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock"):
return
frappe.reload_doctype("A... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
if not frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock"):
return
frappe.reload_doctype("A... | agpl-3.0 | Python |
ae52e3e4dc1fc254b7e1c258caa1fe00317bb9a5 | Add migrate script. | mehdisadeghi/mehdix.ir,mehdisadeghi/mehdix.ir,mehdisadeghi/mehdix.ir,mehdisadeghi/mehdix.ir,mehdisadeghi/mehdix.ir | disqus_converter.py | disqus_converter.py | '''Convert disquls XML comments to YAML.'''
import os
import copy
import pathlib
import hashlib
import yaml
import iso8601
import xmltodict
from postsinfo import mapping
from rebuild_comments import encrypt
COMMENT_DIR = os.environ.get('COMMENT_DIR', './_data/comments')
def get_disqus_threads(infile):
with open... | cc0-1.0 | Python | |
588d49ef47cb4fa0848e44775a0102a7bd3f492a | add hdfs utils to distributed | amosonn/distributed,mrocklin/distributed,dask/distributed,broxtronix/distributed,broxtronix/distributed,dask/distributed,dask/distributed,mrocklin/distributed,amosonn/distributed,blaze/distributed,blaze/distributed,amosonn/distributed,mrocklin/distributed,broxtronix/distributed,dask/distributed | distributed/hdfs.py | distributed/hdfs.py | import os
from .utils import ignoring
with ignoring(ImportError):
import snakebite.protobuf.ClientNamenodeProtocol_pb2 as client_proto
from snakebite.client import Client
def get_locations(filename, name_host, name_port):
client = Client(name_host, name_port, use_trash=False)
files = list(client.ls(... | bsd-3-clause | Python | |
c8ae682ff98f2c5b5733ae4b299970c820e46630 | Add regression test for #636 | explosion/spaCy,Gregory-Howard/spaCy,spacy-io/spaCy,spacy-io/spaCy,recognai/spaCy,recognai/spaCy,explosion/spaCy,raphael0202/spaCy,aikramer2/spaCy,raphael0202/spaCy,spacy-io/spaCy,aikramer2/spaCy,oroszgy/spaCy.hu,raphael0202/spaCy,recognai/spaCy,oroszgy/spaCy.hu,Gregory-Howard/spaCy,raphael0202/spaCy,explosion/spaCy,or... | spacy/tests/regression/test_issue636.py | spacy/tests/regression/test_issue636.py | # coding: utf8
from __future__ import unicode_literals
from ...tokens.doc import Doc
import pytest
@pytest.mark.xfail
@pytest.mark.models
@pytest.mark.parametrize('text', ["I cant do this."])
def test_issue636(EN, text):
"""Test that to_bytes and from_bytes don't change the token lemma."""
doc1 = EN(text)
... | mit | Python | |
423707ea25e88b2454a9541eb52f900da87e95b2 | allow external backends, specified via ZMQ_BACKEND env | dash-dash/pyzmq,caidongyun/pyzmq,dash-dash/pyzmq,Mustard-Systems-Ltd/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq,yyt030/pyzmq,Mustard-Systems-Ltd/pyzmq,swn1/pyzmq,yyt030/pyzmq,ArvinPan/pyzmq,caidongyun/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,swn1/pyzmq,caidongyun/pyzmq,dash-dash/pyzmq,ArvinPan/pyzmq | zmq/backend/__init__.py | zmq/backend/__init__.py | """Import basic exposure of libzmq C API as a backend"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPY... | """Import basic exposure of libzmq C API as a backend"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPY... | bsd-3-clause | Python |
6e501f2cbfe6b53eca72389c9a1c98a3c3d098c9 | Add redhat official helper | morucci/repoxplorer,morucci/repoxplorer,morucci/repoxplorer,morucci/repoxplorer | bin/helpers/redhatofficial/redhatoffical.py | bin/helpers/redhatofficial/redhatoffical.py | #!/usr/bin/env python
# Copyright 2018, Red Hat
# Copyright 2018, Fabien Boucher
#
# 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... | apache-2.0 | Python | |
cb9166c4564c4e763e1214355dc76cbe6d466258 | Add data migration for section | supermitch/simple-author | books/migrations/0009_auto_20141127_1718.py | books/migrations/0009_auto_20141127_1718.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_sections(apps, schema_editor):
# Don't just use books.models.Section, that could be out of date
Section = apps.get_model('books', 'Section')
FRONT_MATTER_CHOICES = [
#('db_value', 'hum... | mit | Python | |
161feec0d3764c7cdeebfdc7cd62e5901a89666a | Add initial implementation | Isaac-W/cpr-vision-measurement,Isaac-W/cpr-vision-measurement,Isaac-W/cpr-vision-measurement | runtracker.py | runtracker.py | import cv2
import numpy as np
import imutils
PI = 3.141592654
AREA_ERROR_THRESH = 0.05 # Error away from the mean area
# Color ranges
#CALIB_COLOR_MIN = ( 70, 40, 61)
#CALIB_COLOR_MAX = (110, 175, 255)
CALIB_COLOR_MIN = ( 52, 24, 56)
CALIB_COLOR_MAX = ( 98, 169, 178)
TRACK_COLOR_MIN = ( 0, 0, 0)
TRACK_CO... | mit | Python | |
07825b7f80a12619c847de49f0f2b991faeea7b4 | Add a simple handler cookie_wsh.py useful for cookie test | bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src | example/cookie_wsh.py | example/cookie_wsh.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the COPYING file or at
# https://developers.google.com/open-source/licenses/bsd
import urlparse
def _add_set_cookie(request, value):
request.extra_headers.append(('Set-Cookie',... | bsd-3-clause | Python | |
39019e998da2c1f73f82e0eb446df78ffc95c134 | Create safe_steps.py | uktechreviews/minecraft_workshops | safe_steps.py | safe_steps.py | import mcpi.minecraft as minecraft
import mcpi.block as block
mc = minecraft.Minecraft.create()
while True:
p = mc.player.getTilePos()
b = mc.getBlock(p.x, p.y-1, p.z)
if b == block.AIR.id or b == block.WATER_FLOWING.id or b==block.WATER_STATIONARY.id:
mc.setBlock(pos.x, pos.y-1, pos.z, block.WOOD_PLANKS.id)
| cc0-1.0 | Python | |
c78480fc1f566bb6d266705336dbe9cd90d07996 | Create 476_number_complement.py | jsingh41/algos | 476_number_complement.py | 476_number_complement.py | """
https://leetcode.com/problems/number-complement/description/
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
Note:
The given integer is guaranteed to fit within the range of a 32-bit signed integer.
You could assume no leading zero b... | mit | Python | |
0104600fe32b2b676974f29df37d10cc86a7441a | enable CMake build (with HTTP/3) -- take 2 | facebook/bistro,facebook/bistro,facebook/bistro,facebook/bistro,facebook/bistro,facebook/bistro | build/fbcode_builder/specs/proxygen_quic.py | build/fbcode_builder/specs/proxygen_quic.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.folly as folly
import specs.fizz as fizz
import specs.mvfst as mvfst
import specs.so... | mit | Python | |
37e74416a090342c18cfad87df74dd958400145d | Add 'Others' category. | enjaz/enjaz,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,osamak/student-portal | bulb/migrations/0009_add_others_category.py | bulb/migrations/0009_add_others_category.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_categories(apps, schema_editor):
Category = apps.get_model('bulb', 'Category')
Category.objects.create(code_name="others", name="أخرى")
def remove_categories(apps, schema_editor):
Category = a... | agpl-3.0 | Python | |
317160665a58a2e0433202e4605710b09a71de9d | add scrub script to remove solution tags, thanks https://gist.github.com/minrk/3836889 | amcdawes/QMlabs | scrub_sols.py | scrub_sols.py | #!/usr/bin/env python
"""
simple example script for scrubping solution code cells from IPython notebooks
Usage: `scrub_code.py foo.ipynb [bar.ipynb [...]]`
Marked code cells are scrubbed from the notebook
"""
import io
import os
import sys
from IPython.nbformat.current import read, write
def scrub_code_cells(nb):
... | mit | Python | |
3bafceba383125475d5edb895bc9d88b0dfc5042 | Add status to Role | barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore-django,barberscore/barberscore-api,dbinetti/barberscore | project/apps/api/migrations/0093_role_status.py | project/apps/api/migrations/0093_role_status.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-05 23:28
from __future__ import unicode_literals
from django.db import migrations
import django_fsm
class Migration(migrations.Migration):
dependencies = [
('api', '0092_auto_20160305_1514'),
]
operations = [
migrations.AddF... | bsd-2-clause | Python | |
4735ee97aa36920e811edc450d8b6e8a09b5caf5 | add utility for explode bam | jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public | iron/utilities/explode_bam.py | iron/utilities/explode_bam.py | #!/usr/bin/python
import sys, argparse
from subprocess import Popen, PIPE
from SamBasics import SamStream
from multiprocessing import cpu_count, Pool
def main():
parser = argparse.ArgumentParser(description="Break a bam into evenly sized chunks print the number of chunks",formatter_class=argparse.ArgumentDefaultsHelp... | apache-2.0 | Python | |
77a031fd34d73047a529fe9e06d7781ba0d4c56d | add basic structure of python ui | wilseypa/warped2-models,wilseypa/warped2-models,wilseypa/warped2-models | models/synthetic/ui/synthetic.py | models/synthetic/ui/synthetic.py |
from Tkinter import *
# initial
root = Tk()
root.title("Synthetic Model")
label = Label(root, text = 'Synthetic Model', font = (None, 20))
label.pack()
m1 = PanedWindow()
m1.pack(fill = BOTH, expand = 1)
m2 = PanedWindow(m1, orient = VERTICAL)
m1.add(m2)
m3 = PanedWindow(m1, orient = VERTICAL)
m1.add(m3)
m4 = Pa... | mit | Python | |
ebd62eac70d5589b0b7f593009024868f981e658 | Add actor with behavior similar to old-style Delay | les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base | calvin/actorstore/systemactors/std/ClassicDelay.py | calvin/actorstore/systemactors/std/ClassicDelay.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | apache-2.0 | Python | |
a88cf930a5c0e67a7aef93ab5c4eb705ad7aad32 | Fix ‘permissions_classes’ typos | benjaoming/kolibri,benjaoming/kolibri,jonboiser/kolibri,lyw07/kolibri,learningequality/kolibri,mrpau/kolibri,jonboiser/kolibri,mrpau/kolibri,indirectlylit/kolibri,benjaoming/kolibri,learningequality/kolibri,jonboiser/kolibri,christianmemije/kolibri,benjaoming/kolibri,learningequality/kolibri,mrpau/kolibri,jonboiser/kol... | kolibri/core/lessons/tests.py | kolibri/core/lessons/tests.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
# Create your tests here.
| mit | Python |
4bbd622921fcef6a07d5d87c0640a9eb4e48cf12 | Add nurseryTherm python file | mattmole/nursery-temperature-touch | nurseryTherm.py | nurseryTherm.py | #!/usr/bin/python
#CamJam Edukit 2 - Sensors
# Worksheet 3 - Temperature
# Import Libraries
import os
import glob
import time
import paho.mqtt.client as paho
import json
# Initialize the GPIO Pins
os.system('modprobe w1-gpio') # Turns on the GPIO module
os.system('modprobe w1-therm') # Turns on the Temperature module
... | mit | Python | |
e363aac46c9a5b607c7b32bcc5546c5a2728d750 | Add migration which fixes missing message IDs. | qubs/data-centre,qubs/data-centre,qubs/climate-data-api,qubs/climate-data-api | climate_data/migrations/0029_auto_20170628_1527.py | climate_data/migrations/0029_auto_20170628_1527.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-28 15:27
from __future__ import unicode_literals
from django.db import migrations
from datetime import timedelta
# noinspection PyUnusedLocal
def add_message_id_to_reading(apps, schema_editor):
# noinspection PyPep8Naming
Reading = apps.get_mod... | apache-2.0 | Python | |
840bc57e7120ae67e84c1c7bca94cfef34c8d2a8 | Copy old script from @erinspace which added identifiers to existing preprints. | erinspace/osf.io,chennan47/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,felliott/osf.io,baylee-d/osf.io,saradbowman/osf.io,leb2dg/osf.io,caseyrollins/osf.io,sloria/osf.io,Johnetordoff/osf.io,TomBaxter/osf.io,crcresearch/osf.io,mattclark/osf.io,brianjgeiger/osf.io,aaxelb/osf.io,felliott/osf.io,mfraezz/osf.io,adlius/osf.io... | scripts/add_missing_identifiers_to_preprints.py | scripts/add_missing_identifiers_to_preprints.py | import sys
import time
import logging
from scripts import utils as script_utils
from django.db import transaction
from website.app import setup_django
from website.identifiers.utils import request_identifiers_from_ezid, parse_identifiers
setup_django()
logger = logging.getLogger(__name__)
def add_identifiers_to_pre... | apache-2.0 | Python | |
3a9ec86e4b996912b1a47abe07c70116be14b3f8 | Create hello.py | BhaveshSGupta/LearnPy | hello.py | hello.py | print "Hello all"
| mit | Python | |
d73b2108358c8aa43509b6def6879fc70b138fb5 | add objects | LumPenPacK/NetworkExtractionFromImages,LumPenPacK/NetworkExtractionFromImages,LumPenPacK/NetworkExtractionFromImages,LumPenPacK/NetworkExtractionFromImages,LumPenPacK/NetworkExtractionFromImages | nefi2_main/nefi2/view/test2.py | nefi2_main/nefi2/view/test2.py | from PyQt4 import QtGui, QtCore
import sys
class Main(QtGui.QMainWindow):
def __init__(self, parent = None):
super(Main, self).__init__(parent)
# main button
self.addButton = QtGui.QPushButton('button to add other widgets')
self.addButton.clicked.connect(self.addWidget)
# ... | bsd-2-clause | Python | |
98bf1c67b95d40888e26068015e4abf1b94d0640 | add ddns state module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/states/ddns.py | salt/states/ddns.py | '''
Dynamic DNS updates.
====================
Ensure a DNS record is present or absent utilizing RFC 2136
type dynamic updates. Requires dnspython module.
.. code-block:: yaml
webserver:
ddns.present:
- zone: example.com
- ttl: 60
'''
def __virtual__():
return 'ddns' if 'ddns.update' ... | apache-2.0 | Python | |
4ea54e24948356b039ad961c857e685c30bb0737 | Solve task #500 | Zmiecer/leetcode,Zmiecer/leetcode | 500.py | 500.py | class Solution(object):
def findWords(self, words):
"""
:type words: List[str]
:rtype: List[str]
"""
rows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm']
def inOneRow(word):
mask = [0, 0, 0]
for i in range(len(rows)):
for ch in word:
... | mit | Python | |
ce3eef2c749f7d9f7bcd1d439497121e89e3727b | Add notification | devicehive/devicehive-python | devicehive/notification.py | devicehive/notification.py | from devicehive.api_object import ApiObject
class Notification(ApiObject):
"""Notification class."""
DEVICE_ID_KEY = 'deviceId'
ID_KEY = 'id'
NOTIFICATION_KEY = 'notification'
PARAMETERS_KEY = 'parameters'
TIMESTAMP_KEY = 'timestamp'
def __init__(self, transport, token, notification):
... | apache-2.0 | Python | |
a02a46752d954c29a65bf8bc5b88fa3545315175 | Add unit tests for timestr() | OakNinja/svtplay-dl,qnorsten/svtplay-dl,dalgr/svtplay-dl,iwconfig/svtplay-dl,dalgr/svtplay-dl,leakim/svtplay-dl,selepo/svtplay-dl,spaam/svtplay-dl,olof/svtplay-dl,leakim/svtplay-dl,OakNinja/svtplay-dl,qnorsten/svtplay-dl,selepo/svtplay-dl,iwconfig/svtplay-dl,olof/svtplay-dl,spaam/svtplay-dl,OakNinja/svtplay-dl,leakim/s... | lib/svtplay_dl/tests/utils.py | lib/svtplay_dl/tests/utils.py | #!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
from __future__ import absolute_import
import unittest
import svtplay_dl.utils
class timestrTest(unittest.TestCase):
def ... | mit | Python | |
46c036cad1323d55c61f546b5cd6174739ab1b42 | add helper functions for data persistence | usc-isi-i2/mydig-webservice,usc-isi-i2/mydig-webservice,usc-isi-i2/mydig-webservice,usc-isi-i2/mydig-webservice | ws/data_persistence.py | ws/data_persistence.py | # https://github.com/usc-isi-i2/dig-etl-engine/issues/92
import json
import threading
import os
import codecs
# 1.acquire file write lock
# 2.write to file.new
# 3.acquire replace lock
# 4.rename file to file.old
# 5.rename file.new to file
# 6.release replace lock and write lock
# 7.remove file.old
def dump_data(da... | mit | Python | |
327b74d5e0328e6415520b907e4c43ed8cb54cf2 | add sample that fetches the graph and renders it as an ascii tree | tariqdaouda/pyArango,tariqdaouda/pyArango | examples/fetchDebianDependencyGraph.py | examples/fetchDebianDependencyGraph.py | #!/usr/bin/python
import sys
from pyArango.connection import *
from pyArango.graph import *
from asciitree import *
conn = Connection(username="root", password="")
db = conn["ddependencyGrahp"]
if not db.hasGraph('debian_dependency_graph'):
raise Exception("didn't find the debian dependency graph, please import ... | apache-2.0 | Python | |
8e73752e9242796a933d3566eb4a5e4470f13d5e | Create sequences.py | edwardjiang7/sequences_project | sequences.py | sequences.py | import random
import sys
import os
# User input
user_input = input("Type in 5 integers of any sequence separated by commas. Example: 1,2,3,4,5: ")
list_input = user_input.split(",")
# Convert numbered strings into integers in list
list_int = list(map(int, list_input))
# Check Arithmetic Sequence
list_arith = list_int... | mit | Python | |
ea40075f8924c2d61da8f92fe9ecf74045bbe6cc | add script to convert Tandem Repeats Finder dat format to bed format required for STRetch | hdashnow/STRetch,Oshlack/STRetch,Oshlack/STRetch,hdashnow/STRetch,Oshlack/STRetch | scripts/TRFdat_to_bed.py | scripts/TRFdat_to_bed.py | #!/usr/bin/env python
from argparse import (ArgumentParser, FileType)
def parse_args():
"Parse the input arguments, use '-h' for help"
parser = ArgumentParser(description='Convert Tandem Repeat Finder (TRF) dat file to bed format with repeat units for microsatellite genotyping')
parser.add_argument(
... | mit | Python | |
272eceebbc44bd7dc44498233a7dca5ab9c2bdd8 | add iplookup | cxhernandez/fah-map,cxhernandez/fah-map | scripts/iplookup.py | scripts/iplookup.py | import sys
import json
import numpy as np
import pandas as pd
import geoip2.database
if len(sys.argv) != 3:
sys.exit('Please specify a GeoLite DB and an ip table.')
reader = geoip2.database.Reader(sys.argv[1])
def get_name(entry, lang):
if hasattr(entry, 'names') and lang in entry.names:
return ent... | mit | Python | |
462cdfaf93f23e227b8da44e143a5ff9e8c047be | test futil for files | hobson/pug-nlp,hobson/pug-nlp,hobson/pug-nlp | tests/test_futil.py | tests/test_futil.py | """Run doctests in pug.nlp.futil."""
from __future__ import print_function, absolute_import
import doctest
import pug.nlp.futil
from unittest import TestCase
class DoNothingTest(TestCase):
"""A useless TestCase to encourage Django unittests to find this module and run `load_tests()`."""
def test_example(se... | mit | Python | |
a1039c2e38243b64d2027621aa87ee020636f23b | Add initial test for routes. | jonathanchu/fpo,jonathanchu/fpo | tests/test_views.py | tests/test_views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import website
import unittest
import tempfile
class FPOTestCase(unittest.TestCase):
def test_homepage(self):
self.app = website.app.test_client()
resp = self.app.get('/')
self.as... | mit | Python | |
6cebbd302556469dd4231d6252ec29c5d7c1165c | add script to convert data from Rime/luna-pinyin | gumblex/pyime | data/convertdict.py | data/convertdict.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
def uniq(seq): # Dave Kirby
# Order preserving
seen = set()
return [x for x in seq if x not in seen and not seen.add(x)]
def pinyin(word):
N = len(word)
pos = 0
result = []
while pos < N:
for i in range(N, pos, -1):
... | mit | Python | |
7553a438672ab68206f30204d572f89bd088e744 | Add files via upload | adigoel/Team-Flux-2017 | pylab.py | pylab.py | import numpy as np
import matplotlib.pyplot as plt
import sympy as sympy
import csv
masterDataList = []
with open('candata.csv', 'r') as f:
reader = csv.reader(f)
for row in reader:
commitList = list(reader)
masterDataList.append(commitList)
print(masterDataList[0][1][0])
"""number of lines of data from csv ... | mit | Python | |
41e3d696967b523d0d031a0a17d18c9804f455ee | Change G+ default type | creimers/djangocms-blog,DjangoBeer/djangocms-blog,marty3d/djangocms-blog,mistalaba/djangocms-blog,vnavascues/djangocms-blog,jedie/djangocms-blog,dapeng0802/djangocms-blog,sephii/djangocms-blog,EnglishConnection/djangocms-blog,EnglishConnection/djangocms-blog,jedie/djangocms-blog,DjangoBeer/djangocms-blog,ImaginaryLands... | djangocms_blog/settings.py | djangocms_blog/settings.py | # -*- coding: utf-8 -*-
from django.conf import settings
from meta_mixin import settings as meta_settings
BLOG_IMAGE_THUMBNAIL_SIZE = getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', {
'size': '120x120',
'crop': True,
'upscale': False
})
BLOG_IMAGE_FULL_SIZE = getattr(settings, 'BLOG_IMAGE_FULL_SIZE', {
... | # -*- coding: utf-8 -*-
from django.conf import settings
from meta_mixin import settings as meta_settings
BLOG_IMAGE_THUMBNAIL_SIZE = getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', {
'size': '120x120',
'crop': True,
'upscale': False
})
BLOG_IMAGE_FULL_SIZE = getattr(settings, 'BLOG_IMAGE_FULL_SIZE', {
... | bsd-3-clause | Python |
ab2b2c6f12e2e5ec53ac6d140919a343a74b7e3c | Update migration | hobarrera/django-afip,hobarrera/django-afip | django_afip/migrations/0017_receipt_issued_date.py | django_afip/migrations/0017_receipt_issued_date.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-10 13:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('afip', '0016_auto_20170529_2012'),
]
operations = [
migrations.AlterField(
... | isc | Python | |
a52dd9d66ff7d9a29f6d635e5ca1a2a0584c267b | Add rosetta utils | lotrekagency/djlotrek,lotrekagency/djlotrek | rosetta_utils.py | rosetta_utils.py | # From: https://github.com/mbi/django-rosetta/issues/50
# Gunicorn may work with --reload option but it needs
# https://pypi.python.org/pypi/inotify package for performances
from django.dispatch import receiver
from rosetta.signals import post_save
import time
import os
@receiver(post_save)
def restart_server(sender... | mit | Python | |
4de410b1ea93665f22874826ceebcea68737dde7 | Add permissions list | TransportLayer/TLBot-Core | tlbot/permission.py | tlbot/permission.py | ###############################################################################
# TransportLayerBot: Permission List - All-in-one modular bot for Discord #
# Copyright (C) 2017 TransportLayer #
# #
... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.