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 |
|---|---|---|---|---|---|---|---|---|
6364ce646e06d1168b8b96f27c8a7df2e2f0f23b | Fix the bug of "Spelling error of a word" | chitr/neutron,asgard-lab/neutron,eayunstack/neutron,noironetworks/neutron,chitr/neutron,mahak/neutron,yanheven/neutron,openstack/neutron,cloudbase/neutron,sebrandon1/neutron,bigswitch/neutron,bigswitch/neutron,huntxu/neutron,MaximNevrov/neutron,asgard-lab/neutron,dims/neutron,wolverineav/neutron,wolverineav/neutron,mah... | neutron/pecan_wsgi/hooks/translation.py | neutron/pecan_wsgi/hooks/translation.py | # Copyright (c) 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | # Copyright (c) 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python |
59155078a73c59c33c7c0711ab78a76e5242bbd3 | Create JSONBasic.py | Project-MAR/TGR2017-SIM,Project-MAR/TGR2017-SIM,Project-MAR/TGR2017-SIM | 01-python-REST/JSONBasic.py | 01-python-REST/JSONBasic.py | #!/usr/bin/python
import json
PythonDict = {
"events": [
{
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"type": "message",
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U206d25c2ea6bd87c17655609a1c37cb8"
},
"me... | mit | Python | |
173bf31ea24e83869a4fe197d97a3d40be00acdd | Implement detection of Proton Torpedo target | ufieeehw/IEEE2017 | ieee2017_perception/scripts/visual_servo.py | ieee2017_perception/scripts/visual_servo.py | #!/usr/bin/python2
'''
Visual Servo: Uses information from the shooter camera to line the shooter up
with the target for Stage 4 - Fire the Proton Torpedo.
'''
from __future__ import division
import cv2
from cv_bridge import CvBridge, CvBridgeError
import rospy
from sensor_msgs.msg import Image
__author__ = "Ant... | mit | Python | |
86f0ede2144e52227c7e57b3c9e741dfe41d0cd8 | add basic unit tests | penzance/quis,penzance/quis,penzance/quis | quis/tests.py | quis/tests.py | import requests
from django.test import TestCase
from mock import patch
from quis.views import get_watchman_data
@patch('quis.views.session.get')
class FetchAndFormatTests(TestCase):
URL_IS_IGNORED_BECAUSE_MOCK = 'https://url.is.ignored/because/mock/'
POSITIVE_TEST_CASES = [
# (get_response, expected... | mit | Python | |
359e4204a1cd28645e11a08c4200936703e009f5 | add svm_sin | yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn | python/sklearn/svm_sin.py | python/sklearn/svm_sin.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
x = np.random.rand(1000, 2)
x[:, 0] = x[:, 0] * 10
y = [ 1 if np.sin(i) > j else 0 for [i, j] in x]
s = svm.SVC()
s.fit(x, y)
"""
以0.1作间隔,得到平面上的网格,计算每个网格上每个点的预测值
"""
x_grid, y_grid = np.meshgrid(... | bsd-3-clause | Python | |
ead00e9cae0871cfa70c0ca81e64093168aa5ef2 | create terminal plugin for enos modules (#31510) | thaim/ansible,thaim/ansible | lib/ansible/plugins/terminal/enos.py | lib/ansible/plugins/terminal/enos.py | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by
# Ansible still belong to the author of the module, and may assign their own
# license to the complete wo... | mit | Python | |
01b84f1b2a73ba31d6304baa0e08415657c72dca | Add tests for cancer model init | reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-... | website/tests/models/test_cancer.py | website/tests/models/test_cancer.py | from database import db
from model_testing import ModelTest
from models import Cancer
from sqlalchemy.exc import IntegrityError
import pytest
class CancerTest(ModelTest):
def test_init(self):
cancer = Cancer(name='Bladder Urothelial Carcinoma', code='BLCA')
assert cancer.name == 'Bladder Uroth... | lgpl-2.1 | Python | |
aed61cecff178d8b59f34ea01b4575d1ea0daf4f | Remove configuration details | titilambert/home-assistant,srcLurker/home-assistant,auduny/home-assistant,FreekingDean/home-assistant,deisi/home-assistant,alexmogavero/home-assistant,jamespcole/home-assistant,Teagan42/home-assistant,mKeRix/home-assistant,mezz64/home-assistant,sffjunkie/home-assistant,lukas-hetzenecker/home-assistant,MungoRae/home-ass... | homeassistant/components/sensor/temper.py | homeassistant/components/sensor/temper.py | """
homeassistant.components.sensor.temper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for getting temperature from TEMPer devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.temper.html
"""
import logging
from homeassistant.helpers.entity ... | """
homeassistant.components.sensor.temper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for getting temperature from TEMPer devices.
Configuration:
To use the temper sensors you will need to add something like the following to
your configuration.yaml file.
sensor:
platform: temper
"""
import logging
from homea... | apache-2.0 | Python |
859ec7fd731bbabbe3c0787e04977fe8a365f5f5 | add test framework and basic test for scuba.__main__ | JonathonReinhart/scuba,JonathonReinhart/scuba,JonathonReinhart/scuba | tests/test_main.py | tests/test_main.py | from __future__ import print_function
from nose.tools import *
from unittest import TestCase
try:
from unittest import mock
except ImportError:
import mock
import logging
import os
import sys
from os.path import join, normpath
from tempfile import mkdtemp, TemporaryFile
from shutil import rmtree
import scuba... | mit | Python | |
641218a3a0c9d4dcd78ea94aceec2303e2ee398c | Implement Stack ADT | andela-kerinoso/data_structures_algo | data_structure.py | data_structure.py | class Stack(object):
"""Implementation of Stack ADT"""
def __init__(self, items):
self.items = items
def is_empty(self):
return self.items == []
def push(self, item):
self.items.appends(item)
def pop(self):
return self.items.pop()
def peek(self):
retu... | mit | Python | |
ddda00ffa9c35f09ef3b043c7e4893ee4afa4339 | add compare_params.py | pdebuyl-lab/RMPCDMD,pdebuyl-lab/RMPCDMD,pdebuyl/RMPCDMD,pdebuyl/RMPCDMD | scripts/compare_params.py | scripts/compare_params.py | #!/usr/bin/env python
r"""
Compare the arguments listed by Doxygen's \param directive and those read using
PTread_* functions. This program is use to check the consistency of the
documentation of the programs.
"""
from __future__ import print_function, division
import argparse
parser = argparse.ArgumentParser(descrip... | bsd-3-clause | Python | |
5166423888be96909080902d899ad9dc97ade28c | Create add_metadata_to_delly_manta_vcf.py | jdeligt/Genetics,CuppenResearch/Genetics,CuppenResearch/Genetics,jdeligt/Genetics,CuppenResearch/Genetics,jdeligt/Genetics | add_metadata_to_delly_manta_vcf.py | add_metadata_to_delly_manta_vcf.py | #!/usr/bin/env python
"""
add_metadata_to_delly_manta_vcf.py
##INFO=<ID=SOMATIC is automatically added after i) the delly somatic filtering step ii) manta somatic calling
"""
import sys
import argparse
import re
import vcf
def add_meta2vcf(vcf_file):
try:
f = open(vcf_file, 'r')
except IOError:
sys.exit("Er... | mit | Python | |
1dc6cf4b07be355ce4ea8056ba5537956fae9576 | Add MyAccount page | BloatIt/bloatit,BloatIt/bloatit,BloatIt/bloatit,BloatIt/bloatit,BloatIt/bloatit | src/bloatit/htmlrenderer/pagecontent/myaccountcontent.py | src/bloatit/htmlrenderer/pagecontent/myaccountcontent.py | # -*- coding: utf-8 -*-
# Copyright (C) 2010 BloatIt.
#
# This file is part of BloatIt.
#
# BloatIt is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... | agpl-3.0 | Python | |
c625c9d8918eab3e86ac14abd674b6232c2fa8e9 | Add data migrations for base app | unt-libraries/catalog-api,unt-libraries/catalog-api,unt-libraries/catalog-api,unt-libraries/catalog-api | django/sierra/base/migrations/0002_auto_20170602_1115.py | django/sierra/base/migrations/0002_auto_20170602_1115.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from utils.load_data import load_data
class Migration(migrations.Migration):
dependencies = [
('base', '0001_squashed_0009_auto_20170602_1057'),
]
operations = [
migrations.RunPython... | bsd-3-clause | Python | |
2c232cb80ead7cced5d1d28da52a66e6c2383c29 | test HealthNetwork model | ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM | myhpom/tests/test_health_network_model.py | myhpom/tests/test_health_network_model.py |
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from myhpom.models.health_network import HealthNetwork, PRIORITY
from myhpom.models.state import State
class HealthNetworkModelTestCase(TestCase):
"""
* with objects.all(), ordering should... | bsd-3-clause | Python | |
36123672050252b4f1dec50477f09438d01ea7ab | add crawler for Cardboard Crack | datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics,datagutten/comics | comics/comics/cardboardcrack.py | comics/comics/cardboardcrack.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Cardboard Crack'
language = 'en'
url = 'http://cardboard-crack.com/'
start_date = '2013-03-01'
class Crawler(CrawlerBase):
history_capable_days... | agpl-3.0 | Python | |
2c7e556bd6db51fe9cd5e1acef34f72af0994d86 | add Parameters and PolicyType properties to PolicyDetails | cloudtools/troposphere,cloudtools/troposphere,ikben/troposphere,ikben/troposphere | troposphere/dlm.py | troposphere/dlm.py | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .validators import (integer, boolean)
VALID_STATES = ('ENABLED', 'DISABLED')
VALID_RESOURCE_TYPES = ('VOLUME')
VALID_INTERVALS = (2, 3, 4, 6, 8, 12, 24)
VALID_I... | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .validators import (integer, boolean)
VALID_STATES = ('ENABLED', 'DISABLED')
VALID_RESOURCE_TYPES = ('VOLUME')
VALID_INTERVALS = (2, 3, 4, 6, 8, 12, 24)
VALID_I... | bsd-2-clause | Python |
684987f8808b017bb351dacefba9a291ef72980e | Create arp_scan.py | thedarkcoder/SPSE,ahhh/SPSE | arp_scan.py | arp_scan.py | #!/usr/bin/env python
# Arp scanner
# Suppress warning messages from Scapy, but show errors.
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
SUBNET = "192.168.1."
HOST_RANGE_START = 1
HOST_RANGE_END = 254
for host in range(HOST_RANGE_START,HOST_RANGE_END):
ip = SU... | mit | Python | |
6acdfd5806da81fd799231bf46ad2da3751ed8a5 | Add Lab color selector demo. | scikit-image/skimage-demos | mm_color_select.py | mm_color_select.py | url = 'http://blogs.mathworks.com/images/steve/2010/mms.jpg'
import os
if not os.path.exists('mm.png'):
print "Downloading M&M's..."
import urllib2
u = urllib2.urlopen(url)
f = open('mm.png', 'w')
f.write(u.read())
f.close()
from skimage import io, color, exposure
import numpy as np
mm = io... | bsd-3-clause | Python | |
facc0000b89efb2c10cf41d5c79dc1563fcc7156 | implement BotManager | brainbots/assistant | assisstant/bots/manager.py | assisstant/bots/manager.py | import settings
import importlib
class BotManager:
def __init__(self):
self.bots = []
registered_bots = self.load_registered_bots()
self.initialize_bots(registered_bots)
def load_registered_bots(self):
registered_bots = settings.REGISTERED_BOTS
bots = []
for bot in registered_bots:
*module, classnam... | apache-2.0 | Python | |
1dc3a0e1cfc0d097991d6bf74c392f15873f49ba | Add update command. | jeffbuttars/pcm,jeffbuttars/pcm | pcm/cmds/update.py | pcm/cmds/update.py | import logging
logger = logging.getLogger('pcm')
from pcm.cmds.base import BaseCmd
from pcm.lib.cmd import PacmanCmd
class Cmd(BaseCmd):
"""Docstring for Cmd """
name = 'update'
help_text = ("update pkgname [pkgnames...]")
aliases = ('up',)
def build(self):
"""todo: Docstring for build
... | mit | Python | |
4b894a164738856befd54b284542d20876acfac5 | add constrains | tzuria/Shift-It-Easy,tzuria/Shift-It-Easy,tzuria/Shift-It-Easy | webApp/shift-it-easy-2015/models/constrains.py | webApp/shift-it-easy-2015/models/constrains.py |
from google.appengine.ext import ndb
class consrains(ndb.Model):
Date = ndb.StringProperty(kind = String)
EmployeeID = ndb.StringProperty(kind = int)
ShiftType = ndb.StringProperty()
ConstrainKind = ndb.StringProperty()
Notes = ndb.StringProperty()
| mit | Python | |
fc8d9b057b8bda6092a33223b2a16d8e68ae4682 | Add an example for the kernel PLS routines | jhumphry/regressions | examples/sinc.py | examples/sinc.py | #!/usr/bin/python3
"""An example of the use of non-linear kernel PLS regression on the output of
a sinc function contaminated by noise.
Reproduces some of the figures from "Kernel Partial Least Squares Regression
in Reproducing Kernel Hilbert Space" by Roman Rosipal and Leonard J Trejo.
Journal of Machine Learning Re... | isc | Python | |
7aed1ecaa97d4c9c22676a84c789d8f5ff9a05f6 | Add app | moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2 | api/apps.py | api/apps.py | from django.apps import AppConfig
class ApiConfig(AppConfig):
name = 'api'
| mit | Python | |
9df2e62b5956b4427a8caddaefc9670017beaf07 | introduce bing random image plugin | abertschi/postcards,abertschi/postcards,abertschi/postcards | postcards_bing_random.py | postcards_bing_random.py | from postcards import Postcards
import sys
import random
import requests
from bs4 import BeautifulSoup
import os
import urllib
import sys
import re, util
search_url = 'http://www.diddly.com/random/'
class PostcardsBingRandom(Postcards):
def get_img_and_text(self, plugin_config, cli_args):
soup = util.... | mit | Python | |
7be96fd5c45956a546e95254e5ee8a78938b5b5b | Add copy functionality | ContinuumIO/pykit,ContinuumIO/pykit,flypy/pykit,Inaimathi/pykit,flypy/pykit,Inaimathi/pykit | pykit/ir/copying.py | pykit/ir/copying.py | # -*- coding: utf-8 -*-
"""
Copy pykit IR.
"""
from __future__ import print_function, division, absolute_import
from functools import partial
from pykit.ir import (Module, Value, Function, Block, Constant, Op,
GlobalValue, Undef, FuncArg)
from pykit.utils import nestedmap, make_temper
def _look... | bsd-3-clause | Python | |
ae4036054ed2a7cea85008882ab65fba0b572983 | Add new Client | numberoverzero/pyservice | pyservice/client.py | pyservice/client.py | import six
import sys
import requests
from pyservice import serialize
from pyservice.exception_factory import ExceptionContainer
class Client(object):
def __init__(self, description, **config):
self._description = description
self._config = config
for operation in self._description.operat... | mit | Python | |
aa1bc4d06967baffcef126e56c89f68bc274042a | Create apkparse.py | ccjj/andropy | apkparse.py | apkparse.py | import subprocess
import threading
import time
import datetime
import re
import os
#example:
#package: name='h.w' versionCode='1' versionName='a'
#launchable-activity: name='a.a' label='' icon=''
def get_package_infos(samplepath):
cmd = 'aapt dump badging {} | grep "package\|activity"'.format(samplepath)
try:
o... | mit | Python | |
8de2e7eb0b64403ccb2b75aace2b14b1112d44a5 | Create function.py | AlephFive/ANNapproximator | function.py | function.py | mit | Python | ||
25417369765087482f0d02b06913b3cffe9f43ad | Add high level secret tests | johnttan/libnacl,cachedout/libnacl,mindw/libnacl,saltstack/libnacl,coinkite/libnacl,RaetProtocol/libnacl | tests/unit/test_secret.py | tests/unit/test_secret.py | # Import libnacl libs
import libnacl.secret
# Import python libs
import unittest
class TestSecret(unittest.TestCase):
'''
'''
def test_secret(self):
msg = 'But then of course African swallows are not migratory.'
box = libnacl.secret.SecretBox()
ctxt = box.encrypt(msg)
self.a... | apache-2.0 | Python | |
57a58893a2ba94b174b06e7f5f63478dff1e879e | Add provider for (Swedish) Netflix. | EmilStenstrom/nephele | providers/popularity/netflix.py | providers/popularity/netflix.py | from providers.popularity.provider import PopularityProvider
from utils.torrent_util import remove_bad_torrent_matches, torrent_to_movie
IDENTIFIER = "netflix"
class Provider(PopularityProvider):
def get_popular(self):
country = "se"
url = f"https://www.finder.com/{country}/netflix-movies"
... | mit | Python | |
4429676b5d03e1f13373a3cc4db224520975b1d5 | add database module | inuitwallet/ALP-Server | database.py | database.py | import sqlite3
__author__ = 'sammoth'
def build():
"""
Build the necessary tables in the database
use the 'IF NOT EXISTS' clause to allow for repeated running without barfing
:return:
"""
conn = sqlite3.connect('pool.db')
c = conn.cursor()
# create the users table
c.execute("CREAT... | mit | Python | |
c02d9738dd251ecd3129aabacf09afc49d3bcdb0 | Add genSkeletons.py script | cameronlai/ml-class-python | solutions/genSkeletons.py | solutions/genSkeletons.py | #!/usr/bin/python
# This scripts generates the skeleton from the solution files
import os
pattern1 = '# ============= YOUR CODE HERE ============='
pattern2 = '# ==========================================='
for d in os.listdir('.'):
if os.path.isdir(d):
for f in os.listdir(d):
src = d + '/' +... | mit | Python | |
a95e739f5a23959764835e6892a8caf960a66c56 | Convert pySpectrumFileFormat to python 3 and make tests pass with python 2.7 and 3.4. | drix00/microanalysis_file_format | pySpectrumFileFormat/emmff/formatter.py | pySpectrumFileFormat/emmff/formatter.py | #!/usr/bin/env python
"""
================================================================================
:mod:`formatter` -- Parse values from XML string
================================================================================
.. module:: formatter
:synopsis: Parse values from XML string
"""
# Script in... | apache-2.0 | Python | |
0283791d5f1bb4354024c5f873690bdea219aec8 | Add OpenStack Auth module | thaim/ansible,thaim/ansible | lib/ansible/modules/cloud/openstack/os_auth.py | lib/ansible/modules/cloud/openstack/os_auth.py | #!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | mit | Python | |
f7244ebb499ee5360a3f5bf2299cfda842ced4b8 | Manage monitoring policies (#28140) | thaim/ansible,thaim/ansible | lib/ansible/modules/network/aci/aci_monitoring_policy.py | lib/ansible/modules/network/aci/aci_monitoring_policy.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 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
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
... | mit | Python | |
cab3057dd41566a2dd9be7e63cbd39c2ede55911 | Add forgotten tls.py file. Sorry :'( | stampery/mongoaudit | src/testers/tls.py | src/testers/tls.py | # -*- coding: utf-8 -*-
import pymongo
def available(test):
"""
Check if MongoDB is compiled with OpenSSL support
"""
return 'OpenSSLVersion' in test.tester.info \
or 'openssl' in test.tester.info
def enabled(test):
"""
Check if TLS/SSL is enabled on the server side
"""
if not ... | mit | Python | |
96526df63b2d45f08c7f007b45ee793e3ccc97a3 | Write rotate 90 degrees nxn 2d matrix algorithm: currently debugging | derekmpham/interview-prep,derekmpham/interview-prep | array/rotate-image.py | array/rotate-image.py | # You are given an n x n 2D matrix that represents an image. Rotate the image by 90 degrees clockwise
# solve with O(1) additional memory
def rotate_image(a):
n = len(a)
if a is None or n < 1:
return a
else:
for i in range(n/2):
for j in range(n-i-1):
temp = a[i][j]
a[i][j] = a[n-1-j][i]
a[n-1-j... | mit | Python | |
4894ac36e71b96daba5b938624386ae55ca50689 | fix check_repeaters | gmimano/commcaretest,puttarajubr/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/c... | corehq/apps/receiverwrapper/tasks.py | corehq/apps/receiverwrapper/tasks.py | from functools import wraps
from celery.log import get_task_logger
from celery.task import periodic_task
from datetime import datetime, timedelta
from django.core.cache import cache
from corehq.apps.receiverwrapper.models import RepeatRecord, FormRepeater
from couchdbkit.exceptions import ResourceConflict
from couchfor... | from functools import wraps
from celery.log import get_task_logger
from celery.task import periodic_task
from datetime import datetime, timedelta
from django.core.cache import cache
from corehq.apps.receiverwrapper.models import RepeatRecord, FormRepeater
from couchdbkit.exceptions import ResourceConflict
from couchfor... | bsd-3-clause | Python |
50e249c876be5d4e201e108350702ebfb7e170e8 | add command to copy tags from one project to another | ssadedin/seqr,ssadedin/seqr,ssadedin/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/seqr,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/seqr | seqr/management/commands/copy_project_tags.py | seqr/management/commands/copy_project_tags.py | from django.core.management.base import BaseCommand, CommandError
from django.db.models.query_utils import Q
from seqr.models import Project, VariantTagType
from seqr.model_utils import create_seqr_model
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--source', help='Pr... | agpl-3.0 | Python | |
7fb2d26047781b28e41569136aca420ba04d0e0a | add dft interface for ASE OTF | mir-group/flare,mir-group/flare | flare/ase/dft.py | flare/ase/dft.py | '''
This module is to provide the same interface as the module `dft_interface`, so we can use ASE atoms and calculators to run OTF
'''
import numpy as np
from copy import deepcopy
def parse_dft_input(atoms):
pos = atoms.positions
spc = atoms.get_chemical_symbols()
cell = np.array(atoms.get_cell())
mas... | mit | Python | |
8dcdb6516199258ddb76ec161fc775194eec95cf | Add a process count check | hobbeswalsh/tensor,calston/tensor,calston/tensor,calston/tensor,hobbeswalsh/tensor,calston/tensor | tensor/sources/linux/process.py | tensor/sources/linux/process.py | from zope.interface import implements
from twisted.internet import defer, utils
from tensor.interfaces import ITensorSource
from tensor.objects import Source
class ProcessCount(Source):
implements(ITensorSource)
@defer.inlineCallbacks
def get(self):
out, err, code = yield utils.getProcessOutputA... | mit | Python | |
af88c949e9759f976787c0cd9f96b0d671ae91fe | Create logger_bot.py | Pathangi-Jatinshravan/reddit_bots | logger_bot.py | logger_bot.py | #!/usr/bin/env python
import praw
import time
r = praw.Reddit('Program to analyse the most accurate predictor')
#Type your subreddit and words here below
REDDIT = 'pcmasterrace'
words = ['input', 'demand', 'version', 'arkham', 'light']
comment_words = ['speed', 'glorious', 'pcmr', 'gaben', 'praise']
r.login()
taken... | mit | Python | |
8c921e946c85e4783ef57757e5b2c6ceb3bca9f9 | Create new package. (#7221) | iulian787/spack,iulian787/spack,matthiasdiener/spack,mfherbst/spack,iulian787/spack,iulian787/spack,mfherbst/spack,tmerrick1/spack,tmerrick1/spack,matthiasdiener/spack,krafczyk/spack,matthiasdiener/spack,EmreAtes/spack,krafczyk/spack,tmerrick1/spack,matthiasdiener/spack,mfherbst/spack,EmreAtes/spack,mfherbst/spack,Emre... | var/spack/repos/builtin/packages/r-jaspar2018/package.py | var/spack/repos/builtin/packages/r-jaspar2018/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
6e1f1d900d77f1352eb941f7ac569a0c681c8dc1 | Add new script to loop on randomly writing registers | vandaele/light-automation,vandaele/light-automation | loop_write.py | loop_write.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
import random
import time
from automaton_client import AutomatonClient
SERVER_HOST = "localhost"
SERVER_PORT = 1502
SLEEP_INTERVAL = 5
# sets on only 6 randomly chosen panels
def random6():
regs_values = [0] * 23
indices = []
while len(indices) < 6:
... | mit | Python | |
f9cd34482fc72bb380ca200adaa51ca414bd1360 | Create sum_of_odd_numbers.py | Kunalpod/codewars,Kunalpod/codewars | sum_of_odd_numbers.py | sum_of_odd_numbers.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Sum of Odd Numbers
#Problem level: 7 kyu
def row_sum_odd_numbers(n):
return n**3
| mit | Python | |
a3b72336c5f04dfdc91b4d296adf669c9e3bf355 | Implement usermode +s (currently doesn't do anything) | ElementalAlchemist/txircd,Heufneutje/txircd,DesertBus/txircd | txircd/modules/umode_s.py | txircd/modules/umode_s.py | from txircd.modbase import Mode
class ServerNoticeMode(Mode):
pass
class Spawner(object):
def __init__(self, ircd):
self.ircd = ircd
def spawn(self):
return {
"modes": {
"uns": ServerNoticeMode()
}
}
def cleanup(self):
self.ircd.removeMode("uns") | bsd-3-clause | Python | |
af9ec9b12f5111cf6b2352ca9efc147c86093024 | Add string compression problem and tests. | HKuz/Test_Code | Problems/compressString.py | Problems/compressString.py | #!/Applications/anaconda/envs/Python3/bin
def main():
# Test suite
tests = [None, '', 'AABBCC', 'AAABCCDDDD']
results = [None, '', 'AABBCC', 'A3BCCD4']
for i in range(len(tests)):
temp_result = compress_string(tests[i])
if temp_result == results[i]:
print('PASS: {} return... | mit | Python | |
4df49571da2b5734d7ef27f10028c23adb8dae59 | add gp_ccX | tschaume/ccsgp_get_started,tschaume/ccsgp_get_started | pyana/examples/gp_ccX.py | pyana/examples/gp_ccX.py | import os, argparse, logging
from .utils import getWorkDirs, checkSymLink, getEnergy4Key, particleLabel4Key
from collections import OrderedDict
from ..ccsgp.ccsgp import make_plot, make_panel
from ..ccsgp.config import default_colors
import numpy as np
def gp_ccX():
"""fit experimental data"""
inDir, outDir =... | mit | Python | |
3e7e78713ccd94d47fda04c009ff3d4bd3519031 | Solve birthday cake candles | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | python/birthday_cake_candles.py | python/birthday_cake_candles.py | #!/bin/python3
import sys
_ = int(input().strip())
candle_heights = list(map(int, input().strip().split(' ')))
print(candle_heights.count(max(candle_heights)))
| mit | Python | |
540a21a01f2311379ba151d86b1c75e6d87210c4 | Add functions to assign tracing to proofreaders | janelia-flyem/synapse-geometry,jni/synapse-geometry | syngeo/assignments.py | syngeo/assignments.py | # built-ins
import os
import argparse
from math import floor, ceil
from random import shuffle
import json
import cPickle as pck
import itertools as it
from operator import __or__, __not__
from functools import partial
# external libraries
import numpy as np
from ray import imio
# local modules
from syngeo import io
... | bsd-3-clause | Python | |
cb2c26321f8ac74e4038353314ff054ad43e4bc6 | add BYOR config | everware/everware,sashabaranov/everware,sashabaranov/everware,everware/everware,sashabaranov/everware,sashabaranov/everware,everware/everware,everware/everware | etc/byor_config.py | etc/byor_config.py | c = get_config()
load_subconfig('etc/base_config.py')
load_subconfig('etc/github_auth.py')
from dockerspawner import DockerSpawner
c.DockerSpawner.hub_ip_connect = c.JupyterHub.hub_ip
| bsd-3-clause | Python | |
0d896d3fdfcd9422fc8a9626ea8c1e5e73358092 | Create effective_subsampling.py | Effective-Quadratures/Effective-Quadratures,psesh/Effective-Quadratures | effective_quadratures/effective_subsampling.py | effective_quadratures/effective_subsampling.py |
# Here we demonstrate our new strategy!
| lgpl-2.1 | Python | |
db3af62d59abda43847aeccf2bd0eb489e1553d0 | Add the proxy.py module to make fresque running being a reverse proxy | vivekanand1101/fresque,rahulrrixe/fresque,whitel/fresque,fedora-infra/fresque,vivekanand1101/fresque,fedora-infra/fresque,fedora-infra/fresque,rahulrrixe/fresque,vivekanand1101/fresque,fedora-infra/fresque,whitel/fresque,rahulrrixe/fresque,whitel/fresque,vivekanand1101/fresque,whitel/fresque,rahulrrixe/fresque | fresque/proxy.py | fresque/proxy.py | # -*- coding: utf-8 -*-
'''
Makes fresque an application behind a reverse proxy and thus ensure the
redirects are using ``https``.
Source: http://flask.pocoo.org/snippets/35/ by Peter Hansen
'''
class ReverseProxied(object): # pragma: no cover
'''Wrap the application in this middleware and configure the
f... | agpl-3.0 | Python | |
d0176bd6cb54fccc5e9d16a73c99979dabced697 | Create 677-Map-Sum-Pairs.py | Vaibhav/InterviewPrep,Vaibhav/InterviewPrep | LeetCode/Medium/677-Map-Sum-Pairs.py | LeetCode/Medium/677-Map-Sum-Pairs.py | '''
Implement a MapSum class with insert, and sum methods.
For the method insert, you'll be given a pair of (string, integer). The string represents the key and the integer represents the value. If the key already existed, then the original key-value pair will be overridden to the new one.
For the method sum, you'll ... | mit | Python | |
3ad5743feaf676361984ef93c8d76ba5c88a5fd9 | Add basic roundtrip test | 6aika/issue-reporting,6aika/issue-reporting,6aika/issue-reporting | issues/tests/test_roundtrip.py | issues/tests/test_roundtrip.py | import random
import pytest
from django.utils.crypto import get_random_string
from issues.tests.schemata import ISSUE_SCHEMA
from issues.tests.utils import get_data_from_response, ISSUE_LIST_ENDPOINT, verify_issue, close_enough
TEST_CASES = [
{
"lat": random.uniform(-50, 50),
"long": random.unifo... | mit | Python | |
1b3de83af4f628a21347201cc42cbcc8ff4babfb | Add organization conext processor | xobb1t/ddash2013,xobb1t/ddash2013 | apps/organizations/context_processors.py | apps/organizations/context_processors.py | def organization(request):
return {'organization': request.organization}
| mit | Python | |
3061099d72364eb6d6aa36613b2a425fc3f99915 | Increment version to v0.3.91 for PyPi. | Gerhut/furl,lastfm/furl,penyatree/furl,guiquanz/furl | furl/__init__.py | furl/__init__.py | #
# furl - URL manipulation made simple.
#
# Arthur Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: Build Amazing Things (Unlicense)
__title__ = 'furl'
__version__ = '0.3.91'
__license__ = 'Unlicense'
__author__ = 'Arthur Grunseid'
__contact__ = 'grunseid@gmail.com'
__url__ = 'https://github.com/gruns/furl'
... | #
# furl - URL manipulation made simple.
#
# Arthur Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: Build Amazing Things (Unlicense)
__title__ = 'furl'
__version__ = '0.3.9'
__license__ = 'Unlicense'
__author__ = 'Arthur Grunseid'
__contact__ = 'grunseid@gmail.com'
__url__ = 'https://github.com/gruns/furl'
... | unlicense | Python |
1a5cfdc240bd94a3105c3ca2a3d4af3514896e55 | Add thermochemistry analysis module. | Bismarrck/pymatgen,sonium0/pymatgen,ctoher/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,migueldiascosta/pymatgen,ctoher/pymatgen,Dioptas/pymatgen,yanikou19/pymatgen,ctoher/pymatgen,sonium0/pymatgen,yanikou19/pymatgen,Dioptas/pymatgen,migueldiascosta/pymatgen,Bismarrck/pymatgen,migueldiascosta/pymatgen,yanikou19/pymatg... | pymatgen/analysis/thermochemistry.py | pymatgen/analysis/thermochemistry.py | #!/usr/bin/env python
'''
A module to perform experimental thermochemical data analysis.
'''
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Jun 10, 2012... | mit | Python | |
9a9641075cccf66768795e62d1b92ed294e7287b | test mpi stuff | adrn/streams,adrn/streams | scripts/test_mpi.py | scripts/test_mpi.py | # coding: utf-8
""" Test the MPI pool """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import logging
# Third-party
import astropy.units as u
from emcee.utils import MPIPool
import numpy as np
def test_function(arr):
return 0.
... | mit | Python | |
838e8f900daf17381e70b22fa01656aeb28fd6ca | Add arp packets sender. | Vladimir-Ivanov-Git/raw-packet,Vladimir-Ivanov-Git/raw-packet | send_arp_packets.py | send_arp_packets.py | from base import Base
from network import Ethernet
from argparse import ArgumentParser
from scapy.all import Ether, IP, ARP, sendp
Base.check_user()
parser = ArgumentParser(description='ARP reply sender')
parser.add_argument('-i', '--interface', type=str, help='Set interface name for send reply packets')
parser.add_... | mit | Python | |
87e5219d6d23cdc954b8c9f0d84e45f5f205f8cf | Create beta_fizzbuzz_plusplus.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/beta/beta_fizzbuzz_plusplus.py | Solutions/beta/beta_fizzbuzz_plusplus.py | from operator import mul
from functools import reduce
def fizzbuzz_plusplus(nums, words):
return [''.join(words[nums.index(d)] for d in nums if i%d==0) or i
for i in range(1,reduce(mul,nums)+1)]
| mit | Python | |
4089886f3004b89742d3217b1188dd7d84d760cf | Add a script to analyze the content of the swift dylib. | modocache/swift,modocache/swift,shahmishal/swift,brentdax/swift,kusl/swift,aschwaighofer/swift,deyton/swift,gmilos/swift,calebd/swift,danielmartin/swift,stephentyrone/swift,IngmarStein/swift,uasys/swift,atrick/swift,natecook1000/swift,hooman/swift,apple/swift,ahoppen/swift,djwbrown/swift,kentya6/swift,gribozavr/swift,L... | utils/analyzeDylibSize.py | utils/analyzeDylibSize.py | #!/usr/bin/env python
import subprocess
import sys
if len(sys.argv) < 2:
print "Usage: %s file.dylib" % sys.argv[0]
sys.exit(0)
class BinaryFunction:
"""
This class represents a disassembled binary function.
"""
def __init__(self, symbolName):
self.name = symbolName
self.start = None
self.end ... | apache-2.0 | Python | |
d8b898efb5eab7c598f97640d55efcd781ffcdf1 | test collections | INCF/pybids | bids/variables/tests/test_collections.py | bids/variables/tests/test_collections.py | from bids.grabbids import BIDSLayout
import pytest
from os.path import join, dirname, abspath
from bids import grabbids
from bids.variables import DenseRunVariable
@pytest.fixture(scope="module")
def run_coll():
mod_file = abspath(grabbids.__file__)
path = join(dirname(mod_file), 'tests', 'data', 'ds005')
... | mit | Python | |
ede2d39e5448b4ea65ef983c57eb6d254876258e | add build script to create a non-minimized (uncompressed) version of OL. this is helpful for debugging | antonio83moura/ol3,fredj/ol3,geekdenz/openlayers,kartverket/openlayers,boundlessgeo/openlayers,v5analytics/openlayers,dracic/openlayers,ahocevar/openlayers,ahocevar/openlayers,pvalsecc/openlayers,mzur/ol3,owenmead/openlayers,avinet/openlayers,adube/ol3,kjelderg/ol3,altamiracorp/openlayers,freylis/ol3,mechdrew/ol3,thoma... | build/buildUncompressed.py | build/buildUncompressed.py | #!/usr/bin/env python
import sys
sys.path.append("../tools")
import jsmin, mergejs
sourceDirectory = "../lib"
configFilename = "library.cfg"
outputFilename = "OpenLayers.js"
if len(sys.argv) > 1:
configFilename = sys.argv[1] + ".cfg"
if len(sys.argv) > 2:
outputFilename = sys.argv[2]
print "Merging librari... | bsd-2-clause | Python | |
63a51ba338229ec6a8ccd1bc6a29b0a95bc17081 | add version module and get_version_files function | sephii/fabliip,liip/fabliip,liip/fabliip,sephii/fabliip | fabliip/version.py | fabliip/version.py | from distutils.version import LooseVersion
import glob
import os
def get_version_files(from_version, to_version, directory):
"""
Get a list of the files named after a version number (eg. 0.1.py, 0.1.2.py,
etc) from the given directory and return a sorted list of tuples (version,
file) of files which v... | mit | Python | |
d59eeee77807f417273f6615135cb36f0ded76e6 | Create ReverseVowelsofaString.py | Chasego/codi,cc13ny/Allin,Chasego/cod,Chasego/codi,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/codirit,cc13ny/algo,Chasego/codirit,cc13ny/algo,cc13ny/algo,Chasego/codirit,Chasego/codi,cc13ny/Allin,cc13ny/Allin,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/cod,Chasego/codirit,Chasego/cod,Chasego/codi,Chasego/codi,cc1... | leetcode/345-Reverse-Vowels-of-a-String/ReverseVowelsofaString.py | leetcode/345-Reverse-Vowels-of-a-String/ReverseVowelsofaString.py | class Solution(object):
def reverseVowels(self, s):
"""
:type s: str
:rtype: str
"""
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
ls = list(s)
idx = [i for i in xrange(len(s)) if s[i] in vowels]
for i in xrange(len(idx)... | mit | Python | |
ecff2ae6eab6ecfeb795e9286425b4b37b0faeff | create quotes spider | hunsen/PopularQuotes | PopularQuotes/spiders/quotespider.py | PopularQuotes/spiders/quotespider.py | # coding: UTF-8
import scrapy
class QuotesSpider(scrapy.Spider):
name = "quotespider"
start_urls = [
"https://www.goodreads.com/quotes?page=1",
"https://www.goodreads.com/quotes?page=2"
]
def parse(self, response):
page = response.url.split('page=')[1]
filename = 'quote... | mit | Python | |
b134db22e4fd73b185181f28a0a58b3e72808256 | create category slice script | researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing | python-processing/src/main/python/createcategoryslice.py | python-processing/src/main/python/createcategoryslice.py | __author__ = 'hfriedrich'
import sys
import codecs
import numpy as np
from scipy.sparse import csr_matrix
from scipy.io import mmwrite
# simple script that creates a categoryslice.mtx from the headers.txt file and the categorized needs in the
# allneeds.txt file. In case the file format of headers.txt and allneeds.tx... | apache-2.0 | Python | |
42892b4bd4fafe6f53abfddec4e1a76f21d386d7 | add test_fake_init_op | luotao1/Paddle,baidu/Paddle,reyoung/Paddle,luotao1/Paddle,chengduoZH/Paddle,PaddlePaddle/Paddle,PaddlePaddle/Paddle,luotao1/Paddle,chengduoZH/Paddle,chengduoZH/Paddle,tensor-tang/Paddle,tensor-tang/Paddle,PaddlePaddle/Paddle,reyoung/Paddle,reyoung/Paddle,luotao1/Paddle,luotao1/Paddle,reyoung/Paddle,reyoung/Paddle,luota... | python/paddle/fluid/tests/unittests/test_fake_init_op.py | python/paddle/fluid/tests/unittests/test_fake_init_op.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | apache-2.0 | Python | |
192d5c44f6743df084c237c44c077127fdfc76dc | Create RespostaVer.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Models/Grau/RespostaVer.py | backend/Models/Grau/RespostaVer.py | from Framework.Resposta import Resposta
from Models.Grau.Grau import Grau as ModelGrau
class RespostaVer(Resposta):
def __init__(self,grau):
self.corpo = ModelCampus(grau)
| mit | Python | |
55eb1c81f02a715adfe70c188985924fbeb340fd | Add script to get average duration based on video list data | Ziggeo/ZiggeoPythonSdk,Ziggeo/ZiggeoPythonSdk | demos/_videos_index_duration.py | demos/_videos_index_duration.py | import sys
from Ziggeo import Ziggeo
if(len(sys.argv) < 3):
print ("Error\n")
print ("Usage: $>python _videos_index_duration.py YOUR_API_TOKEN YOUR_PRIVATE_KEY\n")
sys.exit()
api_token = sys.argv[1]
private_key = sys.argv[2]
total_duration = 0.0
count_duration = 0.0
ziggeo = Ziggeo(api_token, private_key)
def ind... | apache-2.0 | Python | |
e95065f92ee10d99bb46b2023794ae23f7e29405 | Add CRC32 checksum example | SpectraLogic/ds3_python3_sdk,SpectraLogic/ds3_python3_sdk,SpectraLogic/ds3_python3_sdk | samples/puttingDataWithCRC32.py | samples/puttingDataWithCRC32.py | # Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use
# this file except in compliance with the License. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" ... | apache-2.0 | Python | |
3154ef23b48a42e274417a28953c55b98ac3fec3 | Convert .png endings to .jpg | sergiocorreia/panflute-filters | filters/png2jpg.py | filters/png2jpg.py | """
Change image extensions from .png to .jpg
EXAMPLE:
>>>> echo An  | pandoc -F png2jpg.py
"""
import panflute as pf
def action(elem, doc):
if isinstance(elem, pf.Image):
elem.url = elem.url.replace('.png', '.j... | bsd-3-clause | Python | |
cdad3166e1dc7c30cd2373f12f5a1e44dea37072 | Create smartdraft.py | jsucsy/DraftRunner | smartdraft.py | smartdraft.py | '''
Created on Aug 19, 2014
@author: jsu
'''
import config as c
import cPickle as pickle
import os, platform
from team import Team
import playerclass
import scoring as scoring
#-------------draft setup------------------------
def parse_yahoo_qb(sourcefile):
players = []
with open(sourcefile, 'rb+') as source:... | mit | Python | |
800f9329a179ea2c6d18cb2a0739535b4f973c44 | create htmlReportGen | nomadpenguins/opeNPSnake,nomadpenguins/opeNPSnake | htmlReportGen.py | htmlReportGen.py | #!/usr/bin/env python
import datetime
print(str(datetime.datetime.today()).replace(':','').replace('.','').replace(' ','').replace('-','')[0:14])
report = open(str(datetime.datetime.today()).replace(':','').replace('.','').replace(' ','').replace('-','')[0:14]+'report.html','w')
| apache-2.0 | Python | |
59f9e977ee343082b9ad3e815c662d1425549e83 | Add new tests (don't yet work) | JelleAalbers/blueice | tests/test_binned_likelihood.py | tests/test_binned_likelihood.py | # from blueice.test_helpers import *
# from blueice.likelihood import BinnedLogLikelihood
#
# from scipy import stats
#
#
# def test_single_bin():
# conf = test_conf()
# conf['sources'][0]['events_per_day'] = 1
# conf['analysis_space'] = [['x', [-10, 10]]]
#
# lf = BinnedLogLikelihood(conf)
# lf.add... | bsd-3-clause | Python | |
8cd5ec3400a4c767bdf5258f7101762cdffc9476 | add test result summary | yxtj/GSDM,yxtj/GSDM,yxtj/GSDM,yxtj/GSDM,yxtj/GSDM | SupportScript/summary-test-result.py | SupportScript/summary-test-result.py | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 13 22:42:08 2016
@author: Tian Zhou
"""
import os,sys
def processOneFile(fn):
cnt=0;
accurancy=0.0
recall=0.0
f1=0.0
with open(fn) as fin:
header=fin.readline()[:-1].split('\t')
pACC=header.index('accurancy')
pREC=header.index... | apache-2.0 | Python | |
d76ce071c99d4f5f10fec5115c939808a7349487 | Create __init__.py | tKhan719/Theta | bin/__init__.py | bin/__init__.py | mit | Python | ||
7df6010f1dd4cfa00b48f2fe646d3bb0bd02f8ec | Add unittest to verify remote stat on misc fd types | fmoo/python-filedes,fmoo/python-filedes | tests/fd_remote.py | tests/fd_remote.py | from __future__ import absolute_import
from filedes.test.base import BaseFDTestCase
from filedes.subprocess import Popen
from filedes import get_open_fds, FD
from subprocess import PIPE, STDOUT
import unittest2
import filedes
import socket
import tempfile
class RemoteFDTests(BaseFDTestCase):
def testPipe(self):
... | isc | Python | |
fafd1b88b7695a64d787173cd5ee73706c6db5e0 | Add async Memo | xeroc/python-bitshares | bitshares/aio/memo.py | bitshares/aio/memo.py | # -*- coding: utf-8 -*-
from graphenecommon.aio.memo import Memo as GrapheneMemo
from bitsharesbase.account import PrivateKey, PublicKey
from .account import Account
from .instance import BlockchainInstance
@BlockchainInstance.inject
class Memo(GrapheneMemo):
""" Deals with Memos that are attached to a transfer
... | mit | Python | |
ec23d4c6ecb1cab1a6ded3880e70f231c6dd286b | Change date_planned into delay | gisce/openobject-server,MarkusTeufelberger/openobject-server,ovnicraft/openerp-server,vnc-biz/openerp-server,splbio/openobject-server,xrg/openerp-server,gisce/openobject-server,MarkusTeufelberger/openobject-server,splbio/openobject-server,gisce/openobject-server,ovnicraft/openerp-server,xrg/openerp-server,vnc-biz/opene... | doc/migrate/4.0.0-x.x.x/post.py | doc/migrate/4.0.0-x.x.x/post.py | ##############################################################################
#
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences result... | agpl-3.0 | Python | |
c2506fdc71f1dcff2e3455c668e78ad6b7d5d94b | Add inital structure for fenix downloader | iluxonchik/python-general-repo | scripts/fenix/fenix_download.py | scripts/fenix/fenix_download.py | # python fenix_download login_file <url> -e <file_extension> (DEFAULT = pdf) -d <download_directory>
#
#
from fenix import Fenix
import argparse
if __name__ == '__main__':
# TODO: argparse
parser = argparse.ArgumentParser(description='Download files from Fenix Edu pages')
parser.add_argument('login', type... | mit | Python | |
a5f0544bf0ce88ecfca515f0db344fffb90c8d8e | Add simple window transform example | altair-viz/altair,ellisonbg/altair,jakevdp/altair | altair/vegalite/v2/examples/percentage_of_total.py | altair/vegalite/v2/examples/percentage_of_total.py | """
Calculating Percentage of Total
-------------------------------
This chart demonstrates how to use a window transform to display data values
as a percentage of total values.
"""
import altair as alt
import pandas as pd
activities = pd.DataFrame({'Activity': ['Sleeping', 'Eating', 'TV', 'Work', 'Exercise'],
... | bsd-3-clause | Python | |
cc298dc6abb81ccf493e24b7e003a79097e291a0 | add to_netrc.py conversion script | stefco/dotfiles,stefco/dotfiles,stefco/dotfiles | bin/to_netrc.py | bin/to_netrc.py | #!/usr/bin/env python
# (c) Stefan Countryman (2018)
"""
Take my heirarchically-organized passwords directory and dump everything to a
.netrc-formatted file.
"""
import os
SECRETPATH = os.path.expanduser("~/secrets")
OUTFILE = os.path.join(SECRETPATH, ".netrc")
def load_secrets(secretpath):
"""Load passwords a... | mit | Python | |
2baad17e6628d6cf007dcb23ff6ef1d319086fef | add test for core.item | estin/pomp | tests/test_item.py | tests/test_item.py | from nose.tools import assert_equal
from pomp.core.item import Item, Field
def test_item():
class TItem(Item):
f1 = Field()
f2 = Field()
f3 = Field()
i = TItem()
assert_equal(['f1', 'f2', 'f3'], i.keys())
i.f1 = 1
i.f3 = 3
assert_equal([1, None, 3], i.values())
| bsd-3-clause | Python | |
20878df423f8c65358bc8683acbebaf5c28fae8c | add simple int and uint tests using pytest | mgeisler/pygob | tests/test_load.py | tests/test_load.py | import pytest
import pygob
@pytest.mark.parametrize(('data', 'expected'), [
([3, 6, 0, 1], 1),
([3, 6, 0, 2], 2),
([3, 6, 0, 3], 3),
([4, 6, 0, 255, 255], 255),
([5, 6, 0, 254, 1, 0], 256),
([5, 6, 0, 254, 1, 1], 257),
])
def test_uint(data, expected):
assert pygob.load(bytes(data)) == ex... | mit | Python | |
fc82e15743992a3071b18c75eae8abe5b0ed4cc9 | add awe wrapper awe_blat.py | wgerlach/pipeline,MG-RAST/pipeline,teharrison/pipeline,wgerlach/pipeline,wgerlach/pipeline,teharrison/pipeline,teharrison/pipeline,MG-RAST/pipeline,MG-RAST/pipeline | awecmd/awe_blat.py | awecmd/awe_blat.py | #!/usr/bin/env python
import os, sys, time, datetime, operator, shutil
import subprocess as sub
from optparse import OptionParser
Min_Hits = 20
EXIT_MISSING_INPUT = 1
EXIT_RUNBLAT_FAIL = 2
ENV_VAR_DBPATH = 'REFDBPATH'
Info_log = open("awe_blat.info", "w")
def sortandbleach(sims_file, out_file):
print "started ... | bsd-2-clause | Python | |
ce9940995047857c23fc5e1d8730dccd4fde472d | Add project -> initiative migration | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/projects/migrations/0091_auto_20190607_0914.py | bluebottle/projects/migrations/0091_auto_20190607_0914.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-06-07 07:14
from __future__ import unicode_literals
from django.contrib.gis.geos import Point
from django.db import migrations
from bluebottle.clients import properties
def map_status(status):
mapping = {
'plan-new': 'draft',
'plan-s... | bsd-3-clause | Python | |
9f27cf9f0669f98694e7751eb9d22064d24bdb3f | Add testcase for search indexing of Service | theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo | services/tests/test_indexing.py | services/tests/test_indexing.py | from django.test import TestCase
from services.tests.factories import ServiceFactory
from services.models import Service
from services.search_indexes import ServiceIndex
class IndexingTest(TestCase):
def setUp(self):
self.service_ar = ServiceFactory(
name_ar='Arabic', name_en='', name_fr='',... | bsd-3-clause | Python | |
f6b0b8c550066b60cd99fcde062bb63fae276903 | integrate lcov in the test suite | squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto | conftest.py | conftest.py | import subprocess
import sys
import os
import shutil
def pytest_configure(config):
subprocess.check_call([sys.executable, 'build.py', '--coverage'])
subprocess.check_call([
'lcov', '--base-directory', '.', '--directory',
'build/temp.linux-x86_64-3.5', '--zerocounters', '-q'])
def pytest_unc... | mit | Python | |
f39e8f46d1f58f50d624e8f4e6e00f52298c48d7 | Create hop_func.py | Shirui816/FTinMS | hop_func.py | hop_func.py | a = np.random.random((10,1, 11, 1, 3))
a = np.append(a[:,:,:6], a[:,:,5:], axis=1)
c = (a-np.flip(np.expand_dims(a.mean(axis=2),2),axis=1))
ret = np.multiply.reduce(np.mean(c **2, axis=2).sum(axis=-1),axis=1)
pp = np.mean(a**2, axis=2)
p = np.mean(a, axis=2)
pab = np.einsum('...j,...j->...', p[:,0],p[:,1])
ret =... | bsd-3-clause | Python | |
e84d6238623bafca1aa691a12c943218e4885061 | Add tests for module_spotify | EArmour/pyfibot,aapa/pyfibot,aapa/pyfibot,EArmour/pyfibot,lepinkainen/pyfibot,lepinkainen/pyfibot | tests/test_spotify.py | tests/test_spotify.py | # .-*- encoding: utf-8 -*-
from __future__ import unicode_literals
import bot_mock
from nose.tools import eq_
from pyfibot.modules.module_spotify import handle_privmsg
from utils import check_re
bot = bot_mock.BotMock()
def test_spotify_track():
msg = 'spotify:track:46c5HqyYtOkpjdp193KCln'
title = '[Spotify]... | bsd-3-clause | Python | |
729cdbfc9013bbc34bb44cc10f0f8443d604f1be | Add code for RNN time series analysis | KT12/hands_on_machine_learning | time_series_rnn.py | time_series_rnn.py | # Predict time series
import tensorflow as tf
import numpy as np
# Create time series
t_min, t_max = 0, 30
resolution = 0.1
def time_series(t):
return t * np.sin(t) / 3 + 2 * np.sin(t * 5)
def next_batch(batch_size, n_steps):
t0 = np.random.rand(batch_size, 1) * (t_max - t_min - n_steps * resolution)
Ts... | mit | Python | |
7cdeab85468ef1a752ccf6fca7b6a7e145e1ee0c | add genuuidandhash3 with additional features | DavidUnderdown/csvgen | genuuidandhash3.py | genuuidandhash3.py | import uuid, hashlib, os, csv, urllib.parse, random;
beginXML='''<?xml version="1.0" encoding="utf-8"?>
<DigitalFile xmlns="http://nationalarchives.gov.uk/2012/dri/artifact/embedded/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
''';
openUUIDtag='<UUID>';
closeUUIDtag='''</UUID>
''';
openURLtag='<URI... | bsd-3-clause | Python | |
7511c6b7b6af506abb8eff6fba0cd0735dad5be8 | add code to get data remotely | hchiam/cognateLanguage | getDataRemotely.py | getDataRemotely.py | import sys
data = []
# use different import based on python version number:
if (sys.version_info > (3, 0)):
# python 3:
import urllib.request
with urllib.request.urlopen('https://raw.githubusercontent.com/hchiam/cognateLanguage/master/output_shortlist.txt') as response:
line = response.readlin... | mit | Python | |
549f9de4905bc8eef5676e2a43fa4fd3979c059d | Create graphing_clicks.py | AdrianEvans/FFanalysis | graphing_clicks.py | graphing_clicks.py | # quick and dirty code to plot user clicks labelled by tool
import matplotlib.pyplot as plt
import MySQLdb
#database connection
conn = MySQLdb.connect("localhost","adrianevans","CJ3ByCTc!","fossilfinder")
c = conn.cursor()
subject_of_interest = 1145456
#extracts x y and labels into rows
c.execute("select x_coord f... | apache-2.0 | Python | |
075d03666fa9a96ca951fad805a1c0664e5010e1 | Implement basic BridgeT test | 0xPoly/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,0x... | ooni/plugins/bridget.py | ooni/plugins/bridget.py | """
This is a self genrated test created by scaffolding.py.
you will need to fill it up with all your necessities.
Safe hacking :).
"""
from zope.interface import implements
from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.internet import reactor
from ooni import log
from ooni.plugoo.te... | bsd-2-clause | Python | |
46e3d5858eb22930113ff7da1f503e41b26000d3 | Include ziggurat_tables.py | rust-lang/rand | src/distributions/ziggurat_tables.py | src/distributions/ziggurat_tables.py | #!/usr/bin/env python
#
# Copyright 2013 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
#... | apache-2.0 | Python | |
7703f95a87ad562cf6c2a596577128566505ebad | Add a pin example | JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton | src/examples/pin/callback_syscall.py | src/examples/pin/callback_syscall.py |
from triton import *
from pintool import *
# Output
#
# $ ./triton examples/callback_syscall.py ./samples/crackmes/crackme_xor a
# sys_write(1, 7fb7f06e1000, 6)
# loose
#
def my_callback_syscall_entry(threadId, std):
if getSyscallNumber(std) == SYSCALL.WRITE:
arg0 = getSyscallArgument(std, 0)
a... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.