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 |
|---|---|---|---|---|---|---|---|---|
f49e7463d56cce4423748db5c104775cfa485342 | add example for testing curses keys | thomasballinger/curtsies,sebastinas/curtsies,spthaolt/curtsies | examples/curses_keys.py | examples/curses_keys.py | from curtsies import Input
def main():
with Input(keynames='curses') as input_generator:
for e in input_generator:
print(repr(e))
if __name__ == '__main__':
main()
| mit | Python | |
ce6ea956e5a99875d8f3de79ca2a62ac5c7f62ff | Create predict_using_toc_mapper.py | rupendrab/py_unstr_parse | predict_using_toc_mapper.py | predict_using_toc_mapper.py | #!/usr/bin/env python3.5
import sys
import pandas as pd
import math
import re
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import preprocessing
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.metrics import classification_report, accuracy_score, ... | mit | Python | |
3fa00287ae8a5a56ea2b4d7ebcb1b2b47a0263cf | add led example | francois-berder/PyLetMeCreate | examples/led_example.py | examples/led_example.py | #!/usr/bin/env python3
"""This example flashes all LED's 10 times."""
from letmecreate.core import led
from time import sleep
led.init()
for i in range(10):
led.switch_on(led.ALL_LEDS)
sleep(0.1) # Wait 100ms
led.switch_off(led.ALL_LEDS)
sleep(0.4) # Wait 400ms
led.release()
| bsd-3-clause | Python | |
ab9a12438b5c349a248f7050c1f5dd6bf52699df | add stock debug plugin | rascul/botwot | plugins/debug.py | plugins/debug.py | """ Debug Plugin (botbot plugins.debug) """
# Copyright 2013 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | apache-2.0 | Python | |
5cce22664923165b3edf78237574e60876aca25e | Add unittests for orbit.py. | helgee/plyades | plyades/tests/test_orbit.py | plyades/tests/test_orbit.py | from __future__ import division, print_function
import unittest
import numpy as np
import plyades as pl
VALUES = {"vector": np.array([6524.834, 6862.875, 6448.296, 4.901327, 5.533756, -1.976341]),
"elements": np.array([36127.343, 0.832853, np.radians(87.870), np.radians(227.89),
... | mit | Python | |
79baa2a3e9b79a31ff3e2b51630f26dae01f1bb4 | Create recomtrend.py | parthoiiitm/recomtrend | recomtrend.py | recomtrend.py | #!/usr/bin/python
import csv, urllib, sys
nxt = 0
def get_page():
# Open the Yahoo Finance! analyst opinion section of the selected stock code
try:
stockurl = "http://finance.yahoo.com/q/ao?s="+str(sys.argv[1])+"+Analyst+Opinion"
return urllib.urlopen(stockurl).read()
except:
... | apache-2.0 | Python | |
570f565c0c96705013676505831c9bb06ecf7e56 | add reduce_mdf script | tdsmith/migrationscripts,tdsmith/migrationscripts | reduce_mdf.py | reduce_mdf.py | """Given a MTrackJ .mdf file sampled every N frames and a reduction factor R, yield the .mdf file
that would have been produced if the .mdf had originally been sampled every N/R frames."""
import codecs
import argparse
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('r', ... | bsd-3-clause | Python | |
c3fd91f58b9770929b3024cb581bed55a30a4915 | write first simple model test | byteweaver/django-posts,byteweaver/django-posts | posts/tests/models_tests.py | posts/tests/models_tests.py | from django.test import TestCase
from posts.tests.factories import PostFactory
class PostTestCase(TestCase):
def test_create_post(self):
post = PostFactory.create()
self.assertTrue(post.pk)
self.assertTrue(post.author)
self.assertTrue(post.headline)
self.assertTrue(post.sl... | bsd-3-clause | Python | |
bc83974e7de895afa57e1c705a86eddec52b739f | Add broken line example | jmerkow/VTK,biddisco/VTK,johnkit/vtk-dev,aashish24/VTK-old,jmerkow/VTK,berendkleinhaneveld/VTK,candy7393/VTK,demarle/VTK,sankhesh/VTK,aashish24/VTK-old,spthaolt/VTK,keithroe/vtkoptix,SimVascular/VTK,collects/VTK,jmerkow/VTK,SimVascular/VTK,berendkleinhaneveld/VTK,jmerkow/VTK,ashray/VTK-EVM,sankhesh/VTK,demarle/VTK,bere... | Examples/Graphics/Python/ShowBrokenLine.py | Examples/Graphics/Python/ShowBrokenLine.py | ############################################################
from vtk import *
############################################################
# Create sources
arc = vtkArcSource()
arc.SetCenter( 0, 0, 0 )
arc.SetPoint1( 1, 0, 0 )
arc.SetPoint2( -1, 0, 0 )
arc.SetResolution( 32 )
sphere = vtkSphereSource()
sphere.SetRadi... | bsd-3-clause | Python | |
538c8530dfeff063aaa5421a2fbf781727710725 | Create questions.py | Rosensweig/projects | questions.py | questions.py | """
Copyright 2015 Daniel Rosensweig
questions.py provides helper classes for quiz.py
"""
class Question:
answer = None
text = None
class Add(Question):
def __init__(self, num1, num2):
self.text = '{} + {}'.format(num1, num2)
self.answer = num1 + num2
class Subtract(Question):
... | cc0-1.0 | Python | |
d55afcc4fb9673eeb04028c6dc1e834f2cf5a389 | reformat code for partition typr | luckyharryji/smoking-modeling | smoking/format/partition.py | smoking/format/partition.py | from googleplaces import GooglePlaces, types, lang
from numpy import *
import csv
import matplotlib.pyplot as plt
from sklearn.cluster import MeanShift, estimate_bandwidth, KMeans
from sklearn.mixture import GMM
import json
from settings import place_type
def load_data(URL,type_user):
with open(URL,'rU') as f_in:... | mit | Python | |
f8514a3f06dc703f1623dc7fc5e876b04bd9741a | test conceptual circuit | cjwfuller/quantum-circuits | test_conceptual_circuit.py | test_conceptual_circuit.py | import unittest
import conceptual_circuit as cc
import gate
class TestConceptualCircuit(unittest.TestCase):
def test_basic_construction(self):
c = cc.ConceptualCircuit(1, 5)
def test_circuit_construction_size(self):
c = cc.ConceptualCircuit(1, 5)
num_basis = 2
num_steps = 5
... | mit | Python | |
66fb118b7cef67bbe29e46c21d6c19ff9c4fc348 | Create rain_t_h4.py | MiketheChap/weather | rain_t_h4.py | rain_t_h4.py | #!/usr/bin/env python
#!/usr/bin/python
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# 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... | mit | Python | |
3ba250f43ac4ef1252bed1a21f01793141666376 | Add utils.py and get_directory_name | artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history | src/dashboard/src/contrib/utils.py | src/dashboard/src/contrib/utils.py | def get_directory_name(directory):
"""
Expected format:
%sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/
"""
import re
try:
return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w]{4}){3}-[\w]{12}[/]{0,1}$', directory).group('directory')
exce... | agpl-3.0 | Python | |
0460c3fedd9ca7a3d00eba649871ba8dcb6e8576 | Add sidecar args and command | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/scheduler/spawners/templates/sidecar.py | polyaxon/scheduler/spawners/templates/sidecar.py | from django.conf import settings
def get_sidecar_args(pod_id):
return [pod_id,
"--log_sleep_interval={}".format(settings.JOB_SIDECAR_LOG_SLEEP_INTERVAL),
"--persist=true"]
def get_sidecar_command(app_label):
if app_label == settings.APP_LABELS_JOB:
return ["python3", "polyaxo... | apache-2.0 | Python | |
87e8d128fcd944c265c06bc82d8947fcdbb2c360 | Revert "Revert "Add string representation of organizer object"" | benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2017 | pyconcz_2016/team/models.py | pyconcz_2016/team/models.py | from django.db import models
class Organizer(models.Model):
full_name = models.CharField(max_length=200)
email = models.EmailField(
default='', blank=True,
help_text="This is private")
twitter = models.CharField(max_length=255, blank=True)
github = models.CharField(max_length=255, blan... | from django.db import models
class Organizer(models.Model):
full_name = models.CharField(max_length=200)
email = models.EmailField(
default='', blank=True,
help_text="This is private")
twitter = models.CharField(max_length=255, blank=True)
github = models.CharField(max_length=255, blan... | mit | Python |
fbb58a089c247eb6d25843604090314a0c50d9a9 | Create arthmetic.py | JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking | hacker_rank/python/introduction/arthmetic.py | hacker_rank/python/introduction/arthmetic.py | # Enter your code here. Read input from STDIN. Print output to STDOUT
a = int (raw_input())
b = int (raw_input())
print a + b
print a - b
print a * b
| mit | Python | |
41c075a33a02069ffcb83eb6ab574cdbe20dbfe9 | Create config.py | SeerLabs/PDFMEF,SeerLabs/PDFMEF,SeerLabs/PDFMEF,SeerLabs/PDFMEF | src/extractor/csxextract/config.py | src/extractor/csxextract/config.py | import os
# URL to Grobid service
GROBID_HOST = 'http://localhost:8070'
# Path to PDFBox jar
PDF_BOX_JAR = os.path.expanduser('/home/krutarth/Desktop/pdfmef/pdfmef_ke/pdfmef-ke/resources/pdfbox-app-2.0.7.jar')
# Path to ParsCit perl script for extraction
PARSCIT_PATH = os.path.expanduser('/home/krutarth/bin/ParsCit-... | apache-2.0 | Python | |
61ef0739b8cede7bf87076f41fa1a2395ff52da2 | Add Japanese stop words. (#2549) | aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/spaCy,honnibal/spaCy,recognai/spaCy,explosion/spaCy,honnibal/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/s... | spacy/lang/ja/stop_words.py | spacy/lang/ja/stop_words.py | # coding: utf8
from __future__ import unicode_literals
# This list was created by taking the top 2000 words from a Wikipedia dump and
# filtering out everything that wasn't hiragana. ー (one) was also added.
# Considered keeping some non-hiragana words but too many place names were
# present.
STOP_WORDS = set("""
あ あっ ... | mit | Python | |
344105c2b067bbb92ae38127ea4d50f00aa607ec | Define virtual dom. | soasme/riotpy | riot/virtual_dom.py | riot/virtual_dom.py | # -*- coding: utf-8 -*-
from uuid import uuid4
from pyquery import PyQuery
from .observable import Observable
TAG_IMPL = {}
VDOM = {}
def new_tag(impl, root, opts, inner_html):
tag = Observable()
tag.uuid = uuid4()
tag.impl = impl
tag.conf = {
'root': root,
'opts': opts
}
retu... | mit | Python | |
f1dfd112509da09c429d37496e103a3638d6cf5b | Add Frauchiger-Renner implementation in Qiskit. | dlyongemallo/quantum-computation,dlyongemallo/quantum-computation,dlyongemallo/quantum-computation | qiskit/frauchiger-renner.py | qiskit/frauchiger-renner.py | #!/usr/bin/env python3
"""Implementation of the Frauchiger-Renner thought experiment.
"""
from qiskit import(
QuantumCircuit,
QuantumRegister,
ClassicalRegister,
execute, IBMQ, Aer)
from qiskit.providers.ibmq import least_busy
from qiskit.providers.ibmq.job.exceptions import IBMQJobFailureError
import... | apache-2.0 | Python | |
2d0f45cd3c31be8ff87498c18a0acbd41e778e49 | add test for transformer latex | ipython/ipython,ipython/ipython | tests/test_transformers.py | tests/test_transformers.py | import io
import nose.tools as nt
from nose.tools import nottest
from converters import latex_transformer
lt = latex_transformer.LatexTransformer()
lt.enabled = True
@nottest
def test_space(input, reference):
nt.assert_equal(lt.remove_math_space(input),reference)
def test_evens():
references = [
... | bsd-3-clause | Python | |
e9fe49f04c23580755f3c828e01fcdd4ddb9385f | Add auto now fields to intern models | n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb | intern/migrations/0038_auto_20190525_2221.py | intern/migrations/0038_auto_20190525_2221.py | # Generated by Django 2.2.1 on 2019-05-25 20:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('intern', '0037_auto_20190525_2142'),
]
operations = [
migrations.AlterField(
model_name='date',
name='created',
... | mit | Python | |
e6fee5c2149b9f81a6dfa050d51ee6f7bfd846b0 | make distinction between parent and container | beni55/rinohtype,brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype,beni55/rinohtype | pyte/flowable.py | pyte/flowable.py |
from .style import Style, Styled
from .unit import pt
class FlowableStyle(Style):
attributes = {'spaceAbove': 0 * pt,
'spaceBelow': 0 * pt}
def __init__(self, name, base=None, **attributes):
super().__init__(name, base=base, **attributes)
class Flowable(Styled):
style_class =... |
from .style import Style, Styled
from .unit import pt
class FlowableStyle(Style):
attributes = {'spaceAbove': 0 * pt,
'spaceBelow': 0 * pt}
def __init__(self, name, base=None, **attributes):
super().__init__(name, base=base, **attributes)
class Flowable(Styled):
style_class =... | agpl-3.0 | Python |
6cf334ef031303810867bb6eb5ddac0a739cbeba | split a protobuf via a user supplied partition function | acg/lwpb,acg/lwpb,acg/lwpb,acg/lwpb | python/pbpart.py | python/pbpart.py | #!/usr/bin/env python
'''
pbpart - partition a protobuf record stream into multiple files
'''
import sys
import getopt
import lwpb
import lwpb.stream
import lwpb.codec
import percent.stream
def shift(L): e = L[0] ; del L[0:1] ; return e
def main():
key = None
typename = ""
begincode = None
mapcode = Non... | apache-2.0 | Python | |
be7ca05f045cd623e9ff13ca84a45695d9f3f1d6 | add picar class with initialize, drive forward, drive backward, drive forward right & left and drive backward right & left. Add driver code as well This meets mvp | jwarshaw/RaspberryDrive | run_py_car.py | run_py_car.py | import RPi.GPIO as GPIO
from time import sleep
def PiCar(object):
def __init__():
GPIO.setmode(GPIO.BOARD)
self.pins = {'left' : 11,
'right' : 18,
'forward' : 12,
'backward' : 16 }
for pin_number in self.pins.itervalues... | mit | Python | |
81aeecab52692bd3aac3a8adc13f68f784727813 | add parma test stub | cosmolab/cosmogenic | cosmogenic/tests/test_parma.py | cosmogenic/tests/test_parma.py | import unittest
import numpy as np
from cosmogenic import parma
from TestBase import TestBase
class TestParma(TestBase):
def setUp(self):
pass
if __name__ == "__main__":
unittest.main()
| bsd-2-clause | Python | |
cb7d3031ccbee64739331082b65fe0ba51ab887b | Add wavfile.py to read and write basic .wav files. | scipy/scipy-svn,scipy/scipy-svn,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,scipy/scipy-svn,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor | Lib/io/wavfile.py | Lib/io/wavfile.py | import numpy
import struct
# assumes file pointer is immediately
# after the 'fmt ' id
def _read_fmt_chunk(fid):
res = struct.unpack('lhHLLHH',fid.read(20))
size, comp, noc, rate, sbytes, ba, bits = res
if (comp != 1 or size > 16):
print "Warning: unfamiliar format bytes..."
if (size>16):... | bsd-3-clause | Python | |
418a5c3e31f81936b76b6d5fac77755e652c59ee | add script aggregating raw data | hawkrobe/couzin_replication,hawkrobe/couzin_replication,hawkrobe/couzin_replication,hawkrobe/couzin_replication,hawkrobe/couzin_replication,hawkrobe/couzin_replication | data/experiment1/aggregate_games.py | data/experiment1/aggregate_games.py | import sys
import csv
sys.path.append("../utils/")
from game_utils import *
data_dir = './'
games = []
games += get_games(data_dir, 'experiment-exploratory-2016')
games += get_games(data_dir, 'experiment-confirmatory-2016')
raw_data = []
for data_dir in games :
for game in os.listdir(data_dir + '/games'):
... | mit | Python | |
7eed2d5bef1a41f6b0030a43ca5edc8dd7278faa | Add fcidump test | gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf | tools/test/test_fcidump.py | tools/test/test_fcidump.py | #!/usr/bin/env python
import unittest
import tempfile
from functools import reduce
import numpy
from pyscf import gto, scf, ao2mo
from pyscf.tools import fcidump
mol = gto.Mole()
mol.atom = '''
N 0.0000000000 0.0000000000 0.0000000000
N 0.0000000000 0.0000000000 1.0977000000
'''
mol.basis = 'sto-... | apache-2.0 | Python | |
568da96838abe4d0fbc4428255997b1baeaa010f | Make the app installable so the project can find it | markpasc/make-a-face,markpasc/make-a-face | makeaface/setup.py | makeaface/setup.py | from setuptools import setup
setup(
name='makeaface',
version='1.0',
packages=['makeaface'],
include_package_data=True,
)
| mit | Python | |
a8948ea3cea1c58fab8437d4b3474f4d3d6fefae | add surface dataset | sunshineDrizzle/FreeROI,BNUCNL/FreeROI,BNUCNL/FreeROI,sunshineDrizzle/FreeROI | froi/core/hemidataset.py | froi/core/hemidataset.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
class Hemidataset:
def __init__(self):
self.surfs = {}
# Init the dataset, not sure if it's proper
self.surflist = ['white', 'pial', 'inflated', 'flated']
for i in self.surflist:
self.surfs.update({i: ''})
def add_sur... | bsd-3-clause | Python | |
9d6a0ee96fc2b79433abe36be4f1b39011f421e4 | add new tool shed script | kellrott/docker-galaxy-stable,afgane/docker-galaxy-stable,bgruening/docker-galaxy-stable,bgruening/docker-galaxy-stable,afgane/docker-galaxy-stable,afgane/docker-galaxy-stable,chambm/docker-galaxy-stable,chambm/docker-galaxy-stable,bgruening/docker-galaxy-stable,chambm/docker-galaxy-stable,kellrott/docker-galaxy-stable... | galaxy/add_tool_shed.py | galaxy/add_tool_shed.py | #!/usr/bin/env python
import os
import argparse
import xml.etree.ElementTree as ET
TOOL_SHEDS_XML = os.path.join(os.environ['GALAXY_ROOT'], "config/tool_sheds_conf.xml")
TOOL_SHEDS_XML_SAMPLE = TOOL_SHEDS_XML + '.sample'
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Add new Tool Shed t... | mit | Python | |
c0c6d5f54e97de609629ec51516e731b967101e6 | add mapomatic to admin; barebones for now | sbnoemi/django-mapomatic | mapomatic/admin.py | mapomatic/admin.py | from django.contrib import admin
from mapomatic.models import MapPoint
admin.site.register(MapPoint) | bsd-3-clause | Python | |
1f4df8f2d31ed91769761568b33f4de21ea63525 | Add an example client.tac. | flowroute/txjason | examples/client.tac | examples/client.tac | from twisted.application import service
from twisted.internet import defer, endpoints, reactor
from txjason.netstring import JSONRPCClientFactory
from txjason.client import JSONRPCClientError
from txjason.service import JSONRPCClientService
@defer.inlineCallbacks
def main():
try:
r = yield clientService.c... | mit | Python | |
7eac6c3d6d1b5f902c18025f8c43e943244506c0 | Create quotations.py | abhisaxena5694/my-website | quotations.py | quotations.py | <!DOCTYPE html>
<html>
<head>
<title> Inspiring Quotations</title>
<head>
<body>
<p>These are some quotations by few of the most influential people-</p>
<ol>
<li>Michael Jordan-</li>
<blockquote>I’ve missed more than 9000 shots in my career.
I’ve lost almost 300 games. 26 times I’ve ... | mit | Python | |
488b57c0ab52511acd62e0a39fa63d25e85c3b97 | Add new migration | jwarren116/RoadTrip,jwarren116/RoadTrip,jwarren116/RoadTrip | planner/migrations/0004_auto_20150616_1926.py | planner/migrations/0004_auto_20150616_1926.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('planner', '0003_auto_20150614_2058'),
]
operations = [
migrations.AlterField(
model_name='waypoint',
... | apache-2.0 | Python | |
7cd38cc3b051f3dd15105ac8664c4fb355b59a3d | Add autoreload to ipython | spapanik/configuration,spapanik/configuration | .ipython/profile_default/startup/98-autoreload.py | .ipython/profile_default/startup/98-autoreload.py | get_ipython().run_line_magic('load_ext', 'autoreload')
| mit | Python | |
c9ddb5075e5157ddecaea5b1a975700faabdfb4b | Add smoke test for attendance excel export | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | tests/api/test_committee_meeting_attendance_excel_export.py | tests/api/test_committee_meeting_attendance_excel_export.py | from tests import PMGTestCase
from tests.fixtures import dbfixture, CommitteeMeetingData
class TestCommitteeMeetingAttendanceExcelExport(PMGTestCase):
def setUp(self):
super(TestCommitteeMeetingAttendanceExcelExport, self).setUp()
self.fx = dbfixture.data(CommitteeMeetingData)
self.fx.set... | apache-2.0 | Python | |
2dcfe6123c8c6a3698c019882098ef8947139005 | add a MNIST test | datamicroscopes/kernels,datamicroscopes/kernels,datamicroscopes/kernels | test/test_mnist.py | test/test_mnist.py | from distributions.dbg.models import bb
from microscopes.common.dataset import numpy_dataset
from microscopes.models.mixture.dp import DirichletProcess
from microscopes.kernels.gibbs import gibbs_assign
from sklearn.datasets import fetch_mldata
mnist_dataset = fetch_mldata('MNIST original')
import numpy as np
import ... | bsd-3-clause | Python | |
853d3c0d5f6e364dfce4d11c4b1ba5db5a71c9c7 | add entry point for server | webkom/Webkomsnap,webkom/Webkomsnap | run_server.py | run_server.py | from src import server
if __name__ == "__main__":
server.app.run()
| mit | Python | |
68b81d4b2418da6cf80274fa540e2144a7107c2a | Support decay functions in FunctionScore query | harshmaur/elasticsearch-dsl-py,harshit298/elasticsearch-dsl-py,reflection/elasticsearch-dsl-py,f-santos/elasticsearch-dsl-py,avishai-ish-shalom/elasticsearch-dsl-py,hampsterx/elasticsearch-dsl-py,ziky90/elasticsearch-dsl-py,solarissmoke/elasticsearch-dsl-py,sangheestyle/elasticsearch-dsl-py,ngokevin/elasticsearch-dsl-p... | elasticsearch_dsl/function.py | elasticsearch_dsl/function.py | from six import add_metaclass
from .utils import DslMeta, DslBase
class ScoreFunctionMeta(DslMeta):
_classes = {}
def SF(name_or_sf, **params):
# {"script_score": {"script": "_score"}, "filter": {}}
if isinstance(name_or_sf, dict):
if params:
raise #XXX
kwargs = {}
sf ... | from six import add_metaclass
from .utils import DslMeta, DslBase
class ScoreFunctionMeta(DslMeta):
_classes = {}
def SF(name_or_sf, **params):
# {"script_score": {"script": "_score"}, "filter": {}}
if isinstance(name_or_sf, dict):
if params:
raise #XXX
kwargs = {}
sf ... | apache-2.0 | Python |
3a47515aa90f7e8ea35d06bb368452d3e5f1db21 | add live2.py by python3 | loveisbug/liveshow-sh | live2.py | live2.py | # -*- coding: utf-8 -*-
import urllib
from urllib.request import urlopen
import html.parser as h
from bs4 import BeautifulSoup
import sys
def fetchMao():
urlrequest = urlopen('https://site.douban.com/maosh/widget/events/1441569/?start=0')
# html_src = urllib.urlopen(urlrequest).read()
parser = Beautiful... | mit | Python | |
24b6269cfa411107a22b0ace2bbfa0ba6550ab74 | add mapping object to simulate module | Zsailer/epistasis,harmslab/epistasis | epistasis/simulate/mapping.py | epistasis/simulate/mapping.py | from functools import wraps
from ..mapping import EpistasisMap
from numpy import random
class DistributionException(Exception):
""""""
class SimulatedEpistasisMap(EpistasisMap):
"""Just like an epistasis map, but with extra methods
for setting epistatic coefficients
"""
def __init__(self, gpm, df=... | unlicense | Python | |
3215dd816430d51e1a9acab004412b7a007096fb | Create serialMsgs.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/GroG/serialMsgs.py | home/GroG/serialMsgs.py | ##################################
# Basic script to show how serial callbacks can
# be used to create messages
#
virtual = Runtime.start('virtual','VirtualDevice')
virtual.createVirtualSerial('COM77')
serial = Runtime.start('serial','Serial')
serial.connect('COM77')
serial.addByteListener('python')
serdata = ''
meth... | apache-2.0 | Python | |
ad44c3ad512428bee56fd9fac63ba146a88c74e0 | Add new package: ima-evm-utils (#22161) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/ima-evm-utils/package.py | var/spack/repos/builtin/packages/ima-evm-utils/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class ImaEvmUtils(AutotoolsPackage):
"""IMA/EVM control utilities."""
homepage = "https://l... | lgpl-2.1 | Python | |
cbe3528c4d54cd04b1ad08423f0131077a2440eb | Add missing sql tests | cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3 | Orange/tests/sql/test_misc.py | Orange/tests/sql/test_misc.py | """Test for miscellaneous sql queries in widgets
Please note that such use is deprecated.
"""
from Orange.data.sql.table import SqlTable
from Orange.preprocess import Discretize
from Orange.preprocess.discretize import EqualFreq
from Orange.tests.sql.base import PostgresTest
from Orange.widgets.visualize.owmosaic impo... | bsd-2-clause | Python | |
ba02a46a91bd9d61821681d65715825678de8e49 | Add test suite for checking parent_prefix | SpriteLink/NIPAP,SpriteLink/NIPAP,SpriteLink/NIPAP,bbaja42/NIPAP,plajjan/NIPAP,ettrig/NIPAP,plajjan/NIPAP,SoundGoof/NIPAP,garberg/NIPAP,fredsod/NIPAP,SoundGoof/NIPAP,SoundGoof/NIPAP,fredsod/NIPAP,fredsod/NIPAP,plajjan/NIPAP,plajjan/NIPAP,ettrig/NIPAP,bbaja42/NIPAP,bbaja42/NIPAP,garberg/NIPAP,SpriteLink/NIPAP,ettrig/NIP... | tests/nipaptest.py | tests/nipaptest.py | #!/usr/bin/env python
import logging
import unittest
import sys
sys.path.insert(0, '..')
sys.path.insert(0, '../pynipap')
import nipap.nipap
from nipap.authlib import SqliteAuth
from nipap.nipapconfig import NipapConfig
from pynipap import AuthOptions, VRF, Pool, Prefix, NipapNonExistentError, NipapDuplicateError, N... | mit | Python | |
886dcdd622e196280adc1266094357ccdd60044d | Add 'test_bugs' module. | ahawker/ulid | tests/test_bugs.py | tests/test_bugs.py | """
test_bugs
~~~~~~~~~
Tests for validating reported bugs have been fixed.
"""
from ulid import api
def test_github_issue_58():
"""
Assert that :func:`~ulid.api.from_str` can properly decode strings that
contain Base32 "translate" characters.
Base32 "translate" characters are: "iI, lL, ... | apache-2.0 | Python | |
74ac34a23f249c0817f7b3ba664b3fdde9d75548 | Add tests/test_copy.py (three failing deepcopy tests) | tkf/railgun,tkf/railgun | tests/test_copy.py | tests/test_copy.py | import copy
from test_simobj import (
BaseTestVectCalc, TestVectCalc, TestVectCalcWithCwrap,
TestVectCalcFixedShape, TestVectCalcCMemSubSet, TestVectCalcCMemObject)
class MixinCopyTest(object):
"""
Test that SimObject can be shallow-copied.
"""
copyfunc = staticmethod(copy.copy)
def ma... | mit | Python | |
6ca29e217fcb8e925f4388ec61372466fb260bb8 | Add tests for `HQAuditor` | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/tests/test_auditors.py | corehq/apps/users/tests/test_auditors.py | from django.test import TestCase
from corehq.apps.users.auditors import HQAuditor
class TestHQAudit(TestCase):
def setUp(self):
self.auditor = HQAuditor()
def test_change_context_returns_none_when_not_authenticated(self):
request = MockRequest.without_auth("test@example.com", "WebUser")
... | bsd-3-clause | Python | |
918dbac5b1db3f70097477b74721514b4db2ee6d | add initial bioconductor skeleton test | bioconda/bioconda-utils,bioconda/bioconda-utils,bioconda/bioconda-utils | test/test_bioconductor_skeleton.py | test/test_bioconductor_skeleton.py | import os
from textwrap import dedent
import subprocess as sp
import logging
import pytest
from bioconda_utils import bioconductor_skeleton
from bioconda_utils import cran_skeleton
from bioconda_utils import utils
import helpers
utils.setup_logger('bioconda_utils', 'debug')
def test_cran_write_recipe(tmpdir):
... | mit | Python | |
39dbcb4a20a3e018180708b5d64ad0d18f3bfbb9 | Create __init__.py | HTTP-APIs/hydrus,xadahiya/hydrus | hydrus/tests/__init__.py | hydrus/tests/__init__.py | mit | Python | ||
d9cc3c31e5c52345c4b1cefc458dbcaf4e48d7b7 | Create ubermod.py | jasuka/pyBot,jasuka/pyBot | modules/ubermod.py | modules/ubermod.py | def ubermod(self):
self.send_chan("I am the ubermod!")
| mit | Python | |
8bd503d5bd371a425ac426c6278afef772e598fd | Add BufferedReader test. | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tests/basics/io_buffered_reader.py | tests/basics/io_buffered_reader.py | try:
import uio as io
except ImportError:
try:
import io
except ImportError:
print('SKIP')
raise SystemExit
try:
io.BytesIO
io.BufferedReader
except AttributeError:
print('SKIP')
raise SystemExit
BUF_SZ = 4
bts = io.BytesIO()
bts.write(bytes(range(256)))
bts.seek(0... | mit | Python | |
81b1cf6973dde3ca23bbe5ac071d3decad81079a | Format code according to PEP8 | rehassachdeva/pydsa,aktech/pydsa | pydsa/sleep_sort.py | pydsa/sleep_sort.py | from time import sleep
from threading import Timer
# Sleep Sort ;)
# Complexity: O(max(input)+n)
def sleep_sort(a):
"""
Sorts the list 'a' using Sleep sort algorithm
>>> from pydsa import sleep_sort
>>> a = [3, 4, 2]
>>> sleep_sort(a)
[2, 3, 4]
"""
sleep_sort.result = []
def ad... | from time import sleep
from threading import Timer
# Sleep Sort ;)
# Complexity: O(max(input)+n)
def sleep_sort(a):
"""
Sorts the list 'a' using Sleep sort algorithm
>>> from pydsa import sleep_sort
>>> a = [3, 4, 2]
>>> sleep_sort(a)
[2, 3, 4]
"""
sleep_sort.result = []
def add1... | bsd-3-clause | Python |
817e11d87557125abdffbdcc63e9f5fda128b811 | Implement an auxiliary script | srguiwiz/nrvr-commander | dev/nrvr/diskimage/isoimageexperiment.py | dev/nrvr/diskimage/isoimageexperiment.py | #!/usr/bin/python
"""To use in developing and testing of cloning and modifying an .iso disk image.
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
Public repository - https://github.com/srguiwiz/nrvr-commander
Copyright (c) Nirvana Research 2006-2013.
Modified BSD License"""
from optparse i... | bsd-2-clause | Python | |
acd0dfa7b838a946099faffac0dfe059c572782f | add simple IPC thread ctor/dtor analyzer | amccreight/mochitest-logs | ipc-thread-leak.py | ipc-thread-leak.py | #!/usr/bin/python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import re
# Simple script to report the name of leaked threads, with the
# addition of s... | mpl-2.0 | Python | |
fc1500e404e343a85605c588d02009872e863c7e | Add class Fellow | EdwinKato/Space-Allocator,EdwinKato/Space-Allocator | src/fellow.py | src/fellow.py | from .person import Person
class Fellow(Person):
def __init__(self, first_name, last_name, person_type, wants_accomodation, person_id, has_living_space = None, has_office = None):
super(Fellow, self).__init__(first_name, last_name, person_type, wants_accomodation, person_id, has_living_space, has_office)... | mit | Python | |
938f04f1e6e390151f3b2f58ff8a49e5dd0ca7ca | Create 152-Maximum-Product-Subarray.py | Vaibhav/InterviewPrep,Vaibhav/InterviewPrep | LeetCode/Medium/152-Maximum-Product-Subarray.py | LeetCode/Medium/152-Maximum-Product-Subarray.py | class Solution(object):
def maxProduct(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
ret = nums[0]
n = len(nums)
imax = ret
imin = ret
if n == 0 or n == 1:
return ret
for i in range(1,n):
... | mit | Python | |
c2b11f8f0bdbe19aad8bbac7f7c916661b69d87e | Create pucudablas.py | Vrekrer/PycuBLAS | pucudablas.py | pucudablas.py | import ctypes, platform
# cuBLAS Library
if platform.system()=='Microsoft': libcublas = ctypes.windll.LoadLibrary('cublas.dll')
if platform.system()=='Linux': libcublas = ctypes.cdll.LoadLibrary('libcublas.so')
else: libcublas = ctypes.cdll.LoadLibrary('libcublas.so')
| bsd-3-clause | Python | |
f5c654941f8dd5eb64775d680d677993a829963c | Add script to lookup term dictionary. | zaycev/mokujin | lookupdict.py | lookupdict.py | #!/usr/bin/env python
# coding: utf-8
# Copyright (C) USC Information Sciences Institute
# Author: Vladimir M. Zaytsev <zaytsev@usc.edu>
# URL: <http://nlg.isi.edu/>
# For more information, see README.md
# For license information, see LICENSE
"""
Simple dictionary lookup script.
Finds given word in mokujin dictionary... | apache-2.0 | Python | |
b3676782d78296c3ed49bd7bc269b7e28bcd941c | Add Callback object | timeartist/ufyr | ufyr/utils/http.py | ufyr/utils/http.py | #! /usr/bin/python
import json
import requests
class Callback(object):
def __init__(self, url, method='GET', req_kwargs={}, **kwargs):
assert isinstance(url, (str, unicode))
assert isinstance(method, (str, unicode))
assert isinstance(req_kwargs, dict)
se... | unlicense | Python | |
cc1c0d386b2e657c9f1f80a0e1ac1a4375df377b | Add case-insensitive unique index for username | gpodder/mygpo-auth,gpodder/mygpo-auth | mygpoauth/login/migrations/0001_case_insensitive_username.py | mygpoauth/login/migrations/0001_case_insensitive_username.py | from django.db import migrations
class Migration(migrations.Migration):
""" Create a unique case-insensitive index on the username column """
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.RunSQL(
'CREATE UNIQUE INDEX user_case_insensitive_unique '... | agpl-3.0 | Python | |
bd7536e18ea22bc9e384db8283fd348fb514ab76 | Add management command | caneruguz/osf.io,laurenrevere/osf.io,HalcyonChimera/osf.io,sloria/osf.io,hmoco/osf.io,HalcyonChimera/osf.io,caseyrollins/osf.io,TomBaxter/osf.io,CenterForOpenScience/osf.io,Nesiehr/osf.io,pattisdr/osf.io,brianjgeiger/osf.io,crcresearch/osf.io,brianjgeiger/osf.io,sloria/osf.io,caneruguz/osf.io,mattclark/osf.io,chrisseto... | osf/management/commands/strip_trailing_subject_whitespace.py | osf/management/commands/strip_trailing_subject_whitespace.py | # -*- coding: utf-8 -*-
# This is a management command, rather than a migration script, for three primary reasons:
# 1. It makes no changes to database structure (e.g. AlterField), only database content.
# 2. It may need to be ran more than once. (Unlikely, but possible).
# 3. A reverse migration isn't possible w... | apache-2.0 | Python | |
e42eb78cb65d716dd0f3507fd57f0f45967546e3 | Create unsounded_links.py | elzilrac/scrapers | unsounded_links.py | unsounded_links.py | #!/usr/bin/python
""" Site scraper for casualvillain.com to make the comics clickable pages.
"""
from BeautifulSoup import BeautifulSoup as bs
import requests
def main():
# Scrape all the comic data. There are 9 chapters with < 150 pages each
comic = {}
for chapter in range(10):
for page in [str(x)... | mit | Python | |
e6127cffbc0f5e15991c7b8665f586a093d4329d | Add debug_glsl_generator.py | myou-engine/myou-engine | myou_bl_plugin/debug_glsl_generator.py | myou_bl_plugin/debug_glsl_generator.py | import bpy, gpu
uniform_types = {}
for k,v in gpu.__dict__.items():
if isinstance(v,int) and k.startswith('GPU_DYNAMIC_'):
uniform_types[v] = k[12:]
data_types = ['0','1i','1f','2f','3f','4f','m3','m4','4ub']
attr_types = {6: 'CD_MCOL', 5: 'CD_MTFACE', 14: 'CD_ORCO', 18: 'CD_TANGENT'}
shader = gpu.export... | mit | Python | |
175d8aa68860639ae6108368393f979f950a62f9 | add .plot submodule | QULab/sound_field_analysis-py | sofia/plot.py | sofia/plot.py | """Plotting functions
- makeMTX: Generate 3D-matrix-data
- visualize3D: Plot 3D data
"""
import numpy as _np
from vispy import app, visuals, scene
from .process import pdc
def makeMTX(Pnm, dn, Nviz=3, krIndex=1, oversize=1):
"""mtxData = makeMTX(Nviz=3, Pnm, dn, krIndex)
--------------------------------------... | mit | Python | |
ba54114c3574c2680b607442cfb17aac5dfeb9a9 | Add a snippet (Tkinter). | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/tkinter/python3/show_and_resize_image_with_pil.py | python/tkinter/python3/show_and_resize_image_with_pil.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | mit | Python | |
e55cf27307888a059943193271fef89e4e876b9a | Create sphinx_doc.py | mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets,mapattacker/cheatsheets | sphinx_doc.py | sphinx_doc.py | # 1. in cmd or terminal > sphinx-quickstart
| mit | Python | |
db4cf956d71fa5865c34d809f8a6d52330dc4274 | Add __str__ tests. | jongiddy/jute,jongiddy/jute | test/test_jute_str.py | test/test_jute_str.py | import unittest
from jute import Interface, Dynamic
class StringLike(Interface):
def __str__(self):
"""Return string representation."""
class StringTestMixin:
def get_test_object(self):
return object()
def test_str(self):
string_like = self.get_test_object()
self.asse... | mit | Python | |
7a2edea747909449b8e99d9e02cebb5610559246 | Add missing migration | dissemin/dissemin,wetneb/dissemin,wetneb/dissemin,dissemin/dissemin,dissemin/dissemin,dissemin/dissemin,dissemin/dissemin,wetneb/dissemin,wetneb/dissemin | papers/migrations/0050_rename_last_update.py | papers/migrations/0050_rename_last_update.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-11-09 11:05
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('papers', '0049_filter_future_dates'),
]
operations = [
migrations.RenameField(
... | agpl-3.0 | Python | |
0dd65c6af887c737fd87d0255a19d97e75361b40 | deploy script | grap/OpenUpgrade,Endika/OpenUpgrade,laslabs/odoo,apanju/GMIO_Odoo,bplancher/odoo,kifcaliph/odoo,apanju/odoo,Gitlab11/odoo,sadleader/odoo,cdrooom/odoo,fuhongliang/odoo,alhashash/odoo,shivam1111/odoo,tinkhaven-organization/odoo,rubencabrera/odoo,spadae22/odoo,fuhongliang/odoo,agrista/odoo-saas,CatsAndDogsbvba/odoo,lgscof... | addons/base_import_module/bin/oe_module_deploy.py | addons/base_import_module/bin/oe_module_deploy.py | #!/usr/bin/env python
import argparse
import os
import sys
import tempfile
import urllib
import urllib2
import zipfile
def deploy_module(module_path, url, login, password, db=None):
if url.endswith('/'):
url = url[:-1]
module_file = zip_module(module_path)
cookie = authenticate(url, login, password... | agpl-3.0 | Python | |
7de2f347c560923b7e702475ad1fbfd3fc515552 | add tests for OnlineVarStoreBuilder/VarStoreInstancer | fonttools/fonttools,googlefonts/fonttools | Tests/varLib/varStore_test.py | Tests/varLib/varStore_test.py | import pytest
from fontTools.varLib.models import VariationModel
from fontTools.varLib.varStore import OnlineVarStoreBuilder, VarStoreInstancer
from fontTools.ttLib.tables._f_v_a_r import Axis
@pytest.mark.parametrize(
"locations, masterValues",
[
(
[{}, {"a": 1}],
[
... | mit | Python | |
422b5c763039865d69ee15f3b95a84596ba41c77 | Apply Meta changed & field default to SiteMetadata | CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend | api/migrations/0006_alter_site_metadata_fields.py | api/migrations/0006_alter_site_metadata_fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0005_sitemetadata'),
]
operations = [
migrations.AlterModelOptions(
name='sitemetadata',
opti... | apache-2.0 | Python | |
2f450758d66e02f02c542e712a9fe587fb9626db | Add poxpdb | noxrepo/pox,MurphyMc/pox,MurphyMc/pox,MurphyMc/pox,noxrepo/pox,MurphyMc/pox,noxrepo/pox,MurphyMc/pox,noxrepo/pox | pox/misc/poxpdb.py | pox/misc/poxpdb.py | # Copyright 2018 James McCauley
#
# 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 | |
955a2a94046954f2a5f2a114183db145646ffc0d | Add libccd.py for test | jslee02/vend-products | products/libccd.py | products/libccd.py | print("This is libccd.py") | mit | Python | |
1c5f2bd553666607328ca16816db882cd5496364 | Add test case for post creation | Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger | tests/test_client.py | tests/test_client.py | from flask import url_for
from app import user_datastore
from app.models import Post
from tests.general import AppTestCase
class TestClient(AppTestCase):
def setUp(self):
super().setUp()
self.client = self.app.test_client(use_cookies=True)
# Create user and log in
user_datastore.... | mit | Python | |
5408d3543969b557bd49daf9581a5b8af3fd836d | Add custom unit test class. Add debounce unit tests. | rwhitt2049/trouve,rwhitt2049/nimble | tests/test_events.py | tests/test_events.py | import numpy as np
import numpy.testing as npt
from unittest import TestCase
from nimble import Events
class EvTestCase(TestCase):
def assertStartStops(self, events, vstarts, vstops):
npt.assert_array_equal(events._starts, vstarts)
npt.assert_array_equal(events._stops, vstops)
class TestDebounci... | mit | Python | |
aff3f5dab0d01c1b7e74adca88ba3096cb0b9106 | Test our age calculation utilities. | hello-base/web,hello-base/web,hello-base/web,hello-base/web | tests/people/test_utils.py | tests/people/test_utils.py | import datetime
from components.people.utils import calculate_age, calculate_average_age
def test_calculate_age():
birthdate = datetime.date.today() - datetime.timedelta(days=731)
target = datetime.date.today() - datetime.timedelta(days=365)
assert calculate_age(birthdate) == 2
assert calculate_age(b... | apache-2.0 | Python | |
7634f6e86fae31956d6350854acb420e0504cd29 | Add possibly useful helper | jim-minter/github3.py,christophelec/github3.py,agamdua/github3.py,balloob/github3.py,degustaf/github3.py,itsmemattchung/github3.py,h4ck3rm1k3/github3.py,wbrefvem/github3.py,krxsky/github3.py,icio/github3.py,ueg1990/github3.py,sigmavirus24/github3.py | tests/unit/helper.py | tests/unit/helper.py | import mock
import requests
import unittest
MockedSession = mock.create_autospec(requests.Session, spec_set=True)
class UnitHelper(unittest.TestCase):
# Sub-classes must assign the class to this during definition
described_class = None
# Sub-classes must also assign a dictionary to this during definitio... | bsd-3-clause | Python | |
8eebf2b7273f27d4fabf5617d6f5cc854df69494 | Test suite for publications | nestauk/gtr | tests/test_publications.py | tests/test_publications.py | import responses
import gtr
@responses.activate
def test_publication():
"Searching for publications by id works"
with open("tests/results.json") as results:
body = results.read()
responses.add(
responses.GET,
"http://gtr.rcuk.ac.uk/gtr/api/outcomes/publications/glaciers",
... | apache-2.0 | Python | |
df38453ac8ce7d72da2071490201c264a9fd7632 | Add some initial parser tests. | vrtsystems/hszinc,vrtsystems/hszinc | tests/parser_tests.py | tests/parser_tests.py | # -*- coding: utf-8 -*-
# Zinc dumping and parsing module
# (C) 2016 VRT Systems
#
# vim: set ts=4 sts=4 et tw=78 sw=4 si:
import hszinc
import datetime
# These are examples taken from http://project-haystack.org/doc/Zinc
SIMPLE_EXAMPLE='''ver:"2.0"
firstName,bday
"Jack",1973-07-23
"Jill",1975-11-15
'''
def test_si... | bsd-2-clause | Python | |
c92060df23d9cd8ba7a813a9be316bea06688d3f | Create __init__.py | telefonicaid/iotqatools,telefonicaid/iotqatools,telefonicaid/iot-qa-tools,telefonicaid/iotqatools,telefonicaid/iot-qa-tools,telefonicaid/iot-qa-tools | iotqatools/common_utils/__init__.py | iotqatools/common_utils/__init__.py | agpl-3.0 | Python | ||
7caf1988d5bf3c509f8c05c12cc3c9c6aa1ab33a | Add script for exporting values from tensorboard event file | gangchill/nip-convnet,gangchill/nip-convnet | poster/graphics/export_tensorboard_values.py | poster/graphics/export_tensorboard_values.py | """
This script has to be called with the event file as argument
The resulting values can be plotted
"""
import sys
import tensorflow as tf
CEEs = []
my_tag = "CAE/cross_entropy_error"
for e in tf.train.summary_iterator(sys.argv[1]):
for v in e.summary.value:
if v.tag == my_tag:
CEEs.append((e.... | apache-2.0 | Python | |
8718ca9efac9582822c2af34a45b6a562688c7ee | Create parse-dict.py | nevmenandr/thai-language | parse-dict.py | parse-dict.py | # coding: utf-8
__author__ = u'Татьяна'
# скрипт для парсинга словаря с сайта thai-language.com
import os, re, codecs
import json
import HTMLParser
hPrs = HTMLParser.HTMLParser()
path = u'letters\\'
files = os.listdir(u'letters')
barr = []
bdict = {}
for nomen in files:
f = codecs.open(path + nomen, 'r', 'utf-8... | cc0-1.0 | Python | |
d66645ef870c289f6553736d663408aec49fc625 | Add a script for timing test cases with resource limits. | jfeser/L2 | src/timing.py | src/timing.py | #!/usr/bin/env python3
import subprocess
# MAX_MEMORY = int(4e9) # 4 Gb
TIMEOUT = 5 * 60
testcase_names = [
"car",
"cdr",
"dupli",
"incr",
"add",
"evens",
"reverse",
"last",
"length",
"max",
"multfirst",
"multlast",
"append",
"member",
"incrs",
"zeroes"... | apache-2.0 | Python | |
c61b10ea261a1d51c1bf2644ad9b93ed0aa70099 | Print the maximum hourglass sum | arvinsim/hackerrank-solutions | all-domains/data-structures/arrays/2d-array-ds/solution.py | all-domains/data-structures/arrays/2d-array-ds/solution.py | #!/bin/python
#https://www.hackerrank.com/challenges/2d-array
# KEY INSIGHTS
# 1. Variables in list comprehensians are not encapsulated. They could shadow
# local variables if you name them the same
# 2. When looping 2-dimensional arrays, the outer loop should represent the
# y-axis while the inner loop should repres... | mit | Python | |
54ad132d9abe545d61b1af34ffe9d7f5c2822a57 | Add string permutation in python | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | strings/string_permutation/python/spicyyboi_permute_string.py | strings/string_permutation/python/spicyyboi_permute_string.py | """
Gives all permutations of a string given as user input.
Example:
Input: Please enter the string: test
Output:
t
e
te
s
ts
es
tes
t
tt
et
tet
st
tst
est
test
"""
def permute(string):
... | cc0-1.0 | Python | |
db325e8635cbe7edb20ac829038606e47dbe67f5 | add KMP string search algorthims | hongta/practice-python,hongta/practice-python | string/kmp.py | string/kmp.py |
def kmp(text, pattern):
pattern = list(pattern)
#Partial match" table
t = kmp_partial_match_table(pattern)
def kmp_shift_table(pattern):
shifts = [None] * (len(pattern) + 1)
shift = 1
for pos in range(len(pattern) + 1):
while shift < pos and pattern[pos - 1] != pattern[pos - shift - ... | mit | Python | |
7c9c15b6c6a0d21b3becbf5aefa86ed1f82cb285 | add ebuild fixture for app-admin/fleet | alunduil/etest,alunduil/etest | test_etest/test_fixtures/test_ebuilds/8b4f1dd596e641aa87aca835809043aa.py | test_etest/test_fixtures/test_ebuilds/8b4f1dd596e641aa87aca835809043aa.py | # Copyright (C) 2014 by Alex Brandt <alunduil@alunduil.com>
#
# etest is freely distributable under the terms of an MIT-style license.
# See COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_etest.test_fixtures.test_ebuilds import EBUILDS
_ = {
'uuid': '8b4f1dd59-6e64-1aa8-7aca-835809043aa'... | mit | Python | |
ac9775949297a70187fa72b99c7b78463f64c83e | add exists.py | encorehu/validators | validators/exists.py | validators/exists.py | def url_exists(target, source=None):
return False
def title_exists(target, source=None):
return False
def ip_exists(target, source=None):
return False
def domain_exists(target, source=None):
return False
def email_exists(target, source=None):
return False
def cellphone_exists(target, source=Non... | mit | Python | |
2a1301596d4fd762c38c8efd13a8085f905c8fbc | Add the py-xvfbwrapper package (#4093) | matthiasdiener/spack,mfherbst/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,krafczyk/spack,mfherbst/spack,skosukhin/spack,TheTimmy/spack,EmreAtes/spack,skosukhin/spack,krafczyk/spack,EmreAtes/spack,lgarren/spack,iulian787/spack,skosukhin/spack,LLNL/spack,matthiasdiener/spack,LLNL/spack,EmreAtes/spack,mfherbst/s... | var/spack/repos/builtin/packages/py-xvfbwrapper/package.py | var/spack/repos/builtin/packages/py-xvfbwrapper/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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 | |
9ddd02d9b7cdeac5131941685580a1ae984a2f72 | Add patch parser | pa-pyrus/ircCommander | patch.py | patch.py | # vim:fileencoding=utf-8:ts=8:et:sw=4:sts=4:tw=79
from twisted.internet.defer import Deferred, succeed
from twisted.python import log
from database import Session
from database.models import Patch
class PatchParser(object):
"""
Parser for PA patch webservice.
Retrieves the most recently cached patch an... | mit | Python | |
c275c2611643d80d275af0430c5df2a94594caf0 | Create BrowserApp app hook for CMS | mfcovington/djangocms-genome-browser,mfcovington/djangocms-genome-browser,mfcovington/djangocms-genome-browser | cms_genome_browser/cms_app.py | cms_genome_browser/cms_app.py | from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class BrowserApp(CMSApp):
name = _("Genome Browser App")
urls = ["cms_genome_browser.urls"]
app_name = "cms_genome_browser"
apphook_pool.register(BrowserApp)
| bsd-3-clause | Python | |
96d50d18aedf51d202f350093b5ff48c1fdcb727 | add leetcode Climbing Stairs | Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code | leetcode/ClimbingStairs/solution.py | leetcode/ClimbingStairs/solution.py | # -*- coding:utf-8 -*-
class Solution:
# @param n, an integer
# @return an integer
def climbStairs(self, n):
a = b = 1
n = n - 1
while n > 0:
tmp = a
a = a + b
b = tmp
n -= 1
return a
| mit | Python | |
1015225a00b37f6b2322a6ad0450079178c03d17 | Add plugin to cleanup app VCSs | f-droid/fdroidserver,f-droid/fdroidserver,f-droid/fdroidserver,f-droid/fdroidserver,f-droid/fdroidserver | examples/fdroid_clean_repos.py | examples/fdroid_clean_repos.py | #!/usr/bin/env python3
#
# an fdroid plugin for resetting app VCSs to the latest version for the metadata
import argparse
import logging
from fdroidserver import _, common, metadata
from fdserver.exeption import VCSException
fdroid_summary = 'reset app VCSs to the latest version'
def main():
parser = argparse... | agpl-3.0 | Python | |
fa054d2ad0a0514c4d46e5c37591935b5704c9b8 | Add merge_archives.py utility | llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx | utils/merge_archives.py | utils/merge_archives.py | #!/usr/bin/env python
#===----------------------------------------------------------------------===##
#
# The LLVM Compiler Infrastructure
#
# This file is dual licensed under the MIT and the University of Illinois Open
# Source Licenses. See LICENSE.TXT for details.
#
#===--------------------------... | apache-2.0 | Python | |
d3d83a20b27dd252806348a1938b6a9b43fce840 | add default config obj | moonlitlaputa/scheduler-service,moonlitlaputa/scheduler-service | scheduler_service/config.py | scheduler_service/config.py | class Config:
name = "scheduler_service"
PG_URL = "postgresql://localhost/scheduler"
MONGO_URL = "mongodb://localhost:27017"
MONGO_DB = "test"
| bsd-2-clause | Python | |
bca8855efa94f14ed08da2f1ae0f556721e8862b | Create prove.py | eeue56/make-a-murder | prove.py | prove.py | #!/usr/bin/python2
import subprocess as sp
from subprocess import PIPE
import os
import shutil
folder = 'sausage'
my_name = 'Robot Dog'
my_first_names = ['James', 'Robert', 'Rupe', 'Thomas']
my_second_names = ['Davies', 'Doge', 'Butcher', 'Newson']
def minimal(command):
MIN_LENGTH = 1
name = sp.check_output... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.