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 |
|---|---|---|---|---|---|---|---|---|
bb649f299538c76d555e30ac0d31e2560e0acd3e | Add test | kamaxeon/fap | tests/test_calculator.py | tests/test_calculator.py | import unittest
from app.calculator import Calculator
class TestCalculator(unittest.TestCase):
def setUp(self):
self.calc = Calculator()
def test_calculator_addition_method_returns_correct_result(self):
calc = Calculator()
result = calc.addition(2,2)
self.assertEqual(4, resu... | apache-2.0 | Python | |
630309837989e79ba972358a3098df40892982f5 | Create rrd_ts_sync.py | ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station | rrd_ts_sync.py | rrd_ts_sync.py | #-------------------------------------------------------------------------------
#
# Controls shed weather station
#
# The MIT License (MIT)
#
# Copyright (c) 2015 William De Freitas
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (... | mit | Python | |
b20a6ccc211060644ff3e6f89428420fa59f5a5d | add a couple of tests for the build_scripts command | pypa/setuptools,pypa/setuptools,pypa/setuptools | tests/test_build_scripts.py | tests/test_build_scripts.py | """Tests for distutils.command.build_scripts."""
import os
import unittest
from distutils.command.build_scripts import build_scripts
from distutils.core import Distribution
from distutils.tests import support
class BuildScriptsTestCase(support.TempdirManager, unittest.TestCase):
def test_default_settings(self... | mit | Python | |
3cf30bac4d20dbebf6185351ba0c10426a489de9 | Add sanity linter to catch future use | Vizerai/grpc,jboeuf/grpc,vjpai/grpc,carl-mastrangelo/grpc,carl-mastrangelo/grpc,ncteisen/grpc,grpc/grpc,dgquintas/grpc,chrisdunelm/grpc,ctiller/grpc,nicolasnoble/grpc,jtattermusch/grpc,mehrdada/grpc,sreecha/grpc,chrisdunelm/grpc,firebase/grpc,ncteisen/grpc,jboeuf/grpc,jboeuf/grpc,jboeuf/grpc,pszemus/grpc,thinkerou/grpc... | tools/run_tests/sanity/check_channel_arg_usage.py | tools/run_tests/sanity/check_channel_arg_usage.py | #!/usr/bin/env python
# Copyright 2018 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | apache-2.0 | Python | |
51d0623da276aa60a0da4d48343f215f0c517a29 | Add module for ids2vecs | explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc | thinc/neural/ids2vecs.py | thinc/neural/ids2vecs.py | from ._classes.window_encode import MaxoutWindowEncode
| mit | Python | |
ada91bd1ed76d59b7ec41d765af188aed2f8fd62 | add a module for collecting Warnings | michaellaier/pymor,michaellaier/pymor,michaellaier/pymor,michaellaier/pymor | src/pymor/core/warnings.py | src/pymor/core/warnings.py | '''
Created on Nov 19, 2012
@author: r_milk01
'''
class CallOrderWarning(UserWarning):
'''I am raised when there's a preferred call order, but the user didn't follow it.
For an Example see pymor.discretizer.stationary.elliptic.cg
'''
pass | bsd-2-clause | Python | |
03c1f7040cc971c6e05f79f537fc501c550edaa8 | Add back manage.py (doh). | CTPUG/pyconza2014,CTPUG/pyconza2014,CTPUG/pyconza2014 | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
conf = os.path.dirname(__file__)
wafer = os.path.join(conf, '..', 'wafer')
sys.path.append(wafer)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
exe... | mit | Python | |
0b88d652ddb23a385e79bfccb1db89c954d7d27f | Set up Restaurant class | JustineKay/psychic-octo-carnival | get_a_lunch_spot.py | get_a_lunch_spot.py | import json
restaurants_string = """[{
"name" : "sweetgreen"
}]"""
print restaurants_string
restaurants_json = json.loads(restaurants_string)
print restaurants_json
class Restaurant:
name = ""
def __init__(self, data):
self.name = self.getName(data)
def getName(self, data):
for i in data:
ret... | mit | Python | |
6757f4b74f29142b0be7e32b8bdf210d109056ea | Create missing.py | abhishekg2389/youtube-8m-challenge | missing.py | missing.py | import tensorflow as tf
import glob as glob
import getopt
import sys
import cPickle as pkl
import numpy as np
opts, _ = getopt.getopt(sys.argv[1:],"",["chunk_file_path=", "comp_file_path=", "means_file_path=", "output_dir=", "input_dir="])
chunk_file_path = "../video_level_feat_v1/train*.tfrecord"
comp_file_path = "..... | mit | Python | |
23e778c78c2d77a9eeb0904856429546e379f8b5 | change the version of openerp | mkieszek/odoo,Ernesto99/odoo,SerpentCS/odoo,savoirfairelinux/odoo,juanalfonsopr/odoo,avoinsystems/odoo,elmerdpadilla/iv,addition-it-solutions/project-all,provaleks/o8,klunwebale/odoo,lsinfo/odoo,odooindia/odoo,ThinkOpen-Solutions/odoo,lgscofield/odoo,Drooids/odoo,rowemoore/odoo,fjbatresv/odoo,hanicker/odoo,Nowheresly/o... | bin/release.py | bin/release.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole re... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole re... | agpl-3.0 | Python |
23257c56b58c26694773fb12d3ba167de43bd43b | Add validate.py tool | hkjn/hkjninfra,hkjn/hkjninfra,hkjn/hkjninfra | validate.py | validate.py | import json
import sys
import urllib2
data=json.loads(open("bootstrap/{}.json".format(sys.argv[1])).read())
for f in data['storage']['files']:
if 'source' not in f['contents'] or 'http' not in f['contents']['source']:
continue
url = f['contents']['source']
digest = f['contents']['verification']['ha... | mit | Python | |
dd1c49eb12bf69580a8727353aa19741059df6d5 | add 102 | EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler | vol3/102.py | vol3/102.py | import urllib2
if __name__ == "__main__":
ans = 0
for line in urllib2.urlopen('https://projecteuler.net/project/resources/p102_triangles.txt'):
ax, ay, bx, by, cx, cy = map(int, line.split(','))
a = ax * by - ay * bx > 0
b = bx * cy - by * cx > 0
c = cx * ay - cy * ax > 0
... | mit | Python | |
feac5a01059a95910c76a0de5f83ad2473cf09c8 | Create app.py | kuldeepdadhich/fin | app.py | app.py | import os
import sys
import tweepy
import requests
import numpy as np
import json
import os
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTP... | mit | Python | |
1490f438693a5727c722d933a712c889d3c09556 | test where SSL proxying works | marcellodesales/svnedge-console,marcellodesales/svnedge-console,marcellodesales/svnedge-console,marcellodesales/svnedge-console,marcellodesales/svnedge-console | test/others/ProxyTest.py | test/others/ProxyTest.py | import urllib2
httpTarget = "http://www.collab.net"
httpsTargetTrusted = "https://ctf.open.collab.net/sf/sfmain/do/home"
httpsTargetUntrusted = "https://www.collab.net"
proxyHost = "cu182.cloud.sp.collab.net"
proxyPort = "80"
proxyUser = "proxyuser"
proxyPwd = "proxypass"
def main():
print "Testing p... | agpl-3.0 | Python | |
d15ba379ec48c2c5bc76eeb0f8a514625f5b9e2f | add unit test to test whether the parallel implementation is alright | mir-group/flare,mir-group/flare | tests/test_gp_algebra.py | tests/test_gp_algebra.py | import pytest
import pickle
import os
import json
import numpy as np
from pytest import raises
from flare.gp import GaussianProcess
from flare.env import AtomicEnvironment
from flare.struc import Structure
from flare import mc_simple
from flare.otf_parser import OtfAnalysis
from flare.env import AtomicEnvironment
fro... | mit | Python | |
aa1808c9a13894751953c8a1c816c89861e514d1 | Create new package. (#6061) | mfherbst/spack,iulian787/spack,lgarren/spack,iulian787/spack,LLNL/spack,krafczyk/spack,iulian787/spack,EmreAtes/spack,skosukhin/spack,EmreAtes/spack,skosukhin/spack,mfherbst/spack,tmerrick1/spack,mfherbst/spack,krafczyk/spack,tmerrick1/spack,lgarren/spack,LLNL/spack,lgarren/spack,EmreAtes/spack,LLNL/spack,krafczyk/spac... | var/spack/repos/builtin/packages/r-iso/package.py | var/spack/repos/builtin/packages/r-iso/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 | |
4dd36d68225311e328cc4a909b3c56bf9b6e8e53 | Create picture.py | voidJeff/Picture,tiggerntatie/Picture,anoushkaalavilli/Picture,CriticalD20/Picture,adamglueck/Picture,willl4/Picture,sarahdunbar/Picture,VinzentM/Picture,anoushkaalavilli/Picture,jasminelou/Picture,kingmayonaise/Picture,SSupattapone/Picture,T045T3R/Picture,CriticalD20/Picture,morganmeliment/Picture,BautiG/Picture,Chubb... | picture.py | picture.py | from ggame import App
myapp = App()
myapp.run()
| mit | Python | |
b3a3376e90d1eede9b2d33d0a4965c1f4920f20a | Add a memoizer | JasonGross/coq-tools,JasonGross/coq-tools | memoize.py | memoize.py |
# from http://code.activestate.com/recipes/578231-probably-the-fastest-memoization-decorator-in-the-/
__all__ = ["memoize"]
def memoize(f):
""" Memoization decorator for a function taking one or more arguments. """
class memodict(dict):
def __getitem__(self, *key):
return dict.__getitem__... | mit | Python | |
9a902049212ceea29b7b0e440acd33e3c63c7beb | Add timer tests script. | iabdalkader/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv | scripts/examples/02-Board-Control/timer_tests.py | scripts/examples/02-Board-Control/timer_tests.py | # Timer Test Example
#
# This example tests all the timers.
import time
from pyb import Pin, Timer, LED
blue_led = LED(3)
# Note: functions that allocate memory are Not allowed in callbacks
def tick(timer):
blue_led.toggle()
print("")
for i in range(1, 18):
try:
print("Testing TIM%d... "%(i), end="... | mit | Python | |
11447d409756f2bcd459a6db9d51967358272780 | move flags to constant module | danbradham/hotline | hotline/constant.py | hotline/constant.py | # -*- coding: utf-8 -*-
class flags(object):
DontHide = object()
Hide = object()
_list = [DontHide, Hide]
| mit | Python | |
0295a1cbad1dfa2443e6b8e8d639b7d845adaebf | Add lc0225_implement_stack_using_queues.py | bowen0701/algorithms_data_structures | lc0225_implement_stack_using_queues.py | lc0225_implement_stack_using_queues.py | """Leetcode 225. Implement Stack using Queues
Easy
URL: https://leetcode.com/problems/implement-stack-using-queues/
Implement the following operations of a stack using queues.
- push(x) -- Push element x onto stack.
- pop() -- Removes the element on top of the stack.
- top() -- Get the top element.
- empty() -- Retur... | bsd-2-clause | Python | |
0a48d3dc2286db9cff5ec757d8b5f0b45f35ab7d | update : some minor fixes | black-perl/ptop | ptop/interfaces/__init__.py | ptop/interfaces/__init__.py | from .GUI import PtopGUI | mit | Python | |
261b2477cf6f086028a1028c7d8a02f1b1631018 | add solution for Jump Game | zhyu/leetcode,zhyu/leetcode | src/jumpGame.py | src/jumpGame.py | class Solution:
# @param A, a list of integers
# @return a boolean
def canJump(self, A):
if not A:
return False
max_dist = 0
for i in xrange(len(A)):
if i > max_dist:
return False
max_dist = max(max_dist, i+A[i])
return Tru... | mit | Python | |
99f9f14039749f8e3e4340d6bf0e0394e3483ca2 | add basic propfind test | cernbox/smashbox,cernbox/smashbox,cernbox/smashbox,cernbox/smashbox | protocol/test_protocol_propfind.py | protocol/test_protocol_propfind.py | from smashbox.utilities import *
from smashbox.utilities.hash_files import *
from smashbox.protocol import *
@add_worker
def main(step):
d = make_workdir()
reset_owncloud_account()
URL = oc_webdav_url()
ls_prop_desktop20(URL,depth=0)
logger.info("Passed 1")
ls_prop_desktop20(URL,depth=1)
... | agpl-3.0 | Python | |
6bbdd1d9d60b03429dc2bc1ff3ba5d06353fad9a | Add a Bug class. | monsieurp/libzilla | libzilla/bug.py | libzilla/bug.py | class Bug:
def __init__(self,
bug_number,
comment=None,
resolution=None,
status=None):
self.bug_number = bug_number
self.resolution = resolution
self.status = status
self.comment = comment
def __str__(self):
... | mit | Python | |
2dad699b9281fea70c5e078166236f3175ef739a | add parse2.py file to take advantage of new patXML interface | yngcan/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor | parse2.py | parse2.py | #!/usr/bin/env python
import logging
# http://docs.python.org/howto/argparse.html
import argparse
import os
import datetime
import re
import mmap
import contextlib
import multiprocessing
import itertools
import sys
sys.path.append( '.' )
sys.path.append( './lib/' )
import shutil
from patXML import XMLPatent
from pat... | bsd-2-clause | Python | |
17bd35df32dd68d1cbc0fe73fcda186d13a66db0 | Add run.py | marksamman/pylinkshortener | run.py | run.py | #!/usr/bin/env python3
#
# Copyright (c) 2014 Mark Samman <https://github.com/marksamman/pylinkshortener>
#
# 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 with... | mit | Python | |
7613285ba24990d62cf2273387a143aa74ce8bb0 | add shortcut to send sms message | japsu/django-nexmo,tracon/django-nexmo,thibault/django-nexmo | nexmo/utils.py | nexmo/utils.py | from .libpynexmo.nexmomessage import NexmoMessage
from django.conf import settings
def send_message(to, message):
"""Shortcut to send a sms using libnexmo api.
Usage:
>>> from nexmo import send_message
>>> send_message('+33612345678', 'My sms message body')
"""
params = {
'username':... | bsd-2-clause | Python | |
49b68f35bb6555eaad7cd5e3bfeb4e7fadb500ba | Add intermediate tower 4 | arbylee/python-warrior | pythonwarrior/towers/intermediate/level_004.py | pythonwarrior/towers/intermediate/level_004.py | # ----
# |C s |
# | @ S|
# |C s>|
# ----
level.description("Your ears become more in tune with the surroundings. "
"Listen to find enemies and captives!")
level.tip("Use warrior.listen to find spaces with other units, "
"and warrior.direction_of to determine what direction they're in.")
l... | mit | Python | |
7662d0a0701381b37f60d42e7dbf04d7950c18ad | add management command to print out duplicate bihar tasks | dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,q... | custom/bihar/management/commands/bihar_cleanup_tasks.py | custom/bihar/management/commands/bihar_cleanup_tasks.py | import csv
from django.core.management.base import BaseCommand
from corehq.apps.hqcase.utils import get_cases_in_domain
from dimagi.utils.decorators.log_exception import log_exception
class Command(BaseCommand):
"""
Creates the backlog of repeat records that were dropped when bihar repeater
infrastructure... | bsd-3-clause | Python | |
c9f5c9bf8fffe4f513fc8564eb92ca86a76f4087 | add cluster | mmagnuski/mypy | mypy/cluster.py | mypy/cluster.py | import os
from os.path import split
import numpy as np
from scipy import sparse
from scipy.io import loadmat
# import matplotlib.pyplot as plt
from mne.stats.cluster_level import _find_clusters
base_dir = split(split(__file__)[0])[0]
chan_path = os.path.join(base_dir, 'data', 'chan')
# read channel connectivity
d... | mit | Python | |
245879ce699b275edc3ee17e4cba1146241f25de | Add GLib mainllop transport for xmlrpcserver | wizbit-archive/wizbit,wizbit-archive/wizbit | wizbit/xmlrpcdeferred.py | wizbit/xmlrpcdeferred.py | import gobject
import xmlrpclib
class XMLRPCDeferred (gobject.GObject):
"""Object representing the delayed result of an XML-RPC
request.
.is_ready: bool
True when the result is received; False before then.
.value : any
Once is_ready=True, this attribute contains the result of the
re... | lgpl-2.1 | Python | |
0880d067f478ba6474e433e620a1e48e23ed9c34 | Add nginx+uWSGI for 10% perf improvement over gunicorn | hamiltont/FrameworkBenchmarks,seem-sky/FrameworkBenchmarks,sxend/FrameworkBenchmarks,leafo/FrameworkBenchmarks,kostya-sh/FrameworkBenchmarks,steveklabnik/FrameworkBenchmarks,youprofit/FrameworkBenchmarks,mfirry/FrameworkBenchmarks,thousandsofthem/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,valyala/FrameworkBenchma... | wsgi/setup_nginxuwsgi.py | wsgi/setup_nginxuwsgi.py | import subprocess
import multiprocessing
import os
bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
config_dir = os.path.expanduser('~/FrameworkBenchmarks/config')
NCPU = multiprocessing.cpu_count()
def start(args):
try:
subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c ' +
... | bsd-3-clause | Python | |
8fe4b03d7944f2facf8f261d440e7220c4d1228b | add file | familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG | Python/mapexp.py | Python/mapexp.py | #!/usr/bin/env python
"""
map(fun, iterable,...)
Return a list of the results of applying the function to the items of
the argument sequence(s). If more than one sequence is given, the
function is called with an argument list consisting of the corresponding
item of each sequence, substituting None for mi... | bsd-2-clause | Python | |
6dd4b6ee9b9457d2362404aac71fd73e907bf535 | Add Timeline class. | VISTAS-IVES/pyvistas | source/vistas/ui/controls/timeline.py | source/vistas/ui/controls/timeline.py | import datetime
from bisect import insort
class TimelineFilter:
pass # Todo: implement
class Timeline:
_global_timeline = None
@classmethod
def app(cls):
""" Global timeline """
if cls._global_timeline is None:
cls._global_timeline = Timeline()
return cls._glob... | bsd-3-clause | Python | |
560d82cd4b7de72a4fada77b0fe13bfb1caa9790 | package script | JangXa/tutorpgdp | package.py | package.py | import os
import sys
for root, dirs, files in os.walk(os.path.dirname(os.path.abspath(__file__))):
for name in files:
if name.endswith((".java")):
file = open(name, "r")
lines = file.readlines()
file.close()
file = open(name, "w")
for line in lines... | mit | Python | |
cc9ce576a33c60acc9f60f12b42e56f474b760ac | Add json_jinja renderer | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/renderers/json_jinja.py | salt/renderers/json_jinja.py | '''
The default rendering engine, yaml_jinja, this renderer will take a yaml file
with the jinja template and render it to a high data format for salt states.
'''
# Import python libs
import os
import json
# Import Third Party libs
from jinja2 import Template
def render(template):
'''
Render the data passing... | apache-2.0 | Python | |
e35711d368faadaa017186200092297f264648fe | Add web ui | cberner/rospilot,rospilot/rospilot,cberner/rospilot,rospilot/rospilot,cberner/rospilot,cberner/rospilot,rospilot/rospilot,rospilot/rospilot,cberner/rospilot,rospilot/rospilot,cberner/rospilot,rospilot/rospilot | nodes/web_ui.py | nodes/web_ui.py | #!/usr/bin/env python
import roslib; roslib.load_manifest('rospilot')
import rospy
from pymavlink import mavutil
import rospilot.msg
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
PORT_NUMBER = 8085
armed = None
#This class will handles any incoming request from
#the browser
class HttpHandler(BaseHTT... | apache-2.0 | Python | |
c8ede03a393ae1287a9a34e86af40cd6a8b3027b | add missing module (RBL-3757) | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/targets.py | mint/targets.py | #
# Copyright (c) 2008 rPath, Inc.
#
# All Rights Reserved
#
from mint import database, mint_error
import simplejson
class TargetsTable(database.KeyedTable):
name = 'Targets'
key = 'targetId'
fields = ('targetId', 'targetType', 'targetName')
def addTarget(self, targetType, targetName):
cu = ... | apache-2.0 | Python | |
3709bcbd421d82f9404ab3b054989546d95c006f | Fix another broken sc2reader.plugins reference. | ggtracker/sc2reader,GraylinKim/sc2reader,vlaufer/sc2reader,StoicLoofah/sc2reader,GraylinKim/sc2reader,StoicLoofah/sc2reader,ggtracker/sc2reader,vlaufer/sc2reader | sc2reader/scripts/sc2json.py | sc2reader/scripts/sc2json.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
import sc2reader
from sc2reader.factories.plugins.replay import toJSON
def main():
import argparse
parser = argparse.ArgumentParser(description="Prints replay data to a json string... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
import sc2reader
from sc2reader.plugins.replay import toJSON
def main():
import argparse
parser = argparse.ArgumentParser(description="Prints replay data to a json string.")
pa... | mit | Python |
c3c559f893e31e728a429cf446039781cea1f25d | Add unit tests for `%tensorflow_version` | googlecolab/colabtools,googlecolab/colabtools | tests/test_tensorflow_magics.py | tests/test_tensorflow_magics.py | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python | |
fe879d7f6f56db410eb5d3d9aeb5691d020661c7 | Create shackbullet.py | Haxim/ShackBullet,Haxim/ShackBullet | shackbullet.py | shackbullet.py | #Import the modules
import requests
import json
import uuid
#Edit these to your shacknews login credentials
shackname = 'Username'
shackpass = 'ShackPassword'
pushbulletkey = 'access token from https://www.pushbullet.com/account'
#Fun Bbegins
#generate uuid from namespace
uuid = uuid.uuid5(uuid.NAMESPACE_DNS, 'winch... | mit | Python | |
0b419a71a414e605af57029286b627e286c5df47 | add session | NCSSM-CS/CSAssess,NCSSM-CS/CSAssess,NCSSM-CS/CSAssess,NCSSM-CS/CSAssess | controller/addSession.py | controller/addSession.py | #!/usr/local/bin/python3
"""
created_by: Aninda Manocha
created_date: 3/5/2015
last_modified_by: Aninda Manocha
last_modified_date: 3/5/2015
"""
import constants
import utils
import json
from sql.session import Session
from sql.user import User
#Format of session
#requestType: addSession
#token: "str... | mit | Python | |
d83e30cc2ec46eeb2f7c27c26e0fc3d2d3e6de90 | add an environment checker | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/check_environment.py | scripts/check_environment.py | """
Something to run to make sure our machine is up to snuff!
"""
import pg
import xlwt | mit | Python | |
ef78460a3303216f424247203cf0b5e1ecc88197 | Add test for ticket #1074. | lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,scipy/scipy-svn,scipy/scipy-svn,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,scipy/scipy-svn,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor | scipy/optimize/tests/test_regression.py | scipy/optimize/tests/test_regression.py | """Regression tests for optimize.
"""
from numpy.testing import *
import numpy as np
class TestRegression(TestCase):
def test_newton_x0_is_0(self):
"""Ticket #1074"""
import scipy.optimize
tgt = 1
res = scipy.optimize.newton(lambda x: x - 1, 0)
assert_almost_equal(res, tgt... | bsd-3-clause | Python | |
c654841595fd679c511d2d3b91c2edc9335c78cc | Create Quiz-Problem8.py | iharsh234/MIT6.00x | Quiz-Problem8.py | Quiz-Problem8.py | # PROBLEM 8
def satisfiesF(L):
"""
Assumes L is a list of strings
Assume function f is already defined for you and it maps a string to a Boolean
Mutates L such that it contains all of the strings, s, originally in L such
that f(s) returns True, and no other elements
Returns the length ... | mit | Python | |
aa3cf6a383c38a9f17172ae2a754a8e67243e318 | add new form to bulk import indicators from json file | dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/indicators/forms.py | corehq/apps/indicators/forms.py | from django import forms
from django.utils.translation import ugettext_noop, ugettext as _
from bootstrap3_crispy import bootstrap as twbs
from bootstrap3_crispy.helper import FormHelper
from bootstrap3_crispy import layout as crispy
from corehq.apps.style.crispy import FormActions
class ImportIndicatorsFromJsonFileF... | bsd-3-clause | Python | |
42fbeda997d5c8f67231ee5c8f420a7140870c26 | Add gce_img module for utilizing GCE image resources | thaim/ansible,thaim/ansible | lib/ansible/modules/extras/cloud/google/gce_img.py | lib/ansible/modules/extras/cloud/google/gce_img.py | #!/usr/bin/python
# Copyright 2015 Google Inc. All Rights Reserved.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | mit | Python | |
04f851706b4384add01e6cd41f31305d587f7a36 | Create pushbullet.py | dendory/scripts,dendory/scripts | pushbullet.py | pushbullet.py | # Python unofficial Pushbullet client
# (C) 2015 Patrick Lambert - http://dendory.net - Provided under MIT License
import urllib.request
import sys
api_key = "XXXXXXXXX"
title = "My Title"
message = "My Body"
def notify(key, title, text):
post_params = {
'type': 'note',
'title': title,
'body': text
}
post_ar... | mit | Python | |
57b19c56b8be8c8131cc3d98cb9f30da3398412b | create a reporting helper for logging channel info | alfredodeza/remoto,ceph/remoto | remoto/log.py | remoto/log.py |
def reporting(conn, result):
log_map = {'debug': conn.logger.debug, 'error': conn.logger.error}
while True:
try:
received = result.receive()
level_received, message = received.items()[0]
log_map[level_received](message.strip('\n'))
except EOFError:
... | mit | Python | |
371df7c27fa1c4130214c58ececa83b0e0b6b165 | Create palindrome3.py | dushmis/illacceptanything,JeffreyCA/illacceptanything,illacceptanything/illacceptanything,ultranaut/illacceptanything,paladique/illacceptanything,tjhorner/illacceptanything,1yvT0s/illacceptanything,dushmis/illacceptanything,paladique/illacceptanything,paladique/illacceptanything,oneminot/illacceptanything,ds84182/illac... | palindrome3.py | palindrome3.py | palindrome3 = lambda x: str(x) == str(x)[::-1]
| mit | Python | |
5129dd5de6f4a8c0451adbb5631940bb82b51a26 | Add a script to enact updates to positions & alternative names | geoffkilpin/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,patricmutwiri/pombola,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,mysociety/pombola,ken-muturi/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,hzj123/56th,hzj123/56th,patricmutwiri/pombola,hzj123/56th,... | mzalendo/kenya/management/commands/kenya_apply_updates.py | mzalendo/kenya/management/commands/kenya_apply_updates.py | from collections import defaultdict
import csv
import datetime
import errno
import hmac
import hashlib
import itertools
import json
import os
import re
import requests
import sys
from django.core.management.base import NoArgsCommand, CommandError
from django.template.defaultfilters import slugify
from django_date_ext... | agpl-3.0 | Python | |
67e7d530b4b4ffa86c9f147751cf17828e024cba | add migration to create job table | Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok | migrations/versions/5706baf73b01_add_jobs_table.py | migrations/versions/5706baf73b01_add_jobs_table.py | """Add jobs table
Revision ID: 5706baf73b01
Revises: 6bd350cf4748
Create Date: 2016-09-14 15:53:50.394610
"""
# revision identifiers, used by Alembic.
revision = '5706baf73b01'
down_revision = '6bd350cf4748'
from alembic import op
import sqlalchemy as sa
import server
def upgrade():
### commands auto generate... | apache-2.0 | Python | |
ec841c86348302dc67b48af93d2b3b5c8fb96b6e | add list | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | misc/list.py | misc/list.py | #!/usr/bin/env python
# Python 3: List comprehensions
fruits = ['Banana', 'Apple', 'Lime']
loud_fruits = [fruit.upper() for fruit in fruits]
print(loud_fruits)
# List and the enumerate function
print(list(enumerate(fruits)))
| mit | Python | |
427fa7f57776a73b5ec0e5045114d5ac330e6a57 | Create misc.py | CounterClops/Counter-Cogs | misc/misc.py | misc/misc.py | mit | Python | ||
0612769b07e88eae9865a16f1ae8162502fe65f9 | Add senate evacuation | laichunpongben/CodeJam | 2016/1c/senate_evacuation.py | 2016/1c/senate_evacuation.py | #!/usr/bin/env python
from __future__ import print_function
def parse_senates(senates_str):
return [int(_) for _ in senates_str.split(' ')]
def get_evacuation_plan(senates):
if not isinstance(senates, list):
raise TypeError
num_parties = len(senates)
remaining_senates = senates[:]
evacua... | apache-2.0 | Python | |
aabb57148cced94b31109b46adf83a43ca23f7a3 | allow to apply std functions back | moskytw/mosql,uranusjr/mosql | mosql/std.py | mosql/std.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''It applies the standard functions to :mod:`mosql.util`.
The usage:
::
import mosql.std
If you want to patch again:
::
mosql.std.patch()
It will replace the functions in :mod:`mosql.util` with original standard functions.
'''
import mosql.util
def patch(... | mit | Python | |
69892066449a40322a34b3a7b8e60e3fa99eef41 | Create deobfuscator.py | Antelox/FOPO-PHP-Deobfuscator,Antelox/FOPO-PHP-Deobfuscator | ver.-0.1/deobfuscator.py | ver.-0.1/deobfuscator.py | mit | Python | ||
3c396700a52571d5aae2a12fac601f063a7af761 | Add missing add_master.py. | digibib/ls.ext,digibib/ls.ext,digibib/ls.ext,digibib/ls.ext | devops/deployment/add_master.py | devops/deployment/add_master.py | #!/usr/bin/env python
# script to add minion config
import yaml
import sys
import os
f=open("/etc/salt/minion", 'r')
settings=yaml.load(f)
f.close()
ip=os.environ["MASTER_IP"]
if settings["master"].__class__ == str:
settings["master"] = [settings["master"]]
settings["master"] = [ip]
#if not ip in settings["master"]:
... | mit | Python | |
00a059f172e1d6214d858370829e1034c2742ce4 | add gevent run script | cenkalti/pypi-notifier,cenkalti/pypi-notifier | run_gevent.py | run_gevent.py | from gevent.monkey import patch_all; patch_all()
from gevent.wsgi import WSGIServer
from pypi_notifier import create_app
app = create_app('ProductionConfig')
http_server = WSGIServer(('0.0.0.0', 5001), app)
http_server.serve_forever()
| mit | Python | |
916b7fe4ee4c3c5c55278927a7116a4d1e0ad6d1 | Add solarized256.py | gthank/solarized-dark-pygments,john2x/solarized-pygment | solarized256.py | solarized256.py | # -*- coding: utf-8 -*-
"""
solarized256
------------
A Pygments style inspired by Solarized's 256 color mode.
:copyright: (c) 2011 by Hank Gay, (c) 2012 by John Mastro.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Token, Comment, N... | mit | Python | |
07a122374abb60140e05b09f49ef942bd14c05f6 | add missed migration | mvillis/measure-mate,rloomans/measure-mate,mvillis/measure-mate,rloomans/measure-mate,mvillis/measure-mate,rloomans/measure-mate,mvillis/measure-mate,rloomans/measure-mate | measure_mate/migrations/0026_auto_20160531_0716.py | measure_mate/migrations/0026_auto_20160531_0716.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-31 07:16
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('measure_mate', '0025_auto_20160516_0046'),
]
... | mit | Python | |
d3b4053c2ef39eda9246af2000bdf9460730b33b | convert json to git-versionable versions which current TinyDB user can live with. | ConnectableUs/gkp,ConnectableUs/gkp | prettifyjson.py | prettifyjson.py | #!/usr/bin/env python
from os import path
import sys
import json
if len(sys.argv) > 1:
print("usage:\n\t{} < your_json_file > your_prettified_json_file".format(
path.basename(sys.argv[0])))
sys.exit(1)
json.dump(json.load(sys.stdin), sys.stdout, indent=2)
| bsd-3-clause | Python | |
caf0b00bc21208515d0ddded3cbb934735d45939 | add migration to create new model fields | rsalmaso/django-fluo-coupons,rsalmaso/django-fluo-coupons | coupons/migrations/0004_auto_20151105_1456.py | coupons/migrations/0004_auto_20151105_1456.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('coupons', '0003_auto_20150416_0617'),
... | bsd-3-clause | Python | |
b181f2a57d57caaa6e53e193e88002a15e284fd0 | add the missing file. i are senior dvlpr | dstufft/cryptography,dstufft/cryptography,Hasimir/cryptography,Ayrx/cryptography,kimvais/cryptography,kimvais/cryptography,bwhmather/cryptography,skeuomorf/cryptography,skeuomorf/cryptography,kimvais/cryptography,dstufft/cryptography,Ayrx/cryptography,dstufft/cryptography,Hasimir/cryptography,dstufft/cryptography,Ayrx/... | cryptography/hazmat/backends/openssl/utils.py | cryptography/hazmat/backends/openssl/utils.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | bsd-3-clause | Python | |
4a0e00574fc551dde74db1a817229eeb23c4e0a8 | Create prueba.py | aescoda/TFG | prueba.py | prueba.py | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
xml = ""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
email_lib.email_alert(customer_email,iccid, admin_details[1])
r... | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
xml = ""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GET'])
def... | apache-2.0 | Python |
7e4fd6b92040788bda1760cb261730f627ca6a10 | Add example from listing 7.6 | oysstu/pyopencl-in-action | ch7/profile_read.py | ch7/profile_read.py | '''
Listing 7.6: Profiling data transfer
'''
import numpy as np
import pyopencl as cl
import pyopencl.array
import utility
from time import sleep
NUM_VECTORS = 8192
NUM_ITERATIONS = 2000
kernel_src = '''
__kernel void profile_read(__global char16 *c, int num) {
for(int i=0; i<num; i++) {
c[i] = (char16)(5... | mit | Python | |
8ecac8170a3f9323f76aa9252a9d3b2f57f7660c | Include duration in analysis output | ihmeuw/vivarium | ceam/analysis.py | ceam/analysis.py | # ~/ceam/ceam/analysis.py
import argparse
import pandas as pd
import numpy as np
def confidence(seq):
mean = np.mean(seq)
std = np.std(seq)
runs = len(seq)
interval = (1.96*std)/np.sqrt(runs)
return mean, mean-interval, mean+interval
def difference_with_confidence(a, b):
mean_diff = np.mean(... | # ~/ceam/ceam/analysis.py
import argparse
import pandas as pd
import numpy as np
def confidence(seq):
mean = np.mean(seq)
std = np.std(seq)
runs = len(seq)
interval = (1.96*std)/np.sqrt(runs)
return mean, mean-interval, mean+interval
def difference_with_confidence(a, b):
mean_diff = np.mean(... | bsd-3-clause | Python |
0ee4afce4ba81cff6d13152ab082157afc4718f1 | Create pyspark.py | mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets | pyspark.py | pyspark.py | from pyspark import SparkConf, SparkContext
conf = SparkConf().setMaster("local").setAppName("MinTemperatures")
sc = SparkContext(conf = conf)
lines = sc.textFile("file:///Users/Spark/1800.csv")
parsedLines = lines.map(parseLine)
| mit | Python | |
af495c7a69611f2c1fa744dce000c49033eb2dd7 | Add test for sys.intern(). | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tests/basics/sys_intern.py | tests/basics/sys_intern.py | # test sys.intern() function
import sys
try:
sys.intern
except AttributeError:
print('SKIP')
raise SystemExit
s1 = "long long long long long long"
s2 = "long long long" + " long long long"
print(id(s1) == id(s2))
i1 = sys.intern(s1)
i2 = sys.intern(s2)
print(id(i1) == id(i2))
i2_ = sys.intern(i2)
pri... | mit | Python | |
7323565bdc2a290e97617857da475e8f41d5a43f | Add tee plugin | Muzer/smartbot,Cyanogenoid/smartbot,tomleese/smartbot,thomasleese/smartbot-old | plugins/tee.py | plugins/tee.py | class Plugin:
def on_command(self, bot, msg, stdin, stdout, reply):
text = stdin.read().strip()
reply(text)
print(text, file=stdout)
def on_help(self):
return "Copy standard input to reply, and also to standard output."
| mit | Python | |
b8ea356af5121ffd612ccf708fe2372fbae3cc3d | add custom hasher for crypt_sha512 | aipescience/django-daiquiri,aipescience/django-daiquiri,aipescience/django-daiquiri | daiquiri/core/hashers.py | daiquiri/core/hashers.py | # inspired by https://djangosnippets.org/snippets/10572/
from collections import OrderedDict
from django.contrib.auth.hashers import CryptPasswordHasher, mask_hash
from django.utils.encoding import force_str
from django.utils.crypto import get_random_string, constant_time_compare
from django.utils.translation import u... | apache-2.0 | Python | |
042d0d899896342e9f2e7b083f8543e8077bf19a | Add tests.py to app skeleton. | dimagi/rapidsms-core-dev,caktus/rapidsms,lsgunth/rapidsms,unicefuganda/edtrac,ehealthafrica-ci/rapidsms,lsgunth/rapidsms,ken-muturi/rapidsms,rapidsms/rapidsms-core-dev,ken-muturi/rapidsms,caktus/rapidsms,peterayeni/rapidsms,eHealthAfrica/rapidsms,rapidsms/rapidsms-core-dev,unicefuganda/edtrac,catalpainternational/rapid... | lib/rapidsms/skeleton/app/tests.py | lib/rapidsms/skeleton/app/tests.py | from rapidsms.tests.scripted import TestScript
from app import App
class TestApp (TestScript):
apps = (App,)
# define your test scripts here.
# e.g.:
#
# testRegister = """
# 8005551212 > register as someuser
# 8005551212 < Registered new user 'someuser' for 8005551212!
# 8005551... | bsd-3-clause | Python | |
27a7079f9edf01abce7912eb52c5091279bc85a1 | ADD | 添加pygal path的变量设定源码 | mytliulei/DCNRobot | src/lib/PygalPath.py | src/lib/PygalPath.py | #-*- coding:UTF-8 -*-
import socket
import os
__all__ = ['PYGAL_TOOLTIPS_PATH', 'SVG_JQUERY_PATH']
SERVER_WUHAN = '192.168.60.60'
SERVER_WUHAN_PRE = '192.168.6'
SERVER_BEIJING = '192.168.50.193'
SERVER_BEIJING_PRE = '192.168.5'
SERVER = '10.1.145.70'
#根据本机IP获取pygal模块生成svg文件所需的js文件路径
sname=socket.gethostname()
ipList... | apache-2.0 | Python | |
a3db0306133bc3da1cc00d3c745396539a152839 | Add release script | LukeStebbing/Sequence-Scroller,LukeStebbing/Sequence-Scroller,LukeStebbing/Sequence-Scroller | release.py | release.py | #!/usr/bin/env python
from collections import OrderedDict
from itertools import zip_longest
import json
import os
import re
from subprocess import check_output, CalledProcessError
import sys
from zipfile import ZipFile
def sh(command, v=False):
if v:
print(command)
return check_output(command, text=T... | apache-2.0 | Python | |
9ad9808b9bf7c202bc6dbbe8abd74e1c642982ae | structure migration | fosfataza/protwis,cmunk/protwis,fosfataza/protwis,cmunk/protwis,fosfataza/protwis,fosfataza/protwis,protwis/protwis,cmunk/protwis,protwis/protwis,protwis/protwis,cmunk/protwis | structure/migrations/0002_structure_refined.py | structure/migrations/0002_structure_refined.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-09-20 07:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('structure', '0001_initial'),
]
operations = [
migrations.AddField(
... | apache-2.0 | Python | |
be01980afe4b1dbd5a1d5b07651cd7a54c771d01 | Add unit tests for disk module | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | tests/modules/test_disk.py | tests/modules/test_disk.py | # pylint: disable=C0103,C0111
import mock
import unittest
import tests.mocks as mocks
from bumblebee.input import LEFT_MOUSE
from bumblebee.modules.disk import Module
class MockVFS(object):
def __init__(self, perc):
self.f_blocks = 1024*1024
self.f_frsize = 1
self.f_bavail = self.f_block... | mit | Python | |
da52f7c8c9280fe644a01a324eaad5512870dccb | add models.py | SakuraSa/TenhouLoggerX,SakuraSa/TenhouLoggerX,SakuraSa/TenhouLoggerX | core/models.py | core/models.py | #!/usr/bin/env python
# coding = utf-8
"""
core.models
"""
__author__ = 'Rnd495'
import datetime
import hashlib
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, Float, String, DateTime, Text, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import session... | mit | Python | |
ecacda9bab83cd66f25a3ce85f36646c13a61f3f | put full example in its own module | kelle/astropy,joergdietrich/astropy,pllim/astropy,funbaker/astropy,AustereCuriosity/astropy,bsipocz/astropy,pllim/astropy,kelle/astropy,DougBurke/astropy,pllim/astropy,MSeifert04/astropy,astropy/astropy,StuartLittlefair/astropy,MSeifert04/astropy,pllim/astropy,larrybradley/astropy,kelle/astropy,AustereCuriosity/astropy... | docs/coordinates/sgr-example.py | docs/coordinates/sgr-example.py | # coding: utf-8
""" Astropy coordinate class for the Sagittarius coordinate system """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
# Third-party
import numpy as np
from numpy import radians, degrees, cos, sin
import astropy.coordi... | bsd-3-clause | Python | |
4bf1a14f6b6d3b30f30732bb45f4e8a501dfcbf6 | test github backup | radiasoft/pykern,radiasoft/pykern | tests/pkcli/github_test.py | tests/pkcli/github_test.py | # -*- coding: utf-8 -*-
u"""test github
:copyright: Copyright (c) 2019 Bivio Software, Inc. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_backup():
from pykern import pkconfig
pkconfi... | apache-2.0 | Python | |
8fdaeea43e31a1c429703cd4f441a748bcfa8197 | Create create_mask.py | hochthom/char-repeat | create_mask.py | create_mask.py |
from __future__ import print_function
import argparse
from PIL import ImageFont, ImageDraw, Image
def create_mask(text, font_type, font_size=84):
'''
Creates an image with the given text in it.
'''
# initialize fond with given size
font = ImageFont.truetype(font_type, font_size)
dx, dy = fon... | mit | Python | |
79e55030736572608841bbdd3a6022fc2420be45 | implement recursive permutation generation algorithm with switch | huiyiqun/permutation-algorithms | switch.py | switch.py | ###
# A permutation generation algorithm.
# this algorithm is implemented by switching neighboring number.
#
# Under here is two implementation recursive and iterative
###
def recursive_PGA_with_switch(width):
'''
Recursive permutation generation algorithm with switch
'''
# condition
assert width ... | mit | Python | |
dfab68c27b3f25f448c0a2a6d0cee347bae2b08f | Add tests for canonicalize | kvesteri/intervals | tests/test_canonicalize.py | tests/test_canonicalize.py | from intervals import Interval, canonicalize
def test_canonicalize():
assert canonicalize(Interval([1, 4])).normalized == '[1, 5)'
assert canonicalize(
Interval((1, 7)), lower_inc=True, upper_inc=True
).normalized == '[2, 6]'
assert canonicalize(
Interval([1, 7]), lower_inc=False, uppe... | bsd-3-clause | Python | |
76468926c1efe4d18477a70d767f91d4c6e38768 | Add test for dotted circles in sample text | googlefonts/lang | tests/test_dottedcircle.py | tests/test_dottedcircle.py | import uharfbuzz as hb
import gflanguages
import pytest
langs = gflanguages.LoadLanguages()
@pytest.fixture
def hb_font():
# Persuade Harfbuzz we have a font that supports
# every codepoint.
face = hb.Face(b"")
font = hb.Font(face)
funcs = hb.FontFuncs.create()
funcs.set_nominal_glyph_func((l... | apache-2.0 | Python | |
7c69ec08967dc38463cfc5e1323d69fd5f261333 | Create config.py | yearofthepython/pyvty | config.py | config.py | #!/usr/bin/env python
import pyvty
user = 'admin'
password = 'password'
host = '10.36.65.227'
config_file = 'config.txt' # name of text file containing config commands.
logfile = 'config_' + host + '.log' # terminal output will be saved in this file.
try:
input_file = open(config_file)
commands = input_f... | mit | Python | |
7864c8e8591d1de14f18ecfaf880e79de6c7702e | add tests for placeholder class | alphagov/notifications-utils | tests/test_placeholders.py | tests/test_placeholders.py | import re
import pytest
from notifications_utils.field import Placeholder
@pytest.mark.parametrize('body, expected', [
('((with-brackets))', 'with-brackets'),
('without-brackets', 'without-brackets'),
])
def test_placeholder_returns_name(body, expected):
assert Placeholder(body).name == expected
@pyte... | mit | Python | |
9b1f9e9abd2890bc3e4d9f38109f12de8b488b66 | Create config.py | Reckasta/FacilityAI | config.py | config.py | username = "facility_ai"
password = "UncloakIsADick"
client_id = "GORfUXQGjNIveA"
client_secret = "SzPFXaqgVbRxm_V9-IfGL05npPE"
| mit | Python | |
17f71bfb81393241759e38fb9dce01561aeca3d5 | Add tests to product tags | car3oon/saleor,itbabu/saleor,UITools/saleor,KenMutemi/saleor,maferelo/saleor,KenMutemi/saleor,jreigel/saleor,mociepka/saleor,mociepka/saleor,itbabu/saleor,tfroehlich82/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,HyperManTT/ECommerceSaleor,jreigel/saleor,UITools/saleor,UITools/saleor,tfroehlich82/saleor,itbabu/sale... | tests/test_product_tags.py | tests/test_product_tags.py | from mock import Mock
from saleor.product.templatetags.product_images import get_thumbnail, product_first_image
def test_get_thumbnail():
instance = Mock()
cropped_value = Mock(url='crop.jpg')
thumbnail_value = Mock(url='thumb.jpg')
instance.crop = {'10x10': cropped_value}
instance.thumbnail = {'1... | bsd-3-clause | Python | |
27444dfefa70759694b755185c2eb6f25216d326 | Remove Node - migration. | devilry/devilry-django,devilry/devilry-django,devilry/devilry-django,devilry/devilry-django | devilry/apps/core/migrations/0037_auto_20170620_1515.py | devilry/apps/core/migrations/0037_auto_20170620_1515.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-06-20 15:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0036_auto_20170523_1748'),
]
operations = [
migrations.AlterUniqueTogether(
... | bsd-3-clause | Python | |
f1cb5af4f42ccf437cdd6ef06a2056993e54b604 | Create sum13.py | dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey | Python/CodingBat/sum13.py | Python/CodingBat/sum13.py | # http://codingbat.com/prob/p167025
def sum13(nums):
sum = 0
i = 0
while i < len(nums):
if nums[i] == 13:
i += 2
continue
else:
sum += nums[i]
i += 1
return sum
| mit | Python | |
d408ae00d2e5c0a0e7c5e90e98088d52815c5e49 | Create WikiScrape.py | jonathanelbailey/PowerShell-Code-Samples,jonathanelbailey/PowerShell-Code-Samples,jebaile7964/PowerShell-Code-Samples,jebaile7964/PowerShell-Code-Samples | Python/WikiScrape.py | Python/WikiScrape.py | ## This script was tested using Python 2.7.9
## The MWClient library was used to access the api. It can be found at:
## https://github.com/mwclient/mwclient
import mwclient
site = mwclient.Site(('https', 'en.wikipedia.org'))
site.login('$user', '$pass') # credentials are sanitized from the script.
listpage = site.Pag... | mit | Python | |
e455d459590a4f2b16b9a9360b6e33640f5ec7bf | Add a script to check that __all__ in __init__.py is correct | daviddrysdale/python-phonenumbers,roubert/python-phonenumbers,daodaoliang/python-phonenumbers,titansgroup/python-phonenumbers,dongguangming/python-phonenumbers,daviddrysdale/python-phonenumbers,agentr13/python-phonenumbers,gencer/python-phonenumbers,SergiuMir/python-phonenumbers,shikigit/python-phonenumbers,daviddrysda... | python/allcheck.py | python/allcheck.py | #!/usr/bin/env python
import sys
import re
import glob
import phonenumbers
INTERNAL_FILES = ['phonenumbers/util.py',
'phonenumbers/re_util.py',
'phonenumbers/unicode_util.py']
CLASS_RE = re.compile(r"^class +([A-Za-z][_A-Za-z0-9]+)[ \(:]")
FUNCTION_RE = re.compile("^def +([A-Za-z][... | apache-2.0 | Python | |
0deec6fecb527f12ff6851c47820b76db8196a34 | Add files via upload | annamacmillan/python-drabbles | rosette.py | rosette.py | # This is a basic program showing the functionality of the turtle module.
# It generates a very pretty spiraling pattern.
import turtle # import the turtle module so we can draw
import math # import the math module, we need this for e and pi
t = turtle.Pen() # set a variable to draw with
t.reset() ... | mit | Python | |
48c844e602eaa182c4efaaa0b977765f4248d0a0 | Add a data migration tool | Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot | tools/network_migration.py | tools/network_migration.py | import argparse, shelve
def renameDictKeys(storageDict):
for key in storageDict.iterkeys():
if isinstance(storageDict[key], dict):
renameDictKeys(storageDict[key])
if key == options.oldnetwork:
storageDict[options.newnetwork] = storageDict[options.oldnetwork]
del... | mit | Python | |
20269212705bdfd8748be468a50567ba290ad4a1 | Bump PROVISION_VERSION for new APNS. | hackerkid/zulip,dhcrzf/zulip,kou/zulip,jackrzhang/zulip,rht/zulip,timabbott/zulip,eeshangarg/zulip,mahim97/zulip,jackrzhang/zulip,hackerkid/zulip,punchagan/zulip,showell/zulip,showell/zulip,zulip/zulip,brockwhittaker/zulip,verma-varsha/zulip,dhcrzf/zulip,tommyip/zulip,punchagan/zulip,zulip/zulip,timabbott/zulip,shubham... | version.py | version.py | ZULIP_VERSION = "1.6.0+git"
PROVISION_VERSION = '9.4'
| ZULIP_VERSION = "1.6.0+git"
PROVISION_VERSION = '9.3'
| apache-2.0 | Python |
bd2cfd63ce51c55c695a12dc13e9ac52872cea5a | Add ternary_axes_subplot.py | marcharper/python-ternary,btweinstein/python-ternary | ternary/ternary_axes_subplot.py | ternary/ternary_axes_subplot.py | """
Wrapper class for all ternary plotting functions.
"""
from matplotlib import pyplot
import heatmapping
import lines
import plotting
def figure(ax=None, scale=None):
"""
Wraps a Matplotlib AxesSubplot or generates a new one. Emulates matplotlib's
> figure, ax = pyplot.subplot()
Parameters
--... | mit | Python | |
426f9c0b63adf7d7085a45bfe3520eb36a2ad6f7 | Fix indents. | ayust/evelink,FashtimeDotCom/evelink,bastianh/evelink,Morloth1274/EVE-Online-POCO-manager,zigdon/evelink | evelink/parsing/assets.py | evelink/parsing/assets.py | from evelink import api
from evelink import constants
def parse_assets(api_result):
def handle_rowset(rowset, parent_location):
results = []
for row in rowset.findall('row'):
item = {'id': int(row.attrib['itemID']),
'item_type_id': int(row.attrib['typeID']),
... | from evelink import api
from evelink import constants
def parse_assets(api_result):
def handle_rowset(rowset, parent_location):
results = []
for row in rowset.findall('row'):
item = {'id': int(row.attrib['itemID']),
'item_type_id': int(row.attrib['typeID']),
'location_id': i... | mit | Python |
35076b373913381a90aa65e8052036eb51eece46 | add unicode_literals in utils | 9p0le/simiki,zhaochunqi/simiki,9p0le/simiki,zhaochunqi/simiki,tankywoo/simiki,zhaochunqi/simiki,tankywoo/simiki,tankywoo/simiki,9p0le/simiki | simiki/utils.py | simiki/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os
import shutil
import errno
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import shutil
import errno
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033... | mit | Python |
d72d2e38d177476470b22ded061dd06b2be3ee88 | Add the quantity-safe allclose from spectral-cube | e-koch/TurbuStat,Astroua/TurbuStat | turbustat/tests/helpers.py | turbustat/tests/helpers.py | from __future__ import print_function, absolute_import, division
from astropy import units as u
from numpy.testing import assert_allclose as assert_allclose_numpy, assert_array_equal
def assert_allclose(q1, q2, **kwargs):
"""
Quantity-safe version of Numpy's assert_allclose
Copyright (c) 2014, spectral... | mit | Python | |
6c3d92a2d3eb043e466e3d6ab8e303c025cc7e0a | add ColorPrinter.py | legend80s/ColorPrinter | ColorPrinter.py | ColorPrinter.py | class ColorPrinter:
"""
print message to terminal with colored header
"""
def __init__(self, header=''):
self.__header = header
self.__levels = {
'log': '\033[0m', # terminal color header
'info': '\033[1;32;40m', # green header
'warn': '\033[1;33;40m... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.