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 |
|---|---|---|---|---|---|---|---|---|
8f15a2964c1cbbd85ed8301997c05a38268c79a7 | add script used during position comparison | ekg/vg,ekg/vg,ekg/vg | scripts/pos_compare.py | scripts/pos_compare.py | #!/usr/bin/python
import sys
threshold = 100
for line in sys.stdin:
fields = line.split(' ')
aln_name = fields[0]
true_chr = fields[1]
true_pos = int(fields[2])
aln_chr = fields[3]
aln_pos = int(fields[4])
aln_mapq = int(fields[5])
aln_correct = 1 if aln_chr == true_chr and abs(true_p... | mit | Python | |
bb2fa19aa09e5687e13dedf40da1c7a2507c4c62 | add script to replace `@` and `.` in slugsin for input to gr1x | johnyf/gr1experiments | examples/slugsin_chars_for_gr1x.py | examples/slugsin_chars_for_gr1x.py | import argparse
def main():
p = argparse.ArgumentParser()
p.add_argument('source', type=str,
help='input file')
p.add_argument('target', type=str,
help='output file')
args = p.parse_args()
with open(args.source, 'r') as f:
s = f.read()
snew = s.rep... | bsd-3-clause | Python | |
1c615be1d3da720d2d0a1974808e3856cbd9d498 | Create Virgil highlevel api implementation | VirgilSecurity/virgil-sdk-python | virgil_sdk/api/virgil_api.py | virgil_sdk/api/virgil_api.py | # Copyright (C) 2016 Virgil Security Inc.
#
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistributions of ... | bsd-3-clause | Python | |
cfc37e2556dc018f1150e647253f377c3e8b75ae | Add subtree_sim.py | kdmurray91/kwip-experiments,kdmurray91/kwip-experiments,kdmurray91/kwip-experiments | scripts/subtree_sim.py | scripts/subtree_sim.py | import numpy as np
from cogent import LoadTree
CLI = """
USAGE:
random_subtree <tree> <n>
Subsamples <n> taxa from the Newick tree in <tree>, preserving the branch
lengths of subsampled taxa.
"""
def main(treefile, n):
n = int(n)
tree = LoadTree(
with open(treefile) as trees:
for tree in tre... | mit | Python | |
e81bfc0ddcfdc321af0608d553b123fa2188de38 | Consolidate implementations | llllllllll/datashape,ContinuumIO/datashape,quantopian/datashape,quantopian/datashape,llllllllll/datashape,blaze/datashape,cpcloud/datashape,cowlicks/datashape,cowlicks/datashape,blaze/datashape,cpcloud/datashape,ContinuumIO/datashape | datashape/user.py | datashape/user.py | from __future__ import print_function, division, absolute_import
from datashape.dispatch import dispatch
from .coretypes import *
from .predicates import isdimension
from .util import dshape
import sys
from datetime import date, time, datetime
__all__ = ['validate', 'issubschema']
basetypes = np.generic, int, float... | from __future__ import print_function, division, absolute_import
from datashape.dispatch import dispatch
from .coretypes import *
from .predicates import isdimension
from .util import dshape
import sys
from datetime import date, time, datetime
__all__ = ['validate', 'issubschema']
basetypes = np.generic, int, float... | bsd-2-clause | Python |
5d0c16c877fb445114d2b77ee7a4d14686320688 | Add Python solution for day 19 | Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015 | day19/solution.py | day19/solution.py | import re
data = open("data", "r").read()
possibleReplacements = {}
possibleReverseReplacements = {}
for replacement in data.split("\n"):
lhs, rhs = replacement.split(" => ")
if lhs in possibleReplacements:
if rhs not in possibleReplacements[lhs]:
possibleReplacements[lhs].append(rhs)
else:
possibleReplace... | mit | Python | |
cdfdf0646151c54001ccbc80eca5c0e8f83ff38a | add tests for Compose class | red-hat-storage/rhcephcompose,red-hat-storage/rhcephcompose | rhcephcompose/tests/test_compose.py | rhcephcompose/tests/test_compose.py | import os
import time
from rhcephcompose.compose import Compose
from kobo.conf import PyConfigParser
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
FIXTURES_DIR = os.path.join(TESTS_DIR, 'fixtures')
class TestCompose(object):
conf_file = os.path.join(FIXTURES_DIR, 'basic.conf')
conf = PyConfigParser... | mit | Python | |
885bf944b7839e54a83ce0737b05ff11fa7d3d86 | Create selfTest.py | christopher-henderson/Experiments,christopher-henderson/Experiments,christopher-henderson/Experiments,christopher-henderson/Experiments,christopher-henderson/Experiments | searchSort/selfTest.py | searchSort/selfTest.py | from random import randrange, shuffle
def quick_sort(collection, low, high):
if low < high:
p = partition(collection, low, high)
quick_sort(collection, low, p)
quick_sort(collection, p + 1, high)
def partition(collection, low, high):
pivot = collection[(low + high) // 2]
low -= 1... | mit | Python | |
20d1a1784f0831c14e6e03bbb86f5b8dd5ae49ea | Create learn.py | cn04/smalltwo | smalltwo/learn.py | smalltwo/learn.py | cc0-1.0 | Python | ||
6090dc1539bd0701381c73128a5ca0606adc09e4 | Add SSDP unit test case (init) | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/utils/test_ssdp.py | tests/utils/test_ssdp.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Bo Maryniuk <bo@suse.de>`
'''
from __future__ import absolute_import, print_function, unicode_literals
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
NO_MOCK,
NO_MOCK_REASON,
MagicMock,
patch)
# Import Salt libs
imp... | apache-2.0 | Python | |
b6d3ab372f57ad9e3c8427ba8bc211136bc1037b | Set version to 0.1.9a1 | gnotaras/django-powerdns-manager,d9pouces/django-powerdns-manager,d9pouces/django-powerdns-manager,kumina/django-powerdns-manager,gnotaras/django-powerdns-manager,kumina/django-powerdns-manager | src/powerdns_manager/__init__.py | src/powerdns_manager/__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of django-powerdns-manager.
#
# django-powerdns-manager is a web based PowerDNS administration panel.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-powerdns-manager
# Public Source Code Repository:
# - https://source.codetrax.org/hgroot/dja... | # -*- coding: utf-8 -*-
#
# This file is part of django-powerdns-manager.
#
# django-powerdns-manager is a web based PowerDNS administration panel.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-powerdns-manager
# Public Source Code Repository:
# - https://source.codetrax.org/hgroot/dja... | apache-2.0 | Python |
70b4afc095873ad226947edc757cbc4d29daf44a | Add test_incomplete_write.py test to reproduce #173 | akumuli/Akumuli,akumuli/Akumuli,akumuli/Akumuli,akumuli/Akumuli | functests/test_incomplete_write.py | functests/test_incomplete_write.py | from __future__ import print_function
import os
import sys
import socket
import datetime
import time
import akumulid_test_tools as att
import json
try:
from urllib2 import urlopen
except ImportError:
from urllib import urlopen
import traceback
import itertools
import math
HOST = '127.0.0.1'
TCPPORT = 8282
HTTP... | apache-2.0 | Python | |
67328984667246325244c0eaba75de7413c3079f | add fibonacci example in redid-example | python-cache/python-cache | example/redis-example/Fibonacci.py | example/redis-example/Fibonacci.py | # import redis driver
import redis
import pymongo
# import python-cache pycache package
from pycache.Adapter import RedisItemPool
from pycache.Adapter import MongoItemPool
from pycache import cached
client = redis.Redis(host='192.168.99.100', port=32771)
pool = RedisItemPool(client)
mongo_client = pymongo.MongoClien... | mit | Python | |
e39415fbe6a325894abb8d098504150b1c515b57 | Create split-linked-list-in-parts.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/split-linked-list-in-parts.py | Python/split-linked-list-in-parts.py | # Time: O(n)
# Space: O(n)
# Given a chemical formula (given as a string), return the count of each atom.
#
# An atomic element always starts with an uppercase character,
# then zero or more lowercase letters, representing the name.
#
# 1 or more digits representing the count of that element may follow if the count i... | mit | Python | |
4709a38f67c80c1516b4eae6eb7d8f54cdd985e2 | Create songsched.py | AbrhmSanchez/Songsched | Songsched/songsched.py | Songsched/songsched.py | mit | Python | ||
9beaa2052b4e47a2fd075f4d9b7988b03a38a8ad | Create main.py | gappleto97/Senior-Project | main.py | main.py | import optparse, settings
def main():
parser = optparse.OptionParser()
parser.add_option('-c',
'--charity',
dest='charity',
default=None,
action="store_true",
help='Sets whether you accept rewardl... | mit | Python | |
c36f36555b8fba183220456e51e04ccbaa08bb60 | add a data file to play with. | cellnopt/cellnopt,cellnopt/cellnopt | cno/data/ToyMMB/__init__.py | cno/data/ToyMMB/__init__.py | from cellnopt.core import XMIDAS, CNOGraph
pknmodel = CNOGraph("PKN-ToyMMB.sif")
data = XMIDAS("MD-ToyMMB.csv")
description = open("README.rst").read()
| bsd-2-clause | Python | |
c1ef15e895d4f79a9ef5c83aa13964d30bc8dbff | Add main loop | smpcole/tic-tac-toe | main.py | main.py | from Board import *
from Player import *
def main():
board = Board()
players = (HumanPlayer('x', board), HumanPlayer('o', board))
turnNum = 0
currentPlayer = None
while not board.endGame():
currentPlayer = players[turnNum % 2]
print "%s's turn" % currentPlayer
currentPlayer.... | mit | Python | |
f31b42ae43e7cd2af53a504c1cc2ab398bf7810d | Add api call for Premier League standings | conormag94/pyscores | main.py | main.py | import json
import requests
from tabulate import tabulate
BASE_URL = "http://api.football-data.org/alpha/"
soccer_seasons = "soccerseasons/"
epl_current_season = "soccerseasons/398/"
league_table = "leagueTable/"
def print_standings(table):
standings = []
for team in table:
entry = [team['position'], team['team... | mit | Python | |
c1d5dca7c487075229b384585e0eb11cd91bbef8 | add import script for Chesterfield | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_chesterfield.py | polling_stations/apps/data_collection/management/commands/import_chesterfield.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000034'
addresses_name = 'May 2017/ChesterfieldDemocracy_Club__04May2017a.txt'
stations_name = 'May 2017/ChesterfieldDemocracy_Club__04May2017a.txt'
ele... | bsd-3-clause | Python | |
04155a80531e58422253e22635f1e496a27a5647 | add import script for South Ribble | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_south_ribble.py | polling_stations/apps/data_collection/management/commands/import_south_ribble.py | from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = 'E07000126'
addresses_name = 'Properties.csv'
stations_name = 'Polling Stations.csv'
elections = ['local.lancashire.2017-0... | bsd-3-clause | Python | |
e0d728519292377915983385285a3560d3207b19 | Create main.py | commagere/commagere.com,commagere/commagere.com,commagere/commagere.com | main.py | main.py | import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write('Hello world!')
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
| mit | Python | |
99b4a6fa8eb96f9228635142d2686b9601f293b5 | Put main.py back | baylee-d/cos.io,baylee-d/cos.io,baylee-d/cos.io,baylee-d/cos.io | main.py | main.py | import wysiweb
import shutil
try:
shutil.rmtree('./frozen')
except:
pass
# site_path: Where are the files that will build the website
# static_path: where are the static files? has to be within site_path
# static_route: what is the route to access static files: <a href="/static/logo.jpg"> for instance.
w = wy... | apache-2.0 | Python | |
62df41780706161c4e25f854de0b6cc5d2664a39 | Add test for templates in include_router path (#349) | tiangolo/fastapi,tiangolo/fastapi,tiangolo/fastapi | tests/test_router_prefix_with_template.py | tests/test_router_prefix_with_template.py | from fastapi import APIRouter, FastAPI
from starlette.testclient import TestClient
app = FastAPI()
router = APIRouter()
@router.get("/users/{id}")
def read_user(segment: str, id: str):
return {"segment": segment, "id": id}
app.include_router(router, prefix="/{segment}")
client = TestClient(app)
def test_g... | mit | Python | |
9123b90f21fc341cbb2e333eb53c5149dfda8e3b | Add Taiwan time transformed. | toomore/goristock | cttwt.py | cttwt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Toomore Chiang, http://toomore.net/
#
# 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... | mit | Python | |
4b7fb1ad3cd03e0593ecd3d0626bca385fb2800d | Add scroller example. | arminha/python-aosd | examples/scroller/scroller.py | examples/scroller/scroller.py | # coding=utf8
#
# python-aosd -- python bindings for libaosd
#
# Copyright (C) 2010 Armin Häberling <armin.aha@gmail.com>
#
# Based on the scroller example from libaosd.
#
import sys
import aosd
def scroll(osd, width, height):
pos = 8
step = 3
osd.set_position(pos, width, height)
(x, y, _, _) =... | mit | Python | |
a9fee0cab6899effa865c73c38baf73e5272d87e | Create main.py | meagtan/harmonizer | main.py | main.py | ### Command line interface for functions
import freqs
import harmonize
import error
import enharmonic
import voice
# 1. Take input from file or user
# 2. Call desired function on input, specifying type of output (show, save to file, etc.)
# 3. Display result
| mit | Python | |
370d6eb7fc4adb2f2769bdf94f56df239760ef0c | Create quiz2.py | mdmirabal/uip-prog3 | laboratorio-f/quiz2.py | laboratorio-f/quiz2.py | print("OFERTAS El Emperador")
ofer1 = 0.30
ofer2 = 0.20
ofer3 = 0.10
while clientes <5:
monto = int(input("Ingrese monto: "))
clientes += 1
if monto >= 500:
subtotal = monto * ofer1
total = monto - subtotal
print("El total es {0}: ".format(total)
if monto < 500 or monto > 200
subtotal = monto * ofer... | mit | Python | |
c8e6fce132d1eaa9d789dd0c7bd2e5c53e4e5424 | Add python user exception function example (#2333) | nkurihar/pulsar,jai1/pulsar,yahoo/pulsar,yahoo/pulsar,ArvinDevel/incubator-pulsar,ArvinDevel/incubator-pulsar,yahoo/pulsar,jai1/pulsar,nkurihar/pulsar,merlimat/pulsar,massakam/pulsar,nkurihar/pulsar,yahoo/pulsar,massakam/pulsar,nkurihar/pulsar,massakam/pulsar,nkurihar/pulsar,jai1/pulsar,nkurihar/pulsar,massakam/pulsar,... | pulsar-functions/python-examples/user_exception.py | pulsar-functions/python-examples/user_exception.py | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | apache-2.0 | Python | |
3aaee714d59650f36e3918e184905048a83d1cfc | Add new filesystem_stat module. | mk23/snmpy,mk23/snmpy | lib/filesystem_stat.py | lib/filesystem_stat.py | import os
import stat
import snmpy
import time
class filesystem_stat(snmpy.plugin):
def s_type(self, obj):
if stat.S_ISDIR(obj):
return 'directory'
if stat.S_ISCHR(obj):
return 'character special device'
if stat.S_ISBLK(obj):
return 'block special device'... | mit | Python | |
7ac6007e28740e0aff89925b10ae09fa6c0b63d3 | add tests for g.current_user | PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature | backend/geonature/tests/test_users_login.py | backend/geonature/tests/test_users_login.py | import pytest
from flask import g, url_for, current_app
from geonature.utils.env import db
from pypnusershub.db.models import User, Application, AppUser, UserApplicationRight, ProfilsForApp
from . import login, temporary_transaction
from .utils import logged_user_headers
@pytest.mark.usefixtures("client_class", "... | bsd-2-clause | Python | |
205bbba27a89e6f89e26164dbf25ce9763865d36 | add ping.py | liuluheng/utils,liuluheng/utils | ping.py | ping.py | #!/usr/bin/env python
# -*- coding:utf8 -*-
import Queue
import threading
import subprocess
import re
import sys
lock = threading.Lock()
def getip(ip):
a = re.match(r'(.*\d+)\.(\d+)-(\d+)',ip)
print a.groups()
start = int(a.group(2))
end = int(a.group(3))+1
iplist = []
for i in range(start,end... | mit | Python | |
1266fd79369634e2a0399e857107487ae589ea20 | add vpc vpc check script | zerOnepal/sensu-community-plugins,rikaard-groupby/sensu-community-plugins,aryeguy/sensu-community-plugins,warmfusion/sensu-community-plugins,pkaeding/sensu-community-plugins,royalj/sensu-community-plugins,justanshulsharma/sensu-community-plugins,tuenti/sensu-community-plugins,nilroy/sensu-community-plugins,broadinstitu... | plugins/aws/check_vpc_vpn.py | plugins/aws/check_vpc_vpn.py | #!/usr/bin/python
import argparse
import boto.ec2
from boto.vpc import VPCConnection
import sys
def main():
try:
conn = boto.vpc.VPCConnection(aws_access_key_id=args.aws_access_key_id, aws_secret_access_key=args.aws_secret_access_key, region=boto.ec2.get_region(args.region))
except:
print "UN... | mit | Python | |
2d6d5c0a07a751a66c3f0495e3a3a67e4296dd77 | Create subreddits_with_zero_gildings.py | Statistica/reddit-gold | subreddits_with_zero_gildings.py | subreddits_with_zero_gildings.py | # Written by Jonathan Saewitz, released March 26th, 2016 for Statisti.ca
# Released under the MIT License (https://opensource.org/licenses/MIT)
import json, plotly.plotly as plotly, plotly.graph_objs as go
########################
# Config #
########################
graph_title="Largest Subreddits Who ... | mit | Python | |
29e18ed63177dbe8306a22e3c0583342f4591464 | Exit routine for a controlled exit from ample | linucks/ample,rigdenlab/ample,linucks/ample,rigdenlab/ample | python/ample_exit.py | python/ample_exit.py | '''
Created on Mar 18, 2015
@author: jmht
'''
import logging
import sys
import traceback
# external imports
try: import pyrvapi
except: pyrvapi=None
def exit(msg):
logger = logging.getLogger()
#header="**** AMPLE ERROR ****\n\n"
header="*"*70+"\n"
header+="*"*20 + " "*10 + "AMPLE ERROR" + " "*1... | bsd-3-clause | Python | |
fa3450a44621fab4a9a2f2ed1599d08f66860f70 | Integrate densities to check normalization | jarthurgross/bloch_distribution | integrate_density.py | integrate_density.py | import argparse
import numpy as np
import h5py
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Integrate probability ' +
'densities to verify that they are ' +
'normalized')
parser.add_argument('data_filenames',... | mit | Python | |
72a573c24d5234003b9eeb9e0cc487d174908a2e | Add a Trie for storage of data string tokens. | geekofalltrades/quora-coding-challenges | typeahead_search/trie.py | typeahead_search/trie.py | """A Trie (prefix tree) class for use in typeahead search.
Every node in the TypeaheadSearchTrie is another TypeaheadSearchTrie instance.
"""
from weakref import WeakSet
class TypeaheadSearchTrie(object):
def __init__(self):
# The children of this node. Because ordered traversals are not
# impor... | mit | Python | |
e5dd1722911e580caca136fda9b81bb53221c65c | add table widget | Ubuntu-Solutions-Engineering/ubuntu-tui-widgets | ubuntui/widgets/table.py | ubuntui/widgets/table.py | # Copyright 2014, 2015 Canonical, Ltd.
#
# This program 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.
#
# This program is dist... | agpl-3.0 | Python | |
51fc613214f20738270f37280fb465aea84ed065 | test the wsgi logging | slimta/python-slimta,fisele/slimta-abusix | test/test_slimta_logging_wsgi.py | test/test_slimta_logging_wsgi.py |
import unittest
from testfixtures import log_capture
from slimta.logging import getWsgiLogger
class TestWsgiLogger(unittest.TestCase):
def setUp(self):
self.log = getWsgiLogger('test')
self.environ = {'var': 'val'}
@log_capture()
def test_request(self, l):
self.log.request(sel... | mit | Python | |
8af510b18a3f0f8298f9a992bffdccc9aee2c8c2 | add sandbox file | erdincay/gmvault,guaycuru/gmvault,gaubert/gmvault,gaubert/gmvault,gaubert/gmvault,guaycuru/gmvault,guaycuru/gmvault,erdincay/gmvault,erdincay/gmvault | src/gmv/sandbox.py | src/gmv/sandbox.py | '''
Created on Jan 30, 2012
@author: guillaume.aubert@gmail.com
'''
from cmdline_utils import CmdLineParser
if __name__ == '__main__':
global_parser = CmdLineParser()
global_parser.disable_interspersed_args()
| agpl-3.0 | Python | |
65f149c33c1ec6e7d7262092def4b175aa52fe54 | Create BinTreeRightSideView_001.py | Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/codi,cc13ny/algo,Chasego/codi,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,Chasego/codirit,Chasego/cod,Chasego/codirit,Chasego/codirit,cc13ny/algo,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,Ch... | leetcode/199-Binary-Tree-Right-Side-View/BinTreeRightSideView_001.py | leetcode/199-Binary-Tree-Right-Side-View/BinTreeRightSideView_001.py | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return a list of integers
def rightSideView(self, root):
if root == None:
... | mit | Python | |
01c74cfea946eac098a0e144380314cd4676cf2f | Split lowpass filtering into another script. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/04-lowpass.py | analysis/04-lowpass.py | #!/usr/bin/env python
from __future__ import division
import climate
import lmj.cubes
import pandas as pd
import scipy.signal
logging = climate.get_logger('lowpass')
def lowpass(df, freq=10., order=4):
'''Filter marker data using a butterworth low-pass filter.
This method alters the data in `df` in-place.
... | mit | Python | |
0224a259c7fd61fbabdb8ab632471e68b7fd6b4a | Add script used to generate devstats repo groups | pwittrock/community,pwittrock/community,kubernetes/community,kubernetes/community,kubernetes/community | hack/generate-devstats-repo-sql.py | hack/generate-devstats-repo-sql.py | #!/usr/bin/env python3
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 | Python | |
6a6b9eff5e5d0d7c4a1a969b15a2a4583cf79855 | add game-of-throne-ii | EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,EdisonA... | algorithms/strings/game-of-throne-ii/game-of-throne-ii.py | algorithms/strings/game-of-throne-ii/game-of-throne-ii.py | from collections import Counter
MOD = 10**9 + 7
def factMod(x):
ret = 1
for i in range(1, x):
ret = (ret * (i + 1)) % MOD;
return ret
def powMod(x, y):
if y == 0:
return 1
if y == 1:
return x % MOD
temp = powMod(x, y / 2)
if y % 2 == 0:
return (temp * temp)... | mit | Python | |
6a9b6f0227b37d9c4da424c25d20a2b7e9397a9f | Make `publication_date` column not nullable. | gthank/pytips,gthank/pytips,gthank/pytips,gthank/pytips | alembic/versions/3800f47ba771_publication_date_not_nullable.py | alembic/versions/3800f47ba771_publication_date_not_nullable.py | """Make the `publication_date` column required.
Revision ID: 3800f47ba771
Revises: 17c1af634026
Create Date: 2012-12-13 21:14:19.363112
"""
# revision identifiers, used by Alembic.
revision = '3800f47ba771'
down_revision = '17c1af634026'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_c... | isc | Python | |
7bae0fdf5fb6c92548875d21d00daa01cfe86100 | Add test | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/motech/repeaters/expression/tests.py | corehq/motech/repeaters/expression/tests.py | import json
from datetime import datetime, timedelta
from django.test import TestCase
from casexml.apps.case.mock import CaseFactory
from corehq.apps.accounting.models import SoftwarePlanEdition
from corehq.apps.accounting.tests.utils import DomainSubscriptionMixin
from corehq.apps.accounting.utils import clear_plan... | bsd-3-clause | Python | |
57e2776a59214318d335f2fa0e2cc1854c33d488 | Add lc0532_k_diff_pairs_in_an_array.py | bowen0701/algorithms_data_structures | lc0532_k_diff_pairs_in_an_array.py | lc0532_k_diff_pairs_in_an_array.py | """Leetcode 532. K-diff Pairs in an Array
Easy
URL: https://leetcode.com/problems/k-diff-pairs-in-an-array/
Given an array of integers and an integer k, you need to find the number
of unique k-diff pairs in the array. Here a k-diff pair is defined as an
integer pair (i, j), where i and j are both numbers in the arra... | bsd-2-clause | Python | |
c5a736a742897874262259a5199674b7f949de75 | test coverage for templates | evansde77/dockerstache,evansde77/dockerstache,evansde77/dockerstache | test/unit/templates_tests.py | test/unit/templates_tests.py | #!/usr/bin/env python
"""
templates tests
"""
import os
import json
import unittest
import tempfile
import dockerstache.templates as templ
class TemplatesTests(unittest.TestCase):
"""
test coverage for templates module
"""
def setUp(self):
self.tempdir = tempfile.mkdtemp()
self.target_... | apache-2.0 | Python | |
a66ce55c2abcb434168aadb195fd00b8df6f4fd1 | add scoreboard game test | jaebradley/nba_data | tests/test_scoreboardGame.py | tests/test_scoreboardGame.py | from unittest import TestCase
from datetime import datetime
from nba_data.data.scoreboard_game import ScoreboardGame
from nba_data.data.season import Season
from nba_data.data.team import Team
from nba_data.data.matchup import Matchup
class TestScoreboardGame(TestCase):
def test_instantiation(self):
game... | mit | Python | |
6b1be6883ead01cc226226499644adb7e99542f8 | Add functionality to load and test a saved model | harpribot/representation-music,harpribot/representation-music | Experiments/evaluate_model.py | Experiments/evaluate_model.py | # import os
import sys
import tensorflow as tf
# sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../..'))
from Models.low_level_sharing_four_hidden import LowLevelSharingModel
from utils.data_utils.labels import Labels
from utils.data_utils.data_handler import fetch_data
class EvaluateModel(object... | mit | Python | |
d883cfac71c9ec39abcd75e79b9bec0f53e7890d | Initialize transpositionHacker | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter12/transpositionHacker.py | books/CrackingCodesWithPython/Chapter12/transpositionHacker.py | # Transposition Cipher Hacker
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import pyperclip, detectEnglish, transpositionDecrypt
def main():
# You might want to copy & paste this text from the source code at
# https://www.nostarch.com/crackingcodes/:
myMessage = """AaKoosoeDe5 b5sn ma reno ora... | mit | Python | |
75805397dd62cfa00eb9a9d253259ea9c79f426b | Test Issue #605 | Gregory-Howard/spaCy,explosion/spaCy,explosion/spaCy,recognai/spaCy,oroszgy/spaCy.hu,Gregory-Howard/spaCy,raphael0202/spaCy,raphael0202/spaCy,aikramer2/spaCy,oroszgy/spaCy.hu,aikramer2/spaCy,honnibal/spaCy,honnibal/spaCy,raphael0202/spaCy,recognai/spaCy,Gregory-Howard/spaCy,banglakit/spaCy,oroszgy/spaCy.hu,spacy-io/spa... | spacy/tests/regression/test_issue605.py | spacy/tests/regression/test_issue605.py | from ...attrs import LOWER, ORTH
from ...tokens import Doc
from ...vocab import Vocab
from ...matcher import Matcher
def return_false(doc, ent_id, label, start, end):
return False
def test_matcher_accept():
doc = Doc(Vocab(), words=[u'The', u'golf', u'club', u'is', u'broken'])
golf_pattern = [
... | mit | Python | |
38dd3604918b2e0d7770e855f775db9ff6720de8 | Add initial DrugBank client | bgyori/indra,johnbachman/belpy,bgyori/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,bgyori/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/indra | indra/databases/drugbank_client.py | indra/databases/drugbank_client.py | import os
from indra.util import read_unicode_csv
mappings_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
os.pardir, 'resources', 'drugbank_mappings.tsv')
def get_chebi_id(drugbank_id):
return drugbank_chebi.get(drugbank_id)
def get_chembl_id(drugbank_id):
ret... | bsd-2-clause | Python | |
84fcbb34005c5bfa19d33e583ca48583b04baeb4 | Create mp3tag.py | WebShark025/TheZigZagProject,WebShark025/TheZigZagProject | plugins/mp3tag.py | plugins/mp3tag.py | .
| mit | Python | |
407e0b6596539a5f8fcac099c11f1fabc956ea26 | add plugin to show available package updates | bmbove/i3pybar | plugins/pacman.py | plugins/pacman.py | """
@author Brian Bove https://github.com/bmbove
"""
import re
import subprocess
from .base import PluginBase
class PacmanPlugin(PluginBase):
def configure(self):
defaults = {
'format': 'pacman {updates}'
}
return defaults
def get_update_count(self):
lines = subp... | mit | Python | |
9f9e69ac19e982cd6cc577262704fa5c9f4ebdfc | Create test_logo_client.py (#90) | gijzelaerr/python-snap7 | test/test_logo_client.py | test/test_logo_client.py | import unittest
import logging
import time
#import mock
from subprocess import Popen
from os import path, kill
import snap7
logging.basicConfig(level=logging.WARNING)
ip = '127.0.0.1'
tcpport = 1102
db_number = 1
rack = 0x1000
slot = 0x2000
class TestLogoClient(unittest.TestCase):
@classmethod
def setUpCl... | mit | Python | |
71b84632478d5767e742a178edb222745dbd3aa3 | Add tests for bson serialization functions | oneklc/dimod,oneklc/dimod | tests/test_serialization_bson.py | tests/test_serialization_bson.py | import unittest
import dimod
from dimod.serialization.bson import bqm_bson_decoder, bqm_bson_encoder
import numpy as np
try:
import bson
_bson_imported = True
except ImportError:
_bson_imported = False
class TestBSONSerialization(unittest.TestCase):
def test_empty_bqm(self):
bqm = dimod.Bina... | apache-2.0 | Python | |
3501462ebafa15b19ef436231a5a0d9e3b5d430a | Add first implementation of virtual ontology | johnbachman/indra,johnbachman/belpy,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/belpy,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/indra | indra/ontology/virtual_ontology.py | indra/ontology/virtual_ontology.py | import requests
from .ontology_graph import IndraOntology
class VirtualOntology(IndraOntology):
def __init__(self, url, ontology='bio'):
super().__init__()
self.url = url
self.ontology = ontology
def initialize(self):
self._initialized = True
def _rel(self, ns, id, rel_ty... | bsd-2-clause | Python | |
2154c816cdb3ff0f4a98980a2d590888f6819c81 | add signals | MrKiven/REST_ARCH,MrKiven/REST_ARCH | rest_arch/signals.py | rest_arch/signals.py | # -*- coding: utf-8 -*-
from blinker import signal
before_api_called = signal('before_api_called')
after_api_called = signal('after_api_called')
# TODO add more signals
| mit | Python | |
00c5dbbdeee045d9e474ce7b6094cd49df528b05 | add container tests | lmtierney/watir-snake | tests/container_tests.py | tests/container_tests.py | import pytest
from watir_snake.container import Container
class TestContainerExtractSelector(object):
def test_converts_2_arg_selector_into_a_dict(self):
assert Container()._extract_selector('how', 'what') == {'how': 'what'}
def test_returns_the_kwargs_given(self):
assert Container()._extrac... | mit | Python | |
1aebdce5d2fb233927930175fe60e205bca50962 | Fix test :) | peterjanes/dosage,blade2005/dosage,webcomics/dosage,blade2005/dosage,webcomics/dosage,peterjanes/dosage | tests/test_comicnames.py | tests/test_comicnames.py | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import re
from dosagelib import scraper
class TestComicNames(object):
... | # -*- coding: utf-8 -*-
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2016 Tobias Gruetzmacher
from dosagelib import scraper, util
class TestComicNames(object):
def test_names(self):
for scraperclass in scraper.get_scraperclasses():
name = scraperclass.getName()
as... | mit | Python |
8b55c8a524dd853be2c72951f3656db1a991d0bc | test for Experiment class | olivierverdier/odelab | tests/test_experiment.py | tests/test_experiment.py | #!/usr/bin/env python
# −*− coding: UTF−8 −*−
from __future__ import division
from odelab.solver import SingleStepSolver
from odelab.system import System
from odelab.scheme import ExplicitEuler
from odelab.experiment import Experiment
import numpy as np
import nose.tools as nt
def f(t,u):
return -u
def test_experi... | bsd-3-clause | Python | |
5e52a7551b20f74d0b08393e8da89463bb6b5366 | add new tests for busco | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/test_busco.py | test/test_busco.py | from sequana.busco import BuscoConfig, BuscoDownload
from sequana import sequana_data
from easydev import TempFile
def test_busco_config():
bc = BuscoConfig("species", outpath="test", sample_name="test",
conda_bin_path="test", tmp_path="test", hmmsearch_bin_path="itest",
Rscript_bin_path=No... | bsd-3-clause | Python | |
a4ad209ba361ed07574de37598bcedd3ea499a0a | add test file for testing patches | grahamegee/diffr | test/test_patch.py | test/test_patch.py | # The positive cases of patch are extensively tested in test_diff.py because a
# sensible way to validate a diff of two objects is to check that when you apply
# the patch to the first object you get the second.
# Here the testing mainly focuses on patch operations which would fail and some
# of the obscure positive ca... | mit | Python | |
3e8dad480392cc654bca0b0fdf3ac27f4f4be3c6 | Add speed test script | hammerlab/mhcflurry,hammerlab/mhcflurry | test/test_speed.py | test/test_speed.py | import numpy
numpy.random.seed(0)
import time
import cProfile
import pstats
import pandas
from mhcflurry import Class1AffinityPredictor
from mhcflurry.common import random_peptides
NUM = 100000
DOWNLOADED_PREDICTOR = Class1AffinityPredictor.load()
def test_speed(profile=False):
starts = {}
timings = {}
... | apache-2.0 | Python | |
3283c9ac640112ab7a26ec3f82e051394ca72ecf | Add catapult presubmit with list of trybots. | catapult-project/catapult-csm,dstockwell/catapult,sahiljain/catapult,catapult-project/catapult,zeptonaut/catapult,catapult-project/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,modulexcite/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult,catapult-project/catapult-csm,dstockwell/cata... | PRESUBMIT.py | PRESUBMIT.py | # Copyright (c) 2015 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.
"""Top-level presubmit script for catapult.
See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the pres... | bsd-3-clause | Python | |
e39abc889b27c5cebb4c098b2c3858f2a861a6d3 | test to build lstm ner model | dragoon/kilogram,dragoon/kilogram,dragoon/kilogram | kilogram/entity_types/test.py | kilogram/entity_types/test.py | import sys
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.recurrent import LSTM
from gensim.models import word2vec
def get_features(sentence, index):
vector = np.array([])
vector = vector.reshape((0, 128))
# get the context and create a train... | apache-2.0 | Python | |
05a5599fd0cf08cf33c8a90673e8c71b4c1d6c36 | Test implementation of convex hull | tylerburnham42/ProgrammingTeam,MercerBinaryBears/Slides,tylerburnham42/ProgrammingTeam,MercerBinaryBears/Slides,MercerBinaryBears/Slides,MercerBinaryBears/Slides,MercerBinaryBears/Slides,tylerburnham42/ProgrammingTeam | slides/ComputationalGeometry/convex-hull.py | slides/ComputationalGeometry/convex-hull.py | import math
class Vector:
def __init__(self, x, y):
self.x = x
self.y = y
# add theta, so we can sort by it later
self.theta = math.atan2(y, x)
def add(self, other):
return Vector(self.x + other.x, self.y + other.y)
def negate(self):
return Vec... | mit | Python | |
e0597427d93f2260dfce35cfdd3e2714037fb0fb | Implement cheb_dif for getting 1D chebyshev grids and differentiation matrices. | dsteinmo/pysws,dsteinmo/pysws | src/spatial_discretizations/FourierChebyshevSpatialDiscretization.py | src/spatial_discretizations/FourierChebyshevSpatialDiscretization.py | import numpy as np
from numpy.fft import fft, ifft, fftshift, fft2, ifft2
from scipy.linalg import toeplitz
class FourierChebyshevSpatialDiscretization:
def __init__(self, config):
self.length_x = config['length_x']
self.length_y = config['length_y']
self.num_points_x = config['num_points_x... | mit | Python | |
0cb320dee7336f7e68bc9cc5efe0ae88de5541fb | Add YCM config | roman-kashitsyn/libdocset,roman-kashitsyn/libdocset,roman-kashitsyn/libdocset | .ycm_extra_conf.py | .ycm_extra_conf.py | import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-D... | mit | Python | |
23bd2cedbeeef22715fbd65229f881e7230507d8 | Create decorator.py | joshavenue/python_notebook | notebook2/decorator.py | notebook2/decorator.py | def decor(func):
def wrap():
print('===')
func()
print('===')
return wrap
def print_text():
print('Text')
decorated = decor(print_text)
decorated()
| unlicense | Python | |
42c9ce432f1e5a328fe35eef64d0667a01eeeb19 | allow it to have a name and a type | dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild | python/qidoc/template_project.py | python/qidoc/template_project.py | class TemplateProject(object):
def __init__(self, doc_worktree, worktree_project):
self.doc_type = "template"
self.name = "template"
self.src = worktree_project.src
self.path = worktree_project.path
self.doc_worktree = doc_worktree
##
# Add self.doxfile_in, self.sphi... | class TemplateProject(object):
def __init__(self, doc_worktree, worktree_project):
self.src = worktree_project.src
self.path = worktree_project.path
self.doc_worktree = doc_worktree
##
# Add self.doxfile_in, self.sphinx_conf_in, etc.
def __repr__(self):
return "<Templat... | bsd-3-clause | Python |
2a1e09f99c5c1c80286048a27d6ba0c2ef7fc5b3 | Add none property store | trevor/calendarserver,trevor/calendarserver,trevor/calendarserver | txdav/base/propertystore/none.py | txdav/base/propertystore/none.py | # -*- test-case-name: txdav.base.propertystore.test.test_none,txdav.caldav.datastore,txdav.carddav.datastore -*-
##
# Copyright (c) 2010-2011 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may o... | apache-2.0 | Python | |
d77dd62203e0898ab326092c410638a0274e53d9 | Initialize P02_errorExample | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter10/P02_errorExample.py | books/AutomateTheBoringStuffWithPython/Chapter10/P02_errorExample.py | # This program raises an exception and automatically displays the traceback
def spam():
bacon()
def bacon():
raise Exception("This is the error message.")
spam()
| mit | Python | |
61d0649925fae2d1eca1f512ec519f440f4a5528 | Create OutputNeuronGroup_multiple_outputs_2.py | ricardodeazambuja/BrianConnectUDP | examples/OutputNeuronGroup_multiple_outputs_2.py | examples/OutputNeuronGroup_multiple_outputs_2.py | '''
Example of a spike receptor (only receives spikes)
In this example spikes are received and processed creating a raster plot at the end of the simulation.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
# The main function with the NeuronGroup(s) and Synapse(s) must be na... | cc0-1.0 | Python | |
180a1cd82b02d23b824d706c44d4c6838eca0dd2 | Add from_nailgun.py manager | zen/solar,loles/solar,pigmej/solar,loles/solar,openstack/solar,zen/solar,pigmej/solar,Mirantis/solar,openstack/solar,Mirantis/solar,pigmej/solar,openstack/solar,loles/solar,Mirantis/solar,zen/solar,zen/solar,Mirantis/solar,loles/solar | f2s/resources/role_data/managers/from_nailgun.py | f2s/resources/role_data/managers/from_nailgun.py | #!/usr/bin/env python
import sys
import json
from fuelclient.objects.environment import Environment
ARGS = json.loads(sys.stdin.read())
env = Environment(ARGS['env'])
facts = env.get_default_facts('deployment', [ARGS['uid']])
sys.stdout.write(json.dumps(facts))
| apache-2.0 | Python | |
cd444633870a83adc4220b0bc7025a4ee014ba69 | Add e2e testing python file | anirbanroydas/ci-testing-python,anirbanroydas/ci-testing-python,anirbanroydas/ci-testing-python | tests/e2e/test_e2e_identidock.py | tests/e2e/test_e2e_identidock.py | import sys
print(sys.path)
| mit | Python | |
d22e9e6c5c7bded0be5d5c90e86c8dd4ea9ba7d0 | add tests for tree plotting | simpeg/discretize,simpeg/discretize,simpeg/discretize | tests/tree/test_tree_plotting.py | tests/tree/test_tree_plotting.py | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import unittest
from discretize import TreeMesh
matplotlib.use("Agg")
class TestOcTreePlotting(unittest.TestCase):
def setUp(self):
mesh = TreeMesh([32, 32, 32])
mesh.refine_box([0.2, 0.2, 0.2], [0.5, 0.7, 0.8], 5)
self.... | mit | Python | |
475560d9e7320f93bf3e3d40506ffe2092e59d07 | check soft clip position | shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl | lib/QC/bamSoftClipPosition.py | lib/QC/bamSoftClipPosition.py | import pysam
import argparse
import sys
import logging
import os
from asyncore import read
parser = argparse.ArgumentParser(description="Build soft clip position distribution in BAM file.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
DEBUG=False
NOT_DEBUG = not ... | apache-2.0 | Python | |
4c6de322d04504e4c0c2c46f686820d3d62b7dac | Add mdata grains as separate module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/grains/mdata.py | salt/grains/mdata.py | # -*- coding: utf-8 -*-
'''
test grains
'''
from __future__ import absolute_import
# Import python libs
import os
import logging
# Import salt libs
import salt.utils
# Solve the Chicken and egg problem where grains need to run before any
# of the modules are loaded and are generally available for any usage.
impo... | apache-2.0 | Python | |
ccdc943f4c0292d6046b32cacab410ba6cf1477a | Add the StatePass module | MarquisLP/Sidewalk-Champion | lib/game_states/state_pass.py | lib/game_states/state_pass.py | """This module contains the StatePass class which defines the data
object that will be passed between Game States.
"""
from pygame.mixer import Channel
from lib.custom_data.settings_data import SettingsData
class StatePass(object):
"""Stores common data that will be passed between Game States.
All States sho... | unlicense | Python | |
7d09120e1122c5b9888368e7d98b41fe8fdedf87 | add script to send test messages to MNOs | myvoice-nigeria/myvoice,myvoice-nigeria/myvoice,myvoice-nigeria/myvoice,myvoice-nigeria/myvoice | scripts/test-MNOs.py | scripts/test-MNOs.py | #!/usr/bin/env python
import urllib2
import urllib
import sys
import datetime
import pytz
test_phones = [
('MTN', '2348142235832'),
('Etisalat', '2348183273915'),
('Glo', '2348117159357'),
('Airtel', '2347010915898'),
]
wat = pytz.timezone('Africa/Lagos')
for via_operator, _ in test_phones:
for p... | bsd-2-clause | Python | |
0eab290aa16a28a3efd82dadea1e545796b7ca68 | Add spider for UPS Store | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/upsstore.py | locations/spiders/upsstore.py | import scrapy
import json
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
DAY_MAPPING = {
"MONDAY": "Mo",
"TUESDAY": "Tu",
"WEDNESDAY": "We",
"THURSDAY": "Th",
"FRIDAY": "Fr",
"SATURDAY": "Sa",
"SUNDAY": "Su"
}
class UpsStoreSpider(scrapy.Spider):
... | mit | Python | |
308fb5c3cb69966d7f7bf20ea1e4753d68d3fe4b | Add init | jeffreyliu3230/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,fabianvf/scrapi,erinspace/scrapi,alexgarciac/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,ostwald/scrapi,felliott/scrapi,mehanig/scrapi,icereval/scrapi | scrapi/consumers/cmu/__init__.py | scrapi/consumers/cmu/__init__.py | from consumer import consume, normalize | apache-2.0 | Python | |
79343dda0711e34ef577ff37bddfe3f83d0035f5 | add script to fetch NOMADS data | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/model/fetch_nomads_nc.py | scripts/model/fetch_nomads_nc.py | """
Download netcdf data from NOMADS Thredds service, run as
/usr/local/python/bin/python fetch_nomads_nc.py
"""
import mx.DateTime
import subprocess
# start time, GMT
sts = mx.DateTime.DateTime(2010,11,1)
# end time, GMT
ets = mx.DateTime.DateTime(2012,9,17)
# Interval
interval = mx.DateTime.RelativeDateTime(hours=6... | mit | Python | |
44f81107d829f76d9f6338a0ba2545a68539515e | Introduce Partial differences class. | microy/MeshToolkit,microy/PyMeshToolkit,microy/MeshToolkit,microy/PyMeshToolkit | Core/Difference.py | Core/Difference.py | # -*- coding:utf-8 -*-
#--
#
# Copyright (C) 2013-2014 Michaël Roy
#
#--
#--
#
# External dependencies
#
#--
#
from numpy import array
#--
#
# Difference
#
#--
#
# Defines a class representing partial differences on triangular mesh
#
class Difference :
#--
#
# Initialisation
#
#--
#
def __init__( self, ... | mit | Python | |
059a9b14e6db26f6131d41e758d1f14b33bc25b8 | add python script to jump to a random line | vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam | vim/goto-random.py | vim/goto-random.py | import random
import vim
# Jumps to a random line inside the current buffer. Helpful if you have lots of
# testcases inside a single file and you want to minimize conflicts, i.e. just
# appending tests to the end of the file is a bad strategy.
def main():
# Add an entry to the jump list.
vim.command("normal! ... | mit | Python | |
ae6eb7d4716cab50e8850a94a93c96167337c150 | add fourth tool of Ultimate family, Ultimate GemCutter | ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec | benchexec/tools/ultimategemcutter.py | benchexec/tools/ultimategemcutter.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2016-2021 Daniel Dietsch <dietsch@informatik.uni-freiburg.de>
# SPDX-FileCopyrightText: 2016-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
fr... | apache-2.0 | Python | |
b24cc6048a07f1e0787cbd732c29583bcdf5ba3d | Add the roman.py module which docutils require. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Doc/tools/roman.py | Doc/tools/roman.py | """Convert to and from Roman numerals"""
__author__ = "Mark Pilgrim (f8dy@diveintopython.org)"
__version__ = "1.4"
__date__ = "8 August 2001"
__copyright__ = """Copyright (c) 2001 Mark Pilgrim
This program is part of "Dive Into Python", a free Python tutorial for
experienced programmers. Visit http://diveintopython.... | mit | Python | |
772ebd24f21f69eacfaae2b1a6658b82031dbd75 | add import script for North Norfolk | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_north_norfolk.py | polling_stations/apps/data_collection/management/commands/import_north_norfolk.py | from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseCsvStationsCsvAddressesImporter
from data_finder.helpers import geocode_point_only, PostcodeError
class Command(BaseCsvStationsCsvAddressesImporter):
council_id = 'E07000147'
addresses_name = 'PropertyPostCodePo... | bsd-3-clause | Python | |
912ec1162e18b6ffc05ecebaf74f0b946748fa00 | fix device/proxy functions arguments names to | caidongyun/pyzmq,dash-dash/pyzmq,caidongyun/pyzmq,swn1/pyzmq,swn1/pyzmq,dash-dash/pyzmq,ArvinPan/pyzmq,dash-dash/pyzmq,swn1/pyzmq,Mustard-Systems-Ltd/pyzmq,caidongyun/pyzmq,yyt030/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq,ArvinPan/pyzmq,ArvinPan/pyzmq | zmq/cffi_core/devices.py | zmq/cffi_core/devices.py | # coding: utf-8
from ._cffi import C, ffi, zmq_version_info
from .socket import Socket
from zmq.error import ZMQError
def device(device_type, frontend, backend):
rc = C.zmq_device(device_type, frontend._zmq_socket, backend._zmq_socket)
if rc != 0:
raise ZMQError(C.zmq_errno())
return rc
def pro... | # coding: utf-8
from ._cffi import C, ffi, zmq_version_info
from .socket import Socket
from zmq.error import ZMQError
def device(device_type, isocket, osocket):
rc = C.zmq_device(device_type, isocket.zmq_socket, osocket.zmq_socket)
if rc != 0:
raise ZMQError(C.zmq_errno())
return rc
def proxy(i... | bsd-3-clause | Python |
a9348b49b6e91046941fb3af3a6b85edd072d7d9 | add a module for descriptors | SMFOSS/CheesePrism,sciyoshi/CheesePrism,whitmo/CheesePrism,sciyoshi/CheesePrism,SMFOSS/CheesePrism,whitmo/CheesePrism,whitmo/CheesePrism | cheeseprism/desc.py | cheeseprism/desc.py | class updict(dict):
"""
A descriptor that updates it's internal represention on set, and
returns the dictionary to original state on deletion.
"""
def __init__(self, *args, **kw):
super(updict, self).__init__(*args, **kw)
self.default = self.copy()
def __get__(self, obj, ob... | bsd-2-clause | Python | |
dc477c7b1f0e0ffca01b934919cd32cbd635baab | Implement web scraper for GitHub repos | hackebrot/cibopath | cibopath/scraper.py | cibopath/scraper.py | # -*- coding: utf-8 -*-
import asyncio
import logging
import aiohttp
from cibopath import readme_parser, github_api
from cibopath.templates import Template
logger = logging.getLogger('cibopath')
JSON_STORE = 'templates.json'
class CibopathError(Exception):
"""Custom error class for the app."""
class Cookie... | bsd-3-clause | Python | |
549562247018e9c51e8cb8023972c1cf73fc84f4 | add gc01.py | devlights/try-python | trypython/stdlib/gc01.py | trypython/stdlib/gc01.py | # coding: utf-8
"""gcモジュールについてのサンプルです。"""
import gc
import secrets
import string
from trypython.common.commoncls import SampleBase, timetracer
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def __init__(self) -> None:
super().__init__()
self._data_list = None
self._c... | mit | Python | |
4593aa5edf05b014aa6c7fe9de8b239ab2fa91b8 | Add snapshot_framework_stats.py script | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | scripts/snapshot_framework_stats.py | scripts/snapshot_framework_stats.py | #!/usr/bin/env python
"""Change user password
Usage:
snapshot_framework_stats.py <framework_slug> <stage> <api_token>
Example:
./snapshot_framework_stats.py g-cloud-7 dev myToken
"""
import sys
import logging
logger = logging.getLogger('script')
logging.basicConfig(level=logging.INFO)
from docopt import do... | mit | Python | |
dcd02e0a7b626111bc0fc344df9f6fff2de832ae | Add a (bad) example of missing method. | zeth/ainod,zeth/ainod,zeth/ainod | examples/missingmethod.py | examples/missingmethod.py | #!/usr/bin/python3
"""Send an invalid request with missing method member."""
from simpleclient import send_data_to_socket
EXAMPLE = {
"params": {
"filter": {
'store': 'catalog',
'schema': 'product',
'id': '704e418e-682d-4ade-99be-710f2208102e'
}
}
}
def m... | lgpl-2.1 | Python | |
57b9fcfa5b200ec971f8f3070447cbc98026f5a5 | add example of variable-length array branch | ndawe/rootpy,ndawe/rootpy,ndawe/rootpy,kreczko/rootpy,rootpy/rootpy,rootpy/rootpy,rootpy/rootpy,kreczko/rootpy,kreczko/rootpy | examples/tree/vararray.py | examples/tree/vararray.py | #!/usr/bin/env python
"""
=================================
Trees with variable-length arrays
=================================
This example demonstrates how to create a tree with a variable-length array.
"""
print(__doc__)
from rootpy.tree import Tree, TreeModel, IntCol, FloatArrayCol
from rootpy.io import root_open... | bsd-3-clause | Python | |
8ab83988f66270c76b28f36e8263f029011e773b | use Task & Job, a Task has many Jobs | zws0932/farmer,zws0932/farmer,huoxy/farmer | farmer/models.py | farmer/models.py | #coding=utf8
import os
import time
import json
from datetime import datetime
from commands import getstatusoutput
from django.db import models
class Task(models.Model):
# hosts, like web_servers:host1 .
inventories = models.TextField(null = False, blank = False)
# 0, do not use sudo; 1, use sudo .
... | #coding=utf8
import os
import time
import json
from datetime import datetime
from commands import getstatusoutput
from django.db import models
class Job(models.Model):
# hosts, like web_servers:host1 .
inventories = models.TextField(null = False, blank = False)
# 0, do not use sudo; 1, use sudo .
s... | mit | Python |
d692508e9c6fba847f3bb179bbfd3684e6ebcef0 | Add py solution for 384. Shuffle an Array | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/shuffle-an-array.py | py/shuffle-an-array.py | from random import randint
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
"""
self.nums = nums
def reset(self):
"""
Resets the array to its original configuration and return it.
:rtype: List[int]
"""
return se... | apache-2.0 | Python | |
6c7b9a0315bf12fb3e40ddd49f43fe8bec5c6132 | Create 0001_0.py | Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python | pylyria/0001/0001_0.py | pylyria/0001/0001_0.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
import random
import string
def activation_code(id,length=16):
prefix = hex(int(id))[2:]+'V'
length = length - len(prefix)
chars=string.ascii_uppercase+string.digits
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.