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 |
|---|---|---|---|---|---|---|---|---|
4b696c2a54f7afd95013763c098aec30b08409d6 | Create bulb-switcher-ii.py | kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/Le... | Python/bulb-switcher-ii.py | Python/bulb-switcher-ii.py | # Time: O(1)
# Space: O(1)
class Solution(object):
def flipLights(self, n, m):
"""
:type n: int
:type m: int
:rtype: int
"""
if m == 0: return 1
if n == 1: return 2
if m == 1 and n == 2: return 3
if m == 1 or n == 2 re... | mit | Python | |
0621b935558b6805d2b45fee49bc2e959201fd7a | add number-of-digit-one | zeyuanxy/leet-code,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode | vol5/number-of-digit-one/number-of-digit-one.py | vol5/number-of-digit-one/number-of-digit-one.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-03 15:21:00
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-03 15:21:14
import itertools
class Solution(object):
def countDigitOne(self, n):
"""
:type n: int
:rtype: int
"""
... | mit | Python | |
27d37833663842405f159127f30c6351958fcb10 | Add draft of example using the new @bench | ktbs/ktbs-bench,ktbs/ktbs-bench | bench_examples/bench_dec_insert.py | bench_examples/bench_dec_insert.py | from csv import DictWriter
from ktbs_bench.utils.decorators import bench
@bench
def batch_insert(graph, file):
"""Insert triples in batch."""
print(graph, file)
if __name__ == '__main__':
# Define some graph/store to use
graph_list = ['g1', 'g2']
# Define some files to get the triples from
... | mit | Python | |
7c0a37e2ad123dfeb409c682a1cab37630678642 | Improve preprocessing text docs | sarvex/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,sarvex/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,davidzchen/tensorflow,gunan/tensorflow,annarev/tensorflow,davidzchen/tensorflow,aldian/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow... | tensorflow/python/keras/preprocessing/text.py | tensorflow/python/keras/preprocessing/text.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
175470eea9716f587a2339932c1cfb6c5240c4df | add tools.testing module for asserts (numpy, pandas compat wrapper) | wzbozon/statsmodels,wzbozon/statsmodels,phobson/statsmodels,nvoron23/statsmodels,phobson/statsmodels,detrout/debian-statsmodels,cbmoore/statsmodels,kiyoto/statsmodels,wkfwkf/statsmodels,astocko/statsmodels,adammenges/statsmodels,gef756/statsmodels,yl565/statsmodels,hlin117/statsmodels,saketkc/statsmodels,DonBeo/statsmo... | statsmodels/tools/testing.py | statsmodels/tools/testing.py | """assert functions from numpy and pandas testing
"""
import re
from distutils.version import StrictVersion
import numpy as np
import numpy.testing as npt
import pandas
import pandas.util.testing as pdt
# for pandas version check
def strip_rc(version):
return re.sub(r"rc\d+$", "", version)
def is_pandas_min_ve... | bsd-3-clause | Python | |
68cd37c1c1bf279bc67e3d6391c8f4b88e0eb7a0 | add buggy profiler, not ready each instanciation add 2sec to exec time | short-edition/syntaxnet-wrapper | syntaxnet_wrapper/test/profile_execution.py | syntaxnet_wrapper/test/profile_execution.py | from syntaxnet_wrapper.wrapper import SyntaxNetWrapper
from time import time
from prettytable import PrettyTable
def profile_exec(niter, action, keep_wrapper):
t = time()
sentence = 'une phrase de test'
for i in range(niter):
if keep_wrapper == False or i == 0:
sn_wrapper = SyntaxNetWrapper('French... | apache-2.0 | Python | |
c76c7b19afdf364ade2b7d0793cbdb14cb315131 | add smalltalk like object model | loucq123/object_model | smalltalk_like/obj_model.py | smalltalk_like/obj_model.py | class Base(object):
def __init__(self, cls, fields):
self.cls = cls
self.fields = fields
def read_attribute(self, field_name):
return self.fields.get(field_name)
def write_attribute(self, field_name, value):
self.fields[field_name] = value
def call_method(self, method... | mit | Python | |
5bcd31440322d19262b694a5df299f43af577e5e | Create app.py | Kalimaha/fake_data_crud_service | app.py | app.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
| mit | Python | |
f6624531e47c599af42e75d84708359eaa982569 | Solve AoC 2020-12-25/1 | matslindh/codingchallenges,matslindh/codingchallenges | adventofcode2020/25.py | adventofcode2020/25.py |
def loop_size_finder(inp, subject_number=7):
i = 1
c = 0
while i != inp:
i *= subject_number
i %= 20201227
c += 1
return c
def transformer(iterations, subject_number=7):
i = 1
for _ in range(0, iterations):
i *= subject_number
i %= 20201227
retu... | mit | Python | |
b5433672a4e27db4e8f8698c311d05055462ac00 | Create main file | rcs333/ClinVirusSeq | annotate_clin_virus.py | annotate_clin_virus.py | import timeit
import subprocess
import glob
import sys
import argparse
start = timeit.default_timer()
# This program runs some shit and does some shit about clinical virus samples
# Gonna write more as I need too
# parser = argparse.ArgumentParser(description= 'Annotate a set of UW clinical viral samples, pulling vi... | mit | Python | |
92aaff39dbd670f65dcbdeb34a2a506e0fcdf58b | add basic show_urls test | haakenlid/django-extensions,linuxmaniac/django-extensions,linuxmaniac/django-extensions,haakenlid/django-extensions,django-extensions/django-extensions,linuxmaniac/django-extensions,haakenlid/django-extensions,django-extensions/django-extensions,django-extensions/django-extensions | tests/management/commands/test_show_urls.py | tests/management/commands/test_show_urls.py | # -*- coding: utf-8 -*-
from django.core.management import call_command
from django.utils.six import StringIO
def test_show_urls_format_dense():
out = StringIO()
call_command('show_urls', stdout=out)
output = out.getvalue()
assert "/admin/\tdjango.contrib.admin.sites.index\tadmin:index\n" in output
... | mit | Python | |
74a4f56d28497de89415f29ca3e1d6298c2fdd23 | Create drivers.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | chips/sensor/simulation/drivers.py | chips/sensor/simulation/drivers.py | # This code has to be added to the corresponding __init__.py
DRIVERS["simulatedsensors"] = ["PRESSURE", "TEMPERATURE", "LUMINOSITY", "DISTANCE", "HUMIDITY",
"COLOR", "CURRENT", "VOLTAGE", "POWER",
"LINEARACCELERATION", "ANGULARACCELERATION", "ACCELERATION", "LINEARVE... | apache-2.0 | Python | |
0d77fe363b6e6e8b1a0424cec7631cf13b669968 | add linear simulation | harmslab/epistasis,Zsailer/epistasis | epistasis/simulate/linear.py | epistasis/simulate/linear.py | __doc__ = """Submodule with various classes for generating/simulating genotype-phenotype maps."""
# ------------------------------------------------------------
# Imports
# ------------------------------------------------------------
import numpy as np
from gpmap.gpm import GenotypePhenotypeMap
# local imports
from ... | unlicense | Python | |
14e637720d6c80ed88232130b00385ceb4d451da | Create manual/__init__.py | MichaelCurrin/twitterverse,MichaelCurrin/twitterverse | app/tests/manual/__init__.py | app/tests/manual/__init__.py | """
Manual test module.
Note that while `TEST_MODE` should be set an environment variable for the
unit and integration tests, we want that off here so we can test against
local config data.
"""
| mit | Python | |
5bd4534b375efed2ce5026a64228a45a9acc1d64 | add parallel runner | datamicroscopes/kernels,datamicroscopes/kernels,datamicroscopes/kernels | microscopes/kernels/parallel.py | microscopes/kernels/parallel.py | """Contains a parallel runner implementation, with support
for various backends
"""
from microscopes.common import validator
import multiprocessing as mp
def _mp_work(args):
runner, niters = args
runner.run(niters)
return runner.get_latent()
class runner(object):
def __init__(self, runners, backen... | bsd-3-clause | Python | |
0cdc87edc4d5e4c967e7bc5bd35c5b30151d5a6e | Create admin_pages.py | marbindrakon/eve-wspace,evewspace/eve-wspace,mmalyska/eve-wspace,evewspace/eve-wspace,marbindrakon/eve-wspace,evewspace/eve-wspace,evewspace/eve-wspace,marbindrakon/eve-wspace,marbindrakon/eve-wspace,mmalyska/eve-wspace,mmalyska/eve-wspace,mmalyska/eve-wspace | evewspace/API/admin_pages.py | evewspace/API/admin_pages.py | from core.admin_page_registry import registry
registry.register('SSO', 'sso_admin.html', 'API.change_ssoaccesslist')
| apache-2.0 | Python | |
48190b463bcbafc0b1d3af6c41677a295237e3ba | Add missing file | Simran-B/arangodb,Simran-B/arangodb,fceller/arangodb,fceller/arangodb,fceller/arangodb,wiltonlazary/arangodb,graetzer/arangodb,graetzer/arangodb,graetzer/arangodb,Simran-B/arangodb,wiltonlazary/arangodb,graetzer/arangodb,baslr/ArangoDB,arangodb/arangodb,joerg84/arangodb,graetzer/arangodb,graetzer/arangodb,wiltonlazary/... | 3rdParty/V8/V8-5.0.71.39/build/has_valgrind.py | 3rdParty/V8/V8-5.0.71.39/build/has_valgrind.py | #!/usr/bin/env python
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
VALGRIND_DIR = os.path.join(BASE_DIR, 'third_party'... | apache-2.0 | Python | |
82860a07e361aa5322b7d055c60c7178e40296bd | Create search_accepted_nodes_for_queries.py | DynamoDS/Coulomb,DynamoDS/Coulomb,DynamoDS/Coulomb | SearchTools/search_accepted_nodes_for_queries.py | SearchTools/search_accepted_nodes_for_queries.py | # Search and accept, looks for each accept what the previously entered search text
# and the node that was accepted
import gzip
import json
import base64
import sys # Library of system calls
import traceback
import time
import os
from os.path import isfile, join
# Check that the script has been given the right arg... | mit | Python | |
ccce1108e1deab466fd72c022949fa05fa807a3a | add initial files for launch | googleapis/nodejs-policy-troubleshooter,googleapis/nodejs-policy-troubleshooter,googleapis/nodejs-policy-troubleshooter | synth.py | synth.py | # http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing pe... | apache-2.0 | Python | |
f480a0a8d51c5c059a05165f30f64bb310299ee3 | Add 'rescore' command | dbinetti/barberscore-django,dbinetti/barberscore,dbinetti/barberscore-django,dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api | project/apps/api/management/commands/rescore.py | project/apps/api/management/commands/rescore.py | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Contestant,
Appearance,
Performance,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **options):
ps = Performance.objects.all()
for p in ps:
... | bsd-2-clause | Python | |
d4a7bbe27b285e455a3beafefd22fc493edeb161 | Add unittest for eventlogger config validation. | ketoo/Astron,pizcogirl/Astron,ketoo/Astron,blindsighttf2/Astron,blindsighttf2/Astron,ketoo/Astron,pizcogirl/Astron,pizcogirl/Astron,ketoo/Astron,blindsighttf2/Astron,pizcogirl/Astron,blindsighttf2/Astron | test/test_config_eventlogger.py | test/test_config_eventlogger.py | #!/usr/bin/env python2
import unittest
import subprocess
import threading
import tempfile
import os
from testdc import *
DAEMON_PATH = './astrond'
TERMINATED = -15
EXITED = 1
class ConfigTest(object):
def __init__(self, config):
self.config = config
self.process = None
def run(self, timeout)... | bsd-3-clause | Python | |
1578c4328542dd1b1c7ccd1f08dd2b2455055190 | Add integration test covering all cql types | kracekumar/python-driver,tempbottle/python-driver,bbirand/python-driver,coldeasy/python-driver,datastax/python-driver,thobbs/python-driver,yi719/python-driver,mambocab/python-driver,kishkaru/python-driver,mike-tr-adamson/python-driver,markflorisson/python-driver,kracekumar/python-driver,sontek/python-driver,aholmberg/p... | tests/integration/test_types.py | tests/integration/test_types.py | from decimal import Decimal
from datetime import datetime
from uuid import uuid1, uuid4
import unittest
from cassandra.cluster import Cluster
from cassandra.query import ColumnCollection
class TypeTests(unittest.TestCase):
def test_basic_types(self):
c = Cluster()
s = c.connect()
s.execut... | apache-2.0 | Python | |
78c9f392a02c0fdb72294e08a3d5ce78262443f5 | Create 1.py | jreyes97/hello-world | 1.py | 1.py | u=1
| apache-2.0 | Python | |
36d7de73c2908aff574acb06a41660240ca554d4 | Select support | jhamrick/dbtools,jhamrick/dbtools | db.py | db.py | import sqlite3 as sql
import numpy as np
import pandas as pd
class Table(object):
def __init__(self, db, name):
self.db = db
self.name = name
conn = sql.connect(self.db)
with conn:
cur = conn.cursor()
cur.execute("PRAGMA table_info('%s')" % self.name)
... | mit | Python | |
d596bfbbfa725111fb4c0f6d4abf6789669f06de | Create sets.py | davidone/misc,davidone/misc | sets.py | sets.py | #!/usr/bin/env python2
'''
Generates automatically one array, a.
Prints an ordered list with only unique elems
'''
import random
SIZE_LIST_A = 10
a = []
def populate_arrays():
for i in range(0, SIZE_LIST_A):
a.append(random.randint(1, 100))
if __name__ == "__main__":
populate_arrays()
print "a: {:s}".f... | mit | Python | |
563b9e1f826433179a5e3c5e611d40efc8736c4a | Create Hexbin Example | altair-viz/altair,jakevdp/altair | altair/examples/hexbins.py | altair/examples/hexbins.py | """
Hexbin Chart
-----------------
This example shows a hexbin chart.
"""
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
# Size of the hexbins
size = 15
# Count of distinct x features
xFeaturesCount = 12
# Count of distinct y features
yFeaturesCount = 7
# Name of the x field
xFiel... | bsd-3-clause | Python | |
8118dc283eececdd074bac675c57975ceeba3739 | Create gateway.py | jbetsinger/HomeAutomation,jbetsinger/HomeAutomation | Gateway/gateway.py | Gateway/gateway.py | \\ This will be the Gateway.py file for the RPi Gateway
| apache-2.0 | Python | |
d9dcf34a73b4168885a02c495fb9b808a55b5c9e | Add spu debugger printer module | matthiaskramm/corepy,matthiaskramm/corepy,matthiaskramm/corepy,matthiaskramm/corepy | corepy/lib/printer/spu_debugger.py | corepy/lib/printer/spu_debugger.py | # Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... | bsd-3-clause | Python | |
2c0ce3c64720122bf2fdd80aeb2ff8359873ac83 | Test that noindex flag will only show robots metatag when set | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | municipal_finance/tests/test_analytics.py | municipal_finance/tests/test_analytics.py | from django.test import TestCase
from django.conf import settings
class TestAnalytics(TestCase):
def test_noindex_flag(self):
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
self.assertTrue('<meta name="robots" content="noindex">' not in str(response.content))
... | mit | Python | |
11dd2daf7dd125e0be6a604dd22ae25efed16226 | Update at 2017-07-20 14-05-11 | amoshyc/tthl-code | test.py | test.py | import json
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
from keras.models import Sequential, Model
from keras.pr... | apache-2.0 | Python | |
0c76fa59e77786c577f0750c65f97d24eb3c4157 | Test script | hyperlex/vdcnn | test.py | test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import os
import time
import datetime
import tables
from sklearn.metrics import f1_score,confusion_matrix
# ===================== Preparation des données =============================
# Load data
print("Loading data...")
... | mit | Python | |
77effff7ece070eabb3853ba918d40b7eb1c3de5 | Create sc.py | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | sc.py | sc.py | #!/usr/bin/env python
import soundcloud
from clize import clize, run
from subprocess import call
@clize
def sc_load(tracks='', likes='', tags='', group=''):
opts = {}
if likes:
method = 'favorites'
elif tracks or group:
method = 'tracks'
elif tags:
method = 'tracks'
o... | mit | Python | |
2055fc1eda896103931eaba5fb01238506aaac1a | Add signup in urls | gentoo/identity.gentoo.org,dastergon/identity.gentoo.org,dastergon/identity.gentoo.org,gentoo/identity.gentoo.org | urls.py | urls.py | from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from okupy.login.views import *
from okupy.user.views import *
from okupy.signup.views import *
admin.autodiscover()
urlpatterns = patterns('',
url(r'^login/$', mylogin),
url(r'^$', user),
url(r'^signup/', signup... | from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from okupy.login.views import *
from okupy.user.views import *
admin.autodiscover()
urlpatterns = patterns('',
url(r'^login/$', mylogin),
url(r'^$', user),
url(r'^admin/', include(admin.site.urls)),
)
| agpl-3.0 | Python |
d5b6299b802810748584b06242f614550155a283 | Create app.py | bmawji3/testing-my-man-bot | app.py | app.py | from flask import Flask, request
import requests
import json
import traceback
import random
import os
from urllib.parse import urlencode
from urllib.request import Request, urlopen
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def main():
# if request.method == 'POST':
# try:
# ... | mit | Python | |
4ff22a24a7d681a3c62f7d7e4fe56c0032a83370 | Improve logging | zhangwei0181/ldap-passwd-webui,jirutka/change-password | app.py | app.py | import bottle
from bottle import get, post, static_file, request, route, template
from bottle import SimpleTemplate
from configparser import ConfigParser
from ldap3 import Connection, LDAPBindError, LDAPInvalidCredentialsResult, Server
from ldap3 import AUTH_SIMPLE, SUBTREE
from os import path
@get('/')
def get_index... | import bottle
from bottle import get, post, static_file, request, route, template
from bottle import SimpleTemplate
from configparser import ConfigParser
from ldap3 import Connection, LDAPBindError, LDAPInvalidCredentialsResult, Server
from ldap3 import AUTH_SIMPLE, SUBTREE
from os import path
@get('/')
def get_index... | mit | Python |
b720ecf75634718a122c97bcff29129e321aa9b2 | Add cat.py. | lemon24/python-practice | cat.py | cat.py | """
Usage: cat.py [FILE]...
Concatenate FILE(s), or standard input, to standard output.
"""
import sys
def iter_files(paths):
for path in paths:
try:
yield open(path, 'rb')
except (IOError, OSError) as e:
print("error: {}".format(e), file=sys.stderr)
def main(argv=None):... | mit | Python | |
3b58283f613fc827e024c8d971d89c24fc2b3ed0 | Create knn.py | lingcheng99/kagge-digit-recognition | knn.py | knn.py | import numpy as np
import pandas as pd
from sklearn import metrics
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.decomposition import PCA
#Read training data and split into train and test data
data=pd.read_csv('train.csv')
data1=data.values
X=data... | mit | Python | |
1faa3c76d1c752de02149af34954ed538fe10fa1 | Add test | albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com | app/tests/test_data.py | app/tests/test_data.py | import unittest
from app import data
class TestProjects(unittest.TestCase):
def test_load(self) -> None:
projects = data.Projects.load()
self.assertNotEqual(projects.data, {})
self.assertIn('Python', projects.data)
self.assertIn('Git Browse', projects.data['Python'])
self.... | mit | Python | |
5813474651299998fb27c64c6d179a0a59bbe28c | Create otc.py | stqism/THE_KGB,KittyHawkIrc/core | otc.py | otc.py | def tick(a,b,c):
if a == 'help':
msg = '^otc {currency}, specify a 2nd currency for rates, add --last/high/low etc for that alone.'
return msg
import urllib2,json,StringIO
a = a.lower()
b = b.lower()
c = c.lower()
if b.startswith('-'):
c = b
b = 'usd'
if b =... | mit | Python | |
bf678628cf98b1c18a75f09fa15d26526ea0e3ac | Add gender choices fields | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0028_add_gender_fields.py | accelerator/migrations/0028_add_gender_fields.py | from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0027_add_gender_choices_object'),
]
operations = [
migrations.AddField(
model_name='entr... | mit | Python | |
bac06acb1e6255040f371232776f3da75fb9247a | Add data migration to populate preprint_doi_created field on existing published preprints where DOI identifier exists. Set to preprint date_published field. | baylee-d/osf.io,baylee-d/osf.io,erinspace/osf.io,cslzchen/osf.io,mattclark/osf.io,mfraezz/osf.io,cslzchen/osf.io,caseyrollins/osf.io,CenterForOpenScience/osf.io,laurenrevere/osf.io,Johnetordoff/osf.io,saradbowman/osf.io,icereval/osf.io,brianjgeiger/osf.io,felliott/osf.io,cslzchen/osf.io,TomBaxter/osf.io,felliott/osf.io... | osf/migrations/0069_auto_20171127_1119.py | osf/migrations/0069_auto_20171127_1119.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-27 17:19
from __future__ import unicode_literals
import logging
from django.db import migrations
from osf.models import PreprintService
logger = logging.getLogger(__name__)
def add_preprint_doi_created(apps, schema_editor):
"""
Data migration tha... | apache-2.0 | Python | |
167a6497d79a4a18badd5ea85a87e7eefcd02696 | Add init file to the root acceptance tests folder | telefonicaid/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin | test/acceptance/__init__.py | test/acceptance/__init__.py | # -*- coding: utf-8 -*-
"""
Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
This file is part of fiware-orion-pep
fiware-orion-pep is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either versio... | agpl-3.0 | Python | |
d290b3b2cc15a3bab907ed3847da709ab31edace | disable unpredictable tests | looker/sentry,beeftornado/sentry,jean/sentry,gencer/sentry,gencer/sentry,looker/sentry,beeftornado/sentry,jean/sentry,ifduyue/sentry,looker/sentry,beeftornado/sentry,JackDanger/sentry,gencer/sentry,mvaled/sentry,mvaled/sentry,JamesMura/sentry,jean/sentry,JamesMura/sentry,JackDanger/sentry,JamesMura/sentry,JackDanger/se... | tests/acceptance/test_api.py | tests/acceptance/test_api.py | from __future__ import absolute_import
from sentry.testutils import AcceptanceTestCase
class ApiTokensTest(AcceptanceTestCase):
def setUp(self):
super(ApiTokensTest, self).setUp()
self.user = self.create_user('foo@example.com')
self.login_as(self.user)
self.path = '/api/'
def... | from __future__ import absolute_import
from sentry.testutils import AcceptanceTestCase
class ApiTokensTest(AcceptanceTestCase):
def setUp(self):
super(ApiTokensTest, self).setUp()
self.user = self.create_user('foo@example.com')
self.login_as(self.user)
self.path = '/api/'
def... | bsd-3-clause | Python |
8fa776fd2fa63a44cb048a39fe7359ee9366c5e8 | Add basic Processor tests | Hero1378/bucky,trbs/bucky,dimrozakis/bucky,dimrozakis/bucky,ewdurbin/bucky,trbs/bucky,JoseKilo/bucky,ewdurbin/bucky,jsiembida/bucky3,JoseKilo/bucky,Hero1378/bucky | tests/003-test-processor.py | tests/003-test-processor.py | import time
import random
import multiprocessing
from functools import wraps
try:
import queue
except ImportError:
import Queue as queue
import t
import bucky.processor
import bucky.cfg as cfg
cfg.debug = True
def processor(func):
@wraps(func)
def run():
inq = multiprocessing.Queue()
... | apache-2.0 | Python | |
0b185bb6a30cb7c9b02c80051a8426dc736da3d6 | Add sample WSGI app | locke105/mclib | examples/wsgi.py | examples/wsgi.py |
import cgi
import json
from wsgiref import simple_server
import falcon
from mclib import mc_info
class MCInfo(object):
def on_get(self, req, resp):
host = req.get_param('host', required=True)
port = req.get_param_as_int('port', min=1024,
max=65565)
... | apache-2.0 | Python | |
b097075f7606563fc8ae80274e73b74dedd8129f | prepare a new folder "resources" for json files to replace python dynamic_resources | muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous | src/alfanous/Data.py | src/alfanous/Data.py | '''
Created on Jun 15, 2012
@author: assem
'''
class Configs:
pass
class Indexes:
pass
class Ressources:
pass
| agpl-3.0 | Python | |
b171eb0c77f2d68051b48145f4e49275ed6860b9 | Add tests for signup code exists method | pinax/django-user-accounts,pinax/django-user-accounts | account/tests/test_models.py | account/tests/test_models.py | from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase, override_settings
from django.contrib.auth.models import User
from account.models import SignupCode
class SignupCodeModelTestCase(TestCase):
def test_exists_no_match(self)... | mit | Python | |
f5140f87e0e4326fe189b2f5f3ff3ac90f8db5c8 | Add new heroku_worker.py to run as a Heroku worker process | mattstibbs/blockbuster-server,mattstibbs/blockbuster-server | blockbuster/heroku_worker.py | blockbuster/heroku_worker.py | import redis
from rq import Worker, Queue, Connection
import os
REDIS_URL = os.environ.get('REDIS_URL', 'redis://localhost:32769/1')
print(REDIS_URL)
listen = ['default']
conn = redis.from_url(REDIS_URL)
if __name__ == '__main__':
with Connection(conn):
worker = Worker(map(Queue, listen))
worker... | mit | Python | |
0722624244d107b19a006f07fd884d47597e4eb1 | Add utility class to filter text through external program | guillermooo/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle | lib/filter.py | lib/filter.py | from subprocess import Popen
from subprocess import PIPE
from subprocess import TimeoutExpired
import threading
from Dart import PluginLogger
from Dart.lib.plat import supress_window
_logger = PluginLogger(__name__)
class TextFilter(object):
'''Filters text through an external program (sync).
'''
def _... | bsd-3-clause | Python | |
c7da0ed13838150f0276c4c9f425390822b5b43b | Add serializers for API models. | rcutmore/vinotes-api,rcutmore/vinotes-api | vinotes/apps/api/serializers.py | vinotes/apps/api/serializers.py | from django.contrib.auth.models import User
from rest_framework import serializers
from .models import Note, Trait, Wine, Winery
class WinerySerializer(serializers.ModelSerializer):
class Meta:
model = Winery
fields = ('id', 'name')
class WineSerializer(serializers.ModelSerializer):
class Me... | unlicense | Python | |
383c67da4729886602227b715f65390427ccd8bc | Create w3_1.py | s40523239/2016fallcp_hw,s40523239/2016fallcp_hw,s40523239/2016fallcp_hw | w3_1.py | w3_1.py | print ("Hello World!")
| agpl-3.0 | Python | |
66afbaab9abe51a83d6ea9765b7b8b70d045115e | Create question2.py | pythonzhichan/DailyQuestion,pythonzhichan/DailyQuestion | dingshubo/question2.py | dingshubo/question2.py | #_*_ coding:utf-8 _*_
#!/user/bin/python
import random
number_random = random.randint(1,100)
for chance in range(5): #玩家有5次机会
number_player=input('请输入一个1-100之间的整数:')
if(number_player>number_random):
print('这个数字偏大')
elif (number_player<number_random):
print('这个数字偏小')
print('你还有%... | mit | Python | |
3189cd139b868d74caf35aa5b7a80f748f21c231 | add tool to process brian's files | akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/idep | scripts/import/import_brian_files.py | scripts/import/import_brian_files.py | import glob
import os
os.chdir("c")
for filename in glob.glob("*"):
tokens = filename.split("_")
huc12 = tokens[1]
typ = tokens[2].split(".")[1]
newfn = "/i/%s/%s/%s" % (typ, huc12, filename)
os.rename(filename, newfn) | mit | Python | |
e73b5fadbcff141fab2478954345ebaac22d8e63 | add K-means | LeoZ123/Machine-Learning-Practice | K-means/K-means.py | K-means/K-means.py | '''
Created on Apr 30, 2017
@author: Leo Zhong
'''
import numpy as np
# Function: K Means
# -------------
# K-Means is an algorithm that takes in a dataset and a constant
# k and returns k centroids (which define clusters of data in the
# dataset which are similar to one another).
def kmeans(X, k, maxIt):
... | mit | Python | |
7e17363eaf8d17f0d595ca5199e59a51c7b1df65 | Add the core social_pipeline. | WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow | oneflow/core/social_pipeline.py | oneflow/core/social_pipeline.py | # -*- coding: utf-8 -*-
u"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>.
This file is part of the 1flow project.
It provides {python,django}-social-auth pipeline helpers.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by th... | agpl-3.0 | Python | |
ee533a5e2a4eff99641383741e1cbe8e57c43e1f | add typing stub/compat package | charlievieth/GoSubl,charlievieth/GoSubl | gosubl/typing.py | gosubl/typing.py | try:
# ST builds >= 4000
from mypy_extensions import TypedDict
from typing import Any
from typing import Callable
from typing import Dict
from typing import Generator
from typing import IO
from typing import Iterable
from typing import Iterator
from typing import List
from ... | mit | Python | |
2761e3bfd8d2c8281db565e54f6e3ea687bd5663 | add backfill problem_id script | stopstalk/stopstalk-deployment,stopstalk/stopstalk-deployment,stopstalk/stopstalk-deployment,stopstalk/stopstalk-deployment,stopstalk/stopstalk-deployment | private/scripts/extras/backfill_problem_id.py | private/scripts/extras/backfill_problem_id.py | """
Copyright (c) 2015-2019 Raj Patel(raj454raj@gmail.com), StopStalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... | mit | Python | |
a3de0337f6e3511cc3381f92f7bbc384d7667dfd | Create xmas.py | sdlwdr/misc | xmas.py | xmas.py | gifts=['A Partridge in a Pear Tree', 'Two Turtle Doves, and', 'Three French Hens', 'Four Calling Birds', 'Five Golden Rings', 'Six Geese-a-Laying', 'Seven Swans-a-Swimming', 'Eight Maids-a-Milking', 'Nine Ladies Dancing', 'Ten Lords-a-Leaping', 'Eleven Pipers Piping', 'Twelve Drummers Drumming']
ordinal=['st', 'nd', 'r... | mit | Python | |
8fa4888dbf82d225f52b6df347372a0381c08237 | Add __main__.py for running python -m grip. | mgoddard-pivotal/grip,jbarreras/grip,ssundarraj/grip,mgoddard-pivotal/grip,joeyespo/grip,ssundarraj/grip,jbarreras/grip,joeyespo/grip | grip/__main__.py | grip/__main__.py | """\
Grip
----
Render local readme files before sending off to Github.
:copyright: (c) 2014 by Joe Esposito.
:license: MIT, see LICENSE for more details.
"""
from command import main
if __name__ == '__main__':
main()
| mit | Python | |
95874a5e06ff70d1cbea49321549beee5cc5abba | Create an example of storing units in HDF5 | h5py/h5py,h5py/h5py,h5py/h5py | examples/store_and_retrieve_units_example.py | examples/store_and_retrieve_units_example.py | """
Author: Daniel Berke, berke.daniel@gmail.com
Date: October 27, 2019
Requirements: h5py>=2.10.0, unyt>=v2.4.0
Notes: This short example script shows how to save unit information attached
to a `unyt_array` using `attrs` in HDF5, and recover it upon reading the file.
It uses the Unyt package (https://github.com/yt-pro... | bsd-3-clause | Python | |
4fe50fda289be7db3fb96450e713eb8f1a815026 | Add weighted linear algorithm | swarmer/autoscaler | autoscaler/server/scaling/algorithms/weighted.py | autoscaler/server/scaling/algorithms/weighted.py | import math
from autoscaler.server.request_history import RequestHistory
from autoscaler.server.scaling.utils import parse_interval
class WeightedScalingAlgorithm:
def __init__(self, algorithm_config):
self.interval_seconds = parse_interval(
algorithm_config['interval']
)
self... | mit | Python | |
ca43479fc10505b04ec8861de074f25c80c6f5e1 | add rhythm description module | jvbalen/catchy,jvbalen/catchy | rhythm_features.py | rhythm_features.py |
from __future__ import division, print_function
import os
import numpy as np
import utils
onsets_dir = ''
beats_dir = ''
def compute_and_write(data_dir, track_list=None, features=None):
"""Compute frame-based features for all audio files in a folder.
Args:
data_dir (str): where to write features... | mit | Python | |
a726625e13ac08d0b6c2c686de476b6e78bc0f48 | Add unit test for _skeleton | MichelJuillard/dlstats,mmalter/dlstats,Widukind/dlstats,MichelJuillard/dlstats,mmalter/dlstats,Widukind/dlstats,MichelJuillard/dlstats,mmalter/dlstats | dlstats/fetchers/test__skeleton.py | dlstats/fetchers/test__skeleton.py | import unittest
from datetime import datetime
from _skeleton import Dataset
class DatasetTestCase(unittest.TestCase):
def test_full_example(self):
self.assertIsInstance(Dataset(provider='Test provider',name='GDP',dataset_code='nama_gdp_fr',dimension_list=[{'name':'COUNTRY','values':[('FR','France'),('DE','... | agpl-3.0 | Python | |
e54c82c336827c1fc835837006885c245a05e5cb | Add html stripper for announcements | karenang/ivle-bot,karen/ivle-bot | html_stripper.py | html_stripper.py | from html.parser import HTMLParser
class HTMLStripper(HTMLParser):
def __init__(self):
super().__init__()
self.reset()
self.strict = False
self.convert_charrefs= True
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
retur... | mit | Python | |
20830e9fb2785eda94bf9e7c0dab70d476bc82b4 | Add `sample_settings.py` | avinassh/Reddit-GoodReads-Bot | sample_settings.py | sample_settings.py | # Rename this file to `settings.py` in deployment
# supported_subreddits = 'india'
supported_subreddits = 'india+indianbooks'
user_agent = ('Goodreads, v0.1. Gives info of the book whenever goodreads'
'link to a book is posted. (by /u/avinassh)')
scopes = ['identity', 'submit', 'privatemessages', 'read']... | mit | Python | |
638c6383acf4431c95327fd0cbdb535e115e027d | Create admin util for user management. | manylabs/flow-server,manylabs/flow-server,manylabs/flow-server | flow-admin.py | flow-admin.py | #!/usr/bin/env python
#
# To ensure you can import rhizo-server modules set PYTHONPATH
# to point to rhize-server base dir.
# E.g.
# export PYTHONPATH=/home/user/rhizo-server/
#
from optparse import OptionParser
from main.users.auth import create_user
from main.users.models ... | mit | Python | |
0da1d2edc0f2a01d90cfc7cbf2bb4d37d1cc58d9 | Add examples from JModelica User's Manual (1.17.0) | michael-okeefe/soep-sandbox | src/ast_example.py | src/ast_example.py | # Import library for path manipulations
import os.path
# Import the JModelica.org Python packages
import pymodelica
from pymodelica.compiler_wrappers import ModelicaCompiler
# Import numerical libraries
import numpy as N
import ctypes as ct
import matplotlib.pyplot as plt
# Import JPype
import jpype
... | mit | Python | |
55dd21610a2ed1befed6b4560528e8a6bf3602e2 | Define function to retrieve imgur credentials | ueg1990/imgur-cli | imgur_cli/cli.py | imgur_cli/cli.py | import argparse
import logging
import os
import imgurpython
from collections import namedtuple
logger = logging.getLogger(__name__)
def imgur_credentials():
ImgurCredentials = namedtuple('ImgurCredentials', ['client_id', 'client_secret', 'access_token', 'refresh_token', 'mashape_key'])
try:
from con... | mit | Python | |
d3ebb800c88be18861608f8b174cc652223ac67c | Add utils.py with get_options function | klpdotorg/dubdubdub,klpdotorg/dubdubdub,klpdotorg/dubdubdub,klpdotorg/dubdubdub | apps/ivrs/utils.py | apps/ivrs/utils.py | def get_options(question_number):
if question_number == 2:
return " Press 4 or 5 "
else:
return " Press 1 for Yes or 2 for No"
| mit | Python | |
2c8752cd586f6d02ce8da4bc3a79660889ed7f3f | Add some minimal testing for BandRCModel to the test suite. | cjcardinale/climlab,brian-rose/climlab,brian-rose/climlab,cjcardinale/climlab,cjcardinale/climlab | climlab/tests/test_bandrc.py | climlab/tests/test_bandrc.py | import numpy as np
import climlab
import pytest
# The fixtures are reusable pieces of code to set up the input to the tests.
# Without fixtures, we would have to do a lot of cutting and pasting
# I inferred which fixtures to use from the notebook
# Latitude-dependent grey radiation.ipynb
@pytest.fixture()
def model():... | mit | Python | |
c1ea660b72ac10fd0a2dea1416b45c6796ca5adb | add pascal voc ingest | NervanaSystems/aeon,NervanaSystems/aeon,NervanaSystems/aeon,NervanaSystems/aeon | ingest/pascal.py | ingest/pascal.py | #!/usr/bin/python
import json
import glob
import sys
import getopt
import collections
import os
from os.path import isfile, join
import xml.etree.ElementTree as et
from collections import defaultdict
# http://stackoverflow.com/questions/7684333/converting-xml-to-dictionary-using-elementtree
def etree_to_dict(t):
... | apache-2.0 | Python | |
27899a91fc6cdf73dccc7f9c5c353b05d2433c42 | add example participant client inbound drop rule for blackholing | h2020-endeavour/endeavour,h2020-endeavour/endeavour | pclnt/blackholing_test.py | pclnt/blackholing_test.py | {
"inbound": [
{
"cookie": 3,
"match": {
"eth_src": "08:00:27:89:3b:9f"
},
"action": {
"drop": 0
}
}
]
} | apache-2.0 | Python | |
cd910f95753a138e2df48a1370e666bee49ad1dd | Add py solution for 693. Binary Number with Alternating Bits | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/binary-number-with-alternating-bits.py | py/binary-number-with-alternating-bits.py | class Solution(object):
def hasAlternatingBits(self, n):
"""
:type n: int
:rtype: bool
"""
power_2 = (n ^ (n >> 1)) + 1
return (power_2 & -power_2) == power_2
| apache-2.0 | Python | |
b34c0ec439a997705799136e56a926649bd93e52 | add new function to test whether an object is completely within the bounds of an image | danforthcenter/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,stiphyMT/plantcv | plantcv/plantcv/within_frame.py | plantcv/plantcv/within_frame.py | import cv2 as cv2
import numpy as np
def within_frame(img, obj):
'''
This function tests whether the plant object is completely in the field of view
Input:
img - an image with the bounds you are interested in
obj - a single object, preferably after calling pcv.image_composition(), that is from with... | mit | Python | |
c4040803cb670f913bc8743ee68f5a5f0721d4f8 | Add game logic | HPI-Hackathon/cartets,HPI-Hackathon/cartets,HPI-Hackathon/cartets | backend/game.py | backend/game.py | # All game related code
import json
import random
class Game():
def __init__(self):
self.players = {}
self.turn = None
self.running = False
def add_player(self, conn, data):
player = Player(conn, data)
self.players[player.get_name()] = player
conn.send(json.du... | mit | Python | |
69e22c778a576f746784270fa9971a6399433f92 | Add docstring to UnivariateFilter. | Myasuka/scikit-learn,bikong2/scikit-learn,billy-inn/scikit-learn,IndraVikas/scikit-learn,thilbern/scikit-learn,ogrisel/scikit-learn,jblackburne/scikit-learn,mwv/scikit-learn,moutai/scikit-learn,quheng/scikit-learn,tosolveit/scikit-learn,tomlof/scikit-learn,macks22/scikit-learn,krez13/scikit-learn,shangwuhencc/scikit-le... | examples/plot_feature_selection.py | examples/plot_feature_selection.py | """
===============================
Univariate Feature Selection
===============================
An example showing univariate feature selection.
Noisy (non informative) features are added to the iris data and
univariate feature selection is applied. For each feature, we plot the
p-values for the univariate feature s... | """
===============================
Univariate Feature Selection
===============================
An example showing univariate feature selection.
Noisy (non informative) features are added to the iris data and
univariate feature selection is applied. For each feature, we plot the
p-values for the univariate feature s... | bsd-3-clause | Python |
1beec05941a6a34452bea6e9f60a1673c0f0925f | add base test case file | isotoma/KeenClient-Python,keenlabs/KeenClient-Python,ruleant/KeenClient-Python | keen/tests/base_test_case.py | keen/tests/base_test_case.py | __author__ = 'dkador'
| mit | Python | |
1fa849f1a0eadad9573b677d3904986d76f900eb | Create main.py | mindm/2017Challenges,erocs/2017Challenges,popcornanachronism/2017Challenges,mindm/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,erocs/2017Challenges,popcornanachronism/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges... | challenge_2/python/wost/main.py | challenge_2/python/wost/main.py | """
Python 3.6:
:: Counts all the instances of all the elements in a list.
:: Returns all the instances with a count of 1.
"""
def find_one_in_list(a_list):
a_dict = {}
for char in a_list:
if char not in a_dict.keys():
a_dict[char] = 1
else:
a_dict[char] += 1
for letter in a_dict.... | mit | Python | |
ac4679b4dcbbc3b2a29230233afc138f98cf2c42 | Add the basics | wurstmineberg/python-anvil | anvil.py | anvil.py | import gzip
import io
import nbt.nbt
import pathlib
import re
import zlib
class Region:
def __init__(self, path):
if isinstance(path, str):
path = pathlib.Path(path)
with path.open('rb') as f:
data = f.read()
self.locations = data[:4096]
self.timestam... | mit | Python | |
702abe6dc661fbcda04f743edc56d2938098cefa | Add checkJSON file function only for checking a JSON file against a specified schema | jimwaldo/HarvardX-Tools,jimwaldo/HarvardX-Tools | src/main/python/convertfiles/checkJSON.py | src/main/python/convertfiles/checkJSON.py | #!/nfs/projects/c/ci3_jwaldo/MONGO/bin/python
"""
This function will check an existing JSON newline delimited file
against a specified schema
Input is a newline delimited JSON file and schema file
Output is a summary printout of statistics
Usage:
python checkJSON [-options]
OPTIONS:
--input Name of input filename (r... | bsd-3-clause | Python | |
7330f9f1423fe7ee169569957d537441b6d72c08 | Create 0106_us_city_synonyms.py | boisvert42/npr-puzzle-python | 2019/0106_us_city_synonyms.py | 2019/0106_us_city_synonyms.py | #%%
"""
NPR 2019-01-06
https://www.npr.org/2019/01/06/682575357/sunday-puzzle-stuck-in-the-middle
Name a major U.S. city in 10 letters. If you have the right one, you can rearrange its letters to get two 5-letter words that are synonyms. What are they?
"""
import sys
sys.path.append('..')
import nprcommontools as nct... | cc0-1.0 | Python | |
2f08053dc04470c9a1e4802e0e90c198bb5eae63 | Update app/views/account/__init__.py | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | app/views/account/__init__.py | app/views/account/__init__.py | from flask import Blueprint
account = Blueprint(
'account',
__name__
)
from . import views
| mit | Python | |
5470661c6f171f1e9da609c3bf67ece21cf6d6eb | Add example for response status code | timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug | examples/return_400.py | examples/return_400.py | import hug
from falcon import HTTP_400
@hug.get()
def only_positive(positive: int, response):
if positive < 0:
response.status = HTTP_400 | mit | Python | |
450f55f158bdec4b290851d68b8b79bd824d50f6 | Add the joystick test | Pitchless/arceye,Pitchless/arceye | bin/joy_test.py | bin/joy_test.py | #!/usr/bin/env python
from __future__ import print_function
import pygame
# Define some colors
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
# This is a simple class that will help us print to the screen
# It has nothing to do with the joysticks, just outputing the
# information.
class TextPrint:
def _... | apache-2.0 | Python | |
34f44cd57baf9f0a548d728e90ca0c67f47b08a1 | Add tests for Resource | soccermetrics/soccermetrics-client-py | tests/test_resource.py | tests/test_resource.py | import unittest
import soccermetrics
from soccermetrics import __api_version__
from soccermetrics.rest import SoccermetricsRestClient
from soccermetrics.rest.resource import Resource
class ResourceTest(unittest.TestCase):
def setUp(self):
base_url = "http://api-summary.soccermetrics.net"
auth = d... | mit | Python | |
0b0d77ca77cf5359175836d68fc0bcce3829d731 | Create change_config.py | GluuFederation/community-edition-setup,GluuFederation/community-edition-setup,GluuFederation/community-edition-setup | static/scripts/change_hostname/change_config.py | static/scripts/change_hostname/change_config.py | import os, sys
from change_gluu_host import Installer, FakeRemote, ChangeGluuHostname
name_changer = ChangeGluuHostname(
old_host='<current_hostname>',
new_host='<new_hostname>',
cert_city='<city>',
cert_mail='<email>',
cert_state='<state_or_region>',
cert_country='<country>',
server='<actu... | mit | Python | |
3cb39bc8be7fdf857ebbdd2f78cbb617b2dda104 | Create PowofTwo_003.py | Chasego/codi,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/cod,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/codirit,cc13ny/algo,Chasego/cod,cc13ny/Allin,Chasego/cod,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/cod,cc13ny/Allin,cc... | leetcode/231-Power-of-Two/PowofTwo_003.py | leetcode/231-Power-of-Two/PowofTwo_003.py | class Solution:
# @param {integer} n
# @return {boolean}
def isPowerOfTwo(self, n):
return n > 0 and (n & n - 1 is 0)
| mit | Python | |
3cc6edabfc0251516aa2b11a6838fe12a794967c | Duplicate sandwich | SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive | Codewars/DuplicateSandwich.py | Codewars/DuplicateSandwich.py | def duplicate_sandwich(arr):
seen = set()
for word in arr:
if word in seen:
double = word
break
seen.add(word)
i1 = -1
i2 = -1
for i,word in enumerate(arr):
if word == double:
if i1 < 0:
i1 = i
else:
... | unlicense | Python | |
edd28dc68b91af78da1a1d576fcb9dcb83ebd0c8 | Create lin_reg.py | RationalAsh/ml_scripts | lin_reg.py | lin_reg.py | #!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import square
#Mean Square error function
def costf(X, y, theta):
m = y.shape[0]
#print m
return (1.0/m)*np.sum(np.power(np.dot(X,theta) - y, 2))
#Gradient of error function
def gradientf(X, y, theta):
m = y.shape[... | mit | Python | |
dc854dc41929b027f393c7e341be51193b4ca7b9 | Create SearchinRSArr_001.py | Chasego/cod,cc13ny/algo,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/cod,Chasego/codirit,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/codi,cc13ny/Allin,Chasego/cod,Chasego/cod,Chasego/codi,Cha... | leetcode/033-Search-in-Rotated-Sorted-Array/SearchinRSArr_001.py | leetcode/033-Search-in-Rotated-Sorted-Array/SearchinRSArr_001.py | class Solution:
# @param {integer[]} nums
# @param {integer} target
# @return {integer}
def search(self, nums, target):
l, r = 0, len(nums) - 1
while l <= r:
m = (l + r) / 2
if nums[m] == target:
return m
elif nums[m] > target:... | mit | Python | |
b57c24b23fa9566178455da895ea63baf6e16ff4 | Test cases to verify parsing of bitwise encoded PIDs | corbinbs/shadetree,s-s-boika/obdlib,QualiApps/obdlib,QualiApps/obdlib,s-s-boika/obdlib | tests/scanner_tests.py | tests/scanner_tests.py | from shadetree.obd.scanner import decode_bitwise_pids
DURANGO_SUPPORTED_PIDS_RESPONSE = 'BE 3E B8 10 '
JETTA_DIESEL_SUPPORTED_PIDS_RESPONSE = '98 3B 80 19 '
def test_decode_bitwise_pids_durango():
"""
Verify we correctly parse information about supported PIDs on a 1999 Dodge Durango
"""
supported... | mit | Python | |
7a9bb7d412ccfa4921dc691232c1192bbb2789cd | Add rudimentary swarming service. | benschmaus/catapult,benschmaus/catapult,catapult-project/catapult-csm,sahiljain/catapult,sahiljain/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult-csm,catapult-project/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,benschmaus/catapult,sahiljain/catapult,sahil... | dashboard/dashboard/services/swarming_service.py | dashboard/dashboard/services/swarming_service.py | # Copyright 2016 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.
"""Functions for interfacing with the Chromium Swarming Server.
The Swarming Server is a task distribution service. It can be used to kick off
a test run.
... | bsd-3-clause | Python | |
1a3839a083293200862ea21283c9c4d82a836846 | Add test for profiles. | Brown-University-Library/vivo-data-management,Brown-University-Library/vivo-data-management | tests/test_catalyst.py | tests/test_catalyst.py |
from vdm.catalyst import DisambiguationEngine
def pretty(raw):
"""
Pretty print xml.
"""
import xml.dom.minidom
xml = xml.dom.minidom.parseString(raw)
pretty = xml.toprettyxml()
return pretty
def test_profile():
#Basic info about a person.
p = [
'Josiah',
'Carberr... | mit | Python | |
15b69945a209515c236d8ed788e824a895ef6859 | Create uvcontinuum.py | tiffanyhsyu/XMPs | xmps/color_selection/uvcontinuum.py | xmps/color_selection/uvcontinuum.py | bsd-3-clause | Python | ||
ba60687fec047ed94bf7bb76dcf8bcf485c705ec | Add script to repair member relations between organizations and packages. | etalab/etalab-ckan-scripts | repair_organizations_members.py | repair_organizations_members.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Etalab-CKAN-Scripts -- Various scripts that handle Etalab datasets in CKAN repository
# By: Emmanuel Raviart <emmanuel@raviart.com>
#
# Copyright (C) 2013 Emmanuel Raviart
# http://github.com/etalab/etalab-ckan-scripts
#
# This file is part of Etalab-CKAN-Scripts.
#
# ... | agpl-3.0 | Python | |
c6f09446076677e5a3af8fda8c7fbbb73885234f | Add Custom Filter Design demo | rclement/yodel,rclement/yodel | demo/custom_filter_design.py | demo/custom_filter_design.py | import yodel.analysis
import yodel.filter
import yodel.complex
import yodel.conversion
import matplotlib.pyplot as plt
def frequency_response(response):
size = len(response)
freq_response_real = [0] * size
freq_response_imag = [0] * size
fft = yodel.analysis.FFT(size)
fft.forward(response, freq_re... | mit | Python | |
4826764c24fca8204322f88adfde75968b3985ee | add wrapper to start bucky from source tree | trbs/bucky,JoseKilo/bucky,CollabNet/puppet-bucky,MrSecure/bucky2,ewdurbin/bucky,Hero1378/bucky,ewdurbin/bucky,dimrozakis/bucky,trbs/bucky,MrSecure/bucky2,jsiembida/bucky3,CollabNet/puppet-bucky,dimrozakis/bucky,CollabNet/puppet-bucky,JoseKilo/bucky,Hero1378/bucky,CollabNet/puppet-bucky | bucky.py | bucky.py | #!/usr/bin/env python
import bucky.main
if __name__ == '__main__':
bucky.main.main()
| apache-2.0 | Python | |
c757c6ad714afb393c65c1b82bca31de357332fc | Add test coverage for utility module | lresende/toree-gateway,lresende/toree-gateway | python/util_test.py | python/util_test.py | #
# (C) Copyright IBM Corp. 2017
#
# 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 writi... | apache-2.0 | Python | |
8ee2f2b4c3a0ac40c6b7582a2cf3724f30f41dae | Add data migration | shapiromatron/amy,shapiromatron/amy,vahtras/amy,pbanaszkiewicz/amy,pbanaszkiewicz/amy,pbanaszkiewicz/amy,wking/swc-amy,wking/swc-amy,vahtras/amy,shapiromatron/amy,swcarpentry/amy,swcarpentry/amy,wking/swc-amy,wking/swc-amy,swcarpentry/amy,vahtras/amy | workshops/migrations/0035_auto_20150107_1205.py | workshops/migrations/0035_auto_20150107_1205.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def copy_project_to_tags(apps, schema_editor):
Event = apps.get_model('workshops', 'Event')
for event in Event.objects.all().exclude(project=None):
tag = event.project
print('add {} to {}'... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('workshops', '0034_auto_20150107_1200'),
]
operations = [
migrations.RenameModel(
old_name='Project',
... | mit | Python |
3ba67bf461f2f35f549cc2ac5c85dd1bfb39cfa4 | Add a collection of tests around move_or_merge.py | artefactual/archivematica,artefactual/archivematica,artefactual/archivematica,artefactual/archivematica | src/MCPClient/tests/test_move_or_merge.py | src/MCPClient/tests/test_move_or_merge.py | # -*- encoding: utf-8
import pytest
from .move_or_merge import move_or_merge
def test_move_or_merge_when_dst_doesnt_exist(tmpdir):
src = tmpdir.join("src.txt")
dst = tmpdir.join("dst.txt")
src.write("hello world")
move_or_merge(src=src, dst=dst)
assert not src.exists()
assert dst.exists()
... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.