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 |
|---|---|---|---|---|---|---|---|---|
2962c7a467e77079b2c69380e496dcf07e15003d | Add tests for validate_resource_id() | mollie/mollie-api-python | tests/responses/test_resource_base.py | tests/responses/test_resource_base.py | import pytest
from mollie.api.error import IdentifierError
from mollie.api.resources.base import ResourceBase
class MyTestResource(ResourceBase):
"""Minimal resource for testing."""
RESOURCE_ID_PREFIX = "test_"
def test_validate_resource_id(client):
resource = MyTestResource(client)
with pytest.ra... | bsd-2-clause | Python | |
cbf6dc193aec91c0e75a371d67e1d908d96b2028 | remove 2nd thread for monitor2 | WeirdCoder/ABB-IRB140,WeirdCoder/ABB-IRB140,WeirdCoder/ABB-IRB140 | robotsuite-lcm-util/IRB140LCM_monitor2.py | robotsuite-lcm-util/IRB140LCM_monitor2.py | '''
Author: alexc89@mit.edu
IRB140LCMWrapper
This is a script connecting OPEN ABB Driver with LCM. It publishes IRB140's joint position in IRB140Pos LCM Channel and listens IRB140Input to control IRB140's joint.
Please note that the unit of the joint state and command is dependent on the setting on the IRB140, this sc... | mit | Python | |
1ce466dba818885403342d456749c15dc9402e4f | Use PubMed URL to retrieve publication info | mfcovington/pubmed-lookup | pubmed.py | pubmed.py | # http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec136
# pip install biopython
import sys
import re
from urllib.parse import urlparse
from urllib.request import urlopen
from Bio import Entrez
# pubmed_url = 'http://www.ncbi.nlm.nih.gov/pubmed/25122667'
pubmed_url = sys.argv[1]
parse_result = urlparse(pubmed_... | bsd-3-clause | Python | |
1294679a7ea4ceacf610e4dc103677aeedc7b7ea | Split bam into files based on read grouping | HorvathLab/NGS,HorvathLab/NGS,HorvathLab/NGS,HorvathLab/NGS,HorvathLab/NGS | common/src/split.py | common/src/split.py |
from pysamimport import pysam
import re, os, hashlib
class SplitBAM(object):
def __init__(self,bamfile,readgroups,batchsize=10,directory='.',index=False):
self.bamfile = bamfile
self.bambase,self.bamextn = self.bamfile.rsplit('.',1)
self.readgroups = readgroups
self.batchsize = bat... | mit | Python | |
b5f785d1013bdb77003105b9f1f5a5bf8e7597f6 | Print and report totals for pipelines and params | mcb/pcf-pipelines,pivotal-cf/pcf-pipelines,mcb/pcf-pipelines,pivotal-cf/pcf-pipelines,sandyg1/pcf-pipelines,sandyg1/pcf-pipelines,pvsone/pcf-pipelines,pvsone/pcf-pipelines,pvsone/pcf-pipelines,rahulkj/pcf-pipelines,cah-josephgeorge/pcf-pipelines,pivotal-cf/pcf-pipelines,sandyg1/pcf-pipelines,cah-josephgeorge/pcf-pipeli... | ci/scripts/codestats.py | ci/scripts/codestats.py | #!/usr/bin/env python2
import os
import json
import yaml
import subprocess
from datadog import initialize, api
options = {
'api_key': os.environ['DATADOG_API_KEY'],
'app_key': os.environ['DATADOG_APP_KEY'],
}
initialize(**options)
repo_name = os.environ["REPO_NAME"]
print "Code stats for " + repo_name
cloc... | #!/usr/bin/env python2
import os
import json
import yaml
import subprocess
from datadog import initialize, api
options = {
'api_key': os.environ['DATADOG_API_KEY'],
'app_key': os.environ['DATADOG_APP_KEY'],
}
initialize(**options)
repo_name = os.environ["REPO_NAME"]
print "Code stats for " + repo_name
cloc... | apache-2.0 | Python |
622483b275cc70f7abc8a887fdd92e9f6a818448 | Initialize clashcallerbot_reply.py complete rewrite to PRAW6 | JoseALermaIII/clashcallerbot-reddit,JoseALermaIII/clashcallerbot-reddit | clashcallerbot_reply.py | clashcallerbot_reply.py | #! python3
# -*- coding: utf-8 -*-
"""Checks messages in database and sends PM if expiration time passed.
This module checks messages saved in a MySQL-compatible database and sends a reminder
via PM if the expiration time has passed. If so, the message is removed from the
database.
"""
import praw
import praw.excepti... | mit | Python | |
4f982fad854f3974350ee836bb6f59b9c3ba3638 | add strike.py | stackforge/fuel-plugin-vmware-dvs,stackforge/fuel-plugin-vmware-dvs,stackforge/fuel-plugin-vmware-dvs,stackforge/fuel-plugin-vmware-dvs | deployment_scripts/strike.py | deployment_scripts/strike.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, 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... | apache-2.0 | Python | |
1983e75adaa3ded9c4cf0ad136b71e18f4383e96 | Initialize Points calculator. | SRJ9/django-driver27,SRJ9/django-driver27,SRJ9/django-driver27 | driver27/points_calculator.py | driver27/points_calculator.py | from driver27.models import Result, Season, Contender
from driver27.punctuation import get_punctuation_config
from collections import namedtuple
ResultTuple = namedtuple('ResultTuple', 'qualifying finish fastest_lap wildcard alter_punctuation')
class Scoring(object):
def __init__(self, punctuation_config):
... | mit | Python | |
8ddb2d700f07a422a7c8abc72ff701ce05c12696 | 插入排序 Python版 | zhou7rui/algorithm,zhou7rui/algorithm,zhou7rui/algorithm | sorting/python/insertingSort.py | sorting/python/insertingSort.py | # -*- coding: utf-8 -*
'''
插入排序
'''
import sortHelper
@sortHelper.testSort
def insertingSort(arr):
n = len(arr)
for i in range(0,n,1):
for j in range(i,0,-1):
if arr[j] < arr[j-1]:
# sawp 操作 交换位置
temp = arr[j-1]
arr[j] = arr[j-1]
... | mit | Python | |
194c7f999035007df4ef4b3aad1061501a4a0275 | Create essen.py | vvps/Uni-Bremen-Mensa | essen.py | essen.py | # -*- coding: utf-8 -*-
#!/usr/bin/python3
import re
import urllib.request
from bs4 import BeautifulSoup
from collections import OrderedDict
page = urllib.request.urlopen('http://oracle-web.zfn.uni-bremen.de/essen/mensa').read()
soup = BeautifulSoup(page)
soup.prettify()
menuItems = soup.findAll('font',{'color':'RED... | mit | Python | |
801a3455d64247dadb2d2092a9be841520c6b430 | add a version constant | sassoftware/mirrorball,sassoftware/mirrorball | updatebot/constants.py | updatebot/constants.py | #
# Copyright (c) 2008 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.rpath.com/permanent/... | apache-2.0 | Python | |
55c48dae7bc33b0764ba4ac1d66852bd80b6fa6d | Add apivideos2csv.py | ArchiveTeam/twitchtv-items | utils/apivideos2csv.py | utils/apivideos2csv.py | '''Convert video JSON data into CSV list.
The JSON documents should be from
https://api.twitch.tv/kraken/videos/top?limit=20&offset=0&period=all
'''
import argparse
import csv
import json
import glob
def main():
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('directory')
arg_parser.add_... | unlicense | Python | |
f7d4c1a5ee45ff66b701edc10110aac904e543dd | Add unique_licenses.py | Datafable/gbif-data-licenses,Datafable/gbif-data-licenses,Datafable/gbif-data-licenses | code/unique_licenses.py | code/unique_licenses.py | #!/usr/bin/python
import sys
import csv
import re
import os
def check_arguments():
if len(sys.argv) != 3:
print "usage: ./unique_licenses.py <input file> <output file>"
print " The input file should contain two fields: <dataset id> and <license>"
print " This script will read in the input, fetch all lice... | mit | Python | |
2dec0f46c6b8ed61f6fd4723bb43711603ea754f | Add a new example test (GitHub) | mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,mdmintz/SeleniumBase | examples/github_test.py | examples/github_test.py | from seleniumbase import BaseCase
class GitHubTests(BaseCase):
def test_github(self):
self.open("https://github.com/")
self.update_text("input.header-search-input", "SeleniumBase\n")
self.click('a[href="/seleniumbase/SeleniumBase"]')
self.assert_element("div.repository-content")
... | mit | Python | |
5d8f4c3dc7fbd8bc7380e272889640271b512582 | Add tests for pickle functionality | python-bonobo/bonobo,hartym/bonobo,hartym/bonobo,python-bonobo/bonobo,hartym/bonobo,python-bonobo/bonobo | tests/io/test_pickle.py | tests/io/test_pickle.py | import pickle
import pytest
from bonobo import Bag, PickleReader, PickleWriter, open_fs
from bonobo.constants import BEGIN, END
from bonobo.execution.node import NodeExecutionContext
from bonobo.util.testing import CapturingNodeExecutionContext
def test_write_pickled_dict_to_file(tmpdir):
fs, filename = open_fs(... | apache-2.0 | Python | |
06ca428fd12ef9a7facca4ae80843a6d3f5089be | add an exmple progressbar.py | alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | examples/progressbar.py | examples/progressbar.py | #!/usr/bin/env python
# Tai Sakuma <sakuma@fnal.gov>
from AlphaTwirl.ProgressBar import ProgressBar, MPProgressMonitor, ProgressReport
from AlphaTwirl.EventReader import MPEventLoopRunner
import time, random
##____________________________________________________________________________||
class EventLoop(object):
d... | bsd-3-clause | Python | |
2f3187963c594fcc44acf30e28a1b2d208dcec93 | add simple cloudknot example | yeatmanlab/pyAFQ,yeatmanlab/pyAFQ,arokem/pyAFQ,arokem/pyAFQ | examples/cloudknot_example.py | examples/cloudknot_example.py | # import cloudknot and set the correct region
import cloudknot as ck
ck.set_region('us-east-1')
def afq_process_subject(subject):
# define a function that each job will run
# In this case, each process does a single subject
import logging
import s3fs
# all imports must be at the top of the functio... | bsd-2-clause | Python | |
108835713326412756e5491eccf1991ad0b90503 | ADD sketch of validator | automl/SpySMAC,automl/SpySMAC,automl/SpySMAC | spysmac/validation/validator.py | spysmac/validation/validator.py | class Validator(object):
"""
Evaluates configuration on a given set of instances.
"""
def __init__(self, scenario, tae, runhistory):
"""
Create validator to run configurations on instances and create a
cost/performance-table in runhistory.
"""
self.scen = scenari... | bsd-3-clause | Python | |
aefb6010fe0e66eb3fc3f3ba2548a06650001109 | Add symbolizer using llvm. | cstorey/chain-replication-experiment,cstorey/chain-replication-experiment | tools/symbolize-perf.py | tools/symbolize-perf.py | #!/usr/bin/env python
import subprocess
import re
STACK_LINE = re.compile('^\t *([a-f0-9]*) (\S+) \((.*)\)$')
OUT_FMT = "\t %x %s (%s)"
SYMBOLIZE = ['llvm-symbolizer-3.6', '-demangle=true']
class Symbolicator(object):
def __init__(self):
self._child = subprocess.Popen(SYMBOLIZE, stdin=subprocess.PIPE, stdout... | mit | Python | |
0006dbb5009a24e1c5cde00e472d978597415cec | Create currentENV.py | getkub/PythonScriplets | MyEnvService/currentENV.py | MyEnvService/currentENV.py | #!/usr/bin/python
import time, logging
import csv
import os, sys, socket
# =======================================================================================
# Script to generate various Environment Parameters from CSV or external methods
# Created : getkub
program = sys.argv[0]
version = "1"
... | apache-2.0 | Python | |
ccca04b45083ecbde8a05ed709e4062024ab9f8d | Fix coverage | StevenVanAcker/mitmproxy,StevenVanAcker/mitmproxy,Kriechi/mitmproxy,ujjwal96/mitmproxy,mhils/mitmproxy,mitmproxy/mitmproxy,ujjwal96/mitmproxy,vhaupert/mitmproxy,mosajjal/mitmproxy,zlorb/mitmproxy,mosajjal/mitmproxy,cortesi/mitmproxy,laurmurclar/mitmproxy,xaxa89/mitmproxy,StevenVanAcker/mitmproxy,laurmurclar/mitmproxy,v... | mitmproxy/contentviews/image/view.py | mitmproxy/contentviews/image/view.py | import io
import imghdr
from PIL import Image
from mitmproxy.types import multidict
from . import image_parser
from mitmproxy.contentviews import base
class ViewImage(base.View):
name = "Image"
prompt = ("image", "i")
content_types = [
"image/png",
"image/jpeg",
"image/gif",
... | import io
import imghdr
from PIL import ExifTags
from PIL import Image
from mitmproxy.types import multidict
from . import image_parser
from mitmproxy.contentviews import base
class ViewImage(base.View):
name = "Image"
prompt = ("image", "i")
content_types = [
"image/png",
"image/jpeg",... | mit | Python |
e742cf2aec34db6c811d8134e9b00f9e2ca975b8 | Add airy_disk.py, which makes heavy use of utils.py | MattFerraro/radon | airy_disk.py | airy_disk.py | # Description: demonstate making an airy disk, aka simulate a telescope
# Author: Matt Ferraro
from numpy.fft import fft2, ifft2, fftshift, ifftshift
import numpy as np
import cv2
import argparse
import utils
def main(image_name):
# Make the pupil
pupil = utils.pupil_function(35)
utils.plot_image_and_sli... | apache-2.0 | Python | |
ffca478f4f342e26ade6b182e99bbda93ee5b318 | Integrate python's cmd into Docopt for app to run in a loop until user forcibly exits | peterpaints/room-allocator | allocator.py | allocator.py | """
Office Space Allocator.
Usage:
allocator create_room <room_type> <room_name>...
allocator add_person <person_name> <person_surname> <person_type> [<wants_accommodation>]
Options:
-h --help Show this screen.
--version Show version.
Examples:
allocator crea... | mit | Python | |
81108c3521f5bce7479b36b471ede13af08acaf7 | Add motor control node | atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot | src/autobot/src/motorControl.py | src/autobot/src/motorControl.py | #!/usr/bin/env python
"""
This node is responsible for translating drive_param.msg (velocity/angle)
messages to drive_value (pwm) for the teensyboard
Subscribes to:
drive_parameters: drive_param
Publishes to:
drive_pwm: drive_values
eStop: Bool
"""
import rospy
from autobot.msg i... | mit | Python | |
e5c9bcf24ef43227987a0bf7a04e3c030bdc4e7a | add server.py | ckcks12/OneStationGame,ckcks12/OneStationGame | server.py | server.py | # -*- coding: utf-8 -*-
from flask import Flask, make_response
from flask_httpauth import HTTPBasicAuth
from flask_restful import Resource, Api, abort, reqparse
import pymysql
import json
from time import mktime
import datetime
app = Flask(__name__)
api = Api(app)
auth = HTTPBasicAuth()
parser = reqparse.RequestPars... | mit | Python | |
151a383dd6c4bc5495600d59e7b2e2607e6548ae | Revert of Enabled chrome_proxy benchmarks on Android as we now have a TryBot. (https://codereview.chromium.org/367753003/) | hgl888/chromium-crosswalk-efl,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,dednal/chromium.src,ltilve/chromium,dednal/chromium.src,littlstar/chromium.src,mohamed--abdel-maksoud/chromium.src,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,Pluto-tv/chrom... | tools/perf/benchmarks/chrome_proxy.py | tools/perf/benchmarks/chrome_proxy.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import chrome_proxy
import page_sets
from telemetry import benchmark
@benchmark.Disabled
class ChromeProxyLatency(benchmark.Benchmark):
... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import chrome_proxy
import page_sets
from telemetry import benchmark
@benchmark.Enabled('android')
class ChromeProxyLatency(benchmark.Ben... | bsd-3-clause | Python |
3a6b45a619e70440d90cbd330582c58b426bb2ce | add example | y-mitsui/DensityRatioEstimation | example.py | example.py | '''
Created on 2017/05/29
'''
import numpy as np
from lsif import LSIF
from scipy.stats import norm
import matplotlib.pyplot as plt
if __name__ == "__main__":
# setting of sample
n_sample_molecule = 500 # numer of sample molecule
n_sample_denominator = 500 # numer of sample denominator
scale_molecule ... | mit | Python | |
fdce7cfab14bb6d25655e05cb2270fdd67a3a8c6 | Add Vocab class | ronrest/convenience_py,ronrest/convenience_py | convenience/nlp/Vocab.py | convenience/nlp/Vocab.py | from pandas import DataFrame, Series, concat
class Vocab(object):
def __init__(self):
self.vocab = DataFrame()
self.w2i = Series() # word to index Series
self.i2w = Series() # index to word Series
self.size = 0 # vocab size
| apache-2.0 | Python | |
bed879064015fcb96095bd879ed524f0f443af05 | Fix __init__ | cboling/xos,opencord/xos,zdw/xos,opencord/xos,open-cloud/xos,cboling/xos,open-cloud/xos,zdw/xos,cboling/xos,cboling/xos,zdw/xos,open-cloud/xos,cboling/xos,zdw/xos,opencord/xos | xos/core/models/__init__.py | xos/core/models/__init__.py | from .plcorebase import PlCoreBase,PlCoreBaseManager,PlCoreBaseDeletionManager,PlModelMixIn
from .project import Project
from .singletonmodel import SingletonModel
from .service import Service, Tenant, TenantWithContainer, CoarseTenant, ServicePrivilege, TenantRoot, TenantRootPrivilege, TenantRootRole, TenantPrivilege,... | from .plcorebase import PlCoreBase,PlCoreBaseManager,PlCoreBaseDeletionManager,PlModelMixIn
from .project import Project
from .singletonmodel import SingletonModel
from .service import Service, Tenant, TenantWithContainer, CoarseTenant, ServicePrivilege, TenantRoot, TenantRootPrivilege, TenantRootRole, TenantPrivilege,... | apache-2.0 | Python |
476de23191a9e1a4317249327664e59502f93a27 | Create slack helper methods | pipex/gitbot,pipex/gitbot,pipex/gitbot | app/slack.py | app/slack.py | from app import slack, redis, app
def get_channels(force_update=False):
channels = redis.get('channels')
if not channels or force_update:
update_channels()
return redis.smembers('channels')
def get_channel_id(channel):
"""Get channel slack id."""
if not channel.startswith('#'):
ch... | apache-2.0 | Python | |
d184afa1cfcef372b50ab8b231fe6db01b497f65 | Add a basic example GSC experiment with OneCycleLR | numenta/nupic.research,numenta/nupic.research,subutai/nupic.research,mrcslws/nupic.research,subutai/nupic.research,mrcslws/nupic.research | projects/gsc/experiments/gsc_onecyclelr.py | projects/gsc/experiments/gsc_onecyclelr.py | # Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... | agpl-3.0 | Python | |
32048a2b359108a23d776210d5e1a891a186c568 | add suduku | turbidsoul/tsutil | sudoku.py | sudoku.py | # -*- coding: utf8 -*-
from random import Random
rand = Random()
block = []
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def gen_empty_sdk():
"""
产生一个空的数独数组
"""
_sdk = []
for x in nums:
r = []
for x in nums:
r.append(0)
_sdk.append(r)
return _sdk
def get_row(sdk... | mit | Python | |
205a2f76bd7791dcef52e8b1f3acd9b95bc29ad3 | Bump dev version | funkyfuture/docker-py,youhong316/docker-py,funkyfuture/docker-py,youhong316/docker-py,vdemeester/docker-py,vdemeester/docker-py,docker/docker-py,docker/docker-py | docker/version.py | docker/version.py | version = "3.6.0-dev"
version_info = tuple([int(d) for d in version.split("-")[0].split(".")])
| version = "3.5.0"
version_info = tuple([int(d) for d in version.split("-")[0].split(".")])
| apache-2.0 | Python |
f4e8ec3ce5e85d0c31237179dbdf1157f3be9672 | test for scenario | openvstorage/arakoon,openvstorage/arakoon,openvstorage/arakoon | pylabs/test/server/shaky/test_issue_93.py | pylabs/test/server/shaky/test_issue_93.py | """
"""
from .. import system_tests_common as Common
from arakoon.ArakoonExceptions import *
from Compat import X
from nose.tools import *
import logging
import time
import subprocess
@Common.with_custom_setup(Common.setup_3_nodes, Common.basic_teardown)
def test_issue_93():
pass
"""
1. Startup 3 node arakoon... | apache-2.0 | Python | |
df4bd7d8e6b1d6539d3f98ae55db81465883b38e | add country subregions include cities of regional subjection | opendataby/osm-geodata | belarus_subregion_borders_include_cities.py | belarus_subregion_borders_include_cities.py | from itertools import chain
from _helpers import cursor_wrap, dump
subregion_cities = [
# Брестская область
(-71116, -3629362), # Барановичский район: Барановичи
(-59188, -72615), # Брестский район: Брест
(-71119, -1749248), # Пинский район: Пинск
# Витебская область
(-59504, -68614), # ... | mit | Python | |
ef28a4deaab84c8a04d79d682275deb1a6447be2 | add lost file | kunyavskiy/polygon-cli,kunyavskiy/polygon-cli | polygon_cli/actions/update_groups.py | polygon_cli/actions/update_groups.py | from .common import *
def update_groups():
if not load_session():
fatal('No session known. Use init first.')
content = global_vars.problem.get_script_content()
global_vars.problem.update_groups(content)
save_session()
def add_parser(subparsers):
parser_update_groups = subparsers.add_pars... | mit | Python | |
788699b0ed0c7cdc215bfe626d41566cd57551ac | test get and post | biolab-unige/xtens-demo-rest | resttest.py | resttest.py | from __future__ import print_function
import requests
import json
__author__ = 'massi'
irods_username = 'xtensdevel'
irods_password = 'xtensdevel'
xtens_app_uri = "http://localhost:1337"
irods_rest_uri = "http://130.251.10.60:8080/irods-rest/rest"
file_download_fragm = "/fileContents"
file_info_fragm = "/dataObject... | mit | Python | |
dda8691f188dd906481015a7a5f043643d69e65d | add demo that tests CSI n ABCD and tests issue #49 | tartley/colorama,mhils/colorama,openpeer/colorama,tartley/colorama,dannguyen/colorama,openpeer/colorama,dannguyen/colorama,alekibango/colorama,mhils/colorama,alekibango/colorama | demos/demo07.py | demos/demo07.py | import colorama
up = lambda count: "\x1b[%sA" % str(count)
down = lambda count: "\x1b[%sB" % str(count)
forward = lambda count: "\x1b[%sC" % str(count)
back = lambda count: "\x1b[%sD" % str(count)
def main():
"""
expected output:
1a2
aba
3a4
"""
colorama.init()
print "aaa"
print "a... | bsd-3-clause | Python | |
4d43c565bfb1e6a1db6d52f44f8a630eed8a1fdf | fix bugs | xczh/ccoin,xczh/ccoin | modules/TweetModule.py | modules/TweetModule.py | #!/usr/bin/env python
#coding=utf-8
from Base import BaseModule
import Requests
import json
class TweetModule(BaseModule):
tweet_url = r'https://coding.net/api/tweet'
sid = ''
delete_action = True
content = {'content':'hello coding'}
cookie = None
def init(self):
if self.moduleInfo['login'... | apache-2.0 | Python | |
7b80d908bf5712de67fe37d33cf339781657a4a8 | Add RTD local_settings file, to add custom templates. | feilongfl/micropython,lowRISC/micropython,tobbad/micropython,tuc-osg/micropython,tdautc19841202/micropython,bvernoux/micropython,vitiral/micropython,Timmenem/micropython,aethaniel/micropython,noahchense/micropython,ryannathans/micropython,bvernoux/micropython,henriknelson/micropython,paul-xxx/micropython,jmarcelino/pyc... | docs/readthedocs/settings/local_settings.py | docs/readthedocs/settings/local_settings.py | import os
# Directory that the project lives in, aka ../..
SITE_ROOT = '/'.join(os.path.dirname(__file__).split('/')[0:-2])
TEMPLATE_DIRS = (
"%s/templates/" % SITE_ROOT, # Your custom template directory, before the RTD one to override it.
"%s/readthedocs/templates/" % SITE_ROOT, # Default RTD template dir
)
| mit | Python | |
0e4cc5e598d89fb310476f297e07f0127046b141 | add user form. | andrewsmedina/tsuru-following,andrewsmedina/tsuru-following | forms.py | forms.py | from flask_wtf import Form
from wtforms import StringField
from wtforms.validators import DataRequired
class User(Form):
username = StringField('username', validators=[DataRequired()])
password = StringField('password', validators=[DataRequired()])
| bsd-2-clause | Python | |
39a15c3842faa8ffeae78ec31db54656888448ec | Test time to complete reboot call | open-power/op-test-framework,open-power/op-test-framework,open-power/op-test-framework | testcases/OpTestRebootTimeout.py | testcases/OpTestRebootTimeout.py | #!/usr/bin/env python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2018
# [+] International Business Machines Corp.
#
#
# 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 Lic... | apache-2.0 | Python | |
5a18778ad7d16486506cdc5780eedf1c364371c8 | Add editted hello | adamghx/cs3240-labdemo | hello.py | hello.py | print("hello")
def greeting(msg):
print(msg)
def main():
greeting("Adam")
if __name__ == "__main__":
main()
| mit | Python | |
158cd043b1ae35e76a72831b43b9148eccd9fe0d | Add summary CLI | bgyori/indra,sorgerlab/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,johnbachman/indra,bgyori/indra,johnbachman/indra,bgyori/indra,sorgerlab/indra | indra/sources/dgi/__main__.py | indra/sources/dgi/__main__.py | # -*- coding: utf-8 -*-
"""Command line interface for DGI-DB."""
from collections import Counter
from tabulate import tabulate
from .processor import DGIProcessor
def main():
processor = DGIProcessor()
statements = processor.extract_statements()
print(f'Number skipped: {processor.skipped}\n')
pri... | bsd-2-clause | Python | |
9e42dcece695c164d8105651831451f6b05442db | Add censoring dictionary sub-class #23 | peraktong/AnniesLasso | AnniesLasso/censoring.py | AnniesLasso/censoring.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A dictionary sub-class to deal with wavelength censoring.
"""
from __future__ import (division, print_function, absolute_import,
unicode_literals)
__all__ = ["CensorsDict"]
import logging
import numpy as np
logger = logging.getLogger(__name_... | mit | Python | |
312710da5fc247f5c89ea8653e191f9d542daf5b | test linesearch | dmaticzka/GraphProt,dmaticzka/GraphProt,dmaticzka/GraphProt,dmaticzka/GraphProt,dmaticzka/GraphProt | tests/test_graphprot_classification_ls.py | tests/test_graphprot_classification_ls.py | from scripttest import TestFileEnvironment
from filecmp import cmp
testdir = "tests/testenv_graphprot_classification_ls/"
env = TestFileEnvironment(testdir)
def test_classification_ls():
"Run parameter linesearch."
call = """../../GraphProt.pl -mode classification -action ls \
-fasta ../testcl... | mit | Python | |
918cef54c3cd83f41d1322ffc509c78e28b341f5 | Add testcase of error with no space | ifwe/twemproxy,ifwe/twemproxy,ifwe/twemproxy,ifwe/twemproxy | tests/test_redis/test_lua_error_return.py | tests/test_redis/test_lua_error_return.py | #!/usr/bin/env python
#coding: utf-8
from unittest import TestCase
from redis import Redis, ResponseError
from .common import *
class LuaReturnErrorTestCase(TestCase):
def test_lua_return_error(self):
"""Test the error described on issue 404 is fixed.
https://github.com/twitter/twemproxy/issue... | apache-2.0 | Python | |
bead9f754bb8a3b6ffc55ae24c7436771c0f792e | Solve Code Fights file naming problem | HKuz/Test_Code | CodeFights/fileNaming.py | CodeFights/fileNaming.py | #!/usr/local/bin/python
# Code Fights File Naming Problem
def fileNaming(names):
valid = []
tmp = dict()
for name in names:
if name not in tmp:
valid.append(name)
tmp[name] = True
else:
# That file name has been used
k = 1
new = n... | mit | Python | |
57ff677027eec19c0d659e050675e7a320123637 | Add tests for validation errors in response | tiangolo/fastapi,tiangolo/fastapi,tiangolo/fastapi | tests/test_serialize_response.py | tests/test_serialize_response.py | from typing import List
import pytest
from fastapi import FastAPI
from pydantic import BaseModel, ValidationError
from starlette.testclient import TestClient
app = FastAPI()
class Item(BaseModel):
name: str
price: float = None
owner_ids: List[int] = None
@app.get("/items/invalid", response_model=Item)... | mit | Python | |
977a4aa94c87bd3f902498f3830ba42345d835c0 | Add reports.py | rolfschr/GSWL-ecosystem,rolfschr/GSWL-ecosystem,rolfschr/GSWL-ecosystem | reports.py | reports.py | #!/usr/bin/python
"""
Usage:
reports.py (<file>)
"""
import sys
import os
REPORT_FILE = 'reports.txt'
def show((expl, cmd)):
os.system('clear')
print(expl)
print(cmd)
def main(argv=None):
if (argv is not None and len(argv) > 1):
filename = argv[1]
else:
filename = REPORT_F... | mit | Python | |
931ee8a4acb07273c41285b4b6892fb200fee7aa | Create VectorEncoder.py | eryueniaobp/contest | encoder/VectorEncoder.py | encoder/VectorEncoder.py | #encoding=utf-8
#一大类特征
from scipy import sparse
import re
class VectorEncoder(object):
def __init__(self):
self.n_size = 0
self.idmap = {}
def fit(self, X):
for row in X:
units = re.split("\\s+", row)
for unit in units:
if unit == '-1': unit = 'nul... | apache-2.0 | Python | |
925bed90b1c5f0d474951f93ee45cf136e22a9c4 | Add slackcloud app | jasonrhaas/slackcloud | slackcloud.py | slackcloud.py | #! /usr/bin/env python
import os
import time
import logging
import matplotlib.pyplot as plt
from flask import Flask
from flask_slack import Slack
from slacker import Slacker
from wordcloud import WordCloud
app = Flask(__name__)
# Used for flask_slack @slack.command helper
slack = Slack(app)
app.add_url_rule('/', v... | mit | Python | |
549e8eb50159512139da501d506cd4880ff66d3a | Add prototype bPerms-to-zPerms script. Still not multi-world-aware. | MrWisski/zPermissions,MrWisski/zPermissions,MineYourMind/zPermissions,MineYourMind/zPermissions | etc/b-to-z.py | etc/b-to-z.py | #!/usr/bin/env python
from __future__ import print_function
import sys
try:
import yaml
except ImportError:
exit('Install PyYAML from <http://pyyaml.org> first')
__author__ = 'ZerothAngel'
__license__ = 'Public Domain'
def parse_perms(perms):
result = {}
for p in perms:
if p.startswith('^')... | apache-2.0 | Python | |
43760a0a8eebbd4bfff7fe2a8addb12b414443a7 | Use this for ElasticSearch tests. | einvalentin/elasticutils,einvalentin/elasticutils,mozilla/elasticutils,einvalentin/elasticutils,mozilla/elasticutils,mozilla/elasticutils | elasticutils/tests.py | elasticutils/tests.py | """
With `test_utils` you can use this testcase.
"""
from django.conf import settings
import test_utils
from elasticutils import get_es
class ESTestCase(test_utils.TestCase):
"""
ESTestCase turns ElasticSearch on, shuts it down at the end of the tests.
"""
@classmethod
def setup_class(cls):
... | bsd-3-clause | Python | |
182452c2a82da801704c1caae6d0069a6eaf9187 | add generate_training_data.py | marshq/europilot | scripts/generate_training_data.py | scripts/generate_training_data.py | from europilot.screen import Box
from europilot.train import generate_training_data, Config
class MyConfig(Config):
# Screen area
BOX = Box(0, 0, 500, 500)
# Screen capture fps
DEFAULT_FPS = 20
generate_training_data(config=MyConfig)
| mit | Python | |
b14e7a3e3ec94f3bdfdbcc6bb60e31ec6e84ccdb | Add parameter counter | jwsmithers/lwtnn,lwtnn/lwtnn,jwsmithers/lwtnn,lwtnn/lwtnn,lwtnn/lwtnn,jwsmithers/lwtnn | scripts/lwtnn-count-parameters.py | scripts/lwtnn-count-parameters.py | #!/usr/bin/env python3
"""
Utility to count the number of free parameters in a saved network
"""
_help_subset='only consider a subset of the configuration'
import json, sys
from argparse import ArgumentParser
from collections import Mapping, Sequence, Counter
from numbers import Number, Integral
def count_numbers(n... | mit | Python | |
6d1ed4bf18ded809371e383e87679ed1b5714699 | Add mock Connection object for testing purposes. | Gwildor/Pyromancer | pyromancer/test/mock_objects.py | pyromancer/test/mock_objects.py | from pyromancer.objects import Connection
class MockConnection(Connection):
def __init__(self, *args, **kwargs):
self.outbox = []
def write(self, data):
self.outbox.append(data)
| mit | Python | |
1685d512ba0a971b7af1b47d4092aa4191fc2a15 | implement bm25 score | researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing | python-processing/tools/bm25.py | python-processing/tools/bm25.py | __author__ = 'hfriedrich'
import numpy as np
from tools.tensor_utils import SparseTensor
from math import log10
from scipy.sparse import csr_matrix
# see http://en.wikipedia.org/wiki/Okapi_BM25
# parameters:
# tensor: SparseTensor object
# indices: indices pointing to (need, need) combinations to compute the connecti... | apache-2.0 | Python | |
11173786ce0a8e170b6a96317b6bc82785ed5d1b | add RPC test for InvalidateBlock | zottejos/merelcoin,thelazier/dash,genavarov/lamacoin,inkvisit/sarmacoins,mockcoin/mockcoin,DMDcoin/Diamond,xuyangcn/opalcoin,genavarov/brcoin,biblepay/biblepay,ivansib/sibcoin,pelorusjack/BlockDX,pelorusjack/BlockDX,florincoin/florincoin,aspirecoin/aspire,ahmedbodi/test2,ingresscoin/ingresscoin,lakepay/lake,RyanLucches... | qa/rpc-tests/invalidateblock.py | qa/rpc-tests/invalidateblock.py | #!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test InvalidateBlock code
#
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy imp... | mit | Python | |
cc49f9b6576234fbfa2de05df15f1dbb43b4926f | Update OpenSSL package | matthiasdiener/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,LLNL/spack,krafczyk/spack,TheTimmy/spack,mfherbst/spack,krafczyk/spack,krafczyk/spack,mfherbst/spack,tmerrick1/spack,iulian787/spack,EmreAtes/spack,mfherbst/spack,lgarren/spack,tmerrick1/spack,lgarren/spack,mfherbst/spack,matthiasdiener/spack,skosukhi... | var/spack/packages/openssl/package.py | var/spack/packages/openssl/package.py | from spack import *
class Openssl(Package):
"""The OpenSSL Project is a collaborative effort to develop a
robust, commercial-grade, full-featured, and Open Source
toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
Transport Layer Security (TLS v1) protocols as well as a
full-... | from spack import *
class Openssl(Package):
"""The OpenSSL Project is a collaborative effort to develop a
robust, commercial-grade, full-featured, and Open Source
toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
Transport Layer Security (TLS v1) protocols as well as a
full-... | lgpl-2.1 | Python |
a81614bce981f183c0da134ba668b85ada4d0a35 | add sort-colors | tanchao/algo,tanchao/algo | leetcode/py/75_sort_colors.py | leetcode/py/75_sort_colors.py | class Solution:
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
if len(nums) <= 1: return
red, blue = 0, 2
cursor, red_index, blue_index = 0, 0, len(nums) - 1
while cursor <= bl... | mit | Python | |
d981dbf5eec8b11cb1a58f51b53d45474d1275f7 | Add basic auth test | Jamil/sabre_dev_studio | base_test.py | base_test.py | import unittest
import json
from sabre_dev_studio import SabreDevStudio
'''
Tests for the SabreDevStudio base class
Requires config.json in the same directory for API authentication
{
"sabre_client_id": -----,
"sabre_client_secret": -----
}
'''
class TestBaseSabreDevStudio(unittest.TestCase):
def read_config(... | mit | Python | |
5f6642910cec22a1aa42ef6139c56ed323a8a036 | make it easy to forward/unforward ssh ports when managing vm's | DrXyzzy/smc,DrXyzzy/smc,tscholl2/smc,tscholl2/smc,tscholl2/smc,sagemathinc/smc,sagemathinc/smc,tscholl2/smc,tscholl2/smc,DrXyzzy/smc,DrXyzzy/smc,sagemathinc/smc,sagemathinc/smc | salvus/scripts/vm_ssh_portforward.py | salvus/scripts/vm_ssh_portforward.py | #!/usr/bin/env python
import argparse, os, sys
def forward(vm, port, op):
cmd = "virsh -c qemu:///session qemu-monitor-command --hmp %s 'hostfwd_%s ::%s-:22'"%(vm, op, port)
print cmd
os.system(cmd)
parser = argparse.ArgumentParser(description="Forward or unforward a local port to port 22 on a VM.")
par... | agpl-3.0 | Python | |
52e1ca118c830de606458b1c7dbf17bc49933091 | Address translation middleware. | harrissoerja/vumi,TouK/vumi,TouK/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi | vumi/middleware/address_translator.py | vumi/middleware/address_translator.py | from vumi.middleware import BaseMiddleware
class AddressTranslationMiddleware(BaseMiddleware):
def setup_middleware(self):
self.outbound_map = self.config.get('outbound_map')
self.inbound_map = dict((v, k) for k, v in self.outbound_map.items())
def handle_outbound(self, message, endpoint):
... | bsd-3-clause | Python | |
eb60d357fceb9010ba43fa456a4e4de1c69bac37 | Create facedetect.py | jackbillstrom/multify | facedetect.py | facedetect.py | #!/usr/bin/python
import sys
import time
import datetime
import cv2.cv as cv
from optparse import OptionParser
from subprocess import Popen, PIPE
# Parameters for haar detection
# From the API:
# The default parameters (scale_factor=2, min_neighbors=3, flags=0) are tuned
# for accurate yet slow object detection. For ... | apache-2.0 | Python | |
0acc0ed13eb9dc87e600d6a4bf37e231a7951d51 | add example for sgld net | numairmansur/RoBO,numairmansur/RoBO,automl/RoBO,automl/RoBO | examples/example_sgld.py | examples/example_sgld.py | import matplotlib.pyplot as plt
import numpy as np
import logging
from robo.models.bnn import SGLDNet
from robo.initial_design.init_random_uniform import init_random_uniform
def f(x):
return np.sinc(x * 10 - 5).sum(axis=1)[:, None]
logging.basicConfig(level=logging.INFO)
rng = np.random.RandomState(42)
X = i... | bsd-3-clause | Python | |
c6d78148fa1770764c644c88e725e416531d26c5 | Add bmamaster | Eylrid/BMaggregator | bmamaster.py | bmamaster.py | import os
import api_user
import re
from logger import Logger
ADDRESSVERSIONS = (3,4)
class BMAMaster:
def __init__(self, configPath=None, apiUser=None):
self.config = loadConfig(configPath)
if 'runPath' in self.config:
os.chdir(self.config['runPath'])
logPath = self.config['lo... | mit | Python | |
6f31d37bb893f537d14d0d7101840c04d21afaca | Create __init__.py | ggpwnkthx/coach,ggpwnkthx/coach,ggpwnkthx/coach,ggpwnkthx/coach,ggpwnkthx/coach | services/ajenti/coach/widgets/__init__.py | services/ajenti/coach/widgets/__init__.py | from .pages import *
| mit | Python | |
d857c452d31855f04d4274d3189fccf0f3f2da2b | Add example matching script | GaZ3ll3/scikit-image,chintak/scikit-image,newville/scikit-image,Hiyorimi/scikit-image,robintw/scikit-image,ofgulban/scikit-image,GaZ3ll3/scikit-image,ofgulban/scikit-image,almarklein/scikit-image,bennlich/scikit-image,emon10005/scikit-image,SamHames/scikit-image,jwiggins/scikit-image,chintak/scikit-image,chintak/scikit... | doc/examples/plot_matching.py | doc/examples/plot_matching.py | """
============================
Robust matching using RANSAC
============================
In this simplified example we first generate two synthetic images as if they
were taken from different view points.
In the next step we find interest points in both images and find
correspondencies based on a weighted sum of s... | bsd-3-clause | Python | |
2797a5df1d150682f5d4f030c7955d852b15b20a | Split out bootstrap test to sep. file | trondth/master | bootstrap.py | bootstrap.py | ##!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
VERBOSE = True
def prec_bootstrap(lst):
psum = 0.0
for p in lst:
psum += p['p_sc']
return psum / len(lst)
def bootstrap(Xa, Xb, b=2):
"""
@return p-value
"""
if len(Xa) != len(Xb):
raise ValueError('Xa and ... | mit | Python | |
208d75bd6ece84628dbc68ec55351f29ba1e7aaa | add create_admin command | sahlinet/fastapp,sahlinet/fastapp,sahlinet/fastapp,sahlinet/fastapp | fastapp/management/commands/create_admin.py | fastapp/management/commands/create_admin.py | import logging
import sys
from optparse import make_option
from django.core.management.base import BaseCommand
from django.conf import settings
from fastapp.executors.remote import ExecutorServerThread, StaticServerThread
from fastapp.executors.heartbeat import HeartbeatThread, HEARTBEAT_QUEUE
from fastapp.utils impo... | mit | Python | |
904066e152855843bbe73fab730a3b9c3cf0e78a | Create tuples.py | joshavenue/python_notebook | tuples.py | tuples.py | x = (1,2,3,4)
y = (1,2,'abc',[1,2,3]) // Only can change data with a list, other cannot be change
y[3][1] = 22
print(y)
| unlicense | Python | |
1c3c95caeb1deb484d05b9c523990dba411700c7 | add items.py file | jgonzales41/mud_py | items.py | items.py | class Generic_Items(object):
"""
Create the base class for all items. This will mainly handle the most
basic functions for all items.
"""
class PickUp_Items(object):
"""
Creates the base class for all items that can be picked up. This will
initialize all of the generic attributes that these... | mit | Python | |
dd953b71a4cd259f70747a7c83f0427e7db55632 | add rudimentary test for interface compliance | NORDUnet/opennsa,NORDUnet/opennsa,jab1982/opennsa,jab1982/opennsa,NORDUnet/opennsa | test/test_interface.py | test/test_interface.py | from twisted.trial import unittest
from zope.interface.verify import verifyObject
from opennsa.interface import INSIProvider, INSIRequester
from opennsa import registry
from opennsa import aggregator
from opennsa.backends.common import genericbackend
class InterfaceTest(unittest.TestCase):
def setUp(self):
... | bsd-3-clause | Python | |
e9b6297f7a8ba418346c0f6348713b95e1c012d2 | make start request | jingzhou123/tieba-crawler | dirbot/spiders/comment.py | dirbot/spiders/comment.py | from cookieSpider import CookieSpider
from dbSpider import DbSpider
from scrapy import Request, Selector
from dirbot.items import Reply
class CommentSpider(CookieSpider, DbSpider):
"""crawl a post's reply's comments"""
name = 'comment'
def _query_replies(self, start_index, num):
"""
:sta... | mit | Python | |
fc323d4a7bbae7e90d4f64742eaa3c83f09b7906 | add example on how to use a TXT which is configured as "Extension" | ftrobopy/ftrobopy,ftrobopy/ftrobopy | examples/ExtensionControl.py | examples/ExtensionControl.py | import ftrobopy
txt=ftrobopy.ftrobopy('auto', use_extension=True)
# One of the TXTs has be put in "Master"-mode and one in "Extension"-mode (see local TXT configuration menue)
# The two TXTs must be connected with a 10-pin extension cable
m1 = txt.motor(1, ext=0) # use motor output 1 on the Master
m2 = txt.motor(2) ... | mit | Python | |
80b0473a1f4e8c313186810aec667e0654c3cb68 | Create query object | rchui/pyql | Query/query.py | Query/query.py | """ query.py
This file defines the query class.
"""
class Query:
""" Query class that holds query options."""
def __init__(self):
self.q_select = []
self.q_from = []
self.q_where = []
| mit | Python | |
85dee3074009c1b66b1da1c2cc588c32defc9bfe | Change field labels | itbabu/saleor,KenMutemi/saleor,maferelo/saleor,jreigel/saleor,mociepka/saleor,KenMutemi/saleor,maferelo/saleor,HyperManTT/ECommerceSaleor,tfroehlich82/saleor,mociepka/saleor,KenMutemi/saleor,UITools/saleor,car3oon/saleor,jreigel/saleor,UITools/saleor,car3oon/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,tfroehlich82... | saleor/product/migrations/0027_auto_20170113_0435.py | saleor/product/migrations/0027_auto_20170113_0435.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-01-13 10:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0026_auto_20161230_0347'),
]
operations = [
migrations.AlterFiel... | bsd-3-clause | Python | |
5ec029ac2385da2bee54c7910852fe78bd6b01e5 | rename email_public to _conf | xfxf/veyepar,xfxf/veyepar,CarlFK/veyepar,xfxf/veyepar,CarlFK/veyepar,CarlFK/veyepar,xfxf/veyepar,CarlFK/veyepar,CarlFK/veyepar,xfxf/veyepar | dj/scripts/email_conf.py | dj/scripts/email_conf.py | #!/usr/bin/python
# email_conf.py
# emails the confirmation of the public video to presenters
import itertools
from pprint import pprint
from email_ab import email_ab
class email_conf(email_ab):
ready_state = 12
subject_template = "[{{ep.show.name}}] Video public: {{ep.name}}"
body_body = """
Your vid... | mit | Python | |
dde87e6b0d2de331e536d335ead00db5d181ee96 | Add tests for adding parser actions | recognai/spaCy,aikramer2/spaCy,recognai/spaCy,honnibal/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/s... | spacy/tests/parser/test_add_label.py | spacy/tests/parser/test_add_label.py | '''Test the ability to add a label to a (potentially trained) parsing model.'''
from __future__ import unicode_literals
import pytest
import numpy.random
from thinc.neural.optimizers import Adam
from thinc.neural.ops import NumpyOps
from ...attrs import NORM
from ...gold import GoldParse
from ...vocab import Vocab
fro... | mit | Python | |
28907aa6382077e28853fe092819c4f28c12459b | add single test to debug the string issue | DeercoderResearch/0.5-CoCo,DeercoderResearch/0.5-CoCo,DeercoderResearch/0.5-CoCo,DeercoderResearch/0.5-CoCo,DeercoderResearch/CoCo,DeercoderResearch/CoCo,DeercoderResearch/CoCo,DeercoderResearch/CoCo | PythonAPI/singleTest.py | PythonAPI/singleTest.py | #!/usr/bin/env python
from write_xml import write_to_file
# ''' This is just for single test of one function write_to_file
# Because I found that the generated xml is not compatiable with
# original xml, containing the head `<?xml xxx>`, this may harm
# r-cnn code and it crashes when finishing parsing
#'''
write_to_f... | bsd-2-clause | Python | |
848fcb59bc1c43e908c666a6a098102a545fdac9 | Create Largest_Number.py | UmassJin/Leetcode | Array/Largest_Number.py | Array/Largest_Number.py | '''
Given a list of non negative integers, arrange them such that they form the largest number.
For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.
Note: The result may be very large, so you need to return a string instead of an integer.
Credits:
Special thanks to @ts for adding this problem ... | mit | Python | |
ab00d7065bdb788972b481a7d55cd3b461749afa | Add utility logger for cron | mozilla/MozDef,mpurzynski/MozDef,ameihm0912/MozDef,ameihm0912/MozDef,Phrozyn/MozDef,mozilla/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mozilla/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,ameihm0912/MozDef,jeffbryner/MozDef,ameihm0912/MozD... | lib/utilities/logger.py | lib/utilities/logger.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
#
# Contributors:
# Brandon Myers bmyers@mozilla.com
imp... | mpl-2.0 | Python | |
16a36338fecb21fb3e9e6a15a7af1a438da48c79 | Add missing `per_page` migration file. | onespacemedia/cms-jobs,onespacemedia/cms-jobs | apps/jobs/migrations/0003_jobs_per_page.py | apps/jobs/migrations/0003_jobs_per_page.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0002_auto_20140925_1117'),
]
operations = [
migrations.AddField(
model_name='jobs',
name='pe... | mit | Python | |
6f024ec7fada73388e5a9c1df9446747c8e1e586 | Copy is_safe_url unit test from Django. | ismail-s/warehouse,HonzaKral/warehouse,dstufft/warehouse,HonzaKral/warehouse,pypa/warehouse,karan/warehouse,karan/warehouse,dstufft/warehouse,wlonk/warehouse,ismail-s/warehouse,wlonk/warehouse,pypa/warehouse,alex/warehouse,ismail-s/warehouse,chopmann/warehouse,alex/warehouse,karan/warehouse,alex/warehouse,ismail-s/ware... | tests/utils/test_http.py | tests/utils/test_http.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 Li... | apache-2.0 | Python | |
44f818395738fd540fce547f157d2fc0223c987b | Add fastqc only script | dgaston/ddb-scripts,GastonLab/ddb-scripts,dgaston/ddb-ngsflow-scripts | workflow-fastqc.py | workflow-fastqc.py | #!/usr/bin/env python
# Standard packages
import sys
import argparse
# Third-party packages
from toil.job import Job
# Package methods
from ddb import configuration
from ddb_ngsflow import pipeline
from ddb_ngsflow.qc import qc
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argume... | mit | Python | |
91561ececd2b0656e0f4d580bd245bd600487328 | Add basic models | funkybob/django-epistle | epistle/models.py | epistle/models.py |
from django.db import models
from django.conf import settings
from django.utils.functional import cached_property
from django.utils import timezone
class ConversationQuerySet(models.QuerySet):
def with_counts(self):
return self.annotate(post_count=models.Count('messages'))
def with_created(self):
... | mit | Python | |
968f8c1fe7d4f01d9e94ca4ab05ed5b9c7210737 | add compare-data script (#137) | Netflix-Skunkworks/iep-apps,Netflix-Skunkworks/iep-apps | atlas-slotting/src/scripts/compare-data.py | atlas-slotting/src/scripts/compare-data.py | #!/usr/bin/env python3
# Copyright 2014-2019 Netflix, 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 applicabl... | apache-2.0 | Python | |
da14d50ee0eb83f0ff7900aa3c6481532f3dadeb | add spreadseet index calculation problem | marianosimone/interviewed,marianosimone/interviewed | basic_programming/spreadsheet_col_index.py | basic_programming/spreadsheet_col_index.py | class SpreadsheetColRowIndexer:
COLS = dict([(c, i+1) for i, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ")])
@staticmethod
def col_index_from_name(name):
"""
Given the name of a column in a spreadsheet, return its index (1-based)
>>> SpreadsheetColRowIndexer.col_index_from_name('A')... | unlicense | Python | |
4493be742dcc0a45515915b093b2df51db3f7fc9 | Add ClusterAbstraction | studiawan/pygraphc | pygraphc/clustering/ClusterAbstraction.py | pygraphc/clustering/ClusterAbstraction.py |
class ClusterAbstraction(object):
@staticmethod
def dp_lcs(graph, clusters):
abstraction = {}
for cluster_id, nodes in clusters.iteritems():
data = []
for node_id in nodes:
data.append(graph.node[node_id]['preprocessed_event'])
abstraction[clu... | mit | Python | |
103d5e3bc63a8fb3c838946df30eb5cda25494b3 | add tests for file extraction from downloaded files | TUW-GEO/ecmwf_models | tests/test_download.py | tests/test_download.py | # -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2018, TU Wien
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | mit | Python | |
71afe6b0b4b77cc3d1d38906e0dabe438ff9652d | Add back validation | llllllllll/datashape,quantopian/datashape,cpcloud/datashape,cowlicks/datashape,ContinuumIO/datashape,blaze/datashape,cpcloud/datashape,cowlicks/datashape,blaze/datashape,quantopian/datashape,llllllllll/datashape,ContinuumIO/datashape | datashape/validation.py | datashape/validation.py | # -*- coding: utf-8 -*-
"""
Datashape validation.
"""
from . import coretypes as T
def traverse(f, t):
"""
Map `f` over `t`, calling `f` with type `t` and the map result of the
mapping `f` over `t` 's parameters.
Parameters
----------
f : callable
t : DataShape
Returns
-------
... | bsd-2-clause | Python | |
49963e0bf214bb538caec47de3763521ed8a45fb | add ipython configuration | nonylene/dotfiles,nonylene/dotfiles,nonylene/dotfiles | .ipython/profile_default/ipython_config.py | .ipython/profile_default/ipython_config.py | # Configuration file for ipython.
## Configure matplotlib for interactive use with the default matplotlib backend.
#c.InteractiveShellApp.matplotlib = None
## The name of the IPython directory. This directory is used for logging
# configuration (through profiles), history storage, etc. The default is usually
# $HOM... | cc0-1.0 | Python | |
ad6670874f37c52f4a15f30e1ab2682bd81f40f8 | Fix 2nd and more capturing snapshot (PY-15823). | adedayo/intellij-community,muntasirsyed/intellij-community,da1z/intellij-community,vvv1559/intellij-community,vvv1559/intellij-community,diorcety/intellij-community,da1z/intellij-community,asedunov/intellij-community,akosyakov/intellij-community,fitermay/intellij-community,orekyuu/intellij-community,ThiagoGarciaAlves/i... | python/helpers/profiler/yappi_profiler.py | python/helpers/profiler/yappi_profiler.py | import yappi
class YappiProfile(object):
""" Wrapper class that represents Yappi profiling backend with API matching
the cProfile.
"""
def __init__(self):
self.stats = None
def runcall(self, func, *args, **kw):
self.enable()
try:
return func(*args, **kw)
... | import yappi
class YappiProfile(object):
""" Wrapper class that represents Yappi profiling backend with API matching
the cProfile.
"""
def __init__(self):
self.stats = None
def runcall(self, func, *args, **kw):
self.enable()
try:
return func(*args, **kw)
... | apache-2.0 | Python |
01fd666e36899268b87c6cfb25853f64ad6d6d3b | Add tests for nametree | pikepdf/pikepdf,pikepdf/pikepdf,pikepdf/pikepdf | tests/test_nametree.py | tests/test_nametree.py | import pytest
from pikepdf import Array, Dictionary, NameTree, Object, Pdf
# pylint: disable=redefined-outer-name
@pytest.fixture
def outline(resources):
with Pdf.open(resources / 'outlines.pdf') as pdf:
yield pdf
def test_nametree_crud(outline):
nt = NameTree(outline.Root.Names.Dests, outline)
... | mpl-2.0 | Python | |
9f92387cc2abab8f9da62d071158e3932e485c35 | Add tests for helpers | opendata-swiss/ckanext-switzerland,ogdch/ckanext-switzerland,opendata-swiss/ckanext-switzerland,ogdch/ckanext-switzerland,ogdch/ckanext-switzerland,opendata-swiss/ckanext-switzerland | ckanext/switzerland/tests/test_helpers.py | ckanext/switzerland/tests/test_helpers.py | """Tests for helpers.py."""
from nose.tools import * # noqa
import mock
import ckanext.switzerland.helpers as helpers
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
class TestHelpers(unittest.TestCase):
def test_simplify_terms_of_use_open(self):
term_i... | agpl-3.0 | Python | |
3db6d216b9c2dd595b3e7c5d6ef6d2530eabf3fb | Create converter.py | scambier/aseprite-autoexport | converter.py | converter.py | import glob
import os
from time import sleep
import hashlib
from subprocess import call
def main():
while True:
for filename in glob.glob("*.ase"):
# Try to find an existing instance for that file
file = AseFile.find_file(filename)
if file:
# check if ... | mit | Python | |
9f2fddbe3cf3d12b71bcb792c70856e5c073c965 | add source data app back in | SeedScientific/polio,unicef/polio,SeedScientific/polio,unicef/polio,unicef/rhizome,SeedScientific/polio,unicef/rhizome,SeedScientific/polio,unicef/polio,unicef/polio,SeedScientific/polio,unicef/rhizome,unicef/rhizome | polio/prod_settings.py | polio/prod_settings.py | import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '7i_%j5chyhx2k3#874-!8kwwlcr88sn9blbsb7$%58h&t#n84f' # make this envi var
DEBUG = True
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = []
LOGIN_REDIRECT_URL = '/datapoint... | import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '7i_%j5chyhx2k3#874-!8kwwlcr88sn9blbsb7$%58h&t#n84f' # make this envi var
DEBUG = True
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = []
LOGIN_REDIRECT_URL = '/datapoint... | agpl-3.0 | Python |
3f9eaa6ed1e69e6d40637ff9711dd72ad1113457 | Test added for testing proof of concept | eriol/circuits,eriol/circuits,treemo/circuits,eriol/circuits,treemo/circuits,treemo/circuits,nizox/circuits | tmp/test_result_proxy.py | tmp/test_result_proxy.py | #!/usr/bin/env python
from circuits import Component, Event
class Test(Event):
"""Test Event"""
class Foo(Event):
"""Foo Event"""
class Bar(Event):
"""Bar Event"""
class App(Component):
def foo(self):
return 1
def bar(self):
return 2
def test(self):
a = self.fire(... | mit | Python | |
1030bb092527d46990730aa9109517e4a37534bf | add chatroom example | freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/telepathy-python,PabloCastellano/telepathy-python,detrout/telepathy-python,detrout/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,max-posedon/telepathy-python,epage/telepathy-python,max-posedon/telepathy-python,epage/t... | examples/chatroom.py | examples/chatroom.py |
"""
Example Telepathy chatroom client.
"""
import sys
import dbus.glib
import gobject
import telepathy
from account import connection_from_file
class ChatroomClient:
def __init__(self, conn, chatroom):
self.conn = conn
self.chatroom = chatroom
conn[telepathy.CONN_INTERFACE].connect_to... | lgpl-2.1 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.