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 |
|---|---|---|---|---|---|---|---|---|
c5a2d916fa907aa15a425dedc405ecc0ae2ba668 | Add script to compare taxa from before and after filter step | ODoSE/odose.nl | compare_taxa.py | compare_taxa.py | #!/usr/bin/env python
"""Module to compare filtered and unfiltered taxa deduced from their respective trees to assert that they match."""
from divergence import parse_options
import logging as log
import sys
def fail(unfiltered_a, unfiltered_b, filtered_a, filtered_b):
"""Report error back to the user and exit wi... | mit | Python | |
0b8d5794d2c5a1ae46659e02b65d1c21ffe8881d | Implement tests for temperature endpoint | BabyOnBoard/BabyOnBoard-API,BabyOnBoard/BabyOnBoard-API | babyonboard/api/tests/test_views.py | babyonboard/api/tests/test_views.py | import json
from rest_framework import status
from django.test import TestCase, Client
from django.urls import reverse
from ..models import Temperature
from ..serializers import TemperatureSerializer
client = Client()
class GetCurrentTemperatureTest(TestCase):
""" Test class for GET current temperature from API... | mit | Python | |
fa1057d8b9a44bdf2ee0f667184ff5854fd0e8e1 | add rds backup | ministryofjustice/opg-docker,ministryofjustice/opg-docker | base/docker/scripts/rds-snapshot.py | base/docker/scripts/rds-snapshot.py | #!/usr/bin/env python
"""
Backup Amazon RDS DBs.
Script is expected to be run on EC2 VM within the same Amazon account as RDS.
Script reads tags of EC2 and then searches for all matching RDSes.
Where matching RDS is the one that shares the same "Stack" tag value.
"""
import sys
import time
import argparse
import bot... | mit | Python | |
a9d458c0995db80f164f6099b5264f23c1ceffbb | Create 02.py | ezralalonde/cloaked-octo-sansa | 02/qu/02.py | 02/qu/02.py | # Define a procedure, sum3, that takes three
# inputs, and returns the sum of the three
# input numbers.
def sum3(aa, bb, cc):
return aa + bb + cc
#print sum3(1,2,3)
#>>> 6
#print sum3(93,53,70)
#>>> 216
| bsd-2-clause | Python | |
9a705f58acbcfb2cc7292cb396544f1f8c9b89a1 | Add basic web test | laurentb/assnet,laurentb/assnet | tests/baseweb_test.py | tests/baseweb_test.py | from __future__ import with_statement
from ass2m.ass2m import Ass2m
from ass2m.server import Server
from unittest import TestCase
from webtest import TestApp
from tempfile import mkdtemp
import os.path
import shutil
class BaseWebTest(TestCase):
def setUp(self):
self.root = mkdtemp(prefix='ass2m_test_roo... | agpl-3.0 | Python | |
56eba00d00e450b5dc8fae7ea8475d418b00e2db | Add problem69.py | mjwestcott/projecteuler,mjwestcott/projecteuler,mjwestcott/projecteuler | euler_python/problem69.py | euler_python/problem69.py | """
problem69.py
Euler's Totient function, φ(n) [sometimes called the phi function], is used to
determine the number of numbers less than n which are relatively prime to n. For
example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to
nine, φ(9)=6.
It can be seen that n=6 produces a maximum n/φ... | mit | Python | |
e082435619399051321e7c9ae02540f54e436e5b | Create acr_routerauthenticator.py | madumlao/oxAuth,GluuFederation/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth | Server/integrations/acr_router/acr_routerauthenticator.py | Server/integrations/acr_router/acr_routerauthenticator.py | from org.xdi.model.custom.script.type.auth import PersonAuthenticationType
from org.jboss.seam.contexts import Context, Contexts
from org.jboss.seam.security import Identity
from org.xdi.oxauth.service import UserService, AuthenticationService, SessionStateService, VeriCloudCompromise
from org.xdi.util import StringHel... | mit | Python | |
47bdc98a7fb8c030f5beb09ec9bb1b83c100dc9a | Add missing migration | uranusjr/pycontw2016,uranusjr/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | src/users/migrations/0008_auto_20160222_0553.py | src/users/migrations/0008_auto_20160222_0553.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-22 05:53
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0007_auto_20160122_1333'),
]
operations = [
... | mit | Python | |
f0cd785688ed04821f0338021e2360b98bd9dd58 | add very simple perf test | coopernurse/barrister,coopernurse/barrister | conform/perf.py | conform/perf.py | #!/usr/bin/env python
import sys
import barrister
trans = barrister.HttpTransport("http://localhost:9233/")
client = barrister.Client(trans, validate_request=False)
num = int(sys.argv[1])
s = "safasdfasdlfasjdflkasjdflaskjdflaskdjflasdjflaskdfjalsdkfjasldkfjasldkasdlkasjfasld"
for i in range(num):
client.... | mit | Python | |
e88a6a634f600a5ef3ae269fc0d49bcd1e1d58e8 | Revert "More accurate info in examples." | harshaneelhg/scikit-learn,glouppe/scikit-learn,henridwyer/scikit-learn,huzq/scikit-learn,OshynSong/scikit-learn,icdishb/scikit-learn,Sentient07/scikit-learn,yunfeilu/scikit-learn,walterreade/scikit-learn,glennq/scikit-learn,jakobworldpeace/scikit-learn,Fireblend/scikit-learn,huzq/scikit-learn,iismd17/scikit-learn,poryf... | examples/svm/plot_iris.py | examples/svm/plot_iris.py | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on the iris dataset. It
will plot the decision surface and the support vectors.
"""
import numpy as np
import pyl... | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on the iris dataset. It
will plot the decision surface for four different SVM classifiers.
"""
import numpy as np... | bsd-3-clause | Python |
9ba3c840514e765acac2542ee3faf47671824918 | add missing source file | chfw/moban,chfw/moban | moban/buffered_writer.py | moban/buffered_writer.py | from moban import utils, file_system
import fs
import fs.path
class BufferedWriter(object):
def __init__(self):
self.fs_list = {}
def write_file_out(self, filename, content):
if "zip://" in filename:
self.write_file_out_to_zip(filename, content)
else:
utils.wr... | mit | Python | |
b573daf86d2bcb5d8dc71e45a65b5f2ffc0866b1 | Correct module help | iglocska/PyMISP,pombredanne/PyMISP | examples/create_events.py | examples/create_events.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
try:
input = raw_input
except NameError:
pass
def init(url, key):
return PyMISP(url, key, True, 'json')
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
try:
input = raw_input
except NameError:
pass
def init(url, key):
return PyMISP(url, key, True, 'json')
... | bsd-2-clause | Python |
291d882a29981ea6c82c40c8e9a001aa3305e0ae | Create 8kyu_do_I_get_a_bonus.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/8kyu/8kyu_do_I_get_a_bonus.py | Solutions/8kyu/8kyu_do_I_get_a_bonus.py | def bonus_time(salary, bonus):
return '${}'.format(salary*([1,10][bonus]))
| mit | Python | |
7c16172f9ebe65d6928a72001a086637bf4bd725 | Fix buggy annotations for stdout/stderr. | peguin40/zulip,TigorC/zulip,showell/zulip,rishig/zulip,grave-w-grave/zulip,Galexrt/zulip,kou/zulip,Jianchun1/zulip,sup95/zulip,jrowan/zulip,cosmicAsymmetry/zulip,jainayush975/zulip,kou/zulip,hackerkid/zulip,j831/zulip,brockwhittaker/zulip,Juanvulcano/zulip,paxapy/zulip,reyha/zulip,jphilipsen05/zulip,j831/zulip,tommyip/... | scripts/lib/node_cache.py | scripts/lib/node_cache.py | from __future__ import print_function
import os
import hashlib
from os.path import dirname, abspath
if False:
from typing import Optional, List, IO, Tuple
from scripts.lib.zulip_tools import subprocess_text_output, run
ZULIP_PATH = dirname(dirname(dirname(abspath(__file__))))
NPM_CACHE_PATH = "/srv/zulip-npm-ca... | from __future__ import print_function
import os
import hashlib
from os.path import dirname, abspath
if False:
from typing import Optional, List, Tuple
from scripts.lib.zulip_tools import subprocess_text_output, run
ZULIP_PATH = dirname(dirname(dirname(abspath(__file__))))
NPM_CACHE_PATH = "/srv/zulip-npm-cache"... | apache-2.0 | Python |
d10ec57d6f58a4f96a2f648cac1bc94dc78efc32 | Implement identifying to accounts | Heufneutje/txircd | txircd/modules/extra/services/account_identify.py | txircd/modules/extra/services/account_identify.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
irc.ERR_SERVICES = "955" # Custom numeric; 955 <TYPE> <SUBTYPE> <ERROR>
class AccountIdentify(ModuleData):
implements(IPlugin... | bsd-3-clause | Python | |
166854466771850bda3384b75d0f8d0656c259f6 | add predict | Superjom/sematic,Superjom/sematic | gen_predict_res_format.py | gen_predict_res_format.py | # -*- coding: utf-8 -*-
'''
Created on Jul 9, 2013
@author: Chunwei Yan @ pkusz
@mail: yanchunwei@outlook.com
'''
import sys
from utils import get_num_lines, args_check
class Gen(object):
formats = {
'1':1,
'-1':0,
}
def __init__(self, fph, test_ph, tph):
self.fph, self.test_ph, ... | mit | Python | |
aa6837e14e520f5917cf1c452bd0c9a8ce2a27dd | Add new module for plugin loading | minoue/miExecutor | module/others/plugins.py | module/others/plugins.py | from maya import cmds
class Commands(object):
""" class name must be 'Commands' """
commandDict = {}
def _loadObjPlugin(self):
if not cmds.pluginInfo("objExport", q=True, loaded=True):
cmds.loadPlugin("objExport")
commandDict['sampleCommand'] = "sphere.png"
# ^ Don't forget t... | mit | Python | |
67350e9ac3f2dc0fceb1899c8692adcd9cdd4213 | Add a test case to validate `get_unseen_notes` | yashodhank/frappe,StrellaGroup/frappe,frappe/frappe,yashodhank/frappe,yashodhank/frappe,yashodhank/frappe,frappe/frappe,frappe/frappe,StrellaGroup/frappe,StrellaGroup/frappe | frappe/tests/test_boot.py | frappe/tests/test_boot.py | import unittest
import frappe
from frappe.boot import get_unseen_notes
from frappe.desk.doctype.note.note import mark_as_seen
class TestBootData(unittest.TestCase):
def test_get_unseen_notes(self):
frappe.db.delete("Note")
frappe.db.delete("Note Seen By")
note = frappe.get_doc(
{
"doctype": "Note",
... | mit | Python | |
15fd5f6ddd3aa79a26b28d5ef4b93eeb12e28956 | add an update_users management command | edx/edx-ora,edx/edx-ora,edx/edx-ora,edx/edx-ora | controller/management/commands/update_users.py | controller/management/commands/update_users.py | """
Ensure that the right users exist:
- read USERS dictionary from auth.json
- if they don't exist, create them.
- if they do, update the passwords to match
"""
import json
import logging
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.auth.models import User... | agpl-3.0 | Python | |
3d0f6085bceffc5941e55678da20d8db4a7d5ce2 | Create question4.py | pythonzhichan/DailyQuestion,pythonzhichan/DailyQuestion | huangguolong/question4.py | huangguolong/question4.py |
def fib(nums):
'''
:param nums: 一个整数,相当于数列的下标
:return: 返回该下标的值
'''
if nums == 0 or nums == 1:
return nums
else:
return fib(nums-2) + fib(nums-1)
def createFib(n):
'''
:param n: 需要展示前面n个数
:return: 返回一个列表,费波那契数列
'''
list1 = []
for i in range(n):
... | mit | Python | |
448ca2cfb8f7e167b1395e84a4f2b4b4cea57905 | add file | PegasusWang/articles,PegasusWang/articles,PegasusWang/articles | crawler/jb51.py | crawler/jb51.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from async_spider import AsySpider
class Jb51Spider(AsySpider):
def handle_html(self, url, html):
print(url)
'''
filename = url.rsplit('/', 1)[1]
with open(filename, 'w+') as f:
f.write(html)
'''
if __name__ == '... | mit | Python | |
55b3269f9c2cd22ef75a2632f04e37a9f723e961 | add data migration | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0033_migrate_gender_data.py | accelerator/migrations/0033_migrate_gender_data.py | # Generated by Django 2.2.10 on 2021-01-22 12:13
import sys
from django.contrib.auth import get_user_model
from django.db import migrations
# gender identity
GENDER_MALE = "Male"
GENDER_FEMALE = "Female"
GENDER_PREFER_TO_SELF_DESCRIBE = "I Prefer To Self-describe"
GENDER_PREFER_NOT_TO_SAY = "I Prefer Not To Say"
# g... | mit | Python | |
3344bb0a967c4217f6fa1d701b2c4dfb89d578aa | add new package : alluxio (#14143) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/alluxio/package.py | var/spack/repos/builtin/packages/alluxio/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Alluxio(Package):
"""
Alluxio (formerly known as Tachyon) is a virtual distributed sto... | lgpl-2.1 | Python | |
6dc035051d666707fdc09e63f510dbc4edf1724d | Migrate lab_members | mfcovington/django-lab-members,mfcovington/django-lab-members,mfcovington/django-lab-members | lab_members/migrations/0001_initial.py | lab_members/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Position',
fields=[
('id', models.AutoField(pri... | bsd-3-clause | Python | |
f7f25876d3398cacc822faf2b16cc156e88c7fd3 | Use this enough, might as well add it. | ehenneken/loris,medusa-project/loris,rlskoeser/loris,medusa-project/loris,rlskoeser/loris,ehenneken/loris | misc/jp2_kakadu_pillow.py | misc/jp2_kakadu_pillow.py | # This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow
# Useful for debugging the scenario independent of the server.
from PIL import Image
from PIL.ImageFile import Parser
from os import makedirs, path, unlink
import subprocess
import sys
KDU_EXPAND='/usr/local/bin/kdu_expand'
LIB_KDU='/usr/l... | bsd-2-clause | Python | |
2f9324f4d073082f47ecd8279d4bd85eaa1cf258 | add splits-io api wrapper | BatedUrGonnaDie/salty_bot | modules/apis/splits_io.py | modules/apis/splits_io.py | #! /usr/bin/env python2.7
import modules.apis.api_base as api
class SplitsIOAPI(api.API):
def __init__(self, session = None):
super(SplitsIOAPI, self).__init__("https://splits.io/api/v3", session)
def get_user_splits(self, user, **kwargs):
endpoint = "/users/{0}/pbs".format(user)
suc... | mit | Python | |
d5e67563f23acb11fe0e4641d48b67fe3509822f | Add test migration removing ref to old company image | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | apps/companyprofile/migrations/0002_auto_20151014_2132.py | apps/companyprofile/migrations/0002_auto_20151014_2132.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('companyprofile', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='company',
old... | mit | Python | |
a1e2e51c2777107bbc8a20429078638917149b6a | Remove unused import | compas-dev/compas | src/compas/rpc/services/default.py | src/compas/rpc/services/default.py | import os
import inspect
import json
import socket
import compas
from compas.rpc import Server
from compas.rpc import Service
class DefaultService(Service):
pass
if __name__ == '__main__':
import sys
try:
port = int(sys.argv[1])
except:
port = 1753
print('Starting default RP... | import os
import inspect
import json
import socket
import compas
from compas.rpc import Server
from compas.rpc import Service
class DefaultService(Service):
pass
if __name__ == '__main__':
import sys
import threading
try:
port = int(sys.argv[1])
except:
port = 1753
print... | mit | Python |
f20f286a3c5c6e2b9adf7220ac4426ce783d96b5 | Create regressors.py | RonsenbergVI/trendpy,RonsenbergVI/trendpy | trendpy/regressors.py | trendpy/regressors.py | # regressors.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# 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
# to use... | mit | Python | |
ad777af05d2995ee43b3d64ce435cc96379fa9a2 | add iostat template | dbirchak/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer | graph_templates/iostat.py | graph_templates/iostat.py | from . import GraphTemplate
class IostatTemplate(GraphTemplate):
'''
corresponds to diamond diskusage plugin
'''
target_types = {
'gauge': {
'match': '^servers\.(?P<server>[^\.]+)\.iostat\.(?P<device>[^\.]+)\.(?P<type>.*)$',
'default_group_by': 'server',
'de... | apache-2.0 | Python | |
1637b53727f81c9528c47effab172f86a58e8b9a | Add script register_ph_migrate.py to mass register and migrate placeholders remotely | eReuse/DeviceHub,eReuse/DeviceHub | ereuse_devicehub/scripts/register_ph_migrate.py | ereuse_devicehub/scripts/register_ph_migrate.py | import argparse
import requests
from ereuse_devicehub.security.request_auth import Auth
def create_placeholders_and_migrate(base_url, email, password, n_placeholders, origin_db, dest_db, label=None,
comment=None):
"""
Remotely connects to a devicehub, creates n_placehol... | agpl-3.0 | Python | |
417e8d1b63b4b343de3a81366d2d2ce433f089dd | Add paf (#294) | tanghaibao/jcvi | jcvi/formats/paf.py | jcvi/formats/paf.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# paf.py
# formats
#
# Created by Haibao Tang on 09/03/20
# Copyright © 2020 Haibao Tang. All rights reserved.
#
import sys
import logging
from jcvi.formats.base import must_open
from jcvi.apps.base import OptionParser, ActionDispatcher
class PAFLine:
"""
PAF ... | bsd-2-clause | Python | |
54641126cd8d662c6443aff1e6fe238c4bb09932 | Add PowerAnalysers Voltech PMn000 | DavidLutton/EngineeringProject | engineering_project/Instrument/PowerAnalyser.py | engineering_project/Instrument/PowerAnalyser.py | # import time
# import logging
# from scipy.interpolate import UnivariateSpline
# import numpy as np
try:
from Instrument.GenericInstrument import GenericInstrument
from Instrument.IEEE488 import IEEE488
from Instrument.SCPI import SCPI
except ImportError:
from GenericInstrument import GenericInstrumen... | mit | Python | |
d4a5e1bf3e44a8cfe4bd3a9d1900803613e6da67 | Add C_O_L_R_test.py to check basic compile/decompile of otTables.COLR | googlefonts/fonttools,fonttools/fonttools | Tests/ttLib/tables/C_O_L_R_test.py | Tests/ttLib/tables/C_O_L_R_test.py | from fontTools import ttLib
from fontTools.misc.testTools import getXML, parseXML
from fontTools.ttLib.tables import otTables as ot
from fontTools.ttLib.tables.otBase import OTTableReader, OTTableWriter
import pytest
COLR_DATA = (
b"\x00\x00" # Version
b"\x00\x01" # BaseGlyphRecordCount
b"\x00\x00\x00\... | mit | Python | |
884861de58ddfb12f2f5d15ce35349c74eab0c4e | Create 5009-set_bio_gripper.py | xArm-Developer/xArm-Python-SDK | example/wrapper/common/5009-set_bio_gripper.py | example/wrapper/common/5009-set_bio_gripper.py | #!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2020, UFACTORY, Inc.
# All rights reserved.
#
# Author: Hutton <geweipan@ufactory.cc>
"""
Example: Bio Gripper Control
Please make sure that the gripper is attached to the end.
"""
import os
import sys
import time
sys.path.append(os.pa... | bsd-3-clause | Python | |
3ebe9ccebede38cc0638ef4adefe54fca306f2e6 | fix path | aeroevan/pykafka,jofusa/pykafka,sontek/pykafka,wikimedia/operations-debs-python-pykafka,yungchin/pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,sontek/pykafka,fortime/pykafka,aeroevan/pykafka,benauthor/pykafka,yungchin/pykafka,jofusa/pykafka,thedrow/samsa,appsoma/pykafka,fortime/pykafka,appsoma/pyka... | doc/conf.py | doc/conf.py | __license__ = """
Copyright 2012 DISQUS
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, so... | __license__ = """
Copyright 2012 DISQUS
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, so... | apache-2.0 | Python |
965cd743ab1310455fe1ee24c5fa0ae0ae97bd7a | Create MyTestProgram.py | johnscuteri/OpenSourcedButtonBoardTest | MyTestProgram.py | MyTestProgram.py | #!/usr/bin/python
import RPIO, time
# John Scuteri's Button Board tester program
# This program is for John Jay's Button board
# This program was inspired by programs from the following website
# http://www.savagehomeautomation.com/projects/raspberry-pi-john-jays-8-led-button-breakout-board.html
# This program uses Py... | mit | Python | |
3cfd37f81708e1f3a1b69d6c310c7f93d32eb8ed | add script to generate artificial data | djangothon/django-db-meter,djangothon/django-db-meter,djangothon/django-db-meter | django_db_meter/generate_data.py | django_db_meter/generate_data.py | import random
import threading
from django.contrib.auth.models import User
from models import TestModel
def generate_queries():
u1 = User.objects.filter()
new_name = str(random.randint(0, 2000000))
if u1:
u1.update(first_name=new_name)
else:
u1 = User(username=new_name)
u1.sa... | apache-2.0 | Python | |
af88a37ed87b18941232a98f52fec001bd63b453 | Fix bug in CookieJar where QSettings expected str, but got QByteArray instead (#10) | houzhenggang/phantomjs,JamesMGreene/phantomjs,bkrukowski/phantomjs,shinate/phantomjs,hexid/phantomjs,jefleponot/phantomjs,peakji/phantomjs,JingZhou0404/phantomjs,Lochlan/phantomjs,chylli/phantomjs,skyeckstrom/phantomjs,Lochlan/phantomjs,nicksay/phantomjs,AladdinSonni/phantomjs,etiennekruger/phantomjs-qt5,r3b/phantomjs,... | python/pyphantomjs/cookiejar.py | python/pyphantomjs/cookiejar.py | '''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.com>
This program 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
... | '''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.com>
This program 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
... | bsd-3-clause | Python |
eb34dd310cac0106070554c440b134d0baad6c8e | add a way to sequence animations into a new animation | shimpe/pyvectortween,shimpe/pyvectortween | vectortween/SequentialAnimation.py | vectortween/SequentialAnimation.py | from vectortween.Animation import Animation
from vectortween.Tween import Tween
from vectortween.Mapping import Mapping
from copy import deepcopy
from itertools import tee
import numpy as np
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
next(b, None)
return zip(a,... | mit | Python | |
d5b622e9fb855753630cd3a6fae1a315b4be1a08 | Add example using new pytorch backend | nkoep/pymanopt,nkoep/pymanopt,pymanopt/pymanopt,nkoep/pymanopt,pymanopt/pymanopt | examples/dominant_eigenvector_pytorch.py | examples/dominant_eigenvector_pytorch.py | import numpy as np
import numpy.random as rnd
import numpy.linalg as la
import torch
from pymanopt import Problem
from pymanopt.tools import decorators
from pymanopt.manifolds import Sphere
from pymanopt.solvers import TrustRegions
def dominant_eigenvector(A):
"""
Returns the dominant eigenvector of the symm... | bsd-3-clause | Python | |
7a9cb703e776d91d4fc3c632b190bd7d318a12a6 | Create primary directions module | flatangle/flatlib | flatlib/predictives/primarydirections.py | flatlib/predictives/primarydirections.py | """
This file is part of flatlib - (C) FlatAngle
Author: João Ventura (flatangleweb@gmail.com)
This module implements the Primary Directions
method.
"""
from flatlib import angle
from flatlib import utils
# === Base functions === #
def arc(pRA, pDecl, sRA, sDecl, mcRA, lat):
""" Retu... | mit | Python | |
9fbde5b8dd4d2555e03bc0b7915fc4e55f8333d9 | Add test to help module | numba/numba,stonebig/numba,numba/numba,stonebig/numba,seibert/numba,stuartarchibald/numba,cpcloud/numba,sklam/numba,gmarkall/numba,stuartarchibald/numba,IntelLabs/numba,seibert/numba,IntelLabs/numba,IntelLabs/numba,gmarkall/numba,gmarkall/numba,seibert/numba,numba/numba,cpcloud/numba,gmarkall/numba,stuartarchibald/numb... | numba/tests/test_help.py | numba/tests/test_help.py | from __future__ import print_function
import builtins
import types as pytypes
import numpy as np
from numba import types
from .support import TestCase
from numba.help.inspector import inspect_function, inspect_module
class TestInspector(TestCase):
def check_function_descriptor(self, info, must_be_defined=False... | bsd-2-clause | Python | |
e8607fce01bfe17c08de0702c4041d98504bc159 | Add migration for changing CONTACTED_CHOICES | reunition/reunition,reunition/reunition,reunition/reunition | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('alumni', '0005_note'),
]
operations = [
migrations.AlterField(
model_name='note',
name='contacted',
... | mit | Python | |
5db1a4c8c721a0acffa6e903c5eef9b84ebfd0d3 | rename example to avoid namespace problem | ContinuumIO/chaco,ContinuumIO/chaco,burnpanck/chaco,ContinuumIO/chaco,ContinuumIO/chaco,tommy-u/chaco,burnpanck/chaco,tommy-u/chaco,burnpanck/chaco,tommy-u/chaco | examples/tutorials/scipy2008/traits_example.py | examples/tutorials/scipy2008/traits_example.py |
from numpy import linspace, sin
from enable.api import ColorTrait
from chaco.api import ArrayPlotData, Plot, marker_trait
from enable.component_editor import ComponentEditor
from traits.api import HasTraits, Instance, Int
from traitsui.api import Group, Item, View
class ScatterPlotTraits(HasTraits):
plot = Inst... | bsd-3-clause | Python | |
212d19c29a42bd6966965b166cdbb4dd642e5eb4 | Add test-cases for `get_user_membership` | pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2 | wqflask/tests/unit/wqflask/test_resource_manager.py | wqflask/tests/unit/wqflask/test_resource_manager.py | """Test cases for wqflask/resource_manager.py"""
import unittest
from unittest import mock
from wqflask.resource_manager import get_user_membership
class TestGetUserMembership(unittest.TestCase):
"""Test cases for `get_user_membership`"""
def setUp(self):
conn = mock.MagicMock()
conn.hgetall... | agpl-3.0 | Python | |
b2febfd4b52c1e50be4d8ba614adcbe4d59251d8 | Add blank init file | moonrisewarrior/line-memebot | SDK/__init__.py | SDK/__init__.py | apache-2.0 | Python | ||
fc58a85131675672ccef2302038cc55c9e4b0460 | Migrate products | c2corg/v6_api,c2corg/v6_api,c2corg/v6_api | c2corg_api/scripts/migration/documents/products.py | c2corg_api/scripts/migration/documents/products.py | from c2corg_api.models.document import DocumentGeometry, \
ArchiveDocumentGeometry
from c2corg_api.models.waypoint import Waypoint, ArchiveWaypoint, \
WaypointLocale, ArchiveWaypointLocale
from c2corg_api.scripts.migration.documents.document import MigrateDocuments
class MigrateProducts(MigrateDocuments):
... | agpl-3.0 | Python | |
9719189501f8b0fcff186b1bc2130fcef8d21e8d | add movie scraper | yujinjcho/movie_recommendations,yujinjcho/movie_recommendations,yujinjcho/movie_recommendations,yujinjcho/movie_recommendations,yujinjcho/movie_recommendations | scrape_rotten/scrape_rotten/spiders/movie_spider.py | scrape_rotten/scrape_rotten/spiders/movie_spider.py | import scrapy
def get_urls():
# load from file
with open('movie_urls.json') as f:
return [line.rstrip() for line in f]
class MovieSpider(scrapy.Spider):
name = 'movies'
start_urls = get_urls()
def meta_property(self, response, prop):
return response.xpath("//meta[@property='... | mit | Python | |
052832a766e296a3444cb7afd5b5a930013d18d6 | Create z04-convolutional-neural-network.py | hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow | skflow-examples/z04-convolutional-neural-network.py | skflow-examples/z04-convolutional-neural-network.py | # http://terrytangyuan.github.io/2016/03/14/scikit-flow-intro/
# Loading MNIST data
mnist = input_data.read_data_sets('MNIST_data')
def max_pool_2x2(tensor_in):
return tf.nn.max_pool(tensor_in, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1],
padding='SAME')
def conv_model(X, y):
# reshape X to 4d tensor w... | mit | Python | |
b9ff8fc06f9bd55721332831d4ce23589d93fafb | Create 3Sum.py | chengjinlee/leetcode,chengjinlee/leetcode-solution-python | leetcode/15.-3Sum/3Sum.py | leetcode/15.-3Sum/3Sum.py | class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
res = []
sortnum = sorted(nums)
length = len(sortnum)
# make sure a < b < c
for i in xrange(length-2):
a = sortnum[i]
... | mit | Python | |
80bf107b29f51456f778da718ef438fd62545b1b | Add server test file | the-raspberry-pi-guy/lidar | pi_approach/UI/server.py | pi_approach/UI/server.py | import socket
HOST = socket.gethostname() + '.local' # Server IP or Hostname
PORT = 12345 # Pick an open Port (1000+ recommended), must match the client sport
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
#managing error exception
try:
s.bind((HOST, PORT))
print "Opened"
... | mit | Python | |
64577b7eb445a62f4e8348d687fa6ed7ed5401ed | Add migrations to user_profile app. | pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity | localtv/user_profile/migrations/0001_initial.py | localtv/user_profile/migrations/0001_initial.py | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
('localtv', '0008_add_profile'),
)
def forwards(self, orm):
pass # this is handled by 0008_add_profile
def bac... | agpl-3.0 | Python | |
691b27a4d97d5c2966f1627ed6cc5870024537c0 | add bouncy example | jeisenma/ProgrammingConcepts | 06-animation/bouncy.py | 06-animation/bouncy.py | def setup():
size(300,300)
# ball properties
global rad, d, pos, vel, grav
rad = 25 # radius of the ball
pos = PVector( 150, 50 ) # initial position of the ball
vel = PVector( random(-3,3), random(-3,3) ) # velocity of the balll
grav = PVector( 0, 0.9 ) # force on the ball (gravity)
d = 0.97 # how much... | bsd-3-clause | Python | |
1f6e225a1b01e8eb4cd9f1d5da05455d85326064 | Validate ck_user_has_mobile_or_other_auth constraint | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0357_validate_constraint.py | migrations/versions/0357_validate_constraint.py | """
Revision ID: 0357_validate_constraint
Revises: 0356_add_webautn_auth_type
Create Date: 2021-05-13 14:15:25.259991
"""
from alembic import op
revision = '0357_validate_constraint'
down_revision = '0356_add_webautn_auth_type'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op... | mit | Python | |
8387b0289e84ededdd9ba3db5ba47f149b918530 | clean up batch submit script | ENCODE-DCC/dna-me-pipeline,ENCODE-DCC/dna-me-pipeline,ENCODE-DCC/dna-me-pipeline | dnanexus/dx_batch.py | dnanexus/dx_batch.py | #!/usr/bin/env python
import argparse
import os
import sys
import subprocess
import dxpy
import requests
from dxencode import dxencode as dxencode
SERVER = 'https://www.encodeproject.org'
ASSAY_TYPE = 'whole genome bisulfite sequencing'
ASSAY_TERM_ID = 'OBI:0001863'
HEADERS = {'content-type': 'application/json'}
de... | mit | Python | |
9e217f0641328e1dfce91cdffdb8b5d77e4fe8fa | Add segcnn | Cysu/dlearn,Cysu/dlearn,Cysu/dlearn | examples/human_sar/segcnn.py | examples/human_sar/segcnn.py | import os
import sys
import cPickle
import theano.tensor as T
homepath = os.path.join('..', '..')
if not homepath in sys.path:
sys.path.insert(0, homepath)
from dlearn.models.layer import FullConnLayer, ConvPoolLayer
from dlearn.models.nnet import NeuralNet
from dlearn.utils import actfuncs, costfuncs
from dlear... | mit | Python | |
218df31e0f808aae75310b98dfe2c5cb7d87e7ed | introduce image slicer | abertschi/postcards,abertschi/postcards,abertschi/postcards | postcards/slice_image.py | postcards/slice_image.py | from PIL import Image
import os
from time import gmtime, strftime
import math
import sys
import logging
"""slice_image.py: Slice images into tiles."""
__author__ = "Andrin Bertschi. www.abertschi.ch"
LOGGER_NAME = 'slice_image'
logger = logging.getLogger(LOGGER_NAME)
def make_tiles(image, tile_width, tile_height):... | mit | Python | |
ef627493f87d60e404008b26fe13e816d492a333 | add a bluetooth test component that simply displays when a device move on the network | librallu/cohorte-herald,librallu/cohorte-herald,librallu/cohorte-herald | python/test_bluetooth.py | python/test_bluetooth.py | #!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Test bluetooth module that displays informations from
bluetooth and print a message when a bluetooth device
appears or disappears.
:author: Luc Libralesso
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
C... | apache-2.0 | Python | |
a1e3e275a81ff073fed226619bde23361230cfce | Add tests for packaging.tests.support (#12659). | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/packaging/tests/test_support.py | Lib/packaging/tests/test_support.py | import os
import tempfile
from packaging.dist import Distribution
from packaging.tests import support, unittest
class TestingSupportTestCase(unittest.TestCase):
def test_fake_dec(self):
@support.fake_dec(1, 2, k=3)
def func(arg0, *args, **kargs):
return arg0, args, kargs
self... | mit | Python | |
5a59b5b96e223da782cf683aabbf4e8371c883e1 | Add DHKE protocol | divkakwani/cryptos | cryptos/dhke.py | cryptos/dhke.py | """
Implementation of the Diffie-Hellman Key Exchange Protocol
Usage:
# Setup
invoker = DHKEInvoker()
other = DHKEParty(invoker.get_param())
# Key exchange phase
other.receive_partial_key(invoker.get_partial_key())
invoker.receive_partial_key(other.get_partial_key())
# Check consistency
... | mit | Python | |
088cd2ddb79bdd2a8dd68e2d7169484eea90fd1a | Add problem79.py | mjwestcott/projecteuler,mjwestcott/projecteuler,mjwestcott/projecteuler | euler_python/problem79.py | euler_python/problem79.py | """
problem79.py
A common security method used for online banking is to ask the user for three
random characters from a passcode. For example, if the passcode was 531278, they
may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.
The text file, keylog.txt, contains fifty successful login att... | mit | Python | |
a0e9ac222091619f41a4eed0cfb25c1653b8034d | add simple update script | merraksh/cvxpy,merraksh/cvxpy,merraksh/cvxpy,merraksh/cvxpy | cvxpy/utilities/cvxpy_upgrade.py | cvxpy/utilities/cvxpy_upgrade.py | import argparse
import re
# Captures row and column parameters; note the captured object should
# not be a keyword argument other than "cols" (hence the requirement that
# the captured group is followed by a comma, whitespace, or parentheses)
P_ROW_COL = r"(?:rows=)?(\w+),\s*(?:cols=)?(\w+)[\s,)]"
# A list of substi... | apache-2.0 | Python | |
5a99f676a5b0b55d0490c955cb9af42d9121192d | Initialize database transactions | andela-akiura/bucketlist | app/database.py | app/database.py | """This module initialises ."""
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from config.config import Config
engine = create_engine(Config.DATABASE_URI, convert_unicode=True)
db_session = scoped_session(sessionmake... | mit | Python | |
0ee023d29f613f718f5b88c158b120adb8b2fe2e | add new package (#16289) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-murmurhash/package.py | var/spack/repos/builtin/packages/py-murmurhash/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyMurmurhash(PythonPackage):
"""Cython bindings for MurmurHash."""
homepage = "https://github.com/explosio... | lgpl-2.1 | Python | |
e4bc3edf4180ac1385e125a11d01f222747b13f7 | send File Over FTP using ftplib | frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying | python/sendFileOverFTP.py | python/sendFileOverFTP.py | #---License---
#This is free and unencumbered software released into the public domain.
#Anyone is free to copy, modify, publish, use, compile, sell, or
#distribute this software, either in source code form or as a compiled
#binary, for any purpose, commercial or non-commercial, and by any
#means.
#by frainfreeze
#-... | mit | Python | |
b33725e2a3153b27312e820797bbc8375dbe8970 | Create beta_interweaving_strings_and_removing_digits.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/beta_interweaving_strings_and_removing_digits.py | Solutions/beta_interweaving_strings_and_removing_digits.py | from itertools import zip_longest as zlo
from string import digits
interweave = lambda a,b: ''.join((i if i not in digits else '')+(j if j not in digits else '') for i,j in zlo(a, b, fillvalue = ''))
| mit | Python | |
6b53e890958251bd34c29b09f597c8221f4bc98b | Add sublime text utils module | Zeeker/sublime-SessionManager | modules/st_utils.py | modules/st_utils.py | import sublime
def open_window():
sublime.run_command("new_window")
return sublime.active_window()
| mit | Python | |
ff2fba1c09cff57c9fb01ff3c12f076aff23d56a | Create __init__.py | rolc/python-package | __init__.py | __init__.py | #!/usr/bin/python
#-------------------------------IMPORT--------------------------------#
from lib import *
#-------------------------------EXPORT--------------------------------#
__all__ = ['<#PREFIX#>_app','<#PREFIX#>_index']
| mit | Python | |
1641de48deab3e6cc18de7eb40e1d02ab28dd88c | Create StarTrek.py | WRWhite/StarTrek | StarTrek.py | StarTrek.py | # Star Treck
| mit | Python | |
ae93eaf84487339c5fba696c7900485f2918546e | Add __init__.py | mrozekma/pytypecheck | __init__.py | __init__.py | from .pytypecheck import tc, tc_opts
from . import predicates
| mit | Python | |
59e9281d94acf529113697057d80bb6a1eac6191 | Add global init file | walkerke/marble,scities/marble | __init__.py | __init__.py | # -*- coding: utf-8 -*-
"""Marble: analyse social stratification in cities"""
__author__ = "Rémi Louf"
__email__ = "remilouf@sciti.es"
__website__ = "www.sciti.es"
__copyright__ = "2015, Rémi Louf"
| bsd-3-clause | Python | |
f06ebc1da601de961311c4b753e966227eadb911 | Create __init__.py | Hojalab/sarafu,Hojalab/sarafu,pesaply/sarafu,pesaply/sarafu | __init__.py | __init__.py | ""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'... | mit | Python | |
a09fa218a918fbde70ea99a67fa1d964b17c5e2c | add init | thiippal/tankbuster | __init__.py | __init__.py | __all__ = ['bust']
from .detector import bust
| mit | Python | |
7b8136d77f2968ac02d17991eca30862bdf9e104 | add __init__ file | LemonAniLabs/tensorflow-resnet,ry/tensorflow-resnet,sigmunjr/VirtualPetFence | __init__.py | __init__.py | from resnet import *
| mit | Python | |
da874ace234dbac4f0fc8f428cf43d3f415cc596 | Create __init__.py | dabraude/PYSpeechLib | __init__.py | __init__.py | # __init__.py
| apache-2.0 | Python | |
1e716efd7e275068a18d309f42ec8e955309b4b7 | Create __init__.py | eugena/django-stripwhitespace-middleware | __init__.py | __init__.py | mit | Python | ||
0a5710cae8597faf111486600fd90278bfc000f9 | reset head due to large file issue | dkoslicki/CMash,dkoslicki/CMash | dataForShaopeng/generate_data.py | dataForShaopeng/generate_data.py | import numpy as np
from CMash import MinHash as MH
import seaborn
import matplotlib.pyplot as plt
# Data prep
# In bash:
#mkdir dataForShaopeng
#cd dataForShaopeng/
#mkdir data
#cd data
#wget https://ucla.box.com/shared/static/c1g8xjc9glh68oje9e549fjqj0y8nc17.gz && tar -zxvf c1g8xjc9glh68oje9e549fjqj0y8nc17.gz && rm c... | bsd-3-clause | Python | |
d72f11fbfc23de44af8a2600a7310adafe3e2ffe | Create a.py | y-sira/atcoder,y-sira/atcoder | agc015/a.py | agc015/a.py | def main():
n, a, b = map(int, input().split())
if a > b or (n == 1 and a != b):
print(0)
else:
print((n - 1) * (b - a) - (b - a - 1))
if __name__ == '__main__':
main()
| mit | Python | |
47ba8815c7a0de0191fb363c22c42732781a8e38 | Fix blank index_for | aipescience/django-daiquiri,aipescience/django-daiquiri,aipescience/django-daiquiri | daiquiri/metadata/migrations/0020_blank_index_for.py | daiquiri/metadata/migrations/0020_blank_index_for.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-04-05 15:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('daiquiri_metadata', '0019_column_index_for'),
]
operations = [
migrations.A... | apache-2.0 | Python | |
a9d5c1dcb059f02f6c3ec5dbff6b07f54c20194d | Add an example directory | phalt/beckett | example/main.py | example/main.py | from beckett import clients, resources
class PersonResource(resources.BaseResource):
class Meta:
name = 'Person'
resource_name = 'people'
identifier = 'url'
attributes = (
'name',
'birth_year',
'eye_color',
'gender',
'heig... | isc | Python | |
3367f9d1e394bf686bc6bbd6316265c9feef4f03 | Add basic tests for config usb | Yubico/yubikey-manager,Yubico/yubikey-manager | test/on_yubikey/test_cli_config.py | test/on_yubikey/test_cli_config.py | from .util import (DestructiveYubikeyTestCase, ykman_cli)
class TestConfigUSB(DestructiveYubikeyTestCase):
def setUp(self):
ykman_cli('config', 'usb', '--enable-all', '-f')
def tearDown(self):
ykman_cli('config', 'usb', '--enable-all', '-f')
def test_disable_otp(self):
ykman_cli... | bsd-2-clause | Python | |
b8e466a8671be716397d136e16814790b7ed594a | Create Scaffold | au-re/steiner-tree | SteinerTree.py | SteinerTree.py | import random
import numpy
import matplotlib.pyplot as plt
from deap import base, creator, tools, algorithms
'''
SteinerTree
Code scaffold for solving the SteinerTree problem using the
DEAP framework https://github.com/deap/deap
(currently OneMax problem)
you can find more information about DEAP in the noteb... | mit | Python | |
4dbe1b21ab0f82eeba82be7db2e141260942b998 | add num_states to mixture convenience wrapper | theDataGeek/pyhsmm,theDataGeek/pyhsmm,mattjj/pyhsmm,theDataGeek/pyhsmm,wgmueller1/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm,theDataGeek/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm,wgmueller1/pyhsmm,mattjj/pyhsmm,fivejjs/pyhsmm,fivejjs/pyhsmm,theDataGeek/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm | basic/models.py | basic/models.py | # These classes make aliases of class members and properties so as to make
# pybasicbayes mixture models look more like pyhsmm models. When comparing
# H(S)MM model fits to pybasicbayes mixture model fits, it's easier to write one
# code path by using these models.
import pybasicbayes
from ..util.general import rle
c... | # These classes make aliases of class members and properties so as to make
# pybasicbayes mixture models look more like pyhsmm models. When comparing
# H(S)MM model fits to pybasicbayes mixture model fits, it's easier to write one
# code path by using these models.
import pybasicbayes
from ..util.general import rle
c... | mit | Python |
fb7a5b279da36b9dbd6338867168a79011edd0d6 | Create new package (#7208) | EmreAtes/spack,krafczyk/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,iulian787/spack,tmerrick1/spack,mfherbst/spack,mfherbst/spack,LLNL/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,tmerrick1/spack,tmerrick1/spack,EmreAtes/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,iulian787/spack,mfherbst... | var/spack/repos/builtin/packages/glimmer/package.py | var/spack/repos/builtin/packages/glimmer/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 | |
fe1af6449ec4feeaf75a248422e806ad9c818749 | remove doc | dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild | python/qidoc/__init__.py | python/qidoc/__init__.py | ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" qidoc : handle generating sphinx and doxygen documentation of qibuild
projects
"""
| ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" qidoc : handle generating sphinx and doxygen documentation of qibuild
projects
qiDoc: documentation generator
==============================
qi... | bsd-3-clause | Python |
ceb8ec420e5e894644aecce8b96463cc3769ce1d | Add process_alerts management command | NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor | cityhallmonitor/management/commands/process_alerts.py | cityhallmonitor/management/commands/process_alerts.py | from django.conf import settings
from django.core.mail import send_mail
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from cityhallmonitor.models import Subscription
from documentcloud import DocumentCloud
DEFAULT_PROJECT = 'Chicago City Hall Monitor'
EMAIL_SUBJE... | mit | Python | |
59a0996644115bef57de6e15dc572a6227e45b3a | Add script for downloading weekly price data from India | FAB4D/humanitas,FAB4D/humanitas,FAB4D/humanitas | data_crunching/download_india_prices.py | data_crunching/download_india_prices.py | #!/usr/bin/env python2
import urllib
import urllib2
import shutil
import re
import sys
import datetime
usage_str = '''
This scripts downloads weekly food prices from http://rpms.dacnet.nic.in/Bulletin.aspx in XLS format.
'''
def download_spreadsheet(date_string):
main_url = 'http://rpms.dacnet.nic.in/Bulletin.a... | bsd-3-clause | Python | |
44597a9b9f5e2ef2eb391b096d3240b81960ce68 | fix doc generation on plot_lasso_coordinate_descent_path.py example (pb on my box) | ZENGXH/scikit-learn,harshaneelhg/scikit-learn,Obus/scikit-learn,belltailjp/scikit-learn,xzh86/scikit-learn,luo66/scikit-learn,mjudsp/Tsallis,3manuek/scikit-learn,fyffyt/scikit-learn,liangz0707/scikit-learn,aewhatley/scikit-learn,henridwyer/scikit-learn,vibhorag/scikit-learn,ChanChiChoi/scikit-learn,ilo10/scikit-learn,i... | examples/glm/plot_lasso_coordinate_descent_path.py | examples/glm/plot_lasso_coordinate_descent_path.py | """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
"""
print __doc__
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
from itertools import cycle
import numpy as np
import pylab a... | """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
"""
print __doc__
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
from itertools import cycle
import numpy as np
import pylab a... | bsd-3-clause | Python |
c12305c59f9c95149e95094179768ac627d7faf9 | Add test file for upload client class | yunify/qingstor-sdk-python | tests/client/test_upload_client.py | tests/client/test_upload_client.py | import os
import mock
import unittest
from qingstor.sdk.config import Config
from qingstor.sdk.service.qingstor import Bucket
from qingstor.sdk.service.qingstor import QingStor
from qingstor.sdk.client.upload_client import UploadClient
from qingstor.sdk.error import (
BadRequestError,
InvalidObjectNameError
)
... | apache-2.0 | Python | |
305ab2ede27fde9097c7a69804189a529c868140 | add missing filter plugins | nicolai86/ansible-phantomjs | filter_plugins/customs.py | filter_plugins/customs.py | class FilterModule(object):
def filters(self):
return {
'filename_without_extension': self.filename_without_extension
}
def filename_without_extension(self, path, extension):
return path[:-len(extension)] | mit | Python | |
9296c11a013fc03c7f299707a12b74a4ef85abf7 | update cStringIO counter | maliubiao/python_gdb_scripts,maliubiao/python_gdb_scripts | gdb_StringIO.py | gdb_StringIO.py | import gdb
"""
SPECS
/* Entries related to the type of user set breakpoints. */
static struct pybp_code pybp_codes[] =
{
{ "BP_NONE", bp_none},
{ "BP_BREAKPOINT", bp_breakpoint},
{ "BP_WATCHPOINT", bp_watchpoint},
{ "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint},
{ "BP_READ_WATCHPOINT", bp_read_watchpoin... | mit | Python | |
96a94b6901ebca0930a2509ccadfd603f8558b8d | Add test case for event items | leaffan/pynhldb | tests/test_event.py | tests/test_event.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
from lxml import html
from utils.summary_downloader import SummaryDownloader
from utils.data_handler import DataHandler
from parsers.team_parser import TeamParser
from parsers.game_parser import GameParser
from parsers.roster_parser import Ros... | mit | Python | |
bc581b1ac7a12fd3026667663a4812fe0bd3869b | add dict.py | pidofme/T4LE | dict.py | dict.py | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import json
import urllib
import subprocess
def main():
word = subprocess.check_output('xsel')
params = urllib.urlencode({'from': 'auto', 'to': 'auto', 'client_id':'WGCxN9fzvCxPo0nqlzGLCPUc', 'q': word})
f = urllib.urlopen("http://openapi.baidu.co... | mit | Python | |
28b5fef57580640cd78775d6c0544bc633e5958a | Add helper script to generate API keys. | ZeitOnline/content-api,ZeitOnline/content-api | generate-key.py | generate-key.py | #!/usr/bin/python
import os
import sqlite3
import sys
import time
if len(sys.argv) < 3:
raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0])
db = sqlite3.connect('/var/lib/zon-api/data.db')
api_key = str(os.urandom(26).encode('hex'))
tier = 'free'
name = sys.argv[1]
email = sys.argv[... | bsd-3-clause | Python | |
a314da2415e661ed6cbc9929095a0f34610d9c21 | FIX _get_search_domain in partner | adhoc-dev/odoo-personalizations,ingadhoc/odoo-personalizations | transindar_personalization/res_partner.py | transindar_personalization/res_partner.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class re... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class re... | agpl-3.0 | Python |
6807ce92c5d0a26a43db8cb25ef5ffd8b8ff6277 | Add skeleton cryptdev module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/cryptdev.py | salt/modules/cryptdev.py | # -*- coding: utf-8 -*-
'''
Salt module to manage Unix cryptsetup jobs and the crypttab file
'''
# Import python libraries
from __future__ import absolute_import
import logging
# Import salt libraries
import salt
# Set up logger
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = ... | apache-2.0 | Python | |
9b457a08ce433b574f186bb1b32da666edee485a | Complete sol by recursion | bowen0701/algorithms_data_structures | lc0108_convert_sorted_array_to_binary_search_tree.py | lc0108_convert_sorted_array_to_binary_search_tree.py | """Leetcode 108. Convert Sorted Array to Binary Search Tree
Easy
URL: https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/
Given an array where elements are sorted in ascending order,
convert it to a height balanced BST.
For this problem, a height-balanced binary tree is defined as a binary tree... | bsd-2-clause | Python | |
e36df0c827de666fa00d9b806759cde0f0cb1697 | Test code | henrik645/txt-rpg | game.py | game.py | class Room:
def __init__(self, configuration={}):
self.doors = configuration
class Merchant:
def __init__(self, markup=1.2, markdown=0.8):
self.inventory = []
self.markup = markup
self.markdown = markdown
def add_item(self, item):
# Adds an item to the merch... | mit | Python | |
e9eed6b6e99e948ed2863fcc45a037b0e2b1e80f | fix import in tornado worker | zhoucen/gunicorn,alex/gunicorn,prezi/gunicorn,jamesblunt/gunicorn,pschanely/gunicorn,z-fork/gunicorn,harrisonfeng/gunicorn,ccl0326/gunicorn,WSDC-NITWarangal/gunicorn,beni55/gunicorn,tejasmanohar/gunicorn,ccl0326/gunicorn,alex/gunicorn,mvaled/gunicorn,jamesblunt/gunicorn,mvaled/gunicorn,mvaled/gunicorn,malept/gunicorn,1... | gunicorn/workers/gtornado.py | gunicorn/workers/gtornado.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
class TornadoWorker(Worker):
def w... | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
class TornadoWorker(Worker):
def watchdog(sel... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.