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 |
|---|---|---|---|---|---|---|---|---|
a0789a4bad7747073257d8976534b33ab9862ec4 | Add unit test for IssueRegister view | toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity | feed/tests/test_issueregisterview.py | feed/tests/test_issueregisterview.py | from django.contrib.auth.models import User
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from feed.views import IssueRegisterViewSet
from workflow.models import IssueRegister, Organization, TolaUser
class IssueRegisterViewsTest(TestCase):
def setUp(self):
self.user =... | apache-2.0 | Python | |
05e8f84356c63ab953f5c2a3d3d06ee1760008d0 | Add list_queue plugin | ianstalk/Flexget,crawln45/Flexget,ianstalk/Flexget,OmgOhnoes/Flexget,qvazzler/Flexget,sean797/Flexget,Danfocus/Flexget,jawilson/Flexget,qk4l/Flexget,tobinjt/Flexget,gazpachoking/Flexget,JorisDeRieck/Flexget,qk4l/Flexget,OmgOhnoes/Flexget,drwyrm/Flexget,oxc/Flexget,LynxyssCZ/Flexget,oxc/Flexget,malkavi/Flexget,Flexget/F... | flexget/plugins/filter/list_queue.py | flexget/plugins/filter/list_queue.py | import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('list_queue')
class ListQueue(object):
schema = {
'type': 'array',
'items': {
'allOf': [
{'$ref': '/schema/plugins?group=list'},
{
'ma... | mit | Python | |
f7a69e24912c3b9ed52201b52c79be4407884c3a | add module util for trying to resolve an ipv6 netmask to cidr. not perfect, but not meant to be either. | F5Networks/f5-ansible-modules | library/module_utils/network/f5/ipaddress.py | library/module_utils/network/f5/ipaddress.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2018 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
def ipv6_netmask_to_cidr(mask):
"""converts an IPv6 netmask to CIDR for... | mit | Python | |
8922f9430ec2844a3a14621ad0625aa45999c92a | fix args order | liujianpc/xunlei-lixian,sdgdsffdsfff/xunlei-lixian,davies/xunlei-lixian,GeassDB/xunlei-lixian,wogong/xunlei-lixian,iambus/xunlei-lixian,myself659/xunlei-lixian,wangjun/xunlei-lixian,sndnvaps/xunlei-lixian,windygu/xunlei-lixian,xieyanhao/xunlei-lixian,ccagg/xunlei | lixian_hash.py | lixian_hash.py | #!/usr/bin/env python
import hashlib
import lixian_hash_ed2k
import lixian_hash_bt
import os
def lib_hash_file(h, path):
with open(path, 'rb') as stream:
while True:
bytes = stream.read(1024*1024)
if not bytes:
break
h.update(bytes)
return h.hexdigest()
def sha1_hash_file(path):
return lib_hash_fil... | #!/usr/bin/env python
import hashlib
import lixian_hash_ed2k
import lixian_hash_bt
import os
def lib_hash_file(h, path):
with open(path, 'rb') as stream:
while True:
bytes = stream.read(1024*1024)
if not bytes:
break
h.update(bytes)
return h.hexdigest()
def sha1_hash_file(path):
return lib_hash_fil... | mit | Python |
0814bbf6867a4bdd9d92c63e467f237b6129ee28 | add solution for palindrome number | SwordYoung/cutprob,SwordYoung/cutprob | leetcode/palindrome-number/sol.py | leetcode/palindrome-number/sol.py | #!/usr/bin/env python
class Solution:
# @return a boolean
def isPalindrome(self, x):
if x == -1:
return True
def ll(x):
return 0 if x == 0 or x == -1 else ll(x/10)+1
p = x >= 0
l = ll(x)
print "x is %d l is %d" % (x, l)
t = x
... | artistic-2.0 | Python | |
d2a92c5d628f426c26374dea6cb37bd35ba18812 | print variables | calico/basenji,calico/basenji | bin/basenji_variables.py | bin/basenji_variables.py | #!/usr/bin/env python
# Copyright 2017 Calico LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python | |
517a326b2869190bb1c0a676f467e1529e119259 | Create enigma.py | pkeating/Enigma-Machine | enigma.py | enigma.py | from EnigmaMachine import Plugboard
from EnigmaMachine import Rotor
from EnigmaMachine import Reflector
from EnigmaMachine import Machine
import ConfigParser
def configureRotor(n):
# Opens the Rotor configurations file.
config_file = ConfigParser.RawConfigParser()
config_file.read('Config/rotor_config.cfg')
# Pr... | mit | Python | |
0598e61d9bcef2217f22cce2deeec08ed6868575 | Add rmd.py | cangermueller/deepcpg,cangermueller/deepcpg | scripts/rmd.py | scripts/rmd.py | #!/usr/bin/env python
import argparse
import sys
import logging
import os
import os.path as pt
import shutil
class App(object):
def run(self, args):
name = pt.basename(args[0])
parser = self.create_parser(name)
opts = parser.parse_args(args[1:])
return self.main(name, opts)
... | mit | Python | |
30a8e40efee241dd6aa3b534814655b9f70cfffe | Add 020-valid-parentheses.py, but missed case "([])", the description is confused | mvj3/leetcode | 020-valid-parentheses.py | 020-valid-parentheses.py | """
Question:
Valid Parentheses My Submissions Question Solution
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
Performance:
... | mit | Python | |
8249d33898500d9d39e8bee3d44d39c2a6034659 | Add script to create overlays | JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field | scripts/create_overlays.py | scripts/create_overlays.py | """Varcan smart tool."""
import click
from dtoolcore import DataSet
@click.command()
@click.argument('dataset_uri')
@click.option('--config-path', type=click.Path(exists=True))
def main(dataset_uri, config_path=None):
dataset = DataSet.from_uri(dataset_uri, config_path=config_path)
def name_from_identifie... | mit | Python | |
5510f90565809471e545584419b22980b63a1864 | Add metadata | njvack/markdown-to-json | bids_writer/_metadata.py | bids_writer/_metadata.py | # -*- coding: utf-8 -*-
version = "0.1.0"
author = "Nathan Vack"
author_email = "njvack@wisc.edu"
license = "MIT"
copyright = "Copyright 2015 Boards of Regent of the University of Wisconsin System"
url = "https://github.com/njvack/bids-json-writer"
| mit | Python | |
65f574973bbde545c1c815d0ad21e4a8d3f3b59d | Add initial cbio client | bgyori/bioagents,sorgerlab/bioagents | bioagents/cbio_client.py | bioagents/cbio_client.py | import os
import json
import logging
import requests
from collections import defaultdict
logger = logging.getLogger(__name__)
base_url = 'https://www.cbioportal.org/api'
resources_dir = os.path.join(os.path.dirname(
os.path.abspath(__file__)), os.pardir, 'resources')
patient_list_cache = os.path.join(resources... | bsd-2-clause | Python | |
b38b9e62c174ff55d496bec2fb6599bee8262a3c | Add plot_compare_methods from scikit-learn | lucasdavid/Manifold-Learning,lucasdavid/Manifold-Learning | manifold/plot_compare_methods.py | manifold/plot_compare_methods.py | # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu>
# print(__doc__)
from time import time
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import NullFormatter
from sklearn import manifold, datasets
def compare():
# Next line to silence pyflakes. This ... | mit | Python | |
bf60d3c48a30863571a8700fa5a843be48e7646b | add vat_reckoner | douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/combo,douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/combo,douglassquirrel/combo | components/vat_reckoner/vat_reckoner.py | components/vat_reckoner/vat_reckoner.py | #! /usr/bin/env python
from json import loads, dumps
from pika import BlockingConnection, ConnectionParameters
RABBIT_MQ_HOST = '54.76.183.35'
RABBIT_MQ_PORT = 5672
def vat(ch, method, properties, body):
product = loads(body)
sku, price = product['sku'], product['price']
vat = price * 0.20
vat_fact =... | mit | Python | |
77d90ec03eff1946a422e5471cc1a64708eff0f4 | Test dramatis personae | zmbc/shakespearelang,zmbc/shakespearelang,zmbc/shakespearelang | shakespearelang/tests/unit/test_dramatis_personae.py | shakespearelang/tests/unit/test_dramatis_personae.py | from shakespearelang import Shakespeare
from shakespearelang.errors import ShakespeareRuntimeError
import pytest
MANY_CHARACTERS_PLAY = """
A lot of people.
Achilles, a test.
Christopher Sly, a test.
Demetrius, a test.
John of Lancaster, a test.
Juliet, a test.
Mistress Overdone, a test.
Romeo, a test.
Stephano, a te... | mit | Python | |
0ba11dd47dac04f3f7a314cf320558ccbc9eb148 | Add test for water polygon name dropping. | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | integration-test/1477-water-layer-too-big.py | integration-test/1477-water-layer-too-big.py | # -*- encoding: utf-8 -*-
from . import FixtureTest
class WaterLayerTooBigTest(FixtureTest):
def test_drop_label(self):
from tilequeue.tile import calc_meters_per_pixel_area
from shapely.ops import transform
from tilequeue.tile import reproject_mercator_to_lnglat
import math
... | mit | Python | |
a3e538830305d8a6651c5ed46e2dfdffe41c28e6 | Add a module for ssh 'console' API | xcat2/confluent,xcat2/confluent,jjohnson42/confluent,xcat2/confluent,jjohnson42/confluent,whowutwut/confluent,xcat2/confluent,whowutwut/confluent,whowutwut/confluent,whowutwut/confluent,jjohnson42/confluent,jjohnson42/confluent,jjohnson42/confluent,xcat2/confluent | confluent_server/confluent/plugins/shell/ssh.py | confluent_server/confluent/plugins/shell/ssh.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2015 Lenovo
#
# 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 ... | apache-2.0 | Python | |
865dc29421c1e9ef4bf340bf32164863cc5f2006 | Add management command to list installed spiders | legco-watch/legco-watch,comsaint/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,comsaint/legco-watch,legco-watch/legco-watch | app/raw/management/commands/list_spiders.py | app/raw/management/commands/list_spiders.py | from django.core.management import BaseCommand
from raw.utils import list_spiders
class Command(BaseCommand):
help = 'List installed spiders'
def handle(self, *args, **options):
for spider in list_spiders():
print spider
| mit | Python | |
77966f7f993e526467b2e54e0d12241354efec16 | add spec for re2 | facebook/bistro,facebook/bistro,facebook/bistro,facebook/bistro,facebook/bistro,facebook/bistro | build/fbcode_builder/specs/re2.py | build/fbcode_builder/specs/re2.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def fbcode_builder_spec(builder):
return {
'steps': [
builder.github_project_workdir('google/re2', 'build'),
bu... | mit | Python | |
15388e09ab537d3731891353c54f53105c4a7ee4 | add files | youqingkui/weixin_pay | weixin_pay.py | weixin_pay.py | #!/usr/bin/env python
# coding=utf-8
__author__ = 'youqingkui'
| mit | Python | |
b7360d6ba397f8654f4e051227aa86a1ebe693f7 | Add main program | networm/FollowGitHubUser | follow.py | follow.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from github import Github
# usage
def usage():
print 'Follow GitHub user\'s starred, watching and following.'
print
print 'Usage: python follow.py <token> <user>'
print
print 'token: Go to https://github.com/settings/tokens and `Generate n... | mit | Python | |
9080d20bd61ac66a534c834a17a9825808416512 | Add pre-stage hook for FrostNumberModel | csdms/wmt-metadata | metadata/FrostNumberModel/hooks/pre-stage.py | metadata/FrostNumberModel/hooks/pre-stage.py | """A hook for modifying parameter values read from the WMT client."""
import os
import shutil
from wmt.utils.hook import find_simulation_input_file
from topoflow_utils.hook import assign_parameters
file_list = []
def execute(env):
"""Perform pre-stage tasks for running a component.
Parameters
-------... | mit | Python | |
70849edc52acc1c559b35a55c7f1925c1cbf57ad | add new tagcount plugin for yawt rewrite | drivet/yawt,drivet/yawt,drivet/yawt | yawtext/tagcount.py | yawtext/tagcount.py | from flask import current_app, g, Blueprint
import jsonpickle
from yawt.utils import save_file, load_file
import os
tagcountsbp = Blueprint('tagcounts', __name__)
@tagcountsbp.app_context_processor
def tagcounts():
tagcountfile = current_app.config['YAWT_TAGCOUNT_FILE']
tvars = {}
if os.path.isfile(tagcou... | mit | Python | |
d19aaf0fd3c88c08b2b8563030dd38c0cea3631b | Add unit test for `parse_cluster_info` (#22205) | ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray | dashboard/modules/job/tests/test_sdk.py | dashboard/modules/job/tests/test_sdk.py | import pytest
from typing import Dict, Optional, Tuple
from unittest.mock import Mock, patch
from ray.dashboard.modules.job.sdk import parse_cluster_info
@pytest.mark.parametrize(
"address_param",
[
("ray://1.2.3.4:10001", "ray", "1.2.3.4:10001"),
("other_module://", "other_module", ""),
... | apache-2.0 | Python | |
4d570475d22cc85dd55c4b68bd7321cec7be8e7e | Add bytecode patcher to change the snooper URL and interval (see wiki.vg/Session#Snoop) | SupaHam/mark2,frostyfrog/mark2,frostyfrog/mark2,SupaHam/mark2 | snoop_patch.py | snoop_patch.py | from os import chdir
from tempfile import mkdtemp
from shutil import rmtree
from struct import pack
from subprocess import check_output
def jar_contents(j_path):
return check_output(['jar', 'tf', j_path]).split("\n")
def jar_extract(j_path):
return check_output(['jar', 'xf', j_path])
def ja... | mit | Python | |
3c685922756a582030980f319014ba308735ee2c | add nextlaunch command | cblgh/tenyks-contrib,kyleterry/tenyks-contrib | src/tenyksscripts/scripts/rockets.py | src/tenyksscripts/scripts/rockets.py | import datetime
import requests
import time
def run(data, settings):
if data["payload"] != "nextlaunch":
return
launches = requests.get("https://launchlibrary.net/1.2/launch", params={"next": 1, "mode": "verbose"}).json()
if not launches["count"]:
return "No launches scheduled"
launc... | mit | Python | |
ba3e2a81a5e89c010473820732835d8bf7ccc39a | Create morningstar.py | LordCatatonic/Lucifer,LordCatatonic/Lucifer | morningstar.py | morningstar.py | import os
import sys
import threading
import thread
import time
import settings
import subprocess
import psutil
class watchman(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
badwinprocs = ['taskmgr', 'regedit', 'mbam', 'cmd', 'command']
if 'lucifer' in sys.argv[0]:
exe... | unlicense | Python | |
7d546ca0ce8e2e8ef4f71abda50764817ce83c0b | add mouse_click.py | wy36101299/mouse_click | mouse_click.py | mouse_click.py | from pymouse import PyMouse
from time import sleep
m = PyMouse()
sleep(5)
x=969
y=581
a = 1
while a == 1:
m.click(x,y)#移動到(x,y)並且點擊
sleep(0.1)
p = m.position() #獲取目前位置
if not 900<p[0]<1000: #x座標不在 900~1000內 離開迴圈
break | mit | Python | |
9ef3260ba5d27a3274fa6d3112e36091f04989f9 | add file | dragonwolverines/DataStructures,dragonwolverines/DataStructures,dragonwolverines/DataStructures | resource-4/permutations/permutationToInteger.py | resource-4/permutations/permutationToInteger.py | def permutationToInteger(perm):
permLen = len(perm)
elts = range(permLen)
num = 0
for i in range(permLen):
digit = elts.index(perm[i])
num += digit * math.factorial(permLen - i - 1)
del elts(digit)
return num
| bsd-2-clause | Python | |
dafa0060460a2d4e820fbdafd33e51363bac0259 | Create 01.Mean.py | rmatam/Deep-Learning | 01.Python/01.Mean.py | 01.Python/01.Mean.py | import numpy as np
A = np.array([[10,14,11,7,9.5,15,19],[8,9,17,14.5,12,18,15.5],
[15,7.5,11.5,10,10.5,7,11],[11.5,11,9,12,14,12,7.5]])
B = A.T
print B
print(np.mean(B))
print(np.mean(B,axis=0))
print(np.mean(A,axis=1))
| apache-2.0 | Python | |
9570da3427121628d4e144c1092da155583a496d | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/asinh/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/asinh/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark asinh."""
import timeit
name = "asinh"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: total number of test... | apache-2.0 | Python | |
d1ba1a02385581375831fd4b394f68ade4cbb101 | Create RX_TX.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/hairygael/RX_TX.py | home/hairygael/RX_TX.py | arduino = Runtime.createAndStart("arduino","Arduino")
arduino.setBoardMega()
arduino.connect("COM7")
arduino1 = Runtime.createAndStart("arduino1","Arduino")
arduino1.setBoardAtmega328()
#connecting arduino1 to arduino Serial1 instead to a COMX
arduino1.connect(arduino,"Serial1")
servo = Runtime.createAndStart("servo... | apache-2.0 | Python | |
c760c3387b6dcf5bd171960a3e64306c7f2519d0 | add a rotating colored triangle | gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl | pynodegl-utils/pynodegl_utils/examples/misc.py | pynodegl-utils/pynodegl_utils/examples/misc.py | import math
from pynodegl import Texture, Shader, TexturedShape, Rotate, AnimKeyFrameScalar, Triangle
from pynodegl_utils.misc import scene
@scene()
def triangle(cfg):
frag_data = '''
#version 100
precision mediump float;
varying vec2 var_tex0_coords;
void main(void)
{
vec2 c = var_tex0_coords;
gl_FragCo... | apache-2.0 | Python | |
3e9fc08e096ddb212cf40a285887b7ed5dd8897b | Fix running coverage for nose tests (PY-14869) | semonte/intellij-community,youdonghai/intellij-community,apixandru/intellij-community,FHannes/intellij-community,semonte/intellij-community,youdonghai/intellij-community,suncycheng/intellij-community,mglukhikh/intellij-community,da1z/intellij-community,semonte/intellij-community,youdonghai/intellij-community,FHannes/in... | python/helpers/coverage_runner/run_coverage.py | python/helpers/coverage_runner/run_coverage.py | """Coverage.py's main entrypoint."""
import os
import sys
bundled_coverage_path = os.getenv('BUNDLED_COVERAGE_PATH')
if bundled_coverage_path:
sys_path_backup = sys.path
sys.path = [p for p in sys.path if p != bundled_coverage_path]
from coverage.cmdline import main
sys.path = sys_path_backup
else:
... | """Coverage.py's main entrypoint."""
import os
import sys
bundled_coverage_path = os.getenv('BUNDLED_COVERAGE_PATH')
if bundled_coverage_path:
sys_path_backup = sys.path
sys.path = [p for p in sys.path if p != bundled_coverage_path]
from coverage.cmdline import main
sys.path = sys_path_backup
else:
... | apache-2.0 | Python |
fd5ba7ad61a8c7c9aad6b3f1404d819ae21085d1 | Add 'calc_pb_flux.py' to calculate the particle background | liweitianux/chandra-acis-analysis,liweitianux/chandra-acis-analysis,liweitianux/chandra-acis-analysis | bin/calc_pb_flux.py | bin/calc_pb_flux.py | #!/usr/bin/env python3
#
# Copyright (c) 2017 Weitian LI <liweitianux@live.com>
# MIT license
"""
Calculate the particle background flux (e.g., 9.5-12.0 keV) of the spectra.
flux = counts / exposure / area
where 'counts' is the total photon counts within the specified energy range;
'area' is the value of the ``BACKSC... | mit | Python | |
6fb6e67792085b6ee910f1d0b8ed3e89f15dd60d | add script to datamine the reports via nltk | Smelly-London/Smelly-London,Smelly-London/Smelly-London,mgrazebrook/smelly_london,mgrazebrook/smelly_london,Smelly-London/datavisualisation,Smelly-London/Smelly-London,Smelly-London/Smelly-London,Smelly-London/datavisualisation | smelly_london/all_reports_smell_search_final.py | smelly_london/all_reports_smell_search_final.py |
from map import mapping
# walk through the os and get all files
# read each file in tern and go through line by line
# print lines that contain smell and the report name
from os import listdir
import nltk.data
import json
SMELL_WORDS = ['smell', 'stench', 'stink', 'odour', 'sniff', 'effluvium']
REPORTS_DIR = '/Users/... | apache-2.0 | Python | |
5b31e63043e3c3652f751d4a85e6bcdf925f797e | Create q3.py | pollseed/script_lib,pollseed/script_lib,pollseed/script_lib,pollseed/script_lib,pollseed/python_script_lib,pollseed/python_script_lib,pollseed/python_script_lib,pollseed/script_lib,pollseed/python_script_lib,pollseed/python_script_lib,pollseed/python_script_lib,pollseed/script_lib | work/q3.py | work/q3.py | def fibonacci_number(n, m, count):
if count <= 10:
print(n, end=" ")
return fibonacci_number(m, n + m, count + 1)
fibonacci_number(0, 1, 0)
| mit | Python | |
0383796cb681404e6c4794f1321ad62a9945b572 | add script to output all leagues of users | ChristopherIMeyers/ATZ-ReplayFlair,ChristopherIMeyers/ATZ-ReplayFlair | checkLeagues.py | checkLeagues.py | import settings as settings
import funcs
accountMaps = funcs.readAccountsFile("accounts.txt")
def getLeagueForAccountMap(accountMap):
league = funcs.getLeague(settings.regions[accountMap['region']], accountMap['bnet'])
return (accountMap['redditName'], league)
newLeagues = map(getLeagueForAccountMap, accountMaps... | mit | Python | |
c20cde04d1a5a2939e7f5c0953725fd043c5b849 | add media migration | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | molo/core/migrations/0067_media_migration.py | molo/core/migrations/0067_media_migration.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def convert_media_to_molo_media(apps, schema_editor):
from molo.core.models import MoloMedia, ArticlePage
from wagtailmedia.models import Media
for media in Media.objects.all():
new_media = M... | bsd-2-clause | Python | |
77b6c86359376af5eb8de63ae89d9316776b26bc | Add missing migration | rapidpro/tracpro,rapidpro/tracpro,rapidpro/tracpro | tracpro/polls/migrations/0034_auto_20170323_1315.py | tracpro/polls/migrations/0034_auto_20170323_1315.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('polls', '0033_auto_20170307_1338'),
]
operations = [
migrations.AlterField(
model_name='pollrun',
na... | bsd-3-clause | Python | |
255c7ff91bc4918ce13d32cba2b871e3d0befad8 | revert that url change | SeedScientific/polio,SeedScientific/polio,SeedScientific/polio,unicef/polio,unicef/polio,unicef/polio,SeedScientific/polio,unicef/polio,unicef/rhizome,unicef/rhizome,unicef/rhizome,SeedScientific/polio,unicef/rhizome | polio/urls.py | polio/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'polio.views.home', name='home'),
url(r'^datapoints/', include('datapoints.app_urls.urls', namespace="datapoints")),
url(r'^datapoints/indicators... | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'polio.views.home', name='home'),
url(r'^uf04/datapoints/', include('datapoints.app_urls.urls', namespace="datapoints")),
url(r'^uf04/datapoints/... | agpl-3.0 | Python |
5f12ada7fe0ddb44274e18decbaea0d05ab4471f | Solve Code Fights lineup problem | HKuz/Test_Code | CodeFights/lineUp.py | CodeFights/lineUp.py | #!/usr/local/bin/python
# Code Fights Lineup Problem
def lineUp(commands):
aligned, tmp = 0, 0
com_dict = {"L": 1, "A": 0, "R": -1}
for c in commands:
tmp += com_dict[c]
if tmp % 2 == 0:
aligned += 1
return aligned
def main():
tests = [
["LLARL", 3],
[... | mit | Python | |
8deb0dc2743d1d85899cb636b88ed831c05838a9 | Make machine action button translatable | fieldOfView/Cura,ynotstartups/Wanhao,ynotstartups/Wanhao,fieldOfView/Cura,hmflash/Cura,Curahelper/Cura,hmflash/Cura,Curahelper/Cura | DiscoverUM3Action.py | DiscoverUM3Action.py | from cura.MachineAction import MachineAction
from UM.Application import Application
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
class DiscoverUM3Action(MachineAction):
def __init__(self):
super().__init__("DiscoverUM3Action", ... | from cura.MachineAction import MachineAction
from UM.Application import Application
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot
class DiscoverUM3Action(MachineAction):
def __init__(self):
super().__init__("DiscoverUM3Action", "Discover printers")
self._qml_url = "DiscoverUM3Action... | agpl-3.0 | Python |
c486b8df5861fd883b49ea8118d40d73f5b4e7b8 | Add download apikey test case | pansapiens/mytardis,pansapiens/mytardis,pansapiens/mytardis,pansapiens/mytardis | tardis/tardis_portal/tests/test_download_apikey.py | tardis/tardis_portal/tests/test_download_apikey.py | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test import TestCase
from tastypie.test import ResourceTestCase
from django.test.client import Client
from django.conf import settings
from django.contrib.auth.models import User
class ApiKeyDownloadTestCase(ResourceTestCase):
def ... | bsd-3-clause | Python | |
601636b75595031ef9478297f9a52132a9bff9eb | Add herwig3 (#19406) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/herwig3/package.py | var/spack/repos/builtin/packages/herwig3/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import shutil
class Herwig3(AutotoolsPackage):
"""Herwig is a multi-purpose particle physics eve... | lgpl-2.1 | Python | |
af67d052fc78e56ac7f934f4c90f00d2eb097bb3 | Add StarFinder tests | astropy/photutils,larrybradley/photutils | photutils/detection/tests/test_starfinder.py | photutils/detection/tests/test_starfinder.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for StarFinder.
"""
from astropy.modeling.models import Gaussian2D
from astropy.tests.helper import catch_warnings
import numpy as np
import pytest
from ..starfinder import StarFinder
from ...datasets import make_100gaussians_image
from ...util... | bsd-3-clause | Python | |
72203e529f083cbc9427b02348cc178e4443031c | Add new package: libuser (#18916) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/libuser/package.py | var/spack/repos/builtin/packages/libuser/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libuser(AutotoolsPackage):
"""A user and group account administration library."""
hom... | lgpl-2.1 | Python | |
ac09970129df9c5292344287b04a1be143fac681 | add diag openmp | ratnania/pyccel,ratnania/pyccel | tests/examples/openmp/diagnostics.py | tests/examples/openmp/diagnostics.py | # coding: utf-8
import numpy as np
from matplotlib import pyplot as plt
def matrix_product():
procs = [1, 4, 8, 16, 28]
times = [1194.849, 305.231, 69.174,37.145, 22.731]
n_groups = len(procs)
# ...
fig, ax = plt.subplots()
index = np.arange(n_groups)
bar_width = 0.2
opacity = 0.4
... | mit | Python | |
3da13d9597b49a7d929dd84806d1c10b99cf8bea | Create yadisk.py | haitaka/DroiTaka | cogs/utils/api/yadisk.py | cogs/utils/api/yadisk.py | import json
import requests
__version__ = '0.1.2-dev'
USER_AGENT = 'pycopy/{}'.format(__version__)
BASE_URL = 'https://api.copy.com'
AUTH_URL = BASE_URL + '/auth_user' # TODO: should use /rest
OBJECTS_URL = BASE_URL + '/list_objects' # TODO: should use /rest
DOWNLOAD_URL = BASE_URL + '/download_object' # TODO: sho... | mit | Python | |
65f6f78008d4f961c9ebe5d8047b0f2c742fe15f | Add unittest for QInputDialog.getXXX() methods | RobinD42/pyside,RobinD42/pyside,enthought/pyside,BadSingleton/pyside2,M4rtinK/pyside-bb10,pankajp/pyside,BadSingleton/pyside2,M4rtinK/pyside-android,IronManMark20/pyside2,pankajp/pyside,BadSingleton/pyside2,pankajp/pyside,gbaty/pyside2,RobinD42/pyside,qtproject/pyside-pyside,M4rtinK/pyside-android,M4rtinK/pyside-bb10,M... | tests/qtgui/qinputdialog_get_test.py | tests/qtgui/qinputdialog_get_test.py | import unittest
from PySide import QtCore, QtGui
from helper import UsesQApplication, TimedQApplication
class TestInputDialog(TimedQApplication):
def testGetDouble(self):
QtGui.QInputDialog.getDouble(None, "title", "label")
def testGetInt(self):
QtGui.QInputDialog.getInt(None, "title", "labe... | lgpl-2.1 | Python | |
52189e2161e92b36df47a04c2150dff38f81f5e9 | Add mocked tests for activation | pombredanne/viewflow,ribeiro-ucl/viewflow,codingjoe/viewflow,codingjoe/viewflow,pombredanne/viewflow,viewflow/viewflow,viewflow/viewflow,viewflow/viewflow,ribeiro-ucl/viewflow,codingjoe/viewflow,ribeiro-ucl/viewflow | tests/unit/tests/test_activations.py | tests/unit/tests/test_activations.py | from unittest import mock
from django.test import TestCase
from viewflow import activation, flow
from viewflow.models import Task
class TestActivations(TestCase):
def test_start_activation_lifecycle(self):
flow_task_mock = mock.Mock(spec=flow.Start())
act = activation.StartActivation()
a... | agpl-3.0 | Python | |
e0df929e07e30c514b2b39f515bfd3102d1ebfe7 | Add annotate experiment | barry-scott/git-workbench,barry-scott/git-workbench,barry-scott/scm-workbench,barry-scott/scm-workbench,barry-scott/scm-workbench | Source/Git/Experiments/git_annotate.py | Source/Git/Experiments/git_annotate.py | #!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
num = 0
for info in r.blame( 'HEAD', sys.argv[2] ):
num += 1
commit = info[0]
all_lines = info[1]
print( '%s %6d:%s' % (commit, num, all_lines[0]) )
for line in all_lines[1:]:
num += 1
print( '%*s %6d:%s' % (4... | apache-2.0 | Python | |
51d581c7bca0fcacf8604b898f96394847865e15 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/e1e64a45b138980a6d8c125bacc81f22142d2b53. | tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/ten... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "e1e64a45b138980a6d8c125bacc81f22142d2b53"
TFRT_SHA256 = "5afd4500e88c75188e29e6827343... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "0dcdcc3f57a96bc354e66f3805dff4f619e2b93f"
TFRT_SHA256 = "940edcaf656cbbfee314689fd7e5... | apache-2.0 | Python |
5dd31aa3cfacb6bd157d50ac3d310b8064a46b80 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/5f6e52142a3592d0cfa058dbfd140cad49ed451a. | yongtang/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,pa... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "5f6e52142a3592d0cfa058dbfd140cad49ed451a"
TFRT_SHA256 = "8e1efbd7df0fdeb5186b178d7c8b... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "736eeebfb56c6d0de138f4a29286140d8c26d927"
TFRT_SHA256 = "b584ee5ce5ecaadf289b0997987d... | apache-2.0 | Python |
0c13207eeda65754532bab5888cc33693fb06834 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/b87ea071c60db54775b92da8e0eed8477ab96a6a. | tensorflow/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-Corporation/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,yongtang/t... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "b87ea071c60db54775b92da8e0eed8477ab96a6a"
TFRT_SHA256 = "61b8951d9236a82c54be8db871cd427013ec24ae17b0e6... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "75318fbce7817886508abd18dd5ea3b35d552372"
TFRT_SHA256 = "233d123e6287e105acb2b464db68b753624dfe5c27f299... | apache-2.0 | Python |
1eb980caefcbaaa4b29f7c3d92f27e490003e208 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/9562f24de39c95b4a076f7e0a0eb79cb980a9c72. | tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-py... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "9562f24de39c95b4a076f7e0a0eb79cb980a9c72"
TFRT_SHA256 = "6fda4b556e5100e83ba292b8907c82f152740bb9eb157d... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "de22adc4126843c3cf142e0a829d153dc94cdd73"
TFRT_SHA256 = "e345d2ae1d385ebaf41531c831bb1025cab260fe20daa5... | apache-2.0 | Python |
a73671995e1c5b920f5f93226c7bf3e7501a7448 | Add test for GoogLeNet | ronekko/deep_metric_learning | tests/test_googlenet.py | tests/test_googlenet.py | import unittest
import numpy
from chainer import cuda
from chainer import testing
from chainer.testing import attr
from chainer.variable import Variable
from .. import googlenet
@unittest.skipUnless(googlenet.available, 'Pillow is required')
@attr.slow
class TestGoogLeNet(unittest.TestCase):
def setUp(self):
... | mit | Python | |
fd01a25c0f5cb9ba75b2a659d47d1d3902242c5e | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/c3e082762b7664bbc7ffd2c39e86464928e27c0c. | Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,karlless... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "c3e082762b7664bbc7ffd2c39e86464928e27c0c"
TFRT_SHA256 = "9b7fabe6e786e6437bb7cd1a4bed... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "5a604f55b0d725eb537fd1a7cb6a88fcc6fd9b73"
TFRT_SHA256 = "004f312a2c65165e301b101add21... | apache-2.0 | Python |
06cfa4c7055ec997dcb3aec11732ee1be5330b75 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/285e48bc47db23a479637fd1e2767b9a35dc2c9b. | yongtang/tensorflow,Intel-Corporation/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimenta... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "285e48bc47db23a479637fd1e2767b9a35dc2c9b"
TFRT_SHA256 = "6f0067d0cb7bb407caeef060603b6e33f1231cddf1ce4c... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "962d1c7a123f01ccdb39e0d1959794f432b0ffeb"
TFRT_SHA256 = "ce0f2f86d19850e8951514b0e3f76950d07a8dc79d053d... | apache-2.0 | Python |
27cb9279670bd513a1559f4865500d84869bb9f0 | Test module for Predictor class. | exord/pyboas | tests/test_predictor.py | tests/test_predictor.py | #! /usr/env/bin python
import numpy as np
from pyboas import predictor, models
# Build random 3-parameter normal posterior.
posterior = np.random.randn(100, 3)
def toy_model(param, time):
time = np.atleast_1d(time)[:, np.newaxis]
a = param[:, 0]
b = param[:, 1]
c = param[:, 2]
return a*time**2... | mit | Python | |
0b443cab974a0d0ce58a2cb4fdd68c7992377eb8 | add chisquare test comparing random sample with cdf (first try of commit) | efiring/scipy,sonnyhu/scipy,njwilson23/scipy,nvoron23/scipy,WarrenWeckesser/scipy,jakevdp/scipy,ndchorley/scipy,zaxliu/scipy,josephcslater/scipy,endolith/scipy,sriki18/scipy,mingwpy/scipy,jjhelmus/scipy,chatcannon/scipy,mdhaber/scipy,Stefan-Endres/scipy,futurulus/scipy,fernand/scipy,endolith/scipy,matthew-brett/scipy,b... | scipy/stats/tests/test_discrete_chisquare.py | scipy/stats/tests/test_discrete_chisquare.py |
import numpy as np
from scipy import stats
debug = False
def check_discrete_chisquare(distname, arg, alpha = 0.01):
'''perform chisquare test for random sample of a discrete distribution
Parameters
----------
distname : string
name of distribution function
arg : sequence
... | bsd-3-clause | Python | |
7ac3540c2b49bcfd933fe1167f92a9b3c0cdf438 | Add a stub for matching boss catalogue. | legacysurvey/legacypipe,legacysurvey/legacypipe | py/legacyproduct/bin/match-boss-catalogue.py | py/legacyproduct/bin/match-boss-catalogue.py | #!/usr/bin/env python
from __future__ import print_function, division
import numpy as np
from legacyproduct.internal import sharedmem
import argparse
import os, sys
from time import time
from scipy.spatial import cKDTree as KDTree
import fitsio
def main():
ns = parse_args()
bricks = list_bricks(ns)
... | bsd-3-clause | Python | |
34d5b5cdc058f1c9055b82151b518251fa3b4f74 | Add tool to create combined smart contract files | tomashaber/raiden,hackaugusto/raiden,tomashaber/raiden,tomashaber/raiden,hackaugusto/raiden,tomashaber/raiden,tomashaber/raiden | tools/join-contracts.py | tools/join-contracts.py | import os
import click
import re
from click.types import File
IMPORT_RE = re.compile(r'^import +["\'](?P<contract>[^"\']+.sol)["\'];$')
"""
Utility to join solidity contracts into a single output file by recursively
resolving imports.
example usage:
$ cd raiden/smart_contracts
$ python ../../tools/join-contracts.p... | mit | Python | |
e06416a61826229ebd0cccdc519b6dc39d8a0fd9 | Add migration to remove models. | sheagcraig/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal,salopensource/sal,salopensource/sal,salopensource/sal,sheagcraig/sal | server/migrations/0088_auto_20190304_1313.py | server/migrations/0088_auto_20190304_1313.py | # Generated by Django 2.1.4 on 2019-03-04 18:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('server', '0087_auto_20190301_1424'),
]
operations = [
migrations.AlterUniqueTogether(
name='installedupdate',
unique_togethe... | apache-2.0 | Python | |
04a4d7887664753f87d6ccd0921c87160d8ced26 | Create 002_gen.py | ys-nuem/project-euler,ys-nuem/project-euler | 002/002_gen.py | 002/002_gen.py | #!/usr/bin/env python
def fibonatti(n_max=4000000):
f1, f2 = 1, 1
while f2 <= n_max:
yield f2
f2 += f1
f1 = f2 - f1
answer = sum(f for f in fibonatti() if f % 2 == 0)
print(answer)
| mit | Python | |
92f88fb9021094f1429f5175d01a354c4ad35880 | add initial gyp to build freetype lib (problems with cflags not showing up in xcode) | Cue/skia,metajack/skia,mrobinson/skia,Cue/skia,metajack/skia,Cue/skia,mrobinson/skia,mrobinson/skia,mrobinson/skia,metajack/skia,metajack/skia,mrobinson/skia,Cue/skia | gyp/freetype.gyp | gyp/freetype.gyp | {
# 'includes': [
# 'common.gypi',
# ],
'targets': [
{
'target_name': 'skfreetype',
'type': 'static_library',
'sources': [
'../third_party/freetype/src/base/ftbbox.c',
'../third_party/freetype/src/base/ftbitmap.c',
'../third_party/freetype/src/base/ftglyph.c',
... | bsd-3-clause | Python | |
e8efe8de59b32e7b78fcf801dccce36e7ec53768 | implement regular Kmeans | Totoketchup/das,Totoketchup/das | models/Kmeans_2.py | models/Kmeans_2.py | # -*- coding: utf-8 -*-
# My Model
from utils.ops import ops
import tensorflow as tf
import numpy as np
from sklearn.datasets import make_blobs
#############################################
# Deep Adaptive Separator Model #
#############################################
class KMeans:
def __init__(self,... | mit | Python | |
66137a8710bf3b778c860af8d6278ee0c97bbab4 | Add script to delete unused users on JupyterHub | ryanlovett/datahub,berkeley-dsep-infra/datahub,ryanlovett/datahub,berkeley-dsep-infra/datahub,berkeley-dsep-infra/datahub,ryanlovett/datahub | scripts/delete-unused-users.py | scripts/delete-unused-users.py | #!/usr/bin/env python3
"""
Delete unused users from a JupyterHub.
JupyterHub performance sometimes scales with *total* number
of users, rather than running number of users. While that should
be fixed, we can work around it by deleting unused users once in
a while. This script will delete anyone who hasn't registered
a... | bsd-3-clause | Python | |
ad6aa623bbd8f316ab7fb8c389d1c9c74b17ae8c | add util module for converting an update job into xml | sassoftware/rpath-repeater | rpath_repeater/utils/update_job_formatter.py | rpath_repeater/utils/update_job_formatter.py | #!/usr/bin/python
#
# Copyright (c) 2012 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rp... | apache-2.0 | Python | |
7b14028f3796981974b6d01b98277326123c0395 | add get_flatpage template tag | mupi/timtec,mupi/timtec,mupi/timtec,AllanNozomu/tecsaladeaula,mupi/tecsaladeaula,hacklabr/timtec,GustavoVS/timtec,virgilio/timtec,AllanNozomu/tecsaladeaula,AllanNozomu/tecsaladeaula,mupi/tecsaladeaula,virgilio/timtec,GustavoVS/timtec,GustavoVS/timtec,mupi/tecsaladeaula,hacklabr/timtec,mupi/tecsaladeaula,AllanNozomu/tec... | core/templatetags/get_flatpage.py | core/templatetags/get_flatpage.py | from django import template
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import get_current_site
register = template.Library()
class FlatpageNode(template.Node):
def __init__(self, con... | agpl-3.0 | Python | |
b8a07ce36cfeb2679ace05b26d6adc1e525d6044 | Add feature computation module | starcalibre/microscopium,microscopium/microscopium,microscopium/microscopium,Don86/microscopium,Don86/microscopium,jni/microscopium,jni/microscopium | husc/features.py | husc/features.py | import functools as fun
import numpy as np
from scipy.stats.mstats import mquantiles
from scipy import ndimage as nd
from skimage import feature, color, io as imio, img_as_float, \
morphology as skmorph
from skimage import filter as imfilter, measure
def lab_hist(rgb_image, **kwargs):
return np.histogram(col... | bsd-3-clause | Python | |
f16a7e43ce4d9dc82fd4bfca34d80f0447bd57db | add isStaffOrReadOnly permissions | avih/treeherder,avih/treeherder,jgraham/treeherder,gbrmachado/treeherder,moijes12/treeherder,rail/treeherder,vaishalitekale/treeherder,edmorley/treeherder,adusca/treeherder,tojon/treeherder,akhileshpillai/treeherder,parkouss/treeherder,kapy2010/treeherder,jgraham/treeherder,gbrmachado/treeherder,edmorley/treeherder,moi... | treeherder/webapp/api/permissions.py | treeherder/webapp/api/permissions.py | from rest_framework.permissions import BasePermission
from rest_framework.permissions import SAFE_METHODS
class IsStaffOrReadOnly(BasePermission):
"""
The request is authenticated as an admin staff (eg. sheriffs), or is a read-only request.
"""
def has_permission(self, request, view):
return ... | mpl-2.0 | Python | |
5a77678a44ec9838e943b514a586dbd96b8bdfdc | Add migration for license change | openego/oeplatform,tom-heimbrodt/oeplatform,openego/oeplatform,openego/oeplatform,tom-heimbrodt/oeplatform,tom-heimbrodt/oeplatform,openego/oeplatform | modelview/migrations/0042_auto_20171215_0953.py | modelview/migrations/0042_auto_20171215_0953.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-12-15 08:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelview', '0041_merge_20171211_1420'),
]
operations = [
migrations.AlterF... | agpl-3.0 | Python | |
5522285af9179441e56f65405037bb3a4c1c1274 | Revert "Important fixes" | JNeiger/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software | soccer/gameplay/plays/testing/triangle_pass.py | soccer/gameplay/plays/testing/triangle_pass.py | import robocup
import play
import behavior
import skills.move
import skills.capture
import tactics.coordinated_pass
import constants
import main
import enum
## A demo play written during a teaching session to demonstrate play-writing
# Three robots form a triangle on the field and pass the ball A->B->C->A and so on.
... | apache-2.0 | Python | |
0a4c100f9fb6e7540320fb7c55aeebdffe91c6d1 | add primenumber.py | BhaskarNaidu/python | primenumber.py | primenumber.py | lower = int(input("Enter lower range: "))
upper = int(input("Enter upper range: "))
for num in range(lower,upper + 1):
if num > 1:
for i in range(2,num):
if (num % i) == 0:
break
else:
print(num)
| apache-2.0 | Python | |
64ced324f05de20f839782913cfb13d147d49dd6 | create a scheduler example file to test on live | jaredwelch1/CapstoneI,jaredwelch1/CapstoneI | code-samples/web_scraper/jared/scheduling_script.py | code-samples/web_scraper/jared/scheduling_script.py | from time import sleep
from apscheduler.schedulers.background import BackgroundScheduler as Scheduler
import logging
import datetime
# create a scheduler
s = Scheduler()
# This is what I want to happen
def job():
logging.basicConfig(filename='scheduled_task.log',level=logging.INFO,
format='%(asctime)s %(messa... | mit | Python | |
a9a6a3dafc8901ffeeb89862fdc79f7099ba311a | Add UTF-8 test | ksuarz/monary,ksuarz/monary,ksuarz/monary,ksuarz/monary,ksuarz/monary,ksuarz/monary | test/test_utf8.py | test/test_utf8.py | # -*- coding: utf-8 -*-
# Monary - Copyright 2011-2014 David J. C. Beach
# Please see the included LICENSE.TXT and NOTICE.TXT for licensing information.
import pymongo
import monary
def setup():
with pymongo.Connection("127.0.0.1") as c:
c.drop_database("monary_test")
c.monary_test.data.insert({"... | apache-2.0 | Python | |
6740c6192ab9bf37767230981b86e446486d4c43 | implement basic plugin loader for laser | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/laser/ethereum/plugins/plugin_loader.py | mythril/laser/ethereum/plugins/plugin_loader.py | from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.plugins.plugin import LaserPlugin
class LaserPluginLoader:
"""
The LaserPluginLoader is used to abstract the logic relating to plugins.
Components outside of laser thus don't have to be aware of the interface that plugins provide
... | mit | Python | |
a01f4d47410ee1bf164d8b962f6337f8c39f0d16 | add quicksort recursive | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | sort/quick_sort/python/quicksort-recusive.py | sort/quick_sort/python/quicksort-recusive.py |
def quickSort(arr):
sort(arr,0,len(arr)-1)
def sort(arr, low, high):
if (low < high):
p = partition(arr, low, high)
sort(arr, low, p - 1)
sort(arr, p + 1, high)
def partition(arr, low, high):
pivot = arr[high]
i = (low - 1)
for j in range(low,high):
if (arr[j] <=... | cc0-1.0 | Python | |
e6b381a617808c500e115d5e3715dc2ae454e896 | Add command line tool | psd-tools/psd-tools,kmike/psd-tools,kmike/psd-tools | src/psd_tools2/__main__.py | src/psd_tools2/__main__.py | from __future__ import unicode_literals
import logging
import docopt
from psd_tools2 import PSDImage
from psd_tools2.version import __version__
try:
from IPython.lib.pretty import pprint
except ImportError:
from pprint import pprint
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler... | mit | Python | |
bce910100fe0c3970b82d4f5544f11ce3392bc3c | Remove NoQueueMinCycleTime nonsense from sync worker | mduggan/tapiriik,cpfair/tapiriik,campbellr/tapiriik,niosus/tapiriik,abs0/tapiriik,cgourlay/tapiriik,campbellr/tapiriik,niosus/tapiriik,brunoflores/tapiriik,abhijit86k/tapiriik,dlenski/tapiriik,cmgrote/tapiriik,gavioto/tapiriik,olamy/tapiriik,cpfair/tapiriik,mduggan/tapiriik,cpfair/tapiriik,mjnbike/tapiriik,marxin/tapir... | sync_worker.py | sync_worker.py | from datetime import datetime, timedelta
import os
print("Sync worker %s booting at %s" % (os.getpid(), datetime.now()))
from tapiriik.requests_lib import patch_requests_with_default_timeout, patch_requests_source_address
from tapiriik import settings
from tapiriik.database import db, close_connections
import time
imp... | from datetime import datetime, timedelta
import os
print("Sync worker %s booting at %s" % (os.getpid(), datetime.now()))
from tapiriik.requests_lib import patch_requests_with_default_timeout, patch_requests_source_address
from tapiriik import settings
from tapiriik.database import db, close_connections
import time
imp... | apache-2.0 | Python |
6d134c2a870150477ecc41edbab272e75462bbcd | Add benchmark script | knightwupz/mistune,lepture/mistune,jubel-han/mistune,knightwupz/mistune | tests/bench.py | tests/bench.py |
import os
import re
import time
root = os.path.dirname(__file__)
known = []
def listdir(folder):
folder = os.path.join(root, folder)
files = os.listdir(folder)
files = filter(lambda o: o.endswith('.text'), files)
return files
def mistune_runner(content):
import mistune
return mistune.mark... | bsd-3-clause | Python | |
f5970d1488d28f27c5f20dd11619187d0c13c960 | Add simple windows registry read/write functions | ddubson/code-dojo-py | os/win_registry.py | os/win_registry.py | import _winreg
keyName = "myKey"
def write_to_registry():
try:
key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\" + keyName)
_winreg.SetValueEx(key, "myVal", 0, _winreg.REG_SZ, "This is a value.")
print("value created")
except Exception as e:
print(e)
def read_f... | mit | Python | |
a37007e03747395c12cc4bc34c761aa3253f7599 | Add tests folder | MrKiven/ECache | tests/__init__.py | tests/__init__.py | # -*- coding: utf-8 -*-
| mit | Python | |
d046bc3be27c39ca70a45d92939a2aa2444f3195 | test examples | tkarna/cofs | test/examples/test_examples.py | test/examples/test_examples.py | """
Runs all example scripts. Only tests whether examples can be executed.
"""
import pytest
import os
import subprocess
import glob
import sys
# set environment flag
# can be used in examples to reduce cpu cost
os.environ['THETIS_REGRESSION_TEST'] = "1"
exclude_files = [
'baroclinic_eddies/diagnostics.py',
'... | mit | Python | |
b872aaa2837e7cd72c36f2b3fd7679106fda57b4 | Add test cli | MizukiSonoko/iroha-cli,MizukiSonoko/iroha-cli | tests/test_cli.py | tests/test_cli.py | import unittest
import sys, os
import cli
from io import StringIO
io = StringIO()
class TestBuildInCommands(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_normal(self):
sys.stdout = io
# $ iroha-ya-cli
cli.main.main(['iroha-ya-cli'])
... | apache-2.0 | Python | |
3d7bb0dfcbfda9c99ee2372394959667c76bb83f | Add first .py file to project | Nehoroshiy/multi_classifier,Nehoroshiy/multi_classifier | main.py | main.py |
print("Hello!") | mit | Python | |
59a57a25ff925bd1ce6d467d316ec478847b58ad | Create combinations.py | Matir/analysis-tools | combinations.py | combinations.py | #!/usr/bin/env python
from string import uppercase, lowercase, maketrans
import math, sys
class combinations():
def combs(self, total, choice):
return (math.factorial(total)/(math.factorial(choice)*math.factorial(total-choice)))
if __name__ == '__main__':
try:
total = sys.argv[1]
... | mit | Python | |
2c63d77428b84c7d1be1c861079d39d641d51fcf | add script to scrap stock data and save them locally | Michael-Tu/tools,Michael-Tu/tools,Michael-Tu/tools,Michael-Tu/tools | stock_scraping/stock_price_scraping_to_local.py | stock_scraping/stock_price_scraping_to_local.py | '''
This script helps you scrap stock data avaliable on Bloomberg Finance
and store them locally.
Please obey applicable local and federal laws and applicable API term of use
when using this scripts. I, the creater of this script, will not be responsible
for any legal issues resulting from the use of this script.
@au... | mit | Python | |
72fe45ca6e6cd13b0b5fbb250ce769f5ec883e90 | Add awful pixiv command. | MJB47/Jokusoramame,MJB47/Jokusoramame,MJB47/Jokusoramame | joku/cogs/pixiv.py | joku/cogs/pixiv.py | """
Cog for interacting with the Pixiv API.
"""
import random
import shutil
import requests
from discord.ext import commands
from io import BytesIO
from pixivpy3 import AppPixivAPI
from asyncio_extras import threadpool
from pixivpy3 import PixivAPI
from pixivpy3 import PixivError
from joku.bot import Context
class ... | mit | Python | |
ba06683866ce8e4e3bccd4acebd6ec2278acfeaa | Add Litecoin testnet, and Litecoin BIP32 prefixes. | gitonio/pycoin,shivaenigma/pycoin,shayanb/pycoin,XertroV/pycoin,richardkiss/pycoin,antiface/pycoin,Magicking/pycoin,richardkiss/pycoin,thirdkey-solutions/pycoin,Pan0ram1x/pycoin,Treefunder/pycoin,Tetchain/pycoin,shayanb/pycoin,Bluejudy/pycoin,lekanovic/pycoin,tomholub/pycoin,tomholub/pycoin,Tetchain/pycoin,Kefkius/pyco... | pycoin/networks.py | pycoin/networks.py | from collections import namedtuple
from .serialize import h2b
NetworkValues = namedtuple('NetworkValues',
('network_name', 'subnet_name', 'code', 'wif', 'address',
'pay_to_script', 'prv32', 'pub32'))
NETWORKS = (
NetworkValues("Bitcoin", "mainnet", "BTC", b'... | from collections import namedtuple
from .serialize import h2b
NetworkValues = namedtuple('NetworkValues',
('network_name', 'subnet_name', 'code', 'wif', 'address',
'pay_to_script', 'prv32', 'pub32'))
NETWORKS = (
NetworkValues("Bitcoin", "mainnet", "BTC", b'... | mit | Python |
1de668219f618a0632fac80fd892a0a229b8fa05 | Solve Code Fights addition without carrying problem | HKuz/Test_Code | CodeFights/additionWithoutCarrying.py | CodeFights/additionWithoutCarrying.py | #!/usr/local/bin/python
# Code Fights Addition Without Carrying Problem
def additionWithoutCarrying(param1, param2):
s1, s2 = str(param1), str(param2)
shorter = s1 if len(s1) < len(s2) else s2
longer = s2 if shorter == s1 else s1
if len(shorter) < len(longer):
shorter = shorter.zfill(len(longe... | mit | Python | |
ed5c27623711a7f3b798aed9c0f7cdbdcebc0dcd | test python interpreter | eevee/cocos2d-mirror | test/test_interpreter_layer.py | test/test_interpreter_layer.py | # This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
import pyglet
if __name__ == "__main__":
director.init()
interpreter_layer = cocos.layer.... | bsd-3-clause | Python | |
7f4bd900d1e647fe017ce4c01e279dd41a71a349 | Add management command to set SoftwareSecure verification status. | procangroup/edx-platform,fintech-circle/edx-platform,devs1991/test_edx_docmode,a-parhom/edx-platform,pomegranited/edx-platform,zubair-arbi/edx-platform,JCBarahona/edX,naresh21/synergetics-edx-platform,jjmiranda/edx-platform,a-parhom/edx-platform,deepsrijit1105/edx-platform,IONISx/edx-platform,mitocw/edx-platform,zubair... | lms/djangoapps/verify_student/management/commands/set_software_secure_status.py | lms/djangoapps/verify_student/management/commands/set_software_secure_status.py | """
Manually set Software Secure verification status.
"""
import sys
from django.core.management.base import BaseCommand
from verify_student.models import (
SoftwareSecurePhotoVerification, VerificationCheckpoint, VerificationStatus
)
class Command(BaseCommand):
"""
Command to trigger the actions that w... | agpl-3.0 | Python | |
4dd66150c922e1c700fad74727955ef72c045f37 | Add Find Command MCEdit filter | satgo1546/dot-product,satgo1546/dot-product,satgo1546/dot-product,satgo1546/dot-product,satgo1546/dot-product | minecraft/FindCommand.py | minecraft/FindCommand.py | # MCEdit filter
from albow import alert
displayName = "Find Command"
inputs = (
("Command:", ("string", "value=")),
)
def perform(level, box, options):
command = options["Command:"]
n = 0
result = ""
for (chunk, slices, point) in level.getChunkSlices(box):
for e in chunk.TileEntities:
... | mit | Python | |
5e4ef4737c78b6154596ab8c76c4e60bd840453c | Add component.navbar | CodeForPhilly/chime,CodeForPhilly/chime,CodeForPhilly/chime | src/penn_chime_dash/app/components/navbar.py | src/penn_chime_dash/app/components/navbar.py | # components/navbar.py
import dash_bootstrap_components as dbc
import dash_html_components as html
import dash_core_components as dcc
from ..config import Config
cfg = Config()
navbar = dbc.NavbarSimple(
brand='Penn Med CHIME', # Browser window title
brand_href='/', # index page
children=[
... | mit | Python | |
eea33e6207da7446e1713eb4d78b76d37ae5eaf2 | Add sample of scheduler using celery | jovannypcg/python_scheduler | with_celery.py | with_celery.py | from celery import Celery
# The host in which RabbitMQ is running
HOST = 'amqp://guest@localhost'
app = Celery('pages_celery', broker=HOST)
@app.task
def work(msg):
print msg
# To execute the task:
#
# $ python
# >>> from with_celery import work
# >>> work.delay('Hi there!!')
| apache-2.0 | Python | |
7ca1f6c5d51f5e2fc582603012c3ca5a053ee4eb | Add BLT package (#19410) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/blt/package.py | var/spack/repos/builtin/packages/blt/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Blt(Package):
"""BLT is a streamlined CMake-based foundation for Building, Linking and
... | lgpl-2.1 | Python | |
4537ab84bb87eeae6b6865b7b9140d5324384e4a | add test cases for address operations | the-metaverse/metaverse,mvs-org/metaverse,mvs-org/metaverse,the-metaverse/metaverse,mvs-live/metaverse,mvs-org/metaverse,mvs-org/metaverse,mvs-org/metaverse,mvs-org/metaverse,mvs-live/metaverse,the-metaverse/metaverse | test/test-rpc/TestCase/Account/test_address.py | test/test-rpc/TestCase/Account/test_address.py | import random
from TestCase.MVSTestCase import *
class TestAccount(MVSTestCaseBase):
roles = (Alice,)
need_mine = False
def test_0_new_address(self):
#password error
ec, message = mvs_rpc.new_address(Alice.name, Alice.password+'1')
self.assertEqual(ec, 1000, message)
#chec... | agpl-3.0 | Python | |
de40e15b661806dc75e73bd9f1fc2c37af60b0d3 | test case for geometry utils | YannickDieter/testbeam_analysis,SiLab-Bonn/testbeam_analysis,SiLab-Bonn/testbeam_analysis,YannickDieter/testbeam_analysis,YannickDieter/testbeam_analysis,SiLab-Bonn/testbeam_analysis,SiLab-Bonn/testbeam_analysis,YannickDieter/testbeam_analysis | testbeam_analysis/tests/test_geometry_utils.py | testbeam_analysis/tests/test_geometry_utils.py | ''' Script to check the correctness of the geometry utils functions (rotation, translation matrices)
'''
import os
import numpy as np
import unittest
from testbeam_analysis import geometry_utils
tests_data_folder = r'tests/test_track_analysis/'
class TestTrackAnalysis(unittest.TestCase):
@classmethod
def ... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.