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 |
|---|---|---|---|---|---|---|---|---|
3ab0e590479fabb024937e52eab02e2311033448 | Implement a function to map chord segments to STFT blocks. | bzamecnik/tfr,bzamecnik/tfr | time_intervals.py | time_intervals.py | import pandas as pd
import numpy as np
import collections
def block_labels(df_blocks, df_labels):
'''
Given fixed-size overlapping blocks and variable-sized non-overlapping
labels select most suitable label for each block.
This can be useful eg. to assign chord labels to audio blocks.
All times ar... | mit | Python | |
fbaca2f2a0ceaa77606d9c24846a1a1b045dc460 | remove deleted files from manifest | hassoon3/odoo,jesramirez/odoo,cysnake4713/odoo,OpenUpgrade-dev/OpenUpgrade,nitinitprof/odoo,jusdng/odoo,markeTIC/OCB,shingonoide/odoo,ShineFan/odoo,abstract-open-solutions/OCB,CubicERP/odoo,nagyistoce/odoo-dev-odoo,naousse/odoo,SerpentCS/odoo,feroda/odoo,colinnewell/odoo,lightcn/odoo,poljeff/odoo,syci/OCB,cpyou/odoo,fa... | addons/l10n_lu/__openerp__.py | addons/l10n_lu/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2011 Thamini S.à.R.L (<http://www.thamini.com>)
# Copyright (C) 2011 ADN Consultants S.à... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2011 Thamini S.à.R.L (<http://www.thamini.com>)
# Copyright (C) 2011 ADN Consultants S.à... | agpl-3.0 | Python |
c0ee3bb87a26a57bc7dc1bd4e1aaf6136f94bc17 | Add missing filters.py file in organizations | ain7/www.ain7.org,ain7/www.ain7.org,ain7/www.ain7.org,ain7/www.ain7.org | ain7/organizations/filters.py | ain7/organizations/filters.py | # -*- coding: utf-8
"""
ain7/organizations/filters.py
"""
#
# Copyright © 2007-2015 AIn7 Devel Team
#
# 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 2 of the License, or... | lgpl-2.1 | Python | |
f56181aaf6df758abb988d10c757c6eba72d5025 | write beginning of method for storing probabilities in a hash | hollabaq86/haikuna-matata,hollabaq86/haikuna-matata,hollabaq86/haikuna-matata | parser.py | parser.py | import re
probabilityHash = {[], ""}
#[word1, word2], count
def parseIntoProbabilityHash(text):
stripPunctuation = re.sub(ur"[^\w\d'\s]+",' ',text)
wordsInText = stripPunctuation.split()
n = 0
for word in wordsInText:
probabilityHash[wordsInText[n]] = 1
return probabilityHash
| mit | Python | |
5e54e5ebf9add6d8bd879d963803ee57fd591f4b | Write new Preparation tests | osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api | whats_fresh/whats_fresh_api/tests/views/entry/test_new_preparation.py | whats_fresh/whats_fresh_api/tests/views/entry/test_new_preparation.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from whats_fresh_api.models import *
from django.contrib.gis.db import models
import json
class NewPreparationTestCase(TestCase):
"""
Test that the New Preparation page works as expected.
Things tested:
URLs reverse cor... | apache-2.0 | Python | |
4d92b111eecd3ce938676edee36b288c42484905 | test scraper for UKÄ | jplusplus/statscraper | statscraper/scrapers/uka_scraper.py | statscraper/scrapers/uka_scraper.py | # encoding: utf-8
u""" A scraper to fetch Swedish university application statistics from
the Swedish Higher Education Authority (Universitetskanslerämbetet, UKÄ),
at http://statistik.uka.se
"""
from statscraper import BaseScraper, Dataset, Dimension, Result, Collection
import requests
from bs4 import BeautifulSoup
... | mit | Python | |
d2762f81a9f8ed405ca5fc9d567004af182d137b | add importer for delimited data | Arabidopsis-Information-Portal/jbrowse,igemsoftware/Shenzhen_BGIC_0101_2013,SuLab/jbrowse,GMOD/jbrowse,limeng12/jbrowse,Arabidopsis-Information-Portal/jbrowse,limeng12/jbrowse,GreggHelt2/apollo-test,nathandunn/jbrowse,GreggHelt2/apollo-test,erasche/jbrowse,GreggHelt2/apollo-test,SuLab/jbrowse,nathandunn/jbrowse,Arabido... | python/delim_import.py | python/delim_import.py | from json_generator import JsonGenerator, writeTrackEntry
def delimImport(file, skipLines, colNames, dataDir, trackLabel, key = None,
delim = "\t", chunkBytes = 200000, compress = True,
config = {'style': {'className': 'feature2'}} ):
fh = open(file, 'r')
data = [line.split(deli... | lgpl-2.1 | Python | |
51a5c7626b634687be57c3e6ed05ea07f6468ad0 | add analyzer test | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | timeside/tests/api/test_analyzer.py | timeside/tests/api/test_analyzer.py | # -*- coding: utf-8 -*-
import timeside
from sys import stdout
import os.path
import numpy
class TestAnalyzer:
graphers = timeside.core.processors(timeside.api.IGrapher)
decoders = timeside.core.processors(timeside.api.IDecoder)
encoders= timeside.core.processors(timeside.api.IEncoder)
analyzers... | agpl-3.0 | Python | |
b634e5966c48299eda8cc9a3dcd4e8f769df6812 | Create 5kyu_tree_to_list.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/5kyu/5kyu_tree_to_list.py | Solutions/5kyu/5kyu_tree_to_list.py | class Node:
def __init__(self, data, child_nodes=None):
self.data = data
self.child_nodes = child_nodes
def tree_to_list(tr):
call = to_list(tr, 0, [])
return call
def to_list(tr, depth, res):
res.append([tr.data, depth])
if tr.child_nodes:
for i in tr.child_nodes:
... | mit | Python | |
f1cb1cb0cdcf7ef3d5d0e286bfbd9d9664239098 | Create 6kyu_alphabetized.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/6kyu/6kyu_alphabetized.py | Solutions/6kyu/6kyu_alphabetized.py | def alphabetized(s):
return ''.join(s for s in sorted(s, key=lambda s: s.lower()) if s.isalpha())
| mit | Python | |
0f55bd7e100dca1ef94dfe2f47b0f46774197e3f | Create cbus.py | drmcinnes/python-C-BUS | cbus.py | cbus.py | #!/usr/bin/python3
#console command for lighting control of c-bus network
#add command line switches for changing the default ip and port
#add option for immediate return i.e. dont wait for return codes
#cbus on 6, cbus off 7, cbus ramp 7m 100
#parse command line, convert time to closest value
# Copyright 2014 Darre... | mit | Python | |
2eddc73e2d7b78fbfac521eb1e6014ca26421510 | Add forgotten migration | Cartocite/osmada | osmdata/migrations/0012_auto_20170829_1539.py | osmdata/migrations/0012_auto_20170829_1539.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-29 15:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('osmdata', '0011_auto_20170824_1521'),
]
operations... | agpl-3.0 | Python | |
d00243d9500118400f7e08409d9564b15b2b4148 | Add trivial CLI example | AlienVault-Labs/OTX-Python-SDK | examples/cliExample.py | examples/cliExample.py | # Very Simple CLI example
from OTXv2 import OTXv2
import IndicatorTypes
import argparse
# Your API key
API_KEY = ''
OTX_SERVER = 'https://otx.alienvault.com/'
otx = OTXv2(API_KEY, server=OTX_SERVER)
parser = argparse.ArgumentParser(description='Description of your program')
parser.add_argument('-i', '--ip', help='IP... | apache-2.0 | Python | |
ecc8a93ddda784102311ebfd4c3c93624f356778 | Add migration to add strip_html sql function | Connexions/cnx-archive,Connexions/cnx-archive | cnxarchive/sql/migrations/20160723123620_add_sql_function_strip_html.py | cnxarchive/sql/migrations/20160723123620_add_sql_function_strip_html.py | # -*- coding: utf-8 -*-
def up(cursor):
cursor.execute("""\
CREATE OR REPLACE FUNCTION strip_html(html_text TEXT)
RETURNS text
AS $$
import re
return re.sub('<[^>]*?>', '', html_text, re.MULTILINE)
$$ LANGUAGE plpythonu IMMUTABLE;
""")
def down(cursor):
cursor.execute("DROP FUNCTION IF EXISTS stri... | agpl-3.0 | Python | |
0f5b15a1f909c79b40a3f2655d00bc7852d41847 | add missing migration | geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/drf-utm-zone-info,geometalab/osmaxx-frontend,geometalab/osmaxx | conversion_service/conversion_job/migrations/0003_auto_20151120_1528.py | conversion_service/conversion_job/migrations/0003_auto_20151120_1528.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('conversion_job', '0002_auto_20151119_1332'),
]
operations = [
migrations.AlterField(
model_name='conversionjob',... | mit | Python | |
ed45aa20bc54714c6eb355417520c3d90a6b47fc | Add init.py | qqbuby/readthedocs-docker | init.py | init.py | #!/usr/bin/env python
import os
import sys
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'readthedocs.settings.dev')
sys.path.append(os.getcwd())
django.setup()
from django.contrib.auth.models import User
admin = User.objects.create_user('admin', '', 'admin')
admin.is_superuser = True
admin.is_staff ... | mit | Python | |
67d86229279e979d8ef5ac54e5ed8ca85c32ff2e | add another sample script (multiple.py). | maximumG/exscript,knipknap/exscript,maximumG/exscript,knipknap/exscript | demos/multiple.py | demos/multiple.py | #!/usr/bin/env python
from Exscript import Host
from Exscript.util.interact import read_login
from Exscript.util.template import eval_file
from Exscript.util.start import start
def one(conn):
conn.open()
conn.authenticate()
conn.autoinit()
conn.execute('show ip int brie')
def two(conn... | mit | Python | |
3704654e704c0595e933f4ab2832e945816afde8 | Add setup.py file | schmidt4brains/Examples,schmidt4brains/Examples,AquaticInformatics/Examples,schmidt4brains/Examples,schmidt4brains/Examples,AquaticInformatics/Examples,schmidt4brains/Examples,AquaticInformatics/Examples,AquaticInformatics/Examples,AquaticInformatics/Examples | TimeSeries/PublicApis/Python/setup.py | TimeSeries/PublicApis/Python/setup.py | from setuptools import setup
setup(
name="aquarius-timeseries-client",
py_modules=["timeseries_client"],
version="0.1",
description="Python client for Aquarius TimeSeries API",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
url="https://github.com/... | apache-2.0 | Python | |
42e1447db973cce539353912eada05b26870bae6 | Add serial test connection. | salkinium/bachelor,salkinium/bachelor,salkinium/bachelor | experiment_control/test_serial_connection.py | experiment_control/test_serial_connection.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Niklas Hauser
# All rights reserved.
#
# The file is part of my bachelor thesis and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# ------------------------------------------------------... | bsd-2-clause | Python | |
da22d8dffadbb4713e715aca7918942f445090c9 | embed video form and model fields | hellhovnd/django-embed-video,mpachas/django-embed-video,mpachas/django-embed-video,hellhovnd/django-embed-video,yetty/django-embed-video,jazzband/django-embed-video,yetty/django-embed-video,jazzband/django-embed-video | embed_video/fields.py | embed_video/fields.py | from django.db import models
from django import forms
from django.utils.translation import ugettext_lazy as _
from .base import detect_backend
__all__ = ('EmbedVideoField', 'EmbedVideoFormField')
class EmbedVideoField(models.URLField):
def formfield(self, **kwargs):
defaults = {'form_class': EmbedVideoF... | mit | Python | |
b81028067cf65b2ee3a155d081e7983a1de70d5f | Add mistakenly omitted migrations | recklessromeo/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,clever-crow-consulting/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,maurizi/otm-core,recklessromeo/otm-core,recklessromeo/otm-core,RickMohr/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,maurizi/otm-c... | opentreemap/treemap/migrations/0005_auto_20150729_1046.py | opentreemap/treemap/migrations/0005_auto_20150729_1046.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('treemap', '0004_auto_20150720_1523'),
]
operations = [
migrations.AlterField(
model_name='fieldpermission',
... | agpl-3.0 | Python | |
1fa74f6a6a5faeb9579c889df32e4bfe8d6908df | Add migration | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fat/migrations/0059_event_extra_sponsored.py | fat/migrations/0059_event_extra_sponsored.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-08 10:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fat', '0058_auto_20160808_1007'),
]
operations = [
migrations.AddField(
... | bsd-3-clause | Python | |
62c70b301ffc1e178c3bd54bd81291876b3883ea | Add simple linear interpolation filling. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/03-fill-dropouts-linear.py | analysis/03-fill-dropouts-linear.py | #!/usr/bin/env python
from __future__ import division
import climate
import lmj.cubes
import lmj.cubes.fill
import numpy as np
import pandas as pd
logging = climate.get_logger('fill')
def fill(dfs, window):
'''Complete missing marker data using linear interpolation.
This method alters the given `dfs` in-pl... | mit | Python | |
7942254131bcf005d5a5f1bb33ca7d1ffff1b311 | Create keyAllCtrls.py | aaronfang/personal_scripts | af_scripts/blendshapes/keyAllCtrls.py | af_scripts/blendshapes/keyAllCtrls.py | import maya.cmds as cmds
import maya.mel as mel
cmds.select(cmds.ls('*:*.faceCtrl', o=1))
mel.eval('doSetKeyframeArgList 6 { "4","0","0","0","1","0","0","animationList","0","1","0" };')
| mit | Python | |
f51c4abc95fda5504e7c7a5ad87355698798ddd1 | create temporary streaming solution | benbroce3/PiCamServer,benbroce3/PiCamServer,benbroce3/PiCamServer,benbroce3/PiCamServer | temp_vidstream.py | temp_vidstream.py | import picamera
with picamera.PiCamera() as camera:
camera.resolution = (640, 480)
camera.start_recording('vidstream.mp4')
camera.wait_recording(60)
camera.stop_recording()
| mit | Python | |
89d27dd0a28f84c99930c0f1dad496e525f62272 | migrate to namespace table | EthanBlackburn/sync-engine,PriviPK/privipk-sync-engine,wakermahmud/sync-engine,nylas/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,rmasters/inbox,nylas/sync-engine,ErinCall/sync-engine,Eagles2F/sync-engine,gale320/sync-engine,gale320/sync-engine,wakermahmud/sync-engine,ErinCall/sync-engine,ErinCall/sync-engine,E... | migrations/versions/28c0d6c2f887_add_namespaces.py | migrations/versions/28c0d6c2f887_add_namespaces.py | """Add namespaces
Revision ID: 28c0d6c2f887
Revises: 4323056c0b78
Create Date: 2013-10-14 22:18:29.705865
"""
# revision identifiers, used by Alembic.
revision = '28c0d6c2f887'
down_revision = '4323056c0b78'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
###... | agpl-3.0 | Python | |
55f2325354724cfe8b90324038daf2c1acaa916a | Add unit tests for OpenStack config defaults | SUSE/teuthology,dmick/teuthology,ceph/teuthology,SUSE/teuthology,dmick/teuthology,robbat2/teuthology,ktdreyer/teuthology,dmick/teuthology,caibo2014/teuthology,robbat2/teuthology,ktdreyer/teuthology,dreamhost/teuthology,SUSE/teuthology,caibo2014/teuthology,ceph/teuthology,dreamhost/teuthology | teuthology/openstack/test/test_config.py | teuthology/openstack/test/test_config.py | from teuthology.config import config
class TestOpenStack(object):
def setup(self):
self.openstack_config = config['openstack']
def test_config_clone(self):
assert 'clone' in self.openstack_config
def test_config_user_data(self):
os_type = 'rhel'
os_version = '7.0'
... | mit | Python | |
526d58fb917a4e098018f733b4c0b254417140b4 | Add @log_route decorator | lsst-sqre/ltd-keeper,lsst-sqre/ltd-keeper | keeper/logutils.py | keeper/logutils.py | """Logging helpers and utilities.
"""
__all__ = ['log_route']
from functools import wraps
from timeit import default_timer as timer
import uuid
from flask import request, make_response
import structlog
def log_route():
"""Route decorator to initialize a thread-local logger for a route.
"""
def decorato... | mit | Python | |
3f3115a0a9c7407820b3b10c06dcfa4f92ac6e57 | Add owned book scaffold | mdzhang/goodreads-api-client-python | goodreads_api_client/resources/owned_book.py | goodreads_api_client/resources/owned_book.py | # -*- coding: utf-8 -*-
"""Module containing owned book resource class."""
from goodreads_api_client.exceptions import OauthEndpointNotImplemented
from goodreads_api_client.resources.base import Resource
class OwnedBook(Resource):
def create(self):
raise OauthEndpointNotImplemented('owned_book.compare')
... | mit | Python | |
5d99b7c2dfbfbb776716f2258d560bab2602531f | Create main.py | Otend/backlog | main.py | main.py | # -*- coding: utf-8 -*-
#Backlog Manager
#programmed by Ian Hitterdal (otend)
#licensed under MIT license
import work
import random
def addWork(medium):
#input: valid medium string
#user input: work title string
#output: none
#user output: none, really
global workDict
global mediumList
if medium not in me... | bsd-2-clause | Python | |
f75d321b200217514cde901cc15cc2b798e3dcfe | Add new hipchat module | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | bumblebee/modules/hipchat.py | bumblebee/modules/hipchat.py | """Displays the unread messages count for an HipChat user
Requires the following library:
* requests
Parameters:
* hipchat.token: HipChat user access token, the token needs to have the 'View Messages' scope.
* hipchat.interval: Refresh interval in minutes (defaults to 5)
"""
import time
import functools
... | mit | Python | |
786ed1d37ae5285bce1178d401d487233d4bd5b1 | Add greater/less than tests | openstack/openstack-ansible-plugins,os-cloud/openstack-ansible-plugins,os-cloud/openstack-ansible-plugins,openstack/openstack-ansible-plugins | test/osa_tests.py | test/osa_tests.py | #!/usr/bin/env python
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python | |
0a3488915938de418ab0675f4cc051769b470927 | Fix tab switching test on reference builds. | patrickm/chromium.src,axinging/chromium-crosswalk,Jonekee/chromium.src,chuan9/chromium-crosswalk,Jonekee/chromium.src,dednal/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,bright-sparks/chromium-spacewalk,ltilve... | tools/perf/measurements/tab_switching.py | tools/perf/measurements/tab_switching.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The tab switching measurement.
This measurement opens pages in different tabs. After all the tabs have opened,
it cycles through each tab in sequence, an... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The tab switching measurement.
This measurement opens pages in different tabs. After all the tabs have opened,
it cycles through each tab in sequence, an... | bsd-3-clause | Python |
01d9134067852a1f9dfecf75f730f9fba14434e0 | Add test_gradient_checker.py | tensor-tang/Paddle,pengli09/Paddle,hedaoyuan/Paddle,reyoung/Paddle,luotao1/Paddle,putcn/Paddle,lispc/Paddle,QiJune/Paddle,baidu/Paddle,jacquesqiao/Paddle,reyoung/Paddle,Canpio/Paddle,lcy-seso/Paddle,hedaoyuan/Paddle,baidu/Paddle,pengli09/Paddle,chengduoZH/Paddle,PaddlePaddle/Paddle,pkuyym/Paddle,reyoung/Paddle,PaddlePa... | python/paddle/v2/framework/tests/test_gradient_checker.py | python/paddle/v2/framework/tests/test_gradient_checker.py | import unittest
import numpy
from paddle.v2.framework.op import Operator
from gradient_checker import GradientChecker
from gradient_checker import get_numeric_gradient
class GetNumericGradientTest(unittest.TestCase):
def test_add_op(self):
add_op = Operator('add_two', X="X", Y="Y", Out="Z")
x = nu... | apache-2.0 | Python | |
9779fc585d8d8d87580a47139742eb25bc52facd | Add new decorators module, move deprecated from utils over here | stoq/kiwi | kiwi/decorators.py | kiwi/decorators.py | #
# Kiwi: a Framework and Enhanced Widgets for Python
#
# Copyright (C) 2005 Async Open Source
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (a... | lgpl-2.1 | Python | |
9258451157de31f3ece7e18fcb8ae43c433239f4 | add example to post files to Portals File System | exosite-garage/exosite_api_usage_examples | portals_api/upload_files_to_portals_file_system.py | portals_api/upload_files_to_portals_file_system.py | # Example that uploads a file to the Portals File System using Portals API
# Access Level- Portals Domain Administrator
# Note: Uses Python 'Requests' module for calling API
# APIs:
# - http://docs.exosite.com/portals/#update-file-content
import requests
import getpass
directory = "images" #default directory name
do... | bsd-2-clause | Python | |
425d8ef0f439e9580c85e0dc04e5fe0c93cffddf | add 16 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | p016.py | p016.py | # 2**15 = 32768 and the sum of its digits is 3+2+7+6+8=26
# what is the sum of the digits of the number 2**1000?
def f(n):
return sum([ int(c) for c in str(2**n)])
print f(1000)
| bsd-3-clause | Python | |
2b73467ccfbf6e29047223f1c1e3250916b6ffdb | add 23 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | p023.py | p023.py | from itertools import combinations_with_replacement
def divisors(n):
r = set()
for i in range(1, n / 2):
if n % i == 0:
r.add(i)
r.add(n / i)
r.discard(n)
return r
abundant = filter(lambda n: sum(divisors(n)) > n, range(2, 29000))
u = set(range(1, 29000))
for i in com... | bsd-3-clause | Python | |
351f2779549add63963d4103fbe1b058dde59d85 | Add stupid test to make Jenkins happy. | otmaneJai/Zipline,enigmampc/catalyst,davidastephens/zipline,nborggren/zipline,Scapogo/zipline,semio/zipline,keir-rex/zipline,jimgoo/zipline-fork,jordancheah/zipline,dmitriz/zipline,chrjxj/zipline,erikness/AlephOne,YuepengGuo/zipline,zhoulingjun/zipline,StratsOn/zipline,euri10/zipline,wilsonkichoi/zipline,joequant/zipli... | zipline/test/test_sanity.py | zipline/test/test_sanity.py | from unittest2 import TestCase
class TestEnviroment(TestCase):
def test_universe(self):
# first order logic is working today. Yay!
self.assertTrue(True != False)
| apache-2.0 | Python | |
67f5e754a5f90903e09a6a876d858d002c513f8a | Add initial draft of posterior models | lintusj1/elfi,lintusj1/elfi,elfi-dev/elfi,HIIT/elfi,elfi-dev/elfi | abcpy/posteriors.py | abcpy/posteriors.py | import scipy as sp
from .utils import stochastic_optimization
class BolfiPosterior():
def __init__(self, model, threshold, priors=None):
self.threshold = threshold
self.model = model
self.priors = [None] * model.n_var
self.ML, ML_val = stochastic_optimization(self._neg_unnormalize... | bsd-3-clause | Python | |
8131bb276a467d7df00f7452616869d20d312eb7 | add api_view test | MySmile/mysmile,MySmile/mysmile | apps/api/tests/tests_view.py | apps/api/tests/tests_view.py | import datetime
from django.test import TestCase
from django.test.client import Client
from apps.pages.models import Page, Page_translation
class MySmileApiTestCase(TestCase):
def setUp(self):
some_page = Page.objects.create(id=1,
slug='index',
color='#FDA13... | bsd-3-clause | Python | |
6104fdc57931151f6cf3c8cd517f5efee17fe826 | Update repost_stock_for_deleted_bins_for_merging_items.py | indictranstech/erpnext,indictranstech/erpnext,geekroot/erpnext,geekroot/erpnext,Aptitudetech/ERPNext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,njmube/erpnext,indictranstech/erpnext,gsnbng/erpnext,indictranstech/erpnext,geekroot/erpnext,njmube/erpnext,njmube/erpnext,njmube/erpnext | erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py | erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py | from __future__ import unicode_literals
import frappe
from erpnext.stock.stock_balance import repost_stock
def execute():
frappe.reload_doc('manufacturing', 'doctype', 'production_order_item')
frappe.reload_doc('manufacturing', 'doctype', 'production_order')
modified_items = frappe.db.sql_list("""
select name f... | from __future__ import unicode_literals
import frappe
from erpnext.stock.stock_balance import repost_stock
def execute():
frappe.reload_doc('manufacturing', 'doctype', 'production_order_item')
modified_items = frappe.db.sql_list("""
select name from `tabItem`
where is_stock_item=1 and modified >= '2016-10-31'... | agpl-3.0 | Python |
142ec5bdca99d11236f2d479cf4dafbc7e8962a3 | test of the nis module | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_nis.py | Lib/test/test_nis.py | import nis
verbose = 0
if __name__ == '__main__':
verbose = 1
maps = nis.maps()
for nismap in maps:
if verbose:
print nismap
mapping = nis.cat(nismap)
for k, v in mapping.items():
if verbose:
print ' ', k, v
if not k:
continue
if nis.match(k, nismap) <> v:
print "NIS match failed... | mit | Python | |
a35a6b715670e985c0bd711a4cb55df2a267e018 | Create downloader.py | EscapeLife/web_crawler | 3.下载缓存/downloader.py | 3.下载缓存/downloader.py | import urlparse
import urllib2
import random
import time
from datetime import datetime, timedelta
import socket
DEFAULT_AGENT = 'wswp'
DEFAULT_DELAY = 5
DEFAULT_RETRIES = 1
DEFAULT_TIMEOUT = 60
class Downloader:
def __init__(self, delay=DEFAULT_DELAY, user_agent=DEFAULT_AGENT, proxies=None, num_retries=DEFAULT_... | mit | Python | |
6bf4f7491bdfe8a5afd5eb8cdb4a8fcb2af78b36 | Add commands/findCognateClassesCrossingMeanings.py | lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public | ielex/lexicon/management/commands/findCognateClassesCrossingMeanings.py | ielex/lexicon/management/commands/findCognateClassesCrossingMeanings.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from collections import defaultdict
from django.core.management import BaseCommand
from ielex.lexicon.models import CognateJudgement, Lexeme
class Command(BaseCommand):
help = "Compiles a list of cognate classes,"\
"\nw... | bsd-2-clause | Python | |
b7dd7f75f655f4fbcb34d8f9ec260a6f18e8f617 | Add utility to create administrative users. | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/scripts/adminuser.py | backend/scripts/adminuser.py | #!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
import sys
def create_group(conn):
group = {}
group['name'] = "Admin Group"
group['description'] = "Administration Group for Materials Commons"
group['id'] = 'admin'
group['owner'] = 'admin@materialscommons.org'
grou... | mit | Python | |
a1c4eb2183e3d3920e992b0753392d987b518bcf | add unit-test for tablegenerator.util.split_string_at_suffix | ultimate-pa/benchexec,martin-neuhaeusser/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,martin-neuhaeusser/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,martin-neuhaeusser/benchexec,dbeyer/benchexec,martin-neuhaeusser/benchexec,IljaZakharov/benchexec,sosy-lab/benchexec,sosy-... | benchexec/tablegenerator/test_util.py | benchexec/tablegenerator/test_util.py | # BenchExec is a framework for reliable benchmarking.
# This file is part of BenchExec.
#
# Copyright (C) 2007-2016 Dirk Beyer
# 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 Lic... | apache-2.0 | Python | |
8d32947304d72a13ed8e27d41d35028a904072e9 | Add libpq package | trigger-happy/conan-packages | libpq/conanfile.py | libpq/conanfile.py | from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os
class LibpqConn(ConanFile):
name = "libpq"
version = "9.6.3"
license = "PostgreSQL license https://www.postgresql.org/about/licence/"
url = "https://github.com/trigger-happy/conan-packages"
description = "C library for interfa... | mit | Python | |
e59c03f0bad78c9cb1db86f2fb0ac29009c8474e | add rll | mengzhuo/my-leetcode-solution | reverse-linked-list.py | reverse-linked-list.py | # https://leetcode.com/problems/reverse-linked-list/
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param {ListNode} head
# @return {ListNode}
def reverseList(self, head):
last, current = None, hea... | mit | Python | |
0c17398f68597eae175ad6a37945cf37e95e1809 | Reset invalid default quotas for CloudServiceProjectLink [WAL-814] | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/structure/migrations/0050_reset_cloud_spl_quota_limits.py | nodeconductor/structure/migrations/0050_reset_cloud_spl_quota_limits.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.contenttypes import models as ct_models
from django.db import migrations, models
from nodeconductor.quotas.models import Quota
from nodeconductor.structure.models import CloudServiceProjectLink
def reset_cloud_spl_quota_limits(apps,... | mit | Python | |
63ae0b619ea50b1e234abc139becaeb84c703302 | add player class | Mellcap/MellPlayer | MellPlayer/player.py | MellPlayer/player.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Netease Music Player
Created on 2017-02-20
@author: Mellcap
'''
class Player(object):
def __init__(self):
pass
def start(self):
pass
def pause(self):
pass
def start_or_pause(self):
pass
def switch_song(self, a... | mit | Python | |
602db58ff01ef7ea2718d713a5b2026377023b8d | Create context_processors.py | 20tab/twentytab_project,20tab/twentytab_project,20tab/twentytab_project | commons/context_processors.py | commons/context_processors.py | from os import environ
from {{ project_name }} import __version__
import uuid
def metainfo(request):
metainfo = {
'uuid': unicode(uuid.uuid4()),
'version': __version__,
'static_version': "?v={}".format(uuid),
'branch': environ['BRANCH']
}
return metainfo
| mit | Python | |
4152b6a10610aa364e901f062a8611b94f65b3de | Create e.py | xsthunder/a,xsthunder/acm,xsthunder/a,xsthunder/acm,xsthunder/acm,xsthunder/a,xsthunder/a,xsthunder/acm,xsthunder/a | at/abc126/e.py | at/abc126/e.py | # 并查集
read = input
n, m = map(int, read().split())
f = [-1 for i in range(n + 1)] # 1 ~ n
def find(x):
if f[x]<0:
return x
else :
f[x] = find(f[x])
return f[x]
for i in range(m):
x,y,z = map(int, read().split())
if abs(x) < abs(y): #合并到x上,保证x是大集合
x,y = y,x
fx = find(x... | mit | Python | |
2057ebd9bae44b232b133ca0c0f76e11d4ca3b5f | Add missing file | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | conary/server/wsgi_adapter.py | conary/server/wsgi_adapter.py | #
# Copyright (c) rPath, Inc.
#
# 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
# (at your option) any later version.
#
# This program is distributed in the h... | apache-2.0 | Python | |
38cec6e7806e55d957e9810d1bb861054ae4842b | add useful methods | marianosimone/interviewed,marianosimone/interviewed | useful_methods.py | useful_methods.py | # encoding utf-8
def bisect_right(data, target, lo, hi):
"""
Given a sorted array, returns the insertion position of target
If the value is already present, the insertion post is to the right of all of them
>>> bisect_right([1,1,2,3,4,5], 1, 0, 6)
2
>>> bisect_right([1,1,2,3,4,5], 0, 0, 6)
... | unlicense | Python | |
aef33a2c8f34d164bba18741a3cf6e5b71a60a99 | Add stub file for extract_csv.py | illumenati/duwamish-sensor,tipsqueal/duwamish-sensor | extract_csv.py | extract_csv.py | def extract_csv(filename):
# TODO: connect to sqlite database and extract a csv of the rows.
pass
if __name__ == '__main__':
extract_csv('data.csv') | mit | Python | |
f99eb9a2397f571f045f6a5f663a42878e94b3ea | Create Euler_003.py | kingmak/Project_Euler_Solutions | Euler_003.py | Euler_003.py | #
x, num = 2, 600851475143
while num != x:
if num % x == 0: num = num / x; x = 2
else: x += 1
print x
| unlicense | Python | |
411ef30db7431e9df1af02cd68a6ae0b9d874af0 | add a first draft for the test of canal metrics | rfdougherty/dipy,samuelstjean/dipy,sinkpoint/dipy,beni55/dipy,mdesco/dipy,jyeatman/dipy,matthieudumont/dipy,Messaoud-Boudjada/dipy,nilgoyyou/dipy,JohnGriffiths/dipy,JohnGriffiths/dipy,beni55/dipy,villalonreina/dipy,demianw/dipy,samuelstjean/dipy,jyeatman/dipy,sinkpoint/dipy,oesteban/dipy,oesteban/dipy,FrancoisRheaultUS... | dipy/reconst/tests/test_canal_metrics.py | dipy/reconst/tests/test_canal_metrics.py | import numpy as np
from dipy.reconst.dsi import DiffusionSpectrumModel
from dipy.data import get_data
from dipy.core.gradients import gradient_table
from numpy.testing import (assert_almost_equal,
run_module_suite)
from dipy.reconst.canal import ShoreModel, SHOREmatrix
from dipy.sims.voxel im... | bsd-3-clause | Python | |
1072b8e28e75cf41a35302c9febd1ec22473e966 | Add code/analyse_chain_growth.py | pdebuyl/cg_md_polymerization,pdebuyl/cg_md_polymerization | code/analyse_chain_growth.py | code/analyse_chain_growth.py | #!/usr/bin/env python
import sys
import os
import os.path
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('dirs', type=str, nargs='+',
help='directories containing simulation files')
parser.add_argument('--rate', type=float, default=0.1)
parser.add_argument('--sites', type=... | bsd-3-clause | Python | |
bd15388aa877f32ebc613511ad909b311ed3bcf0 | Add tests | ChristinaZografou/sympy,AunShiLord/sympy,Mitchkoens/sympy,saurabhjn76/sympy,VaibhavAgarwalVA/sympy,jbbskinny/sympy,shipci/sympy,Curious72/sympy,abloomston/sympy,meghana1995/sympy,jaimahajan1997/sympy,VaibhavAgarwalVA/sympy,Davidjohnwilson/sympy,mcdaniel67/sympy,beni55/sympy,MechCoder/sympy,shikil/sympy,saurabhjn76/symp... | sympy/concrete/tests/test_dispersion.py | sympy/concrete/tests/test_dispersion.py | from sympy.core import Symbol, S, oo
from sympy.concrete.dispersion import *
def test_dispersion():
x = Symbol("x")
fp = S(0).as_poly(x)
assert sorted(dispersionset(fp)) == [0]
fp = S(2).as_poly(x)
assert sorted(dispersionset(fp)) == [0]
fp = (x + 1).as_poly(x)
assert sorted(dispersions... | bsd-3-clause | Python | |
6ed3b62efe24aa8aeaedd314bb4e472628713bac | Create deft_opportunist.py | GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus | tpdatasrc/tpgamefiles/scr/tpModifiers/deft_opportunist.py | tpdatasrc/tpgamefiles/scr/tpModifiers/deft_opportunist.py | #Deft Opportunist: Complete Adventurer, p. 106
from templeplus.pymod import PythonModifier
from toee import *
import tpdp
print "Registering Deft Opportunist"
def DOAOO(attachee, args, evt_obj):
if attachee.has_feat("Deft Opportunist") != 0:
#Check if it's an AOO, if so add 4 to the Attack Roll
if evt_obj.att... | mit | Python | |
52f8daf63644fde1efd1c132d6b02ac6670ef0a4 | Add migrations merge | pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web | temba/channels/migrations/0038_merge.py | temba/channels/migrations/0038_merge.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('channels', '0037_auto_20160905_1537'),
('channels', '0033_auto_20160623_1438'),
]
operations = [
]
| agpl-3.0 | Python | |
1b538aba890c8a81fc7bf66f2c35519608fbd6be | Create drivers.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | chips/analog/mock/drivers.py | chips/analog/mock/drivers.py | # This code has to be added to the corresponding __init__.py
DRIVERS["analogmock"] = ["ANALOG", "PUUM"]
| apache-2.0 | Python | |
528de5a29d7beb743e5e80775a349f931e71262f | add test that triggers previous error | oesteban/preprocessing-workflow,poldracklab/fmriprep,poldracklab/fmriprep,oesteban/fmriprep,shoshber/fmriprep,oesteban/preprocessing-workflow,poldracklab/preprocessing-workflow,shoshber/fmriprep,oesteban/fmriprep,poldracklab/fmriprep,chrisfilo/fmriprep,poldracklab/preprocessing-workflow,oesteban/fmriprep | test/workflows/test_base.py | test/workflows/test_base.py | import json
import fmriprep.workflows.base as base
import re
import unittest
import mock
class TestBase(unittest.TestCase):
def test_fmri_preprocess_single(self):
''' Tests that it runs without errors '''
# NOT a test for correctness
# SET UP INPUTS
test_settings = {
'o... | bsd-3-clause | Python | |
0e02a9de3599e726b5a4dffd17f92a0cd0d2aaee | add import script for Wyre | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_wyre.py | polling_stations/apps/data_collection/management/commands/import_wyre.py | from data_collection.management.commands import BaseXpressWebLookupCsvImporter
class Command(BaseXpressWebLookupCsvImporter):
council_id = 'E07000128'
addresses_name = 'WyrePropertyPostCodePollingStationWebLookup-2017-03-08 2.CSV'
stations_name = 'WyrePropertyPostCodePollingStationWebLookup-2017-03... | bsd-3-clause | Python | |
b14fb988321076f4cf17cebec7635fd209e08465 | Create video.py | sonus89/FIPER,sonus89/FIPER,sonus89/FIPER | client/video.py | client/video.py | # Capture video with OpenCV
import numpy as np
import cv2
import time
cap = cv2.VideoCapture('serenity.mp4')
while(cap.isOpened()):
ret, frame = cap.read()
# time.sleep(.25)
cv2.rectangle(frame,(384,0),(510,128),(0,255,0),3)
cv2.imshow('frame',frame)
if cv2.waitKey(5) & 0xFF == ord('q'):
break
... | mit | Python | |
18a356c9fa49f32627481f312b03aa34ff711456 | Revert "Define the tests as grpc_cc_test to automatically test against all po…" | Vizerai/grpc,muxi/grpc,pszemus/grpc,nicolasnoble/grpc,kpayson64/grpc,murgatroid99/grpc,carl-mastrangelo/grpc,carl-mastrangelo/grpc,stanley-cheung/grpc,pszemus/grpc,ctiller/grpc,kpayson64/grpc,jtattermusch/grpc,stanley-cheung/grpc,firebase/grpc,donnadionne/grpc,donnadionne/grpc,sreecha/grpc,ejona86/grpc,murgatroid99/grp... | test/core/bad_client/generate_tests.bzl | test/core/bad_client/generate_tests.bzl | #!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | #!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | apache-2.0 | Python |
59ac83e45116a97cfbdd7522f967337e73d51766 | add cargo deny test | firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker | tests/integration_tests/build/test_dependencies.py | tests/integration_tests/build/test_dependencies.py | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Enforces controls over dependencies."""
import os
import framework.utils as utils
def test_licenses():
"""Ensure license compatibility for Firecracker.
For a list of currently allowed licenses ... | apache-2.0 | Python | |
c3f01d8b365e6d367b1a565e5ce59cf04eb1bac3 | fix build | missionpinball/mpf-monitor | get_version.py | get_version.py | """Return the short version string."""
from mpfmonitor._version import __short_version__
print("{}.x".format(__short_version__))
| mit | Python | |
15d3692aee84432b6b7f8306505b3f59649fd6f9 | Remove mimetype from the module_files table | Connexions/cnx-archive,Connexions/cnx-archive | cnxarchive/sql/migrations/20160128111115_mimetype_removal_from_module_files.py | cnxarchive/sql/migrations/20160128111115_mimetype_removal_from_module_files.py | # -*- coding: utf-8 -*-
"""\
- Move the mimetype value from ``module_files`` to ``files``.
- Remove the ``mimetype`` column from the ``module_files`` table.
"""
from __future__ import print_function
import sys
def up(cursor):
# Move the mimetype value from ``module_files`` to ``files``.
cursor.execute("UPDAT... | agpl-3.0 | Python | |
67b5cd3f00ca57c4251dab65c5a6e15ab2be8a42 | Create result.py | JeckLabs/aiorucaptcha | aiorucaptcha/result.py | aiorucaptcha/result.py | class ResultObject:
def __init__(self, code, task_id):
self.code = code
self.task_id = task_id
def __str__(self):
return self.code
| apache-2.0 | Python | |
4a7a15359763cbd6956bd30bde7cd68b05b2b4a2 | test _compare_and_pop_smallest | stephtzhang/algorithms | tests/test_huffman_codes.py | tests/test_huffman_codes.py | import sys
import os
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '../..'))
import unittest
from huffman_codes import huffman_codes, Node, Queue, _compare_and_pop_smallest, \
_traverse_children_and_assign_codes
class TestHuffmanCodes(unittest.TestCase):
def test_compare_an... | mit | Python | |
43d3158e536b7cae3f427f655b08aa8b4c24fe96 | Add an iter_entry_points style test | mozilla/spicedham,mozilla/spicedham | tests/test_spicedham_api.py | tests/test_spicedham_api.py | from unittest import TestCase
from spicedham import Spicedham
from mock import Mock, patch
class TestSpicedHamAPI(TestCase):
@patch('spicedham.Spicedham._classifier_plugins')
def test_classify(self, mock_plugins):
sh = Spicedham()
plugin0 = Mock()
plugin0.classify.return_value = .5
... | mpl-2.0 | Python | |
ba49a66b401bc32e57abede6adc5a0f933e8834a | Add tests for view helpers | IRI-Research/django-cas-ng,11h42/django-cas-ng,wrygiel/django-cas-ng,nitmir/django-cas-ng,bgroff/django-cas-ng,forcityplatform/django-cas-ng,pbaehr/django-cas-ng,11h42/django-cas-ng,mingchen/django-cas-ng | tests/test_views_helpers.py | tests/test_views_helpers.py | from django.test import RequestFactory
from django_cas_ng.views import (
_service_url,
_redirect_url,
_login_url,
_logout_url,
)
#
# _service_url tests
#
def test_service_url_helper():
factory = RequestFactory()
request = factory.get('/login/')
actual = _service_url(request)
expected... | mit | Python | |
3f84a3cb50e18ce9df96a9173d0be180633aad0d | Add polynomial learning example | SamuelWarner/Python-ML | Examples/polynomial_approximation.py | Examples/polynomial_approximation.py | """
Example of neural network learning a polynomial equation. Test polynomial is f(x) = (6x^2 + 3x) ÷ (3x)
Training is run on x values from 1.0 to 100.0
"""
from mazex import MazeX
import numpy as np
import random
import math
import matplotlib.pyplot as plt
# Create list to store how close networks guesses are
graph_... | mit | Python | |
abe40e3c82ef1f351275a59b2e537f43530caa0c | Clean up db script (remove articles older than two days). | hw3jung/Gucci,hw3jung/Gucci | app/cleanup_stories.py | app/cleanup_stories.py | from pymongo import MongoClient
from fetch_stories import get_mongo_client, close_mongo_client
from bson import ObjectId
from datetime import datetime, timedelta
def remove_old_stories():
client = get_mongo_client()
db = client.get_default_database()
article_collection = db['articles']
two_days_ag... | mit | Python | |
ba590d28810409fa57783e6d29a651790f865e5c | create base api exceptions module | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | apps/api/exceptions.py | apps/api/exceptions.py | import json
from tastypie.exceptions import TastypieError
from tastypie.http import HttpResponse
class CustomBadRequest(TastypieError):
"""
This exception is used to interrupt the flow of processing to immediately
return a custom HttpResponse.
"""
def __init__(self, success=False, code="", messa... | mit | Python | |
b1a5764956e0f569b4955dbf43e5656873c903f6 | Create new package. (#7649) | LLNL/spack,mfherbst/spack,EmreAtes/spack,EmreAtes/spack,LLNL/spack,tmerrick1/spack,iulian787/spack,matthiasdiener/spack,krafczyk/spack,iulian787/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,tmerrick1/spack,LLNL/spack,LLNL/spack,EmreAtes/spack,krafczyk/spack,mfherbst/spack,matthiasdiener/spack,mfherbst/spack,iuli... | var/spack/repos/builtin/packages/soapdenovo-trans/package.py | var/spack/repos/builtin/packages/soapdenovo-trans/package.py | ##############################################################################
# Copyright (c) 2013-2018, 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 | |
402004b1a0612e5b4eeb703f3787dd1b7f3def30 | make auto migration | DrMartiner/django-yandex-kassa,VladimirFilonov/django-yandex-kassa,VladimirFilonov/django-yandex-kassa | yandex_kassa/migrations/0004_auto_20151209_0940.py | yandex_kassa/migrations/0004_auto_20151209_0940.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('yandex_kassa', '0003_auto_20151116_1530'),
]
operations = [
migrations.AlterModelOptions(
name='payment',
... | mit | Python | |
7ec4133b11ba91541e9ec9895e39a2c402c63087 | define the AVB loss separately | gdikov/vae-playground | avb/models/avb_loss.py | avb/models/avb_loss.py | import keras.backend as ker
from keras.layers import Layer
from keras.losses import categorical_crossentropy
class AVBLossLayer(Layer):
def __init__(self, **kwargs):
self.is_placeholder = True
super(AVBLossLayer, self).__init__(**kwargs)
@staticmethod
def avb_loss(discrim_output_posterior... | mit | Python | |
fd54c28be8d9ffd7e5711035bf5b5e1b7fe332cc | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/ab2e190c2bfe60b3b738c125ca9db1a2785cdcaa. | tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,ga... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "ab2e190c2bfe60b3b738c125ca9db1a2785cdcaa"
TFRT_SHA256 = "b097063dd10c010e827e58cc8e5a0e4008d99bcba1dcb2... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "285e48bc47db23a479637fd1e2767b9a35dc2c9b"
TFRT_SHA256 = "6f0067d0cb7bb407caeef060603b6e33f1231cddf1ce4c... | apache-2.0 | Python |
c9c00a6a5ab267ab56dd147e6542cae6566061d8 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/dc109b725d8f36f8c7db7847f0c95a819c43f9e9. | tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,gautam1858/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,ka... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "dc109b725d8f36f8c7db7847f0c95a819c43f9e9"
TFRT_SHA256 = "e6a6359ecd731f7208f32402fac9... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "4bcf968d66a6bb2899b9d99917b916f6ec04c327"
TFRT_SHA256 = "9bd2cc2e7003f73f767e138ae477... | apache-2.0 | Python |
d81a2b0328c86165b09c2d41aa2a4684c75388cd | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/78537f15f4873bbed59258bed4442225303f462a. | tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,gautam1858/tensorflow,Intel-tensorflow/tensorflow,karllessard/tensorflow,yongtan... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "78537f15f4873bbed59258bed4442225303f462a"
TFRT_SHA256 = "87526ed2a287d7809b2cadf82f9d... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "a2f5e07760d2a888370d0686546b757ee9628494"
TFRT_SHA256 = "70653b94faa603befef83457482c... | apache-2.0 | Python |
8c1b20941c1216bb56fa55fe881962d2ea883366 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/c68238f982305e3618a2b5347e1e0a5663898c90. | gautam1858/tensorflow,paolodedios/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_save... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "c68238f982305e3618a2b5347e1e0a5663898c90"
TFRT_SHA256 = "b28ed95058c101a9d3203ddbaa271044de984f6b49c560... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "377c20166e8e1b5124493c1433b1df34ca62cf3f"
TFRT_SHA256 = "f0c3c03e7d9ca2e10c3256f28bf9c0aa0aa26d9aa4da53... | apache-2.0 | Python |
5a8fde172f0fc7aff841e8059927ff126712b321 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/feffe7beb261f6dfe9af083e8f46dfea293ded54. | tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,paolodedios/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,karllessard/tensorflow,I... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "feffe7beb261f6dfe9af083e8f46dfea293ded54"
TFRT_SHA256 = "830492c8a9884e5ca84b15a4da953491f74b2ffbd45656... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "509cf2f10beb666002ece6a7b968fe2c7c0c1e4b"
TFRT_SHA256 = "14b22d39d3eebcf255e4dd8ee8630b4da3ecc786f5053a... | apache-2.0 | Python |
e42862ce7bde45e90bec0980f3c35c5cef5c65b6 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/47a1de40f17e70f901238edfe99dc510a5db797a. | Intel-Corporation/tensorflow,frreiss/tensorflow-fred,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "47a1de40f17e70f901238edfe99dc510a5db797a"
TFRT_SHA256 = "87631491c3fdd34b4d00b6999274468b89a98f23113aea... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "033f079420053002701271e4173bdcaf21bd1b73"
TFRT_SHA256 = "15c1c5a3617b91322d4ef96ce884676d27164cf94211f8... | apache-2.0 | Python |
5ab54cf353cece6a8754a1869d8f342ba0a8b351 | Add a script to find and compare F* execution times | project-everest/vale,project-everest/vale,project-everest/vale,project-everest/vale | tools/scripts/collect-fstar-times.py | tools/scripts/collect-fstar-times.py | #!/usr/bin/python
import argparse
import os
import glob
import re
import time
import sys
import fnmatch
import pickle
from prettytable import PrettyTable # Install via: easy_install PrettyTable
def find_fstar_output_files(directory):
matches = []
extensions = ["vfsti", "vfst"]
# Based on: https://stackov... | apache-2.0 | Python | |
a6cc742a7272d1138031e26c61fd10617e6b0ac1 | Initialize transpositionTest | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | # Transposition Cipher Test
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import random, sys, transpositionEncrypt, transpositionDecrypt
def main():
random.seed(42) # Set the random "seed" to a static value.
for i in range(20): # Run 20 tests.
# Generate random messages to test.
... | mit | Python | |
1c7daf0bd9801885d7740620b3e81faa03ce49d4 | add sign/verify json tests | matrix-org/matrix-python-sdk | test/crypto/olm_device_test.py | test/crypto/olm_device_test.py | from copy import deepcopy
from matrix_client.client import MatrixClient
from matrix_client.crypto.olm_device import OlmDevice
HOSTNAME = 'http://example.com'
class TestOlmDevice:
cli = MatrixClient(HOSTNAME)
user_id = '@user:matrix.org'
device_id = 'QBUAZIFURK'
device = OlmDevice(cli.api, user_id, d... | apache-2.0 | Python | |
c4ffd77a56e09f3b418e6d13e8339fe693fffbdb | add fasd_cleanup script | ratheesh/dot-files,ratheesh/dot-files | misc/fasd_clean.py | misc/fasd_clean.py | #/usr/bin/env python
# Copyright (C) 2015 Ratheesh S<ratheeshreddy@gmail.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 2
# of the License, or (at your option) any later v... | apache-2.0 | Python | |
2a45679c02e74ce7a63e259b1475d4190086084e | Add errors to zombase | mozaiques/zombase,ouihelp/yesaide | zombase/errors.py | zombase/errors.py | # -*- coding: utf-8 -*-
class ZombaseRuntimeError(Exception):
pass
| mit | Python | |
629c9e330e6114680f22af125252d95fb6989201 | update migrations for link manager | veselosky/webquills,veselosky/webquills,veselosky/webquills | webquills/linkmgr/migrations/0002_alter_linkcategory_site.py | webquills/linkmgr/migrations/0002_alter_linkcategory_site.py | # Generated by Django 3.2 on 2021-06-07 11:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wqsites', '0001_initial'),
('linkmgr', '0001_initial'),
]
operations = [
migrations.AlterField(
... | apache-2.0 | Python | |
24e2ddfd49aa2c05879460baeb67ed6cc75ffa87 | fix benchmark script | rabernat/pyqg,jamesp/pyqg,crocha700/pyqg,pyqg/pyqg | benchmark/benchmark.py | benchmark/benchmark.py | import pyqg
import time
import cProfile
import pstats
import numpy as np
tmax = 8000*1000
dtfac = 64 * 8000.
mynx = [32, 64, 128, 256, 512, 1024, 2048]
mynth = [1,2,4,8,16,32]
res = np.zeros((len(mynx), 5))
print 'nx, threads, timesteps, time'
for j, nx in enumerate(mynx):
dt = dtfac / nx
#for i, (use_ff... | from pyqg import qg_model, model
import time
import cProfile
import pstats
import numpy as np
tmax = 104000000
dtfac = (64 * 8000.)
mynx = [32, 64, 128, 256]
res = np.zeros((len(mynx), 5))
for j, nx in enumerate(mynx):
dt = dtfac / nx
for i, (use_fftw, nth) in enumerate([(False, 1), (True, 1),
(Tr... | mit | Python |
078727dcaba9f7861f84ab7ef61e653f28253226 | add script | grinich/mdmvendorsign,tjmoney0201/mdmvendorsign | mdm_vendor_sign.py | mdm_vendor_sign.py | # This is based loosely on Softthinker's java code found here
# http://www.softhinker.com/in-the-news/iosmdmvendorcsrsigning
# fuck java
import argparse
from plistlib import writePlistToString
import os
import subprocess
from base64 import b64encode
import sys
import urllib2
def p(s):
sys.stdout.write(s)
sys.stdout... | mit | Python | |
2347ee253f04fa87b28206b0ec00fd2a3fffb49f | Create hello_market_maker.py | MKTSTK/Runover | hello_market_maker.py | hello_market_maker.py | class hello_market_maker():
def __init__(self, anchor_price, tick_increment, max_pos):
self.anchor_price = anchor_price
self.tick_increment = tick_increment
self.position = 0
self.upper_bound = anchor_price + ((max_pos + 1) * tick_increment)
self.lower_bound = anchor_price - ((max_pos + 1) * tick_... | bsd-3-clause | Python | |
819a47ce69164aa48f3b68e9ab997f6ee90e2292 | Add a index stats tool | andyfoundi/mongodb-tools,safanaj/mongodb-tools,jwilder/mongodb-tools,safanaj/mongodb-tools,jwilder/mongodb-tools,andyfoundi/mongodb-tools,yaowenqiang/mongodb-tools,yaowenqiang/mongodb-tools,svdata/mongodb-tools,svdata/mongodb-tools | index-stats.py | index-stats.py | """
This script prints some basic collection stats about the size of the
collections and their indexes.
"""
from prettytable import PrettyTable
import psutil
from pymongo import Connection
from pymongo import ReadPreference
connection = Connection(read_preference=ReadPreference.SECONDARY)
def compute_signature(index... | mit | Python | |
372f4a988411e48a0c50cdc74fb2a7f4e5abf052 | Add a server identity test | Kitware/tangelo,Kitware/tangelo,Kitware/tangelo | tests/server-identity.py | tests/server-identity.py | import nose
import requests
import fixture
@nose.with_setup(fixture.start_tangelo, fixture.stop_tangelo)
def test_server_identity():
response = requests.get(fixture.url("/"))
assert response.headers["server"] == "Tangelo"
| apache-2.0 | Python | |
19db4647257617992e9b195828baf39907cc5db1 | Add tests for exit codes | amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint | tests/test_exit_codes.py | tests/test_exit_codes.py | """Check that the CLI returns the appropriate exit code."""
import subprocess
def test_exit_code_demo():
"""Ensure that linting the demo returns an exit code of 1."""
try:
subprocess.check_output("proselint --demo", shell=True)
except subprocess.CalledProcessError as grepexc:
assert(grep... | bsd-3-clause | Python | |
787298889fd85dffb597dee6571dead42227c7d6 | add test to validate generated stub constants.pyi | mehcode/python-xmlsec,mehcode/python-xmlsec | tests/test_type_stubs.py | tests/test_type_stubs.py | """Test type stubs for correctness where possible."""
import os
import sys
import pytest
import xmlsec
black = pytest.importorskip('black')
if sys.version_info >= (3, 4):
from pathlib import Path
else:
from _pytest.pathlib import Path
constants_stub_header = """
import sys
from typing import NamedTuple
... | mit | Python | |
f1e35886822a7ff7e7f19ef4f1db90c870e8d45d | Add file for remove nonterminal tests | PatrikValkovic/grammpy | tests/NonterminalRemoveTest.py | tests/NonterminalRemoveTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import Grammar
from grammpy import Nonterminal
class TempClass(Nonterminal):
pass
class Second(Nonterminal):
pass
class Th... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.