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 |
|---|---|---|---|---|---|---|---|---|
207bc1dd5d2377e7d9d9887816cae4da0fa2b69b | Add readtagger cli | bardin-lab/readtagger,bardin-lab/readtagger | readtagger/cli/readtagger_cli.py | readtagger/cli/readtagger_cli.py | import click
from readtagger.readtagger import TagManager
from readtagger import VERSION
def parse_file_tags(filetags):
"""
Parse list of filetags from commandline.
:param filetags: list of strings with filepath.
optionally appended by the first letter that should be used for read a... | mit | Python | |
6a84e31d29ec0d532209ab05d1ad83c672f4f445 | add test for matadd sortkey | kevalds51/sympy,hrashk/sympy,lidavidm/sympy,ChristinaZografou/sympy,sampadsaha5/sympy,beni55/sympy,Curious72/sympy,wyom/sympy,mafiya69/sympy,kumarkrishna/sympy,abhiii5459/sympy,vipulroxx/sympy,VaibhavAgarwalVA/sympy,MechCoder/sympy,lindsayad/sympy,yukoba/sympy,wyom/sympy,sunny94/temp,Vishluck/sympy,mafiya69/sympy,Curio... | sympy/matrices/expressions/tests/test_matadd.py | sympy/matrices/expressions/tests/test_matadd.py | from sympy.matrices.expressions import MatrixSymbol, MatAdd
X = MatrixSymbol('X', 2, 2)
Y = MatrixSymbol('Y', 2, 2)
def test_sort_key():
assert MatAdd(Y, X).doit().args == (X, Y)
| bsd-3-clause | Python | |
3040022f0b426b2b7fb896177af419a34fbcf843 | Create randomquicksort.py | TheAlgorithms/Python | sorts/randomquicksort.py | sorts/randomquicksort.py | from random import randint
from tempfile import TemporaryFile
import numpy as np
import math
def _inPlaceQuickSort(A,start,end):
count = 0
if start<end:
pivot=randint(start,end)
temp=A[end]
A[end]=A[pivot]
A[pivot]=temp
p,count= _inPlacePartition(A,start,end... | mit | Python | |
956c1fda8c166e5b0c9d7ea244c43205968f3cfe | add serial_loopback example | claudyus/pylibftdi | pylibftdi/examples/serial_loopback.py | pylibftdi/examples/serial_loopback.py | #!/usr/bin/python -u
"""
test serial loopback; assumes Rx and Tx are connected
Copyright (c) 2010-2013 Ben Bass <benbass@codedstructure.net>
All rights reserved.
"""
import os
import sys
import time
from pylibftdi import Device
def test_string(length):
return os.urandom(length)
class LoopbackTester(object):
... | mit | Python | |
caf8028dfbdc15d70b335260dfae6fc389c4b616 | fix #43 (error makemigrations to 1.0.0 from 0.6.1 or lower.) | dictoss/active-task-summary,dictoss/active-task-summary,dictoss/active-task-summary,dictoss/active-task-summary | ats/bigint_patch.py | ats/bigint_patch.py | """
This file is nessasary if this application upgrade from 0.6.1 or lower.
"""
from django.db import models
class BigAutoField(models.BigAutoField):
pass
| bsd-2-clause | Python | |
cd13ddd24df33e3a34cd5fc71c3ad0b352952f8b | Add __str__ to APIError exception | rkhleics/police-api-client-python | police_api/exceptions.py | police_api/exceptions.py | from requests.exceptions import HTTPError
class BaseException(Exception):
pass
class APIError(BaseException, HTTPError):
"""
The API responded with a non-200 status code.
"""
def __init__(self, http_error):
self.message = getattr(http_error, 'message', None)
self.response = geta... | from requests.exceptions import HTTPError
class BaseException(Exception):
pass
class APIError(BaseException, HTTPError):
"""
The API responded with a non-200 status code.
"""
def __init__(self, http_error):
self.message = getattr(http_error, 'message', None)
self.response = geta... | mit | Python |
b2ae340052122e43b812af1a36ae1128405f0220 | Change prelim tests | rbn920/feebb | feebb/test_sub.py | feebb/test_sub.py | from feebb import *
import matplotlib.pyplot as plt
import itertools
# Beam 1
pre = Preprocessor()
pre.load_json('ex_json/test2.json')
elems = [Element(elem) for elem in pre.elements]
print(pre.supports)
beam = Beam(elems, pre.supports)
post = Postprocessor(beam, 10)
print(max(post.interp('moment')))
print(min(post.in... | mit | Python | |
018ecf79f5235882b47d37f363f746fce271a7cd | Add fabfile to install readthedocs for development. | laplaceliu/readthedocs.org,clarkperkins/readthedocs.org,LukasBoersma/readthedocs.org,safwanrahman/readthedocs.org,agjohnson/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,dirn/readthedocs.org,stevepiercy/readthedocs.org,attakei/readthedocs-oauth,cgourlay/readthedocs.org,davidfischer/readthedocs.org,attakei/r... | fabfile-development.py | fabfile-development.py | from fabric.api import *
# Fill out USER and HOSTS configuration before running
env.user = ''
env.hosts = ['']
env.code_dir = '/home/%s/rtd/checkouts/readthedocs.org' % (env.user)
env.virtualenv = '/home/%s/rtd' % (env.user)
def install_prerequisites():
"""Install prerequisites."""
sudo("apt-get -y install p... | mit | Python | |
2fa79ad053f8af0acc121543a9ceb85cc07c2ac2 | Add step 0, which create a sample file for labelling instruction | chuajiesheng/twitter-sentiment-analysis | step_0/scripts/instructional_sampling.py | step_0/scripts/instructional_sampling.py | # coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# sc is an existing SparkContext.
from pyspark.sql import SQLContext
sqlContext = SQLContext(sc)
directory = "/Volumes/JS'S FIT/json"
datasets = sqlContext.read.json(directory)
file_count = datasets.where(datasets['verb'].isNull()).count()
assert ... | apache-2.0 | Python | |
11cf3b6a7b232eb54d7e8bf051fa7b4e3605a937 | Add local transform script | GoogleCloudDataproc/cloud-dataproc,GoogleCloudDataproc/cloud-dataproc,GoogleCloudDataproc/custom-images,GoogleCloudDataproc/custom-images,GoogleCloudDataproc/cloud-dataproc | spark-tensorflow/trainer/transform_text.py | spark-tensorflow/trainer/transform_text.py | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | apache-2.0 | Python | |
91e2c663fa454f0532b92e93fab5def34cb21b94 | UPDATE run makemigrations | semitki/semitki,semitki/semitki,semitki/semitki,semitki/semitki | api/sonetworks/migrations/0006_auto_20170216_2125.py | api/sonetworks/migrations/0006_auto_20170216_2125.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-16 21:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sonetworks', '0005_auto_20170202_2319'),
]
operati... | mit | Python | |
d269568387b622861001fdc39eeeaff03ebd9a78 | Implement class for managing formulas | peterl94/CLbundler,peterl94/CLbundler | formulamanager.py | formulamanager.py | import os
import imp
_formula_cache = {}
_default_search_path = [os.path.join(os.path.dirname(__file__), "..", "Formula")]
class FormulaManager:
@staticmethod
def _find(name, search_path=[]):
file_path = ""
for path in search_path + default_search_path:
if os.path.exists(os.path.j... | mit | Python | |
128680cdc78e155a77c5c47b343538cecd0edc4f | Create Grau.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Database/Controllers/Grau.py | backend/Database/Controllers/Grau.py | from Framework.BancoDeDados import BancoDeDados
from Database.Models.Grau import Grau as ModelGrau
class Grau(object):
def pegarGraus(self, condicao, valores):
graus = []
for grau in BancoDeDados().consultarMultiplos("SELECT * FROM grau %s" % (condicao), valores):
graus.append(ModelGrau(grau))
return gra... | mit | Python | |
91d7eddcb24fd537549832d8167e96469fdc9aa0 | add eval ms marco script | UKPLab/sentence-transformers | examples/training/ms_marco/eval_msmarco.py | examples/training/ms_marco/eval_msmarco.py | """
This script runs the evaluation of an SBERT msmarco model on the
MS MARCO dev dataset and reports different performances metrices for cossine similarity & dot-product.
Usage:
python eval_msmarco.py model_name [max_corpus_size_in_thousands]
"""
from sentence_transformers import LoggingHandler, SentenceTransformer... | apache-2.0 | Python | |
f501cd004b17dc5603f8965f2a378c1c18c1700a | Create DeterministicCache class | ranjinidas/Axelrod,ranjinidas/Axelrod,marcharper/Axelrod,marcharper/Axelrod | axelrod/determinstic_cache.py | axelrod/determinstic_cache.py | try:
from collections import UserDict
except ImportError:
from UserDict import UserDict
import dill
class DeterministicCache(UserDict):
def __init__(self, file_name=None):
UserDict.__init__(self)
self.mutable = True
self.turns = None
if file_name is not None:
s... | mit | Python | |
590915c95675355bf37604e1c9bc4de49ff46455 | Add python script to build releases for a few different compiler configurations | seqzap/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,seqzap/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,micronpn/sequanto-automation,micronpn/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,rasmus-toftdahl-olesen/sequanto-auto... | build_win_releases.py | build_win_releases.py | import sys
import subprocess
import os
from os import path
import shutil
DEVENV_8 = path.join ( os.getenv('ProgramFiles'), 'Microsoft Visual Studio 8', 'Common7', 'IDE', 'devenv.exe' )
VCEXPRESS_9 = path.join ( os.getenv('ProgramFiles'), 'Microsoft Visual Studio 9.0', 'Common7', 'IDE', 'VCExpress.exe' )
if n... | apache-2.0 | Python | |
eff79d3dc25e2cd5a296f50e051bd950e73ebf47 | Add basic sound generation (time sampling, sine wave, white noise, save to WAV file, play via afplay). | bzamecnik/tfr,bzamecnik/tfr | generate_sound.py | generate_sound.py | from scipy.io import wavfile
import numpy as np
import subprocess
from scipy.signal import hilbert, chirp
from tuning import pitch_to_freq
def sample_time(since, until, fs=44100.):
'''
Generates time sample in given interval [since; until]
with given sampling rate (fs).
'''
return np.arange(since,... | mit | Python | |
2c4adff6b9003e4fa3510ec9a35f96af63427087 | make config file for twilio api | neonbadger/DestinationUnknown,neonbadger/DestinationUnknown,neonbadger/DestinationUnknown | twilio_api.py | twilio_api.py | import io
import json
from twilio.rest import TwilioRestClient
with io.open('config_twilio_secret.json') as cred:
creds = json.load(cred)
ACCOUNT_SID = creds['ACCOUNT_SID']
AUTH_TOKEN = creds['AUTH_TOKEN']
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
def send_uber_text():
client.messages.creat... | mit | Python | |
d61d1d7e5b1ee0f36b04b724bdb9d298b341597d | Create twitterqtr.py | aerovolts/python-scripts | twitterqtr.py | twitterqtr.py | """
twitterqtr.py -- A Twitter bot that takes quotes input into Google Drive and posts them to Twitter.
"""
import tweepy
import gspread
#Twitter API Settings
CONSUMER_KEY = 'xxxxxxxxxxxx'
CONSUMER_SECRET = 'xxxxxxxxxxxx'
ACCESS_KEY = 'xxxxxxxxxxxx'
ACCESS_SECRET = 'xxxxxxxxxxxx'
auth = tweepy.OAuthHandler(CONSUMER_... | mit | Python | |
d7af31e1a7af3a3bfddaa18397fc31111a2b2a35 | Add check_babel_syntax ; see extended note | orezpraw/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,nat... | check_babel_syntax.py | check_babel_syntax.py | #!/usr/bin/python
# Copyright 2017 Dhvani Patel
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | agpl-3.0 | Python | |
97923179b300444d5c238cc6ef3c935d8ac84023 | Set new version to open Grizzly development | takeshineshiro/glance,ozamiatin/glance,cloudbau/glance,klmitch/glance,kfwang/Glance-OVA-OVF,openstack/glance,wkoathp/glance,paramite/glance,kfwang/Glance-OVA-OVF,JioCloud/glance,scripnichenko/glance,cloudbau/glance,citrix-openstack-build/glance,saeki-masaki/glance,jumpstarter-io/glance,citrix-openstack-build/glance,tak... | glance/version.py | glance/version.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# 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
... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# 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
... | apache-2.0 | Python |
e901e84a9335f6aaea2dd33d44374f20778f486d | Add google_keydump | porduna/appcomposer,go-lab/appcomposer,morelab/appcomposer,morelab/appcomposer,porduna/appcomposer,morelab/appcomposer,porduna/appcomposer,go-lab/appcomposer,morelab/appcomposer,go-lab/appcomposer,go-lab/appcomposer,porduna/appcomposer | google_keydump.py | google_keydump.py | import goslate
import json
from appcomposer import db, app
from appcomposer.models import ActiveTranslationMessage, TranslationBundle, TranslationExternalSuggestion
gs = goslate.Goslate()
DATABASE = True
LANG = 'eu'
FILE = 'langs.json'
def load():
try:
return json.load(open(FILE))
except:
p... | bsd-2-clause | Python | |
b3b1416ef02460a0bd91c593ff766ac8a169cd80 | add kipple interpreter | evuez/esolangs | kipple.py | kipple.py | """
> Push left operand onto right stack
< Push right operand onto left stack
+ Push the sum of the right operand and the topmost
item of the left stack onto the left stack
- Push the topmost left stack item minus the right operand onto the stack
? Takes only one operand; clears the left stack if its topmost item i... | unlicense | Python | |
c12d70090b47765a658a98c29fd332ca6ec057d7 | Add script for migrating tips to new teams | studio666/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,eXcomm/gratipay.com,studio666/gratipay.com,mccolgst/www.gittip.com,eXcomm/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,studio6... | bin/migrate-tips.py | bin/migrate-tips.py | from gratipay.wireup import db, env
from gratipay.models.team import Team, AlreadyMigrated
db = db(env())
slugs = db.all("""
SELECT slug
FROM teams
WHERE is_approved IS TRUE
""")
for slug in slugs:
team = Team.from_slug(slug)
try:
team.migrate_tips()
print("Migrated tips for '%... | mit | Python | |
bee0a249678000cdb457fe247d3fab834434a838 | add joint lammps/espp analysis in analyse_chain.py | pdebuyl/cg_md_polymerization,pdebuyl/cg_md_polymerization | code/analyse_chain.py | code/analyse_chain.py | #!/usr/bin/env python
import sys
import os
import os.path
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--lammps', type=str, nargs='+',
help='directories containing LAMMPS simulation files', default=[])
parser.add_argument('--espp', type=str, nargs='+',
... | bsd-3-clause | Python | |
3be9493d48f0e15ac519816b91298f18990925cf | Add i386_find_jump.py | jakkdu/idapythons | i386_find_jump.py | i386_find_jump.py | push_esp_ret = FindBinary(MinEA(), SEARCH_DOWN|SEARCH_CASE, "\x54\xc3")
if push_esp_ret != 0xffffffff:
print "push esp; ret : 0x%x" % push_esp_ret
jmp_esp = FindBinary(MinEA(), SEARCH_DOWN|SEARCH_CASE, "\xff\xe4")
if jmp_esp != 0xffffffff:
print "jmp_esp : 0x%x" % jmp_esp
call_esp = FindBinary(MinEA(), SEARCH_DOWN|S... | mit | Python | |
20fd4ecb9aba73a002e9722174c4dc73bae65c5b | add arduino switch platform | michaelarnauts/home-assistant,dmeulen/home-assistant,shaftoe/home-assistant,Duoxilian/home-assistant,teodoc/home-assistant,keerts/home-assistant,auduny/home-assistant,FreekingDean/home-assistant,tboyce1/home-assistant,GenericStudent/home-assistant,vitorespindola/home-assistant,ErykB2000/home-assistant,jamespcole/home-a... | homeassistant/components/switch/arduino.py | homeassistant/components/switch/arduino.py | """
homeassistant.components.switch.arduino
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for switching Arduino pins on and off. So fare only digital pins are
supported.
Configuration:
switch:
platform: arduino
pins:
11:
name: Fan Office
type: digital
12:
name: Light Desk
type: d... | mit | Python | |
e177fc5b998e49f8fee65ad1f4ac275308708947 | Put first file | Donutnz/RemotePiBot,Donutnz/RemotePiBot | camxy.py | camxy.py | #!/usr/bin/env python3
import socket
import picamera as pc
import time
import serial
import threading as th
import sys
import io
stp=th.Event() #Major stop flag for clean exit! Only touch if you know what you're doing.
strmlive=th.Event()
def streaminit():
sock=socket.socket()
sock.bind(("0.0.0.0",8000)) #From whe... | mit | Python | |
3624541648c0d4be9f120db805610d4c70f83890 | Add "notification" demo | pthien92/sdn,VamsikrishnaNallabothu/pox,kpengboy/pox-exercise,denovogroup/pox,denovogroup/pox,pthien92/sdn,PrincetonUniversity/pox,chenyuntc/pox,noxrepo/pox,VamsikrishnaNallabothu/pox,xAKLx/pox,kpengboy/pox-exercise,xAKLx/pox,andiwundsam/_of_normalize,kavitshah8/SDNDeveloper,waltznetworks/pox,jacobq/csci5221-viro-proje... | pox/lib/ioworker/notify_demo.py | pox/lib/ioworker/notify_demo.py | # Copyright 2013 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 | |
45c8e983604151d778365b5c3ce1d0560baca590 | Introduce child class SPI | DancingQuanta/pyusbiss | usbiss/spi.py | usbiss/spi.py |
from . import USBISS
class SPI(USBISS):
"""SPI operating mode of USBISS
"""
self.mode = None
def __init__(self, port, spi_mode=None, freq=None):
# Execute baseclass __init__
super(SPI, self).__init__(port)
# Select the SPI mode of USB-ISS's SPI operating mode
try:... | mit | Python | |
ec903799dbd99ddc198fb0ff8dec5e46a8f89c46 | put into package | mzwiessele/topslam | manifold/simulation/__init__.py | manifold/simulation/__init__.py | #===============================================================================
# Copyright (c) 2016, Max Zwiessele
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sour... | bsd-3-clause | Python | |
63b4b1dd0301686f9d14842d680a1f41eb7d0596 | Add a basic smoke test for a person view page | datamade/yournextmp-popit,openstate/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,openstate/yournextrepresentative,DemocracyClub/yournextrepresentative,neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepresentative,openstate/yournextrepresentat... | candidates/tests/test_person_view.py | candidates/tests/test_person_view.py | # Smoke tests for viewing a candidate's page
import re
from mock import patch
from django_webtest import WebTest
from .fake_popit import FakePersonCollection
@patch('candidates.popit.PopIt')
class TestPersonView(WebTest):
def test_get_tessa_jowell(self, mock_popit):
mock_popit.return_value.persons = F... | agpl-3.0 | Python | |
5674e6f2ac47abb4d0b61eb0f0874df68477f94e | Add benchmark utility script. | brendandahl/pdf.js.utils,brendandahl/pdf.js.utils,brendandahl/pdf.js.utils | bench.py | bench.py | #! /usr/bin/env python
"""\
%prog [options] <pdf>
Helper script to compare the perfomance of code changes for a PDF.
Can be run in two modes:
-stash: Compare stats of current changes and stashes them to build
a baseline.
-commits: Compare stats of two commit ids. Specify id's... | apache-2.0 | Python | |
2a35dc8835aab9471198a2e1bd32de0ad31014eb | Add integration test for receiving chunks | juruen/cavalieri,juruen/cavalieri,juruen/cavalieri,juruen/cavalieri | ci/send-test/run.py | ci/send-test/run.py | import bernhard
import socket
import struct
import time
import sys
def events(n):
events = list()
for i in range(0, n):
events.append(bernhard.Event(params={'host': "host-%i" % i,
'service' : 'service-foo',
'tags'... | mit | Python | |
b2746e533d6c411c3847bdfc07afb349126b9764 | Create change_overlays_and_take_picture.py | CaptFennec/photobooth | tests/change_overlays_and_take_picture.py | tests/change_overlays_and_take_picture.py | from picamera import PiCamera
from gpiozero import Button
from overlay_functions import *
from time import gmtime, strftime
# Tell the next overlay button what to do
def next_overlay():
global overlay
overlay = next(all_overlays)
preview_overlay(camera, overlay)
# Tell the take picture button what to do
d... | mit | Python | |
a6649e5021b9c4a80c9c47923c7dba89ccf054bc | Add demoserver from vim | jalanb/dotjab,jalanb/dotjab,jalanb/jab,jalanb/jab | src/python/vimserver.py | src/python/vimserver.py | #!/usr/bin/python
#
# Server that will accept connections from a Vim channel.
# Run this server and then in Vim you can open the channel:
# :let handle = ch_open('localhost:8765')
#
# Then Vim can send requests to the server:
# :let response = ch_sendexpr(handle, 'hello!')
#
# And you can control Vim by typing a JSON... | mit | Python | |
eae8f4bb6acab6119d31c7316ed8e8d1f18978e4 | Add browse sample | fbraem/mqweb,fbraem/mqweb,fbraem/mqweb | samples/python/message_browse.py | samples/python/message_browse.py | '''
This sample will browse messages from a queue.
MQWeb runs on localhost and is listening on port 8081.
'''
import json
import httplib
import socket
import argparse
parser = argparse.ArgumentParser(
description='MQWeb - Python sample - Browse messages from a queue',
epilog="For more information: http://www.mqwe... | mit | Python | |
c9c862a0bee2a1b314862d0ff5f6ed63de167c35 | Add test code. | djgagne/scikit-learn,mjgrav2001/scikit-learn,RachitKansal/scikit-learn,Windy-Ground/scikit-learn,xwolf12/scikit-learn,hdmetor/scikit-learn,wlamond/scikit-learn,sarahgrogan/scikit-learn,hsiaoyi0504/scikit-learn,yunfeilu/scikit-learn,nvoron23/scikit-learn,robbymeals/scikit-learn,costypetrisor/scikit-learn,ephes/scikit-le... | scikits/learn/machine/em2/yop.py | scikits/learn/machine/em2/yop.py | import numpy as np
from scipy.cluster.vq import kmeans2
from gm import GM
from gmm import GMM
from scikits.learn.machine.em import EM as OEM, GMM as OGMM, GM as OGM
def initkmeans(data, k):
# XXX: This is bogus initialization should do better (in kmean with CV)
(code, label) = kmeans2(data, data[:k], 5, minit... | bsd-3-clause | Python | |
ed2b7b8cde99e0ef2f0e414f73c1c0ab922fdd91 | add scripts to find duplicate user | HalcyonChimera/osf.io,chennan47/osf.io,alexschiller/osf.io,monikagrabowska/osf.io,mluo613/osf.io,TomHeatwole/osf.io,leb2dg/osf.io,binoculars/osf.io,zamattiac/osf.io,baylee-d/osf.io,kch8qx/osf.io,crcresearch/osf.io,RomanZWang/osf.io,DanielSBrown/osf.io,amyshi188/osf.io,acshi/osf.io,adlius/osf.io,mfraezz/osf.io,zachjanic... | scripts/get_duplicate_account.py | scripts/get_duplicate_account.py | import sys
import logging
from website.app import init_app
from website.models import User
from scripts import utils as script_utils
from modularodm import Q
from bson.son import SON
from framework.mongo import database as db
logger = logging.getLogger(__name__)
pipeline = [
{"$unwind": "$emails"},
{"$group"... | apache-2.0 | Python | |
a14f71f86b36f3dc837141c70744c2e238241862 | Add a dry-run to foreach | dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild | python/qisrc/actions/foreach.py | python/qisrc/actions/foreach.py | ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
"""Run the same command on each source project.
Example:
qisrc foreach -- git reset --hard origin/mytag
Use -- to seprate qisrc arguments from the ... | ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
"""Run the same command on each source project.
Example:
qisrc foreach -- git reset --hard origin/mytag
Use -- to seprate qisrc arguments from the ... | bsd-3-clause | Python |
069e8b3f29f3d2700c93c86668f81d67ff9299aa | add simple signature test | mehdisadeghi/saga-python,luis-rr/saga-python,luis-rr/saga-python,mehdisadeghi/saga-python,telamonian/saga-python,telamonian/saga-python,luis-rr/saga-python | tests/unittests/utils/test_signatures.py | tests/unittests/utils/test_signatures.py |
__author__ = "Andre Merzky"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
""" Unit tests for saga.utils.signatures
"""
import saga
def test_signatures () :
""" Test if signature violations are flagged """
try :
s = saga.Session ('should not accept a string')
... | mit | Python | |
ed2eaf47a5e48ecd589802173de34abfa1a3d165 | Test user account deletion | m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps | tests/services/user/test_delete_account.py | tests/services/user/test_delete_account.py | """
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from uuid import UUID
import pytest
from byceps.services.user import command_service as user_command_service
from byceps.services.user import event_service
from tests.helpers import create_user, create_user_with_deta... | bsd-3-clause | Python | |
90d4be564f73fa8641f6eec7134f02877fc252d2 | Create test_gyro_GY61.py | somchaisomph/RPI.GPIO.TH | test/test_gyro_GY61.py | test/test_gyro_GY61.py | from gadgets.navigators.gyro import GYRO_GY61
import signal
import time
def signal_handler(signal,frame):
global stop_flag
stop_flat = True
gyro = GYRO_GY61(0,0,1,2)
stop_flag = False
while not stop_flag :
direction = gyro.get_data()
x,y,z = direction
print x,y,z
| mit | Python | |
63e858d8c8a183c431409fb1c10a31faf409de90 | Create wikidata.py | fnielsen/cvrminer,fnielsen/cvrminer,fnielsen/cvrminer | cvrminer/wikidata.py | cvrminer/wikidata.py | """wikidata.
Usage:
cvrminer.wikidata cvr-to-q <cvr>
Examples:
$ python -m cvrminer.wikidata cvr-to-q 10007127
Q45576
"""
from __future__ import absolute_import, division, print_function
import requests
def cvr_to_q(cvr):
"""Convert CVR to Wikidata ID.
Parameters
----------
cvr : str or in... | apache-2.0 | Python | |
bf1b86427704e38e7655ce201d65197c912bc003 | Create DoSOCSprogram.py | bwolatz/CSCI4900,bwolatz/CSCI4900 | DoSOCSprogram.py | DoSOCSprogram.py | #!/usr/bin/env python
import subprocess;
import re;
import sys;
#Declaring the variables for the program
count = 0;
pos = 0;
results = [];
#loop to check and get all the lines of output from nomos for all the files.
for arg in sys.argv:
if(count > 0):
results.insert(pos,subprocess.check_outpu... | mit | Python | |
aaf284a1450ce2943d0e02cd0727caa330c93b59 | update a lenet example | NeuromorphicProcessorProject/snn_toolbox | snntoolbox/models/mnist_lenet.py | snntoolbox/models/mnist_lenet.py | """A example for letnet."""
from __future__ import absolute_import
from __future__ import print_function
from keras.datasets import mnist as dataset
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import AveragePooling2D, MaxPooling... | mit | Python | |
f6809e4b65c189dea60cb3cc33500faf5e7bccbf | Create HR_Recursion3.py | bluewitch/Code-Blue-Python | HR_Recursion3.py | HR_Recursion3.py | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the factorial function below.
def factorial(n):
x = 0
factorial = 1
while x != n:
x += 1
factorial = factorial * x
return(factorial)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PAT... | mit | Python | |
9a01a2179415e871dc7cdadce4419000ae822cd7 | Create Save.py | SkinnyRat/Benchmark-MNIST | ImageNet/Save.py | ImageNet/Save.py | import os, pickle
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from PIL import Image
mpl.use('Agg')
map_file = 'LABELS'
def unpickle(file):
with open(file, 'rb') as fo:
dict = pickle.load(fo)
return dict
def loadData(infile):
d = unpickle(infile)... | apache-2.0 | Python | |
18d460c4e611a0b2bb84e56a56c9bfff1db8835d | add bob ross clustering code | ajackwin/data,alf10087/data,xavierwu/data,pmk2109/data,FreeSchoolHackers/data,jjrennie/data,umby/data,Derek-Cartwright-Jr/data,jmmateo/test,xavierwu/data,Derek-Cartwright-Jr/data,rhiever/data,jjrennie/data,quevedin/data-1,SteveM49/data,linearregression/data,mikedshadow/data,rhiever/data,developer-aj/data,jmwoloso/data,... | bob-ross/cluster-paintings.py | bob-ross/cluster-paintings.py | from numpy import array
from scipy.cluster.vq import vq, kmeans, whiten
import math
# TK: Load data from file as array and assign to bobross
# Normalizes according to st.dev.
whitened = whiten(bobross)
output = kmeans(whitened,10)
print output
# Determines distance between each of 403 vectors and ea... | mit | Python | |
fdc1723e5d4769902f7896264e27a7d475f2ba1a | Add db related test steps | Galeria-Kaufhof/private-postgres-rds,Galeria-Kaufhof/private-postgres-rds,Galeria-Kaufhof/private-postgres-rds | test/features/steps/access_db.py | test/features/steps/access_db.py | #!/usr/bin/env python2
from __future__ import print_function
import logging
import time
import sys
import psycopg2
from behave import *
from contextlib import contextmanager
from cluster_under_test import *
from db_retriable import *
@when('application inserts {number} batches of test data')
def step_insert_test_data(... | mit | Python | |
cc6519915df65d28ed5fcac12a2afa9ece8feb1d | Create Generator.py | derekso1/RSA | Generator.py | Generator.py | #Key generator
import random
from Primes import *
def generator():
return random.sample(primes,2)
def primeFactors(n):
factors = []
d = 2
step = 1
while d*d <= n:
while n>1:
while n%d == 0:
factors.append(d)
n = n/d
d += step
step = 2
return factors
#following function is from
#https://en.wi... | mit | Python | |
6a559aabbdd15e6d267ed183d39eaf32a6558bf1 | add test_instance_segmentation_coco_evaluator | pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv,chainer/chainercv,yuyu2172/chainercv | tests/extensions_tests/evaluator_tests/test_instance_segmentation_coco_evaluator.py | tests/extensions_tests/evaluator_tests/test_instance_segmentation_coco_evaluator.py | import numpy as np
import unittest
import chainer
from chainer.datasets import TupleDataset
from chainer.iterators import SerialIterator
from chainer import testing
from chainercv.extensions import InstanceSegmentationCOCOEvaluator
class _InstanceSegmentationStubLink(chainer.Link):
def __init__(self, masks, la... | mit | Python | |
0d16475132f5434e2fe280e8e6400333ba5518e0 | add script that cleanups linux perf traces | squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto | cleanup_script.py | cleanup_script.py | import sys
def main():
fp = open(sys.argv[1])
for line in fp:
line = line.rstrip()
if line.startswith('\t'):
rest = line[18:]
name_addr, _, rest = rest.partition(' ')
name, _, addr = name_addr.partition('+')
line = line[:18] + name + ' ' + rest
... | mit | Python | |
7371b52b17e7ecd6fd813fb0b2d7e4a7a19889ba | Add test for get_managed_rooms | indico/indico,mvidalgarcia/indico,OmeGak/indico,pferreir/indico,DirkHoffmann/indico,mic4ael/indico,pferreir/indico,pferreir/indico,mvidalgarcia/indico,mic4ael/indico,ThiefMaster/indico,OmeGak/indico,mvidalgarcia/indico,ThiefMaster/indico,ThiefMaster/indico,DirkHoffmann/indico,indico/indico,OmeGak/indico,DirkHoffmann/in... | indico/modules/rb/operations/rooms_test.py | indico/modules/rb/operations/rooms_test.py | # This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import pytest
from indico.modules.users import User
pytest_plugins = 'indico.modules.rb.testing.fixture... | mit | Python | |
5a3778712a929393feb78ea684c10215949de0d7 | add base likelihood | huangyh09/brie,huangyh09/brie | brie/models/base_model.py | brie/models/base_model.py | import numpy as np
from scipy.stats import multinomial
def BRIE_base_lik(psi, counts, lengths):
"""Base likelihood function of BRIE model
"""
size_vect = np.array([psi, (1 - psi), 1]) * lengths
prob_vect = size_vect / np.sum(size_vect)
rv = multinomial(np.sum(counts), prob_vect)
return rv.... | apache-2.0 | Python | |
a2a70d0eda4a632c268d603cc3072ea2dfe4a212 | Add test suite with py.test | jaredleekatzman/DeepSurv | tests/test_deepsurv.py | tests/test_deepsurv.py |
import pytest
import deepsurv
from deepsurv import DeepSurv
import numpy
def generate_data(treatment_group = False):
numpy.random.seed(123)
sd = deepsurv.datasets.SimulatedData(5, num_features = 9,
treatment_group = treatment_group)
train_data = sd.generate_data(5000)
valid_data = sd.generat... | mit | Python | |
1316ed65550b47d694b870093c38fef47e88a06c | Add tests for the fix_entities parameter | rspeer/python-ftfy | tests/test_entities.py | tests/test_entities.py | from __future__ import unicode_literals
from ftfy import fix_text, fix_text_segment
from nose.tools import eq_
def test_entities():
example = '&\n<html>\n&'
eq_(fix_text(example), '&\n<html>\n&')
eq_(fix_text_segment(example), '&\n<html>\n&')
eq_(fix_text(example, fix_entities=True... | mit | Python | |
ef99851831472c75308220ca6a2ac6d14c17e150 | Add crawler for 'Spiked Math' | klette/comics,jodal/comics,datagutten/comics,datagutten/comics,klette/comics,jodal/comics,jodal/comics,datagutten/comics,klette/comics,datagutten/comics,jodal/comics | comics/crawlers/spikedmath.py | comics/crawlers/spikedmath.py | from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta
from comics.crawler.utils.lxmlparser import LxmlParser
class ComicMeta(BaseComicMeta):
name = 'Spiked Math'
language = 'en'
url = 'http://www.spikedmath.com/'
start_date = '2009-08-24'
history_capable_day... | agpl-3.0 | Python | |
5aaf3806658edd92f23fa8aace02f2ce8b0bba04 | Make migration script log correctly | alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft | do_dashboard_migration.py | do_dashboard_migration.py | from stagecraft.apps.dashboards.lib.spotlight_config_migration import (
spotlight_json, Dashboard
)
import os
import logging
import sys
import argparse
from django.conf import settings
SPOTLIGHT_CONFIG_JSON_DEFAULT = (
'../spotlight/app/support/stagecraft_stub/responses'
)
if __name__ == '__main__':
# fo... | from stagecraft.apps.dashboards.lib.spotlight_config_migration import (
spotlight_json, Dashboard
)
import os
import logging
import sys
import argparse
from django.conf import settings
SPOTLIGHT_CONFIG_JSON_DEFAULT = (
'../spotlight/app/support/stagecraft_stub/responses'
)
if __name__ == '__main__':
logg... | mit | Python |
ef6457f6cbe6c56ade9d84bce738f8ab58cd4e95 | Add test for JSON encoding `bytes` and `bytearray` | paulfurley/encryptit,paulfurley/encryptit | encryptit/tests/dump_json/test_encoder.py | encryptit/tests/dump_json/test_encoder.py | import json
from nose.tools import assert_equal
from encryptit.dump_json import OpenPGPJsonEncoder
def test_encode_bytes():
result = json.dumps(bytes(bytearray([0x01, 0x08])), cls=OpenPGPJsonEncoder)
assert_equal('{"octets": "01:08", "length": 2}', result)
def test_encode_bytearray():
result = json.du... | agpl-3.0 | Python | |
11a7bcb7580db93c40c64a8730966b129f84c35a | add a new ammonia example | allisony/pyspeckit,allisony/pyspeckit,low-sky/pyspeckit,pyspeckit/pyspeckit,e-koch/pyspeckit,bsipocz/pyspeckit,vlas-sokolov/pyspeckit,jpinedaf/pyspeckit,dinossimpson/pyspeckit,mikelum/pyspeckit,low-sky/pyspeckit,keflavich/pyspeckit,e-koch/pyspeckit,vlas-sokolov/pyspeckit,jpinedaf/pyspeckit,mikelum/pyspeckit,bsipocz/pys... | examples/ammonia_vtau_multitem_example.py | examples/ammonia_vtau_multitem_example.py | import numpy as np
import pyspeckit
from astropy import units as u
from pyspeckit.spectrum.models import ammonia_constants, ammonia
# Generate a synthetic spectrum based off of 3 NH3 lines
xarr11 = pyspeckit.units.SpectroscopicAxis(np.linspace(-30, 30, 100)*u.km/u.s,
velocity... | mit | Python | |
45022c41f1254f80738d9bba7f0c90f5e4e2ec92 | Create MergeSort.py | lingcheng99/Algorithm | MergeSort.py | MergeSort.py | def mergeSort(alist):
if len(alist)<=1:
return alist
m=len(alist)//2
left=alist[:m]
right=alist[m:]
left=mergeSort(left)
right=mergeSort(right)
print 'splitting:',left,right
return list(merge(left,right))
def merge(left,right):
i,j=0,0
result=[]
while i<len(left) and... | mit | Python | |
6cd4e1dadda93d2e8fa4ed26f3e8d83ea22292d3 | Add a simple test for the OS boot from volume api. | salv-orlando/MyRepo,josephsuh/extra-specs,usc-isi/nova,apporc/nova,takeshineshiro/nova,thomasem/nova,devendermishrajio/nova_test_latest,cloudbase/nova-virtualbox,Metaswitch/calico-nova,SUSE-Cloud/nova,gspilio/nova,citrix-openstack-build/nova,rajalokan/nova,sridevikoushik31/nova,rajalokan/nova,leilihh/nova,citrix-openst... | nova/tests/api/openstack/contrib/test_volumes.py | nova/tests/api/openstack/contrib/test_volumes.py | # Copyright 2011 Josh Durgin
# 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 a... | apache-2.0 | Python | |
df9e951694472f2f8a63a59c059c4851f6a7da6b | enable complaints | openprocurement/openprocurement.tender.openeu | openprocurement/tender/openeu/views/complaint.py | openprocurement/tender/openeu/views/complaint.py | # -*- coding: utf-8 -*-
from logging import getLogger
from openprocurement.api.views.complaint import TenderComplaintResource
from openprocurement.api.utils import opresource
LOGGER = getLogger(__name__)
@opresource(name='Tender EU Complaints',
collection_path='/tenders/{tender_id}/complaints',
... | apache-2.0 | Python | |
c9c6ea5035f40019c43b544415981eacb14fb6dd | Test debile/master/filerepo.py | opencollab/debile,lucaskanashiro/debile,mdimjasevic/debile,tcc-unb-fga/debile,mdimjasevic/debile,tcc-unb-fga/debile,opencollab/debile,lucaskanashiro/debile | tests/test_filerepo.py | tests/test_filerepo.py | from debile.master.filerepo import FileRepo, FilesAlreadyRegistered
from debile.master.dud import Dud
import unittest
import mock
class FileRepoTestCase(unittest.TestCase):
@mock.patch('debile.utils.deb822.Changes', return_value='Update package')
def setUp(self, mock):
self.filerepo = FileRepo()
... | mit | Python | |
3b501d8b3c2becbd3567b0b7d65f509e4698c59c | Add Formats | gogoair/gogo-utils | src/gogoutils/formats.py | src/gogoutils/formats.py | """Determine the generator format"""
from collections import ChainMap
DEFAULT_FORMAT = {
'domain': 'example.com',
'app': '{repo}{project}',
'dns_elb': '{repo}.{project}.{env}.{domain}',
'dns_instance': '{repo}{project}-xx.{env}.{domain}',
'iam_base': '{project}_{repo}',
'iam_user': '{project}_{... | apache-2.0 | Python | |
9d242e9e03835204aaf51a4ba51b5543146f5698 | test responses automatically | eugene-eeo/mailthon,krysros/mailthon,ashgan-dev/mailthon | tests/test_response.py | tests/test_response.py | import pytest
from mailthon.response import Response, SendmailResponse
@pytest.fixture(params=(250, 255))
def reply(request):
return (request.param, 'message')
@pytest.fixture(params=[(), {'addr': (255, 'reason')}])
def rejected(request):
return dict(request.param)
class TestResponse:
def test_ok(self... | mit | Python | |
3300d86b0d2c40d1a431c9575a1755e0e53daa44 | Add tests for reading environment variables | serverless/serverless-helpers-py | tests/test_env.py | tests/test_env.py | # -*- coding: utf-8 -*-
# MIT Licensed, Copyright (c) 2016 Ryan Scott Brown <sb@ryansb.com>
import mock
import serverless_helpers
def write_testenv(env_fname):
with open(str(env_fname), 'w') as env:
env.write('''SERVERLESS_TEST=1
SERVERLESS_STAGE=dev
# this is a comment
SERVERLESS_DATA_MODEL_STAGE=dev
SER... | mit | Python | |
e303425602e7535fb16d97a2f24a326791ef646d | Add first job module tests | igboyes/virtool,igboyes/virtool,virtool/virtool,virtool/virtool | tests/test_job.py | tests/test_job.py | import pytest
import multiprocessing
from copy import deepcopy
from pprint import pprint
import virtool.job
class TestProcessor:
def test(self, test_job):
"""
Test that the processor changes the ``_id`` field to ``job_id``.
"""
processed = virtool.job.processor(deepcopy... | mit | Python | |
2d6a24ccc28cb750ec14f2140a64d7aa0d2b988b | Create CreateWikiPage.py | ebasso/rest-client-examples,ebasso/rest-client-examples | connections/CreateWikiPage.py | connections/CreateWikiPage.py | # -*- coding: utf-8 -*-
#
# Necessary libraries:
#
# > pip install requests
#
# For documentation on Tone Analyzer:
# https://watson-api-explorer.mybluemix.net/apis/tone-analyzer-v3#!/tone/GetTone
#
import sys
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from requests.auth ... | mit | Python | |
8860cb45cbc0be048a0f87335b7a150a4d8b0b7a | Add a basic presubmit script. | bpsinc-native/src_third_party_trace-viewer,bpsinc-native/src_third_party_trace-viewer,bpsinc-native/src_third_party_trace-viewer,bpsinc-native/src_third_party_trace-viewer | PRESUBMIT.py | PRESUBMIT.py | # Copyright (c) 2012 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.
_EXCLUDED_PATHS = (
)
def _CommonChecks(input_api, output_api):
results = []
results.extend(input_api.canned_checks.PanProjectChecks(
input_api... | bsd-3-clause | Python | |
97951834d5ca5adcdae10aaafbfeb651182a73da | Create Camera.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | PyGame/Camera.py | PyGame/Camera.py | """
Name : Python Camera with PyGame
Created By : Agus Makmun (Summon Agus)
Blog : bloggersmart.net - python.web.id
License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
Documentation : https://github.com/agusmakmun/Some-Examples-of-Simple-Python-Script/
Powered ... | agpl-3.0 | Python | |
3744721471c0140a7aa0c9f72485c8d14a722c56 | Create find_earth_g.py | wannaphongcom/code-python3-blog | science/physics/find_earth_g.py | science/physics/find_earth_g.py | # คำนวณหาค่า g แรงโน้มถ่วงของโลกด้วย Python
# เขียนโดย นาย วรรณพงษ์ ภัททิยไพบูลย์
# https://python3.wannaphong.com/2016/05/หาค่าแรงโน้มถ่วงของโลก.html
from math import pow
import quantities as pq
mass = 5.9723*pow(10,24) * pq.kg
r = 6378.137*pow(10,3) * pq.meter
G = 6.673*pow(10,11) * pq.N*pq.meter**2/ (pq.kg**2)
g = G... | mit | Python | |
259abe289720ff03a0a117eef0c3780bc5adee56 | add preprocessing python script | songsense/Pregelix_Social_Graph,songsense/Pregelix_Social_Graph,songsense/Pregelix_Social_Graph,songsense/Pregelix_Social_Graph,songsense/Pregelix_Social_Graph | preprocessing/twitter_with_tags_parser.py | preprocessing/twitter_with_tags_parser.py | import os
import sys
neighborDict = {}
weightDict = {}
featureDict = {}
featureDictTotal = {}
totalFeatureDict = {}
currPath = "../twitter"
fileArray = os.listdir(currPath)
######## get totalFeature #############
for fileGraphName in fileArray:
if fileGraphName.endswith('.featnames'):
nodeNum = fileGrap... | apache-2.0 | Python | |
b008bcab5078e7ac598e743bc8f739393c62334f | Add a simple script to add a capsule header | fwupd/fwupd,hughsie/fwupd,fwupd/fwupd,hughsie/fwupd,vathpela/fwupd,vathpela/fwupd,hughsie/fwupd,vathpela/fwupd,fwupd/fwupd,vathpela/fwupd,hughsie/fwupd,fwupd/fwupd | contrib/add-capsule-header.py | contrib/add-capsule-header.py | #!/usr/bin/python3
#
# Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
#
# SPDX-License-Identifier: LGPL-2.1+
import sys
import uuid
import argparse
import struct
CAPSULE_FLAGS_PERSIST_ACROSS_RESET = 0x00010000
CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE = 0x00020000
CAPSULE_FLAGS_INITIATE_RESET = 0x00040000
def mai... | lgpl-2.1 | Python | |
15e9a32a8e375b270dd4c2cfd94fb5d98c9290f7 | Test for CASSANDRA-10392 | carlyeks/cassandra-dtest,spodkowinski/cassandra-dtest,riptano/cassandra-dtest,beobal/cassandra-dtest,carlyeks/cassandra-dtest,blerer/cassandra-dtest,krummas/cassandra-dtest,iamaleksey/cassandra-dtest,riptano/cassandra-dtest,thobbs/cassandra-dtest,bdeggleston/cassandra-dtest,iamaleksey/cassandra-dtest,snazy/cassandra-dt... | cql_tracing_test.py | cql_tracing_test.py | # coding: utf-8
import os
import subprocess
import sys
from ccmlib import common
from dtest import Tester, debug
class TestCqlTracing(Tester):
def prepare(self, create_keyspace=True, nodes=3, rf=3, protocol_version=3, jvm_args=[], **kwargs):
cluster = self.cluster
cluster.populate(nodes).start(w... | apache-2.0 | Python | |
f525d04e978c35132db6ff77f455cf22b486482f | Allow resuse-addr at http server start | floooh/fips,floooh/fips,michaKFromParis/fips,floooh/fips,michaKFromParis/fips,anthraxx/fips,mgerhardy/fips,anthraxx/fips,mgerhardy/fips,code-disaster/fips,code-disaster/fips | mod/httpserver.py | mod/httpserver.py | """wrap SimpleHTTPServer and prevent Ctrl-C stack trace output"""
import SimpleHTTPServer
import SocketServer
import log
try :
log.colored(log.GREEN, 'serving on http://localhost:8000 (Ctrl-C to quit)')
SocketServer.TCPServer.allow_reuse_address = True
httpd = SocketServer.TCPServer(('localhost', 8000), ... | """wrap SimpleHTTPServer and prevent Ctrl-C stack trace output"""
import SimpleHTTPServer
import SocketServer
import log
try :
log.colored(log.GREEN, 'serving on http://localhost:8000 (Ctrl-C to quit)')
httpd = SocketServer.TCPServer(('localhost', 8000), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.s... | mit | Python |
c23b7eaad8363fa7821df55d2a1cc25377237890 | Create core.py | thegreathippo/crispy | crispy/dice/core.py | crispy/dice/core.py | import random
class Check:
def __init__(self, bonus=0, dc=10, crit_range=20, vantage=0):
self.bonus = bonus
self.dc = dc
self.crit_range = crit_range
self.vantage = vantage
roll = [random.randint(1, 20), random.randint(1, 20)]
self._first = roll[0]
roll.sort()
self._low = roll[0]
... | mit | Python | |
2585d3fac2cedf17a5d851629f8e898d0ed6ec61 | Add forgotten table delete for table we don't need | Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela | umibukela/migrations/0014_auto_20170110_1019.py | umibukela/migrations/0014_auto_20170110_1019.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0013_auto_20161215_1252'),
]
operations = [
migrations.RemoveField(
model_name='surveysource',
... | mit | Python | |
eec00e07d8e50d260249eab6cbefc976cc184683 | Add crypto pre-submit that will add the openssl builder to the default try-bot list. | Fireblend/chromium-crosswalk,M4sse/chromium.src,M4sse/chromium.src,rogerwang/chromium,bright-sparks/chromium-spacewalk,hujiajie/pa-chromium,ChromiumWebApps/chromium,ltilve/chromium,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,dednal/chromium.src,patrickm/chromium.src,littlstar/chromium.src,mohamed--ab... | crypto/PRESUBMIT.py | crypto/PRESUBMIT.py | # Copyright (c) 2012 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.
"""Chromium presubmit script for src/net.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit ... | bsd-3-clause | Python | |
43f4e83031f2481508e07af1c38959e63c5d1e6d | add fibo.py | QuinceySun/Python,zeroonegit/python,QuinceySun/Python,zeroonegit/python | docs.python.org/fibo.py | docs.python.org/fibo.py | # Fibonacci numbers module
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print(b, end=' ')
a, b = b, a+b
print()
def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while b < n:
result.append(b)
a, b = b, a+b
... | mit | Python | |
4524729ff123a869f1d2872296c618443dcea716 | Add one test | mattstibbs/blockbuster-server,mattstibbs/blockbuster-server | tests/test_heroku_worker.py | tests/test_heroku_worker.py | def test_canary():
assert True
| mit | Python | |
24f16bbaeb0939b7c6ebef7d4bfbefb1338532d1 | Add Gmail client | johnbachman/indra,sorgerlab/belpy,jmuhlich/indra,bgyori/indra,bgyori/indra,johnbachman/indra,johnbachman/indra,jmuhlich/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,pvtodorov/indra,sorgerlab/indra,sorgerlab/indra,jmuhlich/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,johnbachman/belpy,johnbachman/belpy,... | models/rasmachine/gmail_client.py | models/rasmachine/gmail_client.py | import re
import os
import sys
import imaplib
import email
import datetime
import getpass
import base64
import shutil
def get_mailboxes(M):
res, mailboxes = M.list()
if res == 'OK':
return mailboxes
else:
return None
def select_mailbox(M, mailbox):
res, data = M.select(mailbox)
if ... | bsd-2-clause | Python | |
d5b8bacc6d901e8a705cd3db3960a1ae9e7701d2 | Create robloxlib.py | NoahCristino/robloxlib | builds/V1.0/robloxlib.py | builds/V1.0/robloxlib.py | import requests
import json
global data
import sys
import re
import os
import getpass
def checkFriends(userid1, userid2):
r = requests.get("https://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerId="+str(userid1)+"&userId="+str(userid2))
if "true" in r.text:
retur... | mit | Python | |
ecd9e9a3f97bdf9489b6dc750d736855a2c109c2 | Add tests for the setup.py hook | wlonk/python-semantic-release,relekang/python-semantic-release,jvrsantacruz/python-semantic-release,relekang/python-semantic-release,riddlesio/python-semantic-release | tests/test_setup_py_hook.py | tests/test_setup_py_hook.py | from unittest import TestCase, mock
from semantic_release import setup_hook
class SetupPyHookTests(TestCase):
@mock.patch('semantic_release.cli.main')
def test_setup_hook_should_not_call_main_if_to_few_args(self, mock_main):
setup_hook(['setup.py'])
self.assertFalse(mock_main.called)
@m... | mit | Python | |
2103df15a2467d3a037c5762dd20985dfd14d95c | Create extract_seeds.py | paolo7/prohow-crawler,paolo7/prohow-crawler | seed-generator/extract_seeds.py | seed-generator/extract_seeds.py | import os
# This python code iterates over the .ttl files generated by the crawler to generate a seeds.txt file which contains a line-separated list of URLs to visit.
# All the URLs in the seeds.txt file will be added to the seeds of the crawl if this file is found in the root folder where the crawler is run.
out = ... | mit | Python | |
15accd41656bc2ec709f658c3b42caa114aa5a9d | Add convert2tf tool | GoogleCloudPlatform/terraform-sample-tools,GoogleCloudPlatform/terraform-sample-tools,GoogleCloudPlatform/terraform-sample-tools | convert2tf.py | convert2tf.py | #! /usr/local/bin/python3
"""
Magic Modules Terraform Scripts testing(helper) tool!
Job of this script to convert .erb files to .tf files using values defined in .yaml files
## How to use this script?
1. Download this script. Make this scrpt executeable & `pip3 install termcolor`
2. run shell command `./convert2tf.... | apache-2.0 | Python | |
d9f4794e04d928cd6e6a35c03e3db266b1de4e36 | Create u2-parser.py | jshlbrd/python-drawer | u2-parser/u2-parser.py | u2-parser/u2-parser.py | # Converts Unified2 event artifacts to simple JSON file
# Primary use case is to convert Snort alerts to JSON
# Performs no error checking
#
# Josh Liburdi 2016
import unified2.parser
import argparse
import socket, struct
import json
def dec_to_ipv4(decimal):
return socket.inet_ntoa(struct.pack('!L',decimal))
def ... | apache-2.0 | Python | |
61437f8b817bc8c5430cd4d1020bb9024c041afe | Add initial checker tests | wylee/django-local-settings,PSU-OIT-ARC/django-local-settings | local_settings/tests/test_checker.py | local_settings/tests/test_checker.py | import os
import unittest
from ..checker import Checker
from ..loader import Loader
from ..types import LocalSetting
LOCAL_SETTINGS_FILE = os.path.join(os.path.dirname(__file__), 'local.cfg#test')
class TestChecker(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.checker = Checker(LOCAL_S... | mit | Python | |
38375976e4d1a9f196b52e536d05ab4811380c23 | add empty schema | globality-corp/microcosm-flask,globality-corp/microcosm-flask | microcosm_flask/generic_resources.py | microcosm_flask/generic_resources.py | from marshmallow import Schema, fields
class EmptySchema(Schema):
"""
Dummy schema for making empty requests without swagger validation errors.
"""
_ = fields.Boolean(required=True, dump_only=True)
| apache-2.0 | Python | |
47131bdda00ddc6ef6994d1f6f0098b977767174 | add solution for Pascals Triangle | zhyu/leetcode,zhyu/leetcode | src/pascalsTriangle.py | src/pascalsTriangle.py | class Solution:
# @return a list of lists of integers
def generate(self, numRows):
if numRows <= 0:
return []
res = [[1]]
for i in xrange(1, numRows):
line = [1]
for j in xrange(1, i+1):
if j == i:
line.append(1)
... | mit | Python | |
9a404afc71bd335b4345e049083b9407aee2d2ea | Add esphomelib discovery (#229) | balloob/netdisco | netdisco/discoverables/esphome.py | netdisco/discoverables/esphome.py | """Discover ESPHome devices."""
from . import MDNSDiscoverable
class Discoverable(MDNSDiscoverable):
"""Add support for discovering ESPHome devices."""
def __init__(self, nd):
super().__init__(nd, '_esphomelib._tcp.local.')
| mit | Python | |
5e48d933795cc367ba0c5c378994c1b6c5cb3fb2 | Add merge migration for hotfix 0.107.6 | Nesiehr/osf.io,Johnetordoff/osf.io,icereval/osf.io,caseyrollins/osf.io,saradbowman/osf.io,baylee-d/osf.io,chrisseto/osf.io,cslzchen/osf.io,TomBaxter/osf.io,cslzchen/osf.io,adlius/osf.io,aaxelb/osf.io,mfraezz/osf.io,chennan47/osf.io,mattclark/osf.io,HalcyonChimera/osf.io,TomBaxter/osf.io,aaxelb/osf.io,baylee-d/osf.io,ch... | osf/migrations/0023_merge_20170503_1947.py | osf/migrations/0023_merge_20170503_1947.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-04 00:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0022_auto_20170503_1818'),
('osf', '0021_retraction_date_retracted'),
]
operat... | apache-2.0 | Python | |
acd37e0663f3ebf222e654247fec6062a31e38b4 | Create parser.py | ecoh70/Essential | parser.py | parser.py | def parse(source):
parsedScript = [[]]
word = ''
prevChar = ''
inArgs = False
inList = False
inString = False
inQuote = False
for char in source:
if char == '(' and not inString and not inQuote:
parsedScript.append([])
if word:
parsedScript... | bsd-3-clause | Python | |
7a15963a81da6120a79f282dcf43e5e508d13ff5 | Add time and geo query examples | emarschner/gothub,emarschner/gothub,emarschner/gothub,emarschner/gothub | queries.py | queries.py | #!/usr/bin/env python
# Brandon Heller
#
# Run geo, time, and combined queries to get an early idea of how interactive
# this might be.
import time
from datetime import datetime
from pymongo import Connection
INPUT_DB = 'processed'
conn = Connection(slave_okay=True)
processed = conn[INPUT_DB]
def time_queries():
... | mit | Python | |
5319ad286080b5e87c96b81182d667bb6b2ff8c4 | Add files via upload | dewuem/python-bioinf | orthology/calculate-lrt-corr-all-short.py | orthology/calculate-lrt-corr-all-short.py | #!/usr/bin/python2
import sys
from scipy.stats import chisqprob
# Daniel Elsner
# calculates the likelihood ratio test
with open(sys.argv[1], "r") as fileA:
fcontent = list(fileA)
fileA.close()
switch = False
mem_0 = 0
df_0 = 0
mem_1 = 0
df_1 = 0
df = 0
p_value = 0
for lineA in fcontent:
if switch ==... | mit | Python | |
da3621c0e133413c5d81e570632c8b6729fbe8d7 | add entropy tests | Autoplectic/dit,dit/dit,dit/dit,Autoplectic/dit,Autoplectic/dit,chebee7i/dit,chebee7i/dit,chebee7i/dit,Autoplectic/dit,Autoplectic/dit,dit/dit,dit/dit,chebee7i/dit,dit/dit | dit/algorithms/tests/test_entropy.py | dit/algorithms/tests/test_entropy.py | from __future__ import division
from nose.tools import *
import numpy as np
from dit import Distribution as D, ScalarDistribution as SD
from dit.algorithms.entropy2 import entropy2 as H
def test_H1():
d = D(['H', 'T'], [1/2, 1/2])
assert_almost_equal(H(d), 1)
def test_H2():
d = D(['00', '01', '10', '11... | bsd-3-clause | Python | |
84ee9fef0bb7133bf4e761933bd054088e06ef5d | Add clio | josephl/simplio | clio.py | clio.py | from sys import argv, stdin, stdout
def clio(func):
"""
Simple command-line IO.
Function decorator that passes input, output file objects as arguments.
Determines if input and output are command-line argument file names or
STDIN and STDOUT, or mix of one of each.
"""
argc = len(argv)
i... | mit | Python | |
a8445750dcf527d1cedd1fab66c7340bca5200aa | Embed video settings file | jazzband/django-embed-video,jazzband/django-embed-video,mpachas/django-embed-video,yetty/django-embed-video,hellhovnd/django-embed-video,yetty/django-embed-video,hellhovnd/django-embed-video,mpachas/django-embed-video | embed_video/settings.py | embed_video/settings.py | from django.conf import settings
EMBED_VIDEO_BACKENDS = getattr(settings, 'EMBED_VIDEO_BACKENDS', (
'embed_video.backends.YoutubeBackend',
'embed_video.backends.VimeoBackend',
'embed_video.backends.SoundCloudBackend',
))
| mit | Python | |
95cb8eae0b2da2ad5fb85887acb6c55ab759d8ac | Create datatypes.py | rbheemana/Sqoop-Automated | code/scripts/datatypes.py | code/scripts/datatypes.py | import sys
def getColumnType(datasource,columnType,maxLen,totalDigits,totalFraction):
columnType = columnType.lower().strip()
if (datasource.lower() == "teradata"):
return mapTeradataType(columnType,maxLen,totalDigits,totalFraction)
elif (datasource.lower() == 'sqlserver'):
return mapSqlS... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.