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 |
|---|---|---|---|---|---|---|---|---|
5e67c16d06786e5ed5e74e40a2c29131ec011748 | rename app to doc | qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/domainsync/management/commands/copy_doc.py | corehq/apps/domainsync/management/commands/copy_doc.py | from couchdbkit import Database
from dimagi.utils.couch.database import get_db
from django.core.management.base import LabelCommand, CommandError
from corehq.apps.domainsync.config import DocumentTransform, save
class Command(LabelCommand):
help = "Copy any couch doc"
args = '<sourcedb> <doc_id> (<domain>)'
... | from couchdbkit import Database
from dimagi.utils.couch.database import get_db
from django.core.management.base import LabelCommand, CommandError
from corehq.apps.domainsync.config import DocumentTransform, save
class Command(LabelCommand):
help = "Copy any couch doc"
args = '<sourcedb> <doc_id> (<domain>)'
... | bsd-3-clause | Python |
bd00e5ae48c81ee96d843675d76520f9e8bcab4c | Add COAP ping script | thejdeep/CoAPthon,Tanganelli/CoAPthon,thejdeep/CoAPthon,Cereal84/CoAPthon,mcfreis/CoAPthon,Gnomjolnir/CoAPthon,Gnomjolnir/CoAPthon,Tanganelli/CoAPthon | coapping.py | coapping.py | #!/usr/bin/env python2
# COAP ping implementation
# 0x4000 0001 <--> 0x7000 0001
# 0x4000 0002 <--> 0x7000 0002
# 0x4000 0003 <--> 0x7000 0003
import socket
import struct
import sys
from time import sleep, time
from optparse import OptionParser
# Parse Options
if __name__ == '__main__':
parser = OptionParser... | mit | Python | |
e56a0ca2d788bc3b865f6d18ad42e5feadb47566 | 添加新的数据格式,增加uuid实现 | SilverBlogTeam/SilverBlog,SilverBlogTeam/SilverBlog | upgrade/upgrade_from_3.py | upgrade/upgrade_from_3.py | import hashlib
import json
import shutil
import uuid
from common import file
def add_id(list_item):
list_item["uuid"] = str(uuid.uuid4())
return list_item
def main():
shutil.copyfile("./config/page.json", "./config/page.json.bak")
page_list = json.loads(file.read_file("./config/page.json"))
pag... | bsd-3-clause | Python | |
91b8239d858d60bbcd70e17870648a87b2d6da02 | add wip installer | codyopel/dotfiles,codyopel/dotfiles,codyopel/dotfiles | local/bin/dotfiles.py | local/bin/dotfiles.py | #!/usr/bin/env python3
import os
import sys
def exec_hook(hook):
with open(hook) as f:
exec(compile(f.read(), config_file, 'exec'), globals(), locals())
#def generate_hook(dotfile):
def install_hook(dotfile, dotfilesdir):
# Fix relpath output
if dotfile.startswith('./'):
dotfile = os.path.basename(dot... | bsd-3-clause | Python | |
83041a8b132ce61910fdd0b6d9c24d020e857a04 | add test for compute_disparity_map timeout | carlodef/s2p,carlodef/s2p,mnhrdt/s2p,mnhrdt/s2p | tests/block_matching_test.py | tests/block_matching_test.py | import os
import pytest
import s2p
from tests_utils import data_path
def test_compute_disparity_map_timeout(timeout=1):
"""
Run a long call to compute_disparity_map to check that the timeout kills it.
"""
img = data_path(os.path.join("input_pair", "img_01.tif"))
disp = data_path(os.path.join("tes... | agpl-3.0 | Python | |
e8b09ed22bfe19c355b3dc315f0e831ac43f0c0d | Update code.py | mapto/sprks,mapto/sprks,mapto/sprks,mapto/sprks | code.py | code.py | import web
import json
urls = (
'/', 'index'
)
class index:
def GET(self):
db = web.database(dbn='mysql', user='user', pw='password', db='test')
table = db.select('pw_policy')
return json.dumps(table[0]) + " hello world2"
if __name__ == "__main__":
app = web.application(urls, glo... | mit | Python | |
e8bcdebaa9af0affa152a91ad489447d1cc4ba8f | Create main.py | AgneethMazumdar/powerpoint-maker | main.py | main.py | # Released under MIT License
# Created By Agneeth Mazumdar
from PIL import Image
from pptx import Presentation
from pptx.util import Inches
import urllib
import os
import csv
prs = Presentation()
def read_csv():
names = []
urls = []
with open('your_csv_file_here.csv', 'rb') as names_images_data:
... | mit | Python | |
e2955477f8d3dde879ecdd8f8f75f438a8905661 | Add dots.py | joseph346/dots,jaredmichaelsmith/dots-1,nullx002/dots | dots.py | dots.py | import sys
RIGHT = 0
LEFT = 0
INC = 2
DEC = 3
LOOP_START = 4
LOOP_END = 5
GETC = 6
PUTC = 7
def compile_file(source_file):
program_n = 0
try:
with open(source_file, "r") as f:
eof = False
while not eof:
c = f.read(1)
if le... | unlicense | Python | |
72f43fc9c8aecc9fd8f240cfc37500cad4bc7858 | Test for math.assert_close() | tum-pbs/PhiFlow,tum-pbs/PhiFlow | tests/commit/math/test__functions.py | tests/commit/math/test__functions.py | from unittest import TestCase
from phi import math
def assert_not_close(*tensors, rel_tolerance, abs_tolerance):
try:
math.assert_close(*tensors, rel_tolerance, abs_tolerance)
raise BaseException(AssertionError('1 != 0'))
except AssertionError:
pass
class TestMathFunctions(TestCase)... | mit | Python | |
27f187d3cc5725b6ed912e15ecafb38a44cc4992 | Add unit tests for new service util | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/utils/test_win_service.py | tests/unit/utils/test_win_service.py | # Import Python Libs
import os
# Import Salt Libs
import salt.utils.platform
# Import Salt Testing Libs
from tests.support.mock import patch, MagicMock
from tests.support.unit import TestCase, skipIf
try:
import salt.utils.win_service as win_service
from salt.exceptions import CommandExecutionError
except Ex... | apache-2.0 | Python | |
60b9041f76a88dddaf627458d98a357974a6a302 | Add __init__.py | xuwenyihust/Shutterfly-Customer-Lifetime-Value,xuwenyihust/Shutterfly-Customer-Lifetime-Value | __init__.py | __init__.py | mit | Python | ||
482218b20ea6281c49be7edd66370c778b301c7f | Create __init__.py | majikpig/ubtech | __init__.py | __init__.py | mit | Python | ||
fa5ffd2f2f51607703912209b5876cb8f951df88 | Add simple testing driver | dramborleg/text-poker | test.py | test.py | import parser
p = parser.Parser()
input = ['-c mango', '--create mango', 'c mango',
'--create kiwi c guava lemon', '--create']
for i in input:
ret = p.parse(i)
print('--------')
print(i)
print(ret)
print('--------')
| bsd-2-clause | Python | |
775edf9fec8bbe32dceef3efc1e1cffc642ae61c | Create __init__.py | piomonti/pySINGLE | __init__.py | __init__.py | __all__ = ["SINGLE"]
import SINGLE
#from SINGLE import SINGLE
#from choose_h import *
#from fitSINGLE import *
| mit | Python | |
9065b9f5baedfc1895c612a7995f15878144d3e7 | Create test.py | crap0101/fup,crap0101/fup,crap0101/fup | test.py | test.py | #coding: utf-8
import operator
import re
import sys
import time
import urlparse
import fhp.api.five_hundred_px as _fh
import fhp.helpers.authentication as _a
from fhp.models.user import User
_TREG = re.compile('^(\d+)-(\d+)-(\d+).*?(\d+):(\d+):(\d+).*')
_URL = 'http://500px.com/'
_HTML_BEGIN = '''<!DOCTYPE HTML PUBLI... | mit | Python | |
a0705902dcf335cadeee717fbbdcbb247bc14645 | Move wsgi.py to project directory | mhotwagner/backstage,mhotwagner/backstage,mhotwagner/backstage | wsgi.py | wsgi.py | """
WSGI config for backstage project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | mit | Python | |
b9283871a8be5ee0f289cb6181023a8366f530bd | modify response example | SpectoLabs/hoverfly,tjcunliffe/hoverfly,SpectoLabs/hoverfly,tjcunliffe/hoverfly,tjcunliffe/hoverfly,tjcunliffe/hoverfly,tjcunliffe/hoverfly,tjcunliffe/hoverfly | examples/middleware/modify_response/modify_response.py | examples/middleware/modify_response/modify_response.py | #!/usr/bin/env python
import sys
import logging
import json
logging.basicConfig(filename='middleware.log', level=logging.DEBUG)
logging.debug('Middleware is called')
def main():
data = sys.stdin.readlines()
# this is a json string in one line so we are interested in that one line
payload = data[0]
l... | apache-2.0 | Python | |
4e18da98f3398e1cc3b4c8f76bc8f81529baff3c | Add doc modification script | Flat/serenity,Roughsketch/serenity,eLunate/serenity,zeyla/serenity,acdenisSK/serenity,Lakelezz/serenity,zeyla/serenity.rs | docs.py | docs.py | import glob
for filename in glob.glob("target/doc/serenity/**/*.html"):
print('Parsing {}'.format(filename))
with open(filename) as f:
content = f.read()
new_content = content.replace('<nav class="sidebar">\n', '<nav class="sidebar"><img src="https://docs.austinhellyer.me/serenity.rs/docs_header.p... | isc | Python | |
94cfd557b604947a1e2ce23fc67bf82c508439ff | change request.base_payout from float to numeric (decimal) | eskwire/evesrp,paxswill/evesrp,paxswill/evesrp,eskwire/evesrp,paxswill/evesrp,eskwire/evesrp,eskwire/evesrp | evesrp/migrate/versions/4198a248c8a_.py | evesrp/migrate/versions/4198a248c8a_.py | """Move from using floats for ISK to numeric types.
Revision ID: 4198a248c8a
Revises: 45024170cf6
Create Date: 2014-06-18 14:34:25.967159
"""
# revision identifiers, used by Alembic.
revision = '4198a248c8a'
down_revision = '45024170cf6'
from decimal import Decimal
from alembic import op
import sqlalchemy as sa
fro... | bsd-2-clause | Python | |
314b195160d539101dd3c3fa53e6f870fd2ee083 | add beautiful-triplets | EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,Ed... | contest/world-codesprint-april/beautiful-triplets/beautiful-triplets.py | contest/world-codesprint-april/beautiful-triplets/beautiful-triplets.py | # -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-04-30 19:35:03
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-04-30 19:38:26
if __name__ == "__main__":
n, d = map(int, raw_input().split())
a = map(int, raw_input().split())
ele = set()
for x in a:
ele.add(x)
ans = 0
for x in a:... | mit | Python | |
69f323bba974ea73963c8da63a3c3b8326fffc6e | Create RevLinkedList_002.py | cc13ny/algo,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/cod,Chasego/cod,cc13ny/Allin,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/cod,Chasego/codirit,Chasego/codi,Chasego/codi,Chasego/codirit,Chasego/cod,cc13ny/algo,Chasego/codi,Chasego/codirit,Chasego/cod,cc13ny/algo,cc13ny/Allin,Chaseg... | leetcode/206-Reverse-Linked-List/RevLinkedList_002.py | leetcode/206-Reverse-Linked-List/RevLinkedList_002.py | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
dummy = ListNode(0)
dummy.... | mit | Python | |
ced07a1f5d0d5c3c460bda1de29381ba7aff0c87 | add knn | starsriver/ML | 4/KNN.py | 4/KNN.py | # -*- coding: utf-8 -*-
import csv
import random
import math
import operator
import os
def loadDataSet(fileName, split, trainingSet=[], testSet=[]):
with open(fileName, "rb") as csvFile:
lines = csv.reader(csvFile)
dataSet = list(lines)
for x in range(len(dataSet) - 1):
for y in... | bsd-2-clause | Python | |
f1268d95f224b0bb3df00f3a76c92074f0db037a | Update utils.py | rishubhjain/commons,r0h4n/commons,Tendrl/commons | tendrl/commons/central_store/utils.py | tendrl/commons/central_store/utils.py | from tendrl.commons.etcdobj import fields
def to_etcdobj(cls_etcd, obj):
for attr, value in vars(obj).iteritems():
if value is None:
continue
if attr.startswith("_"):
continue
if attr in ["attrs", "enabled", "obj_list", "obj_value", "atoms",
"flo... | from tendrl.commons.etcdobj import fields
def to_etcdobj(cls_etcd, obj):
for attr, value in vars(obj).iteritems():
if attr.startswith("_"):
continue
if attr in ["attrs", "enabled", "obj_list", "obj_value", "atoms",
"flows", "value", "list"]:
continue
... | lgpl-2.1 | Python |
71bbd57214cd8be6ac8583884eb1fc2e5b270eb8 | Add conf file for Emmaus Ideasbox in France | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ideascube/conf/idb_fra_emmaus.py | ideascube/conf/idb_fra_emmaus.py | # -*- coding: utf-8 -*-
"""Ideaxbox for Emmaus, France"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"Emmaus"
IDEASCUBE_PLACE_NAME = _("city")
COUNTRIES_FIRST = ['FR']
TIME_ZONE = None
LANGUAGE_CODE = 'fr'
LOAN_DURATION = 14
MONITORING_ENTRY_EXPORT_FIELDS = ['s... | agpl-3.0 | Python | |
f7f76bc7eb217e4c7b81e58afec41726f0dd2848 | Add another dip example | matthewearl/strippy | examples/dip2.py | examples/dip2.py | #!/usr/bin/env python3
# Copyright (c) 2015 Matthew Earl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | mit | Python | |
60a6b98d0bc3f8e55414dd1f6461ad863bcfd12a | Create matching_ending_items.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/regex/repetitions/matching_ending_items.py | hacker_rank/regex/repetitions/matching_ending_items.py | Regex_Pattern = r'^[a-zA-Z]*[s]$' # Do not delete 'r'.
| mit | Python | |
4822b3c55478bd76b66d5afbfabf0c9ec51a9c8e | Add an example ('move.py'). | jeremiedecock/pyax12,jeremiedecock/pyax12 | examples/move.py | examples/move.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pydynamixel.packet as pk
import pydynamixel.connection
import pydynamixel.instruction_packet as ip
import time
def main():
serial_connection = pydynamixel.connection.Connection()
# Goto to 180°
instruction_packet = ip.InstructionPacket(_id=pk.BROADC... | mit | Python | |
1e9b1c2270d8dfc722f92b8b046581ce6172016a | update divergence | clinicalml/theanomodels,clinicalml/theanomodels | utils/divergences.py | utils/divergences.py | """
Author: Rahul G. Krishnan
File containing divergences used between probability measures
"""
import theano.tensor as T
def KL(mu_1,cov_1,mu_2,cov_2):
"""
Estimate the KL divergence between two gaussians with diagonal covariance
KL(q||p) 0.5*(log|Sigma_2| - log |Sigma_1|
"""
diff = mu_2-mu_1
... | mit | Python | |
ee633ae9576ee1d2c0edd55551319879a9c32864 | Add initial version of fit_sota_model | sot/aca_stats,sot/aca_stats,sot/aca_stats | fit_sota_model.py | fit_sota_model.py | #!/usr/bin/env python
from __future__ import division
import numpy as np
SOTA2013_FIT = [0.18, 0.99, -0.49, # Scale
-1.49, 0.89, 0.28] # Offset
if 'data' not in globals():
import cPickle as pickle
with open('data/mini_acq_table.pkl', 'r') as fh:
data = pickle.load(fh)
data... | bsd-3-clause | Python | |
4ea892fe28b3045ab265cfd9fd5aa6a2b7c1ee52 | add report related to the fix contaminant | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | sequana/report_fix.py | sequana/report_fix.py | import easydev
import os
from .report_main import BaseReport
# a utility from external reports package
from reports import HTMLTable
import pandas as pd
def _get_template_path(name):
# Is it a local directory ?
if os.path.exists(name):
return name
else:
template_path = easydev.get_... | bsd-3-clause | Python | |
9c67d72fbbdec53e2adc5ff2718bae8b3493b219 | add a simple test for celery config | therewillbecode/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea,mozilla/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea | ichnaea/tests/test_worker.py | ichnaea/tests/test_worker.py | from unittest2 import TestCase
class TestWorkerConfig(TestCase):
def _get_target(self):
from ichnaea.worker import celery
return celery
def test_config(self):
celery = self._get_target()
self.assertTrue(celery.conf['CELERY_ALWAYS_EAGER'])
self.assertEqual(celery.conf[... | apache-2.0 | Python | |
a990292ec2d3e2ebc74dd548cfc9ee55427bf5f0 | Create news_url.py | wolfdale/Scraper | news_url.py | news_url.py | """ PROJECT SCRAPER """
'''GET URL FROM BBC NEWS'''
from bs4 import BeautifulSoup
import urllib2
url='http://www.bbc.com/news'
web=urllib2.urlopen(url)
soup=BeautifulSoup(web,'html.parser')
with open('news_url.txt','w') as file:
for tag in soup.find_all('a',{'class':'title-link'}):
url=tag.get('href')
file.wr... | mit | Python | |
4d747b0ff0f700e41ff31b028618163d180301fa | Add Utils | coala-analyzer/coala-sublime | Utils.py | Utils.py | """
Holds various common functions and variables which will be useful in general
by the other classes.
"""
def log(*args, **kwargs):
print(" COALA -", *args, **kwargs)
| agpl-3.0 | Python | |
dbc64554694f117dfe2def082acaeb60117a4f1e | add template for classifier test | austinlostinboston/mitsWebApp,austinlostinboston/mitsWebApp,austinlostinboston/mitsWebApp,austinlostinboston/mitsWebApp | weiss/tests/test_dialogue.py | weiss/tests/test_dialogue.py | from django.test import TestCase
class StateTestCase(TestCase):
def setUp(self):
pass
def test_classifier(self):
pass
| apache-2.0 | Python | |
c193b4718a707f16b436d62f6b6a26882b742251 | test for branching and shas | OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api | ws-tests/test_integration.py | ws-tests/test_integration.py | #!/usr/bin/env python
from opentreetesting import test_http_json_method, config
import datetime
import codecs
import json
import sys
import os
study_id = '9'
DOMAIN = config('host', 'apihost')
#A full integration test, with GET, PUT, POST, MERGE and a merge conflict,
#test get and save sha
data = {'output_nexml2j... | bsd-2-clause | Python | |
ffe374bd1fc40aab3dcdbc37141a068af81465de | Create onmodify.timetrack.py | jhmartin/taskwarrior-effort-tracker | onmodify.timetrack.py | onmodify.timetrack.py | #!/usr/bin/env python
#
# Writes task effort log to LEDGERFILE. Format is:
# 2015/03/22,e28087e9-525e-403c-9c4b-1aed53809092,9,no project,test3
# Date,UID,Seconds effort, Project name (or 'no project'), task description
#
# You need to adjust LEDGERFILE, or set the TIMELOG environment variable.
# Based on https://gist... | apache-2.0 | Python | |
4641195df10da114b896fbe16c89324954833d22 | Create main.py | DavidJFelix/hatchit,DavidJFelix/hatchit,DavidJFelix/hatchit | web/src/main.py | web/src/main.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
| agpl-3.0 | Python | |
a4af8609686386d3371289ea24e019a897ca13bd | introduce a new kind of exception: RedirectWarning (warning with an additional redirection button) | Antiun/odoo,pplatek/odoo,xzYue/odoo,Grirrane/odoo,javierTerry/odoo,hmen89/odoo,kirca/OpenUpgrade,hmen89/odoo,gavin-feng/odoo,pplatek/odoo,Nowheresly/odoo,sinbazhou/odoo,ramadhane/odoo,ubic135/odoo-design,joshuajan/odoo,stephen144/odoo,odoousers2014/odoo,Danisan/odoo-1,lightcn/odoo,erkrishna9/odoo,eino-makitalo/odoo,Mar... | openerp/exceptions.py | openerp/exceptions.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | agpl-3.0 | Python |
7e7f0585971f472c25fda3b6370e37eb4d8d0ea5 | test import of ssh.tunnel | Mustard-Systems-Ltd/pyzmq,swn1/pyzmq,caidongyun/pyzmq,caidongyun/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq,swn1/pyzmq,swn1/pyzmq,Mustard-Systems-Ltd/pyzmq,ArvinPan/pyzmq,caidongyun/pyzmq,ArvinPan/pyzmq,dash-dash/pyzmq,ArvinPan/pyzmq | zmq/tests/test_imports.py | zmq/tests/test_imports.py | # Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import sys
from unittest import TestCase
class TestImports(TestCase):
"""Test Imports - the quickest test to ensure that we haven't
introduced version-incompatible syntax errors."""
def test_toplevel(self):
... | # Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import sys
from unittest import TestCase
class TestImports(TestCase):
"""Test Imports - the quickest test to ensure that we haven't
introduced version-incompatible syntax errors."""
def test_toplevel(self):
... | bsd-3-clause | Python |
4e8da16d761c507f9cb2a2ad2635903f90390c5c | Add python implementation for problem 38. | daithiocrualaoich/euler | python/038.py | python/038.py | '''
Pandigital Multiples
===================
Take the number 192 and multiply it by each of 1, 2, and 3:
192 × 1 = 192
192 × 2 = 384
192 × 3 = 576
By concatenating each product we get the 1 to 9 pandigital, 192384576. We
will call 192384576 the concatenated product of 192 a... | apache-2.0 | Python | |
df9fc9f64b5450851abef90b50804e56e0d152bf | add fragment reaction class | KEHANG/AutoFragmentModeling | afm/reaction.py | afm/reaction.py |
class FragmentReaction(object):
def __init__(self,
index=-1,
reactants=None,
products=None,
kinetics=None,
reversible=False,
pairs=None,
family=None
):
self.index = index
self.reactants = reactants
self.products = products
self.kinetics = kinetics
self.reversible = rever... | mit | Python | |
9192fe92621d6f79b0f99802f50014d27c967d26 | Add alg_knapsack.py | bowen0701/algorithms_data_structures | alg_knapsack.py | alg_knapsack.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def main():
wt_cap = 10
wt = [1, 2, 4, 2, 5]
val = [5, 3, 5, 3, 2]
if __name__ == '__main__':
main()
| bsd-2-clause | Python | |
a101bd9ccb280348e6da32b3f2c0540ca6c65807 | Implement String field | polygraph-python/polygraph | polygraph/types/fields.py | polygraph/types/fields.py | from collections import OrderedDict
from graphql.type.definition import GraphQLField, GraphQLNonNull
from graphql.type.scalars import GraphQLString
from marshmallow import fields
class String(fields.String):
def __init__(self, description, nullable=False, args=None,
deprecation_reason=None, **ad... | mit | Python | |
f0033f87e0b4082e55dd3641282e65369e03c03e | Create natural_sort.py (#3286) | TheAlgorithms/Python | sorts/natural_sort.py | sorts/natural_sort.py | from __future__ import annotations
import re
def natural_sort(input_list: list[str]) -> list[str]:
"""
Sort the given list of strings in the way that humans expect.
The normal Python sort algorithm sorts lexicographically,
so you might not get the results that you expect...
>>> example1 = ['2 f... | mit | Python | |
bba04c867055715bb93e2fc2736538337b9f26ac | Add caesar cipher | xiao0720/leetcode,xliiauo/leetcode,xliiauo/leetcode,xiao0720/leetcode,xliiauo/leetcode | CaesarCipher.py | CaesarCipher.py | class CaesarCipher:
def encrypt(self, plain, n):
rst = [None] * len(plain)
for i in range(len(plain)):
rst[i] = chr((ord(plain[i]) - ord('A') + n) % 26 + ord('A'))
return ''.join(rst)
def decrypt(self, encrypted, n):
rst = [None] * len(encrypted)
f... | mit | Python | |
4fef2ff44b2f195a9a135ba3ca5c70bb08572d39 | Add sphinx configuration | openthings/zeppelin,nkconnor/magellan,chiwanpark/incubator-zeppelin,vgmartinez/incubator-zeppelin,elbamos/Zeppelin-With-R,karuppayya/zeppelin,digitalreasoning/incubator-zeppelin,wary/zeppelin,vrlo/zeppelin,Yingmin-Li/incubator-zeppelin,r-kamath/zeppelin,astroshim/incubator-zeppelin,Solution-Global/zeppelin,ReeceRobinso... | zeppelin-docs/src/main/spinx/conf.py | zeppelin-docs/src/main/spinx/conf.py | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | apache-2.0 | Python | |
a5aadd892df181a8e4a48ceebedff48211d5d22c | Add paver file. | cournape/audiolab,cournape/audiolab,cournape/audiolab | pavement.py | pavement.py | import os
import subprocess
import sphinx
import setuptools
import numpy.distutils
import paver
import paver.doctools
import common
from setup import configuration
options(
setup=Bunch(
name=common.DISTNAME,
namespace_packages=['scikits'],
packages=setuptools.find_packag... | lgpl-2.1 | Python | |
91d83745d94ba0eeb06d6d12eb32d5950963ad2a | move backend definition | rthill/django-ldapdb | ldapdb/backends/ldap/base.py | ldapdb/backends/ldap/base.py | # -*- coding: utf-8 -*-
#
# django-ldapdb
# Copyright (c) 2009-2010, Bolloré telecom
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# ... | bsd-3-clause | Python | |
f3eb1c8efbcd3695dba0037faa4f90328625f547 | Add script for creating numeric passwordlists using permutation & combination. | JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology | permcomb.py | permcomb.py | #!/usr/bin/python
import itertools
import sys
def combination(elements,items):
for combination in itertools.product(xrange(elements), repeat=items):
print ''.join(map(str, combination))
if len(sys.argv) == 3:
allSet = int(sys.argv[1])
setItems = int(sys.argv[2])
if allSet >= setItems:
... | cc0-1.0 | Python | |
b01076381ebc91f20c527f1632c7b3f2aa82d39a | Add a very simple performance testing tool. | ajmirsky/couchdb-python | perftest.py | perftest.py | """
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for test in tests if test.__name__ in sys.argv... | bsd-3-clause | Python | |
29c59fcbe8b15e37e96fec43e613d6f537727ea2 | Create Base64_Demo.py | danjia/EncryptDemo | Base64_Demo/Base64_Demo.py | Base64_Demo/Base64_Demo.py | # -*- coding: utf8 -*-
'''
@brief 用base64加密,解密(必须为ascii)
'''
import base64
'''
@brief 编码加密
@params content 要编码加密的内容(必须为ascii)
'''
def encrypt_base64(content):
return base64.b64encode(content)
'''
@brief 解码解密
@params secretContent 要解密的内容
'''
def decrypt_base64(secretContent):
return base64.b64decode(secretC... | mit | Python | |
ff7292352b7d4b1609f077c3650d94a3c83051fc | Add property.py. | ueno/ibus,j717273419/ibus,j717273419/ibus,luoxsbupt/ibus,ibus/ibus,luoxsbupt/ibus,Keruspe/ibus,phuang/ibus,fujiwarat/ibus,fujiwarat/ibus,Keruspe/ibus,ueno/ibus,luoxsbupt/ibus,luoxsbupt/ibus,fujiwarat/ibus,ibus/ibus,Keruspe/ibus,ibus/ibus-cros,fujiwarat/ibus,ueno/ibus,ibus/ibus-cros,j717273419/ibus,phuang/ibus,ibus/ibus... | ibus/property.py | ibus/property.py | import dbus
PROP_TYPE_NORMAL = 0
PROP_TYPE_TOGGLE = 1
PROP_TYPE_RADIO = 2
PROP_TYPE_SEPARATOR = 3
PROP_STATE_UNCHECKED = 0
PROP_STATE_CHECKED = 1
PROP_STATE_INCONSISTENT = 2
class Property:
def __init__ (self, name,
type = PROP_TYPE_NORMAL,
label = "",
icon = "",
tip = "",
sensitive =... | lgpl-2.1 | Python | |
55ee2e14a173ea68f3ed02edbd525a6538dd0c0c | add deploy.py script | andyfischer/circa,andyfischer/circa,andyfischer/circa,andyfischer/circa | improv/deploy.py | improv/deploy.py |
import os, shutil, zipfile
AppName = 'ImprovAlpha4.app'
def mkdir(path):
if os.path.exists(path):
return
os.mkdir(path)
def rmdir(path):
if not os.path.exists(path):
return
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.remove(path)
def copy(path, dest):
... | mit | Python | |
fbf91352da4cf16be8462f57c71aa9f86f21746f | Add class balance checking code | googleinterns/amaranth,googleinterns/amaranth | amaranth/data_analysis/class_balance.py | amaranth/data_analysis/class_balance.py | # Lint as: python3
"""This script checks the balance of classes in the FDC dataset.
Classes are split based on LOW_CALORIE_THRESHOLD and
HIGH_CALORIE_THRESHOLD in the amaranth module.
"""
import os
import pandas as pd
import amaranth
from amaranth.ml import lib
FDC_DATA_DIR = '../../data/fdc/'
def main():
# Rea... | apache-2.0 | Python | |
85bd9515a92b3e603c2113919230d37729a0bd44 | add Python3LexerBase.py | antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4 | python/python3/Python/Python3LexerBase.py | python/python3/Python/Python3LexerBase.py | from typing import TextIO
from antlr4 import *
from antlr4.Token import CommonToken
from .Python3Parser import Python3Parser
import sys
from typing import TextIO
import re
class Python3LexerBase(Lexer):
NEW_LINE_PATTERN = re.compile('[^\r\n\f]+')
SPACES_PATTERN = re.compile('[\r\n\f]+')
def __init__(sel... | mit | Python | |
7432e7fb9ad5199ef3f55e7c85e542eaef4237da | Add pelicanconf_sample.py | lord63/pelican-scribble-hex,lord63/pelican-scribble-hex,lord63/pelican-scribble-hex | pelicanconf_sample.py | pelicanconf_sample.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# The followings are recommanded to set them up.
AUTHOR = ''
SITENAME = ''
SITEURL = ''
SITE_DESCRIPTION = ''
SELF_INTRO = 'A brief introduction about yourself.'
PATH = 'content'
DEFAULT_LANG = ''
THEME = ''
TIMEZONE = ''
LI... | mit | Python | |
7eab5ef84db52800912b8cfcc9d631655c002a3f | read pg_hba.conf and resolve DNS names to addresses | aiven/aiven-tools | pg/pg_hba_resolver.py | pg/pg_hba_resolver.py | #!/usr/bin/python
"""
pg_hba_resolver - read pg_hba.conf and resolve DNS names to addresses
Copyright (C) 2016, https://aiven.io/
This file is under the Apache License, Version 2.0.
See http://www.apache.org/licenses/LICENSE-2.0 for details.
Read pg_hba.conf and look for comment lines ending with a '# RESOLVE' tag:
... | apache-2.0 | Python | |
93b2d93098c395d866f18e51b6ac42a9ba81a9b5 | Test if C changes with more examples. | charanpald/APGL | exp/modelselect/RealDataSVMExp.py | exp/modelselect/RealDataSVMExp.py | """
Observe if C varies when we use more examples
"""
import logging
import numpy
import sys
import multiprocessing
from apgl.util.PathDefaults import PathDefaults
from apgl.predictors.AbstractPredictor import computeTestError
from exp.modelselect.ModelSelectUtils import ModelSelectUtils
from apgl.util.Sampling... | bsd-3-clause | Python | |
d8e0104c92d9457ba60285cb856d8f435e0e08bd | Add initial setup script | Mstrodl/jose,lnmds/jose,Mstrodl/jose | initial-setup.py | initial-setup.py | import pickle
from pathlib import Path
import joseconfig as jcfg
# touch files
Path(jcfg.jcoin_path).touch()
Path('db/jose-data.txt').touch()
def initialize_db(path):
with open(path, 'wb') as f:
pickle.dump({}, f)
# initialize databases
initialize_db(jcfg.jcoin_path)
initialize_db('ext/josememes.db')
| mit | Python | |
40d8cf13bd91b2da43c5cecedcabc8e794f7febd | Add __init__.py to suite/wrappers directory. | deepmind/dm_control | dm_control/suite/wrappers/__init__.py | dm_control/suite/wrappers/__init__.py | # Copyright 2018 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | apache-2.0 | Python | |
7515f9de3e1aab11eb6ffae93cbff7290557c6af | Make functions visible | markbrough/maedi-projects,markbrough/maedi-projects,markbrough/maedi-projects | maediprojects/views/codelists.py | maediprojects/views/codelists.py | from flask import Flask, render_template, flash, request, Markup, \
session, redirect, url_for, escape, Response, abort, send_file, jsonify
from flask.ext.login import login_required, current_user
from maediprojects import app, db, models
from maediprojects.query import activity as qact... | agpl-3.0 | Python | |
50e4d81b034c930784df2cab36ba3f7ff726d6d8 | Add ETCD implementation for NB API | no2key/dragonflow,openstack/dragonflow,FrankDuan/df_code,FrankDuan/df_code,neoareslinux/dragonflow,openstack/dragonflow,neoareslinux/dragonflow,no2key/dragonflow,FrankDuan/df_code,openstack/dragonflow | dragonflow/db/drivers/etcd_nb_impl.py | dragonflow/db/drivers/etcd_nb_impl.py | # Copyright (c) 2015 OpenStack Foundation.
#
# 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
#
# Unle... | apache-2.0 | Python | |
476ccea37c0509f55be1bbeb90fdd999e3b3f3b4 | Create bip-0070-payment-protocol.py | petertodd/dust-b-gone | examples/bip-0070-payment-protocol.py | examples/bip-0070-payment-protocol.py | #!/usr/bin/python2.7
#
# bip-0070-payment-protocol.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
"""Bip-0070-related functionality
Handles incoming serialized string data in the form of a http request
and returns an... | mit | Python | |
5a471d778a8affea5552923a8fbd74a61bcc81f1 | add radiometric_normalization.py - need to test on remote server | planetlabs/radiometric_normalization,planetlabs/radiometric_normalization | radiometric_normalization/radiometric_normalization.py | radiometric_normalization/radiometric_normalization.py | import numpy
from radiometric_normalization.time_stack import time_stack
from radiometric_normalization.pif import pif
from radiometric_normalization.transformation import transformation
from radiometric_normalization.validation import validation
from radiometric_normalization import gimage
def generate_luts(candida... | apache-2.0 | Python | |
08493dd851a5023057c6f5b3439d3e965b256bf8 | add aux script | robertaboukhalil/ginkgo,robertaboukhalil/ginkgo,robertaboukhalil/ginkgo,robertaboukhalil/ginkgo,robertaboukhalil/ginkgo,robertaboukhalil/ginkgo,robertaboukhalil/ginkgo,robertaboukhalil/ginkgo | genomes/scripts/other/fix_hg19_exons.py | genomes/scripts/other/fix_hg19_exons.py | #!/usr/bin/env python
import numpy as np
import sys
import re
fin = open("genes.hg19.out", 'r')
fout = open("genes.hg19.exons.temp", 'w')
line=fin.readline()
for line in fin:
fields = line.strip().split()
chr = fields[2]
strand = fields[3]
gene = fields[1]
exon_start = fields[9].split(',')[:-1]
exon_end... | bsd-2-clause | Python | |
7997d02e52172b8ad0e96a845f953f90a6e739b7 | Add VSYNC GPIO output example. | iabdalkader/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv | scripts/examples/02-Board-Control/vsync_gpio_output.py | scripts/examples/02-Board-Control/vsync_gpio_output.py | # VSYNC GPIO output example.
#
# This example shows how to toggle the IR LED pin on VSYNC interrupt.
import sensor, image, time
from pyb import Pin
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesiz... | mit | Python | |
7d88a914cba0141a0f1b0b35a84e2d82aa7b080e | Create code_3.py | jnimish77/Cloud-Computing-and-Programming-using-various-tools,jnimish77/Cloud-Computing-and-Programming-using-various-tools,jnimish77/Cloud-Computing-and-Programming-using-various-tools | MPI_Practice_Examples/code_3.py | MPI_Practice_Examples/code_3.py | import numpy
import sys
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
randNum = numpy.zeros(1)
rank = 1
a=input("number of processes ?? \n")
while(rank<a):
randNum = numpy.random.random_sample(1)
print "Process", rank, "draw the number", randNum[0]
comm.Send(rand... | apache-2.0 | Python | |
4d4a862aa81218b788e961916115667a212f42e0 | Add conftest.py to allow skipping slow test. | dask/dask,chrisbarber/dask,ssanderson/dask,PhE/dask,freeman-lab/dask,mikegraham/dask,wiso/dask,wiso/dask,PhE/dask,mraspaud/dask,cowlicks/dask,freeman-lab/dask,vikhyat/dask,jcrist/dask,blaze/dask,jcrist/dask,pombredanne/dask,jayhetee/dask,mraspaud/dask,pombredanne/dask,ContinuumIO/dask,dask/dask,clarkfitzg/dask,simudrea... | conftest.py | conftest.py | import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", help="run slow tests")
def pytest_runtest_setup(item):
if 'slow' in item.keywords and not item.config.getoption("--runslow"):
pytest.skip("need --runslow option to run")
| bsd-3-clause | Python | |
4d0e0a4c7fb70838427212180bb213061f0b67ea | Create config11.py | davidfergusonaz/davidtest,davidfergusonaz/davidtest | config11.py | config11.py | provider "aws" {
access_key = "AKIAJCJUB35JFIDR5XWW"
secret_key = "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"
region = "${var.region}
}
| mit | Python | |
1e79c1580055d2279b1a8523a2b382d98fe6cad3 | Configure minimal django settings | altaurog/django-caspy,altaurog/django-caspy,altaurog/django-caspy | conftest.py | conftest.py | from django.conf import settings
def pytest_configure():
settings.configure(
INSTALLED_APPS = (
'caspy',
'rest_framework',
),
ROOT_URLCONF = 'caspy.urls',
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... | bsd-3-clause | Python | |
7d29d96385ec9a3274f5e6409e04635e89f8c8c9 | Create find-anagram-mappings.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/find-anagram-mappings.py | Python/find-anagram-mappings.py | # Time: O(n)
# Space: O(n)
class Solution(object):
def anagramMappings(self, A, B):
"""
:type A: List[int]
:type B: List[int]
:rtype: List[int]
"""
lookup = collections.defaultdict(collections.deque)
for i, n in enumerate(B):
lookup[n].append(i)
... | mit | Python | |
da9ed4dacbeaf7f8ec3873b658547a215f9d6920 | Create __init__.py | coryjog/anemoi,coryjog/anemoi,coryjog/anemoi | anemoi/io/__init__.py | anemoi/io/__init__.py | mit | Python | ||
a228f5874d6d419a6333b91abceaf2c50843f92e | Create multObjShapeUpdate.py | aaronfang/personal_scripts | af_scripts/tmp/multObjShapeUpdate.py | af_scripts/tmp/multObjShapeUpdate.py | import maya.cmds as cmds
def multObjShapeImport():
files_to_import = cmds.fileDialog2(fileFilter = '*.obj', dialogStyle = 2, caption = 'import multiple object files', fileMode = 4,okc="Import")
for file_to_import in files_to_import:
object_name = file_to_import.split('/')[-1].split('.obj')[0]
... | mit | Python | |
8056aa34ac52a09952e3588605ce0e1a8642e29a | Create Final-Project.py | phstearns/Final-Project | Final-Project.py | Final-Project.py | mit | Python | ||
4a1644452b7ddf8e18a57e6520bf7be8b060b7f7 | Add Sorting Comparator solution | denisrmp/hacker-rank | algorithms/sorting/sorting_comparator.py | algorithms/sorting/sorting_comparator.py | # https://www.hackerrank.com/challenges/ctci-comparator-sorting/problem
from functools import cmp_to_key
class Player:
def __init__(self, name, score):
self.name = name
self.score = score
def comparator(a, b):
if a.score == b.score:
if a.name >= b.name:
r... | mit | Python | |
15d21e8ce24e8058db26035e192ee2ba240c7184 | Update clusters tasks | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | api/clusters/tasks.py | api/clusters/tasks.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import logging
from polyaxon_k8s.manager import K8SManager
from api.settings import CeleryTasks, CeleryRoutedTasks
from api.celery_api import app as celery_app
logger = logging.getLogger('polyaxon.tasks.clusters')
@celery_app... | apache-2.0 | Python | |
ffed6fb5b853f621af0e242abf00d97defc2a4a8 | add audio setup routine | swb1701/AlexaPi | audio.py | audio.py | #
# Set Up Audio Pairing with Alexa from a Pi
#
import os
import sys
import secrets as s
from pulsectl import Pulse
def run(cmd):
print("Executing:"+cmd)
os.system(cmd)
def btctl(cmd):
print("Sending "+cmd+" to bluetoothctl...")
os.system('echo -e "'+cmd+'\nquit\n"|bluetoothctl')
try:
p=Pulse()
... | mit | Python | |
b2a4709eae73786b40b4d0f58b1e02075ce023b3 | Create blink.py | brice-morin/resin-blink-python | blink.py | blink.py | import RPi.GPIO as GPIO
import time
# blinking function
def blink(pin):
GPIO.output(pin,GPIO.HIGH)
time.sleep(1)
GPIO.output(pin,GPIO.LOW)
time.sleep(1)
return
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# set up GPIO output channel
GP... | mit | Python | |
bae50ccc70a077944c92738faf2009df28ae75a7 | Add Python boilerplate | foxscotch/advent-of-code,foxscotch/advent-of-code | bp/bp.py | bp/bp.py | # Python 3.6.1
with open('input.txt', 'r') as f:
puzzle_input = f.read().split()
# Code here
| mit | Python | |
2585b44484b175bb116c228496069cc4269440c0 | Add python tests for cosine squared angles | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/md/test-py/test_angle_cosinesq.py | hoomd/md/test-py/test_angle_cosinesq.py | # -*- coding: iso-8859-1 -*-
# Maintainer: joaander
from hoomd import *
from hoomd import md
context.initialize()
import unittest
import os
import numpy
# tests md.angle.cosinesq
class angle_cosinesq_tests (unittest.TestCase):
def setUp(self):
print
snap = data.make_snapshot(N=40,
... | bsd-3-clause | Python | |
cbbe6f4709763c44ca0185f7e9127a0737525aff | add test_iterator_example.py | alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl | tests/test_iterator_example.py | tests/test_iterator_example.py | #!/usr/bin/env python
import alphatwirl
import unittest
##____________________________________________________________________________||
def genFunc():
yield 101
yield 102
yield 103
##____________________________________________________________________________||
class IteClass(object):
def __init__(se... | bsd-3-clause | Python | |
ea4e0742317b2b26dc8fa9ddca79b1179f301329 | Add protocol module | dotoscat/Polytank-ASIR | protocol.py | protocol.py | #Copyright (C) 2017 Oscar Triano 'dotoscat' <dotoscat (at) gmail (dot) com>
#This program 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
#License, or (at your option) any later ... | agpl-3.0 | Python | |
9912b5a8fd981bae9ab003eb8386643661918cde | fix name OUtsideBrightness Sensor | k-team/KHome,k-team/KHome,k-team/KHome | all_module/OutsideBrightnessSensor.py | all_module/OutsideBrightnessSensor.py | from twisted.internet import reactor
import core.module
import core.fields
import core.fields.io
import core.fields.persistant
import time
class OutsideBrightness(core.module.Base):
update_rate = 10
class Brightness(
core.fields.sensor.Light,
core.fields.io.Readable,
core.fi... | mit | Python | |
6b142bc64f5966c695907692c29f52fce808a78d | add poll demo for linux platform | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | network/echo-server/echo-poll/lnx_poll.py | network/echo-server/echo-poll/lnx_poll.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2016 ASMlover. 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 source code must retain the above copyright... | bsd-2-clause | Python | |
d168256dd4b75375770b3391f716ceaba2cf722e | Add scrapper of Bureau of Labor Statistis Employment status | lexieheinle/python-productivity | cpsScrap.py | cpsScrap.py | #user/local/bin/python
#uses python3
import urllib.request
from bs4 import BeautifulSoup
url = "http://www.bls.gov/cps/cpsaat01.htm" #access the search term through website
page = urllib.request.urlopen(url).read()
soup = BeautifulSoup(page)
tables = soup.findAll('table') #find all tables
#print(tables)
mainTable = so... | mit | Python | |
7bdfc081cee0326d54c667bed8f870427fe2eeb6 | Add new file createDB.py | HeLanDou/free-time,HeLanDou/free-time,HeLanDou/free-time,HeLanDou/free-time,HeLanDou/free-time | createDB.py | createDB.py | #!/usr/bin/python
#coding=utf-8
import MySQLdb
db = MySQLdb.connect("localhost", "root", "soeasy", "free_time")
cursor = db.cursor();
cursor.execute("drop table lib");
cursor.execute('''
create table lib (
id char(8) not null,
name varchar(10) not null,
Mon_m1 bool,
Mon_m2 bool,
Mon_a1 bool,
Mon_a2 bool,
Mon_e boo... | mit | Python | |
eebe75ffbe39e7f8f91c3e3a425c7058f7bd8f01 | Write some preliminary code for undersampling component | tensorflow/tfx-addons | projects/component.py | projects/component.py | from tfx import v1 as tfx
from tfx.types import artifact_utils
from tfx.utils import io_utils
from tfx.components.util import tfxio_utils
from tfx.dsl.component.experimental.decorators import component
import apache_beam as beam
import random
@component
def UndersamplingComponent(
examples: tfx.dsl.components.Inpu... | apache-2.0 | Python | |
d377867ea501c4d9dae1f5c3ce1efc02f0a9639b | check Python version | pympler/pympler,pympler/pympler,Khan/pympler,Khan/pympler,yunjianfei/pympler,yunjianfei/pympler,swiftstack/pympler | pympler/sizer/__init__.py | pympler/sizer/__init__.py |
# check supported Python version
import sys
if getattr(sys, 'hexversion', 0) < 0x2020000:
raise NotImplementedError('sizer requires Python 2.2 or newer')
from asizeof import *
| from asizeof import *
| apache-2.0 | Python |
39de01462baf3db60c5a0f5d8a3b529f798730ab | Add script to check the performance | studiawan/pygraphc | pygraphc/bin/Check.py | pygraphc/bin/Check.py | import csv
from os import listdir
from pygraphc.evaluation.ExternalEvaluation import ExternalEvaluation
# read result and ground truth
result_dir = '/home/hudan/Git/pygraphc/result/improved_majorclust/Kippo/per_day/'
groundtruth_dir = '/home/hudan/Git/labeled-authlog/dataset/Kippo/attack/'
result_files = listdir(resul... | mit | Python | |
477d310ca2add1a5fd539159592f36ca626502f0 | add way to read geotiffs | jrising/research-common,jrising/research-common,jrising/research-common,jrising/research-common | python/geotiffgrid.py | python/geotiffgrid.py | import gdal
from spacegrid import SpatialGrid
class GeotiffGrid(SpatialGrid):
def __init__(self, filepath):
ds = gdal.Open(filepath)
x0_corner, sizex, zero1, y0_corner, zero2, sizey = ds.GetGeoTransform()
band = ds.GetRasterBand(1)
array = band.ReadAsArray()
self.array = ar... | mit | Python | |
8da927a0a196301ce5fb2ef2224e556b4d414729 | Add solution for counting DNA nucleotides | MichaelAquilina/rosalind-solutions | problem1.py | problem1.py | from collections import Counter
if __name__ == '__main__':
with open('data/rosalind_dna.txt', mode='r') as f:
sequence = f.read()
counts = Counter(sequence)
print '%d %d %d %d' % (counts['A'], counts['C'], counts['G'], counts['T'])
| mit | Python | |
572c8bdc1b18620857db9f61386fed5234bce957 | Create searchBook.py | frank-cq/Toys | searchBook.py | searchBook.py | # sudo apt install python-lxml,python-requests
from lxml import html
import requests
urlPrefix = 'https://book.douban.com/subject/'
candidateBookNums = []
candidateBookNums.append('3633461')
selectedBooks = {}
# i = 1
while candidateBookNums:
bookNum = candidateBookNums.pop(0)
bookUrl = urlPrefix + str(bookNum)
... | apache-2.0 | Python | |
a2f6a399c643b89c73aca2335b938f584cd572d5 | create Page object to better organize Links | rivergillis/crawler | page.py | page.py | from bs4 import BeautifulSoup, SoupStrainer
from link import Link
import requests
class Page(object):
def __init__(self, full_hyperlink, links=None):
self.full_hyperlink = full_hyperlink
self.links = links
# This doesn't feel great, maybe pull root_url creation method out of Link?
... | mit | Python | |
5178b104993401f47b1c4d8e3c796bef379e389e | Add migration for `communities` app. | letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click | letsmeet/communities/migrations/0011_auto_20160318_2240.py | letsmeet/communities/migrations/0011_auto_20160318_2240.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-18 21:40
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('communities', '0010_auto_20160108_1618'),
]
operations = [
migrations.AlterModelManager... | mit | Python | |
bb04b6771ccc39d86ea099f595d64c64ee2974f8 | Add a cookbook recipe for DipoleMagDir class | cmeessen/fatiando,cmeessen/fatiando,rafaelmds/fatiando,mtb-za/fatiando,drandykass/fatiando,rafaelmds/fatiando,mtb-za/fatiando,eusoubrasileiro/fatiando,santis19/fatiando,santis19/fatiando,eusoubrasileiro/fatiando,victortxa/fatiando,eusoubrasileiro/fatiando_seismic,fatiando/fatiando,drandykass/fatiando,eusoubrasileiro/fa... | cookbook/gravmag_magdir_dipolemagdir.py | cookbook/gravmag_magdir_dipolemagdir.py | """
GravMag: Use the DipoleMagDir class to estimate the magnetization direction
of dipoles with known centers
"""
import numpy
from fatiando import mesher, gridder
from fatiando.utils import ang2vec, contaminate
from fatiando.gravmag import sphere
from fatiando.vis import mpl
from fatiando.gravmag.magdir import Dipol... | bsd-3-clause | Python | |
5c0b2d662b08f49b5de1393c7db9826203e842e8 | add tool for count words | jasonwbw/jason_putils | putils/tools/words_length.py | putils/tools/words_length.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# count how much word in one line, get the statistics result
#
# @Author : Jasonwbw@yahoo.com
import sys
des = '<input file name> [-p parts] [-c threshold]' + \
'\n\tcompute average word count for each line, default will print out int average length, standard varian... | apache-2.0 | Python | |
eee85e5157d69cee515c01fa0f638b064de74a6e | Add a script to graph problem reports over time by transport mode | mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport | script/graph-reports-by-transport-mode.py | script/graph-reports-by-transport-mode.py | #!/usr/bin/python
# A script to draw graphs showing the number of reports by transport
# type each month. This script expects to find a file called
# 'problems.csv' in the current directory which should be generated
# by:
# DIR=`pwd` rake data:create_problem_spreadsheet
import csv
import datetime
from collecti... | agpl-3.0 | Python | |
bdbf5f538ea15360004a4efe769b629c3032b4bb | add admin view for eventschedule | dimagi/rapidsms,dimagi/rapidsms | lib/rapidsms/contrib/scheduler/admin.py | lib/rapidsms/contrib/scheduler/admin.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from django.contrib import admin
from .models import EventSchedule
class EventScheduleAdmin(admin.ModelAdmin):
model = EventSchedule
admin.site.register(EventSchedule, EventScheduleAdmin)
| bsd-3-clause | Python | |
7bfd677d1f4fce45b657e201ea5dfc639974cd16 | add script to generate color space matrices | Ryp/Reaper,Ryp/Reaper,Ryp/Reaper,Ryp/Reaper | tools/convert-rgb-space-xyz.py | tools/convert-rgb-space-xyz.py | #!/usr/bin/env python
#
# This program allows to generate matrices to convert between RGB spaces and XYZ
# All hardcoded values are directly taken from the ITU-R documents
#
# NOTE: When trying to convert from one space to another, make sure the whitepoint is the same,
# otherwise math gets more complicated (see Bradfo... | mit | Python | |
26d56afb094db4b471ec6bd6d5e496e0f9b547d0 | check all dataset shapes | dswah/pyGAM | pygam/tests/test_datasets.py | pygam/tests/test_datasets.py | # -*- coding: utf-8 -*-
import numpy as np
import pytest
from pygam.datasets import cake
from pygam.datasets import coal
from pygam.datasets import default
from pygam.datasets import faithful
from pygam.datasets import hepatitis
from pygam.datasets import mcycle
from pygam.datasets import trees
from pygam.datasets im... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.