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 |
|---|---|---|---|---|---|---|---|---|
7b7aa0506d8a9c2f12a41a3bcff84645dfb1e9b5 | Create ScikitSVM.py | vidhyal/WitchMusic | Scikit/ScikitSVM.py | Scikit/ScikitSVM.py | import numpy as np
from sklearn import svm
from sklearn.metrics import *
from sklearn import cross_validation
from sklearn.cross_validation import KFold
from BalanceData import *
import matplotlib.pyplot as plt
cParam = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
kFold =10
def ShuffleTrainFeatures(feats, lab... | mit | Python | |
94d7a3b01b7360001817ef3ed3ad2003f0722b14 | Add complex parse scenario - environment variables and init | melkamar/webstore-manager,melkamar/webstore-manager | tests/script_parser/test_parsing_complex.py | tests/script_parser/test_parsing_complex.py | from script_parser import parser
import os
def test_environ_init():
""" Set up variables in environment and check parser uses them to init properly. """
os.environ['client_id'] = 'x'
os.environ['client_secret'] = 'y'
os.environ['refresh_token'] = 'z'
p = parser.Parser(['chrome.init ${env.client_... | mit | Python | |
569a7cd00af6d7d0fe43427982b54f3cab81ca4f | add test-fallback-socks5-proxy.py | Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,community-ssu/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,jku/tele... | tests/twisted/test-fallback-socks5-proxy.py | tests/twisted/test-fallback-socks5-proxy.py | import dbus
from gabbletest import exec_test, make_result_iq, elem, elem_iq, sync_stream
from servicetest import call_async, EventPattern
from twisted.words.xish import domish, xpath
import ns
import constants as cs
from bytestream import create_from_si_offer, BytestreamS5B
# FIXME: stolen from offer-private-dbus-tu... | lgpl-2.1 | Python | |
76d781b83e1ab124cf1ae405a6cd5ad5274eef2d | add 3d conv benchmark | diogo149/treeano,jagill/treeano,nsauder/treeano,jagill/treeano,diogo149/treeano,nsauder/treeano,diogo149/treeano,nsauder/treeano,jagill/treeano | benchmarks/conv_3d.py | benchmarks/conv_3d.py | import numpy as np
import theano
import theano.tensor as T
import treeano.nodes as tn
fX = theano.config.floatX
# TODO change me
conv3d_node = tn.Conv3DNode
# conv3d_node = tn.DnnConv3DNode
network = tn.SequentialNode(
"s",
[tn.InputNode("i", shape=(1, 1, 32, 32, 32)),
conv3d_node("conv", num_filters=32,... | apache-2.0 | Python | |
76cc1118940850aed26f1d098ae8e23c2e17956d | create obfuscateion command | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/legalaid/management/commands/obfuscate.py | cla_backend/apps/legalaid/management/commands/obfuscate.py | # -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
"""
Obfuscate all sensitive data in db
Personal details:
full_name
postcode
street
mobile_phone
home_phone
email
date_of_birth
ni_nu... | mit | Python | |
0baf7e8863f7064dd0159c29616dd8b4751db15a | Test for issue #3. SQLite backend is not thread safe | femtotrader/requests-cache,YetAnotherNerd/requests-cache,reclosedev/requests-cache | tests/test_thread_safety.py | tests/test_thread_safety.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Path hack
import os, sys
sys.path.insert(0, os.path.abspath('..'))
from threading import Thread
import unittest
import requests
import requests_cache
CACHE_BACKEND = 'sqlite'
CACHE_NAME = 'requests_cache_test'
class ThreadSafetyTestCase(unittest.TestCase):
def te... | bsd-2-clause | Python | |
ceec6416f892a600adc41c0ee5bc75f7b340e200 | Deploy fabric task. | marcelor/xchange | fabfile.py | fabfile.py | import os
from fabric.api import run, cd
from fabric.contrib.console import confirm
from fabric.decorators import hosts
PROJECT_DIR = os.path.dirname(__file__)
@hosts('asimo@xchange.asimo.webfactional.com')
def deploy_production():
if confirm('This action will deploy to the site xchange.asimo.webfactional.com, ... | mit | Python | |
d9720f1fcc3013324c9ea58620df9c458a2e314e | Add (broken) AWc test for debugging purposes | FInAT/FInAT | test/test_awc.py | test/test_awc.py | import pytest
import FIAT
import finat
import numpy as np
from gem.interpreter import evaluate
from fiat_mapping import MyMapping
def test_morley():
ref_cell = FIAT.ufc_simplex(2)
ref_element = finat.ArnoldWinther(ref_cell, 3)
ref_pts = finat.point_set.PointSet(ref_cell.make_points(2, 0, 3))
phys_cel... | mit | Python | |
e307dcd0a7e4ff6bdeeca65ae2fc09577fdecb1e | add anti hot-linking test | PegasusWang/wechannel,PegasusWang/wechannel,PegasusWang/wechannel,PegasusWang/wechannel | test/test_img.py | test/test_img.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""防盗链测试"""
from requests import get
url = 'http://read.html5.qq.com/image?src=forum&q=5&r=0&imgflag=7&imageUrl=http://mmbiz.qpic.cn/mmbiz/zYJiboYpSP4dxQ9bUDia7tXvc5xwAtibkff3wSPicGwdWAM1z9j8G5ajohicO5b46ePmv3ibxqRpnp7KfQtvKAR6zQlg/0?wx_fmt=jpeg'
def test_my():
#H ... | mit | Python | |
a146670645eb5d225b82c56a580896fea3b6d32a | add pyfund1_sol | NYUDataBootcamp/Materials | Code/Python/pract_fund1_sol.py | Code/Python/pract_fund1_sol.py | """
Practice problems, Python fundamentals 1 -- Solutions
@authors: Balint Szoke, Daniel Csaba
@date: 06/02/2017
"""
#-------------------------------------------------------
# 1) Solution
good_string = "Sarah's code"
#or
good_string = """Sarah's code"""
#-------------------------------------------------------
... | mit | Python | |
8266673b2059a6cc583c5b5393d235d1a55b3ed7 | Update server.py | crossbario/autobahn-python,hzruandd/AutobahnPython,jvdm/AutobahnPython,schoonc/AutobahnPython,bencharb/AutobahnPython,meejah/AutobahnPython,oberstet/autobahn-python,crossbario/autobahn-python,nucular/AutobahnPython,iffy/AutobahnPython,markope/AutobahnPython,Geoion/AutobahnPython,dash-dash/AutobahnPython,iffy/AutobahnPy... | examples/asyncio/websocket/echo/server.py | examples/asyncio/websocket/echo/server.py | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | mit | Python |
d5420bddc9d845a8b56d62cc798b9851f68e3713 | Add zimg test script | vapoursynth/vapoursynth,Kamekameha/vapoursynth,Kamekameha/vapoursynth,vapoursynth/vapoursynth,Kamekameha/vapoursynth,Kamekameha/vapoursynth,vapoursynth/vapoursynth,vapoursynth/vapoursynth | test/zimgtest.py | test/zimgtest.py | import vapoursynth as vs
core = vs.get_core()
colorfamilies = (vs.GRAY, vs.YUV, vs.RGB, vs.YCOCG)
intbitdepths = (8, 9, 11, 11, 12, 13, 14, 15, 16)
floatbitdepths = (16, 32)
yuvss = (0, 1, 2)
formatids = []
for cfs in colorfamilies:
for bps in intbitdepths:
if cfs in (vs.YUV, vs.YCOCG):
for w... | lgpl-2.1 | Python | |
77b4624d5e0f5fb77edfca18be6ccf11d50fa862 | add Python/Visualisation/OrientedGlyphs | lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples | src/Python/Visualization/OrientedGlyphs.py | src/Python/Visualization/OrientedGlyphs.py | import vtk
sphereSource = vtk.vtkSphereSource()
sphereSource.Update()
input_data = vtk.vtkPolyData()
input_data.ShallowCopy(sphereSource.GetOutput())
arrowSource = vtk.vtkArrowSource()
glyph3D = vtk.vtkGlyph3D()
glyph3D.SetSourceConnection(arrowSource.GetOutputPort())
glyph3D.SetVectorModeToUseNormal()
glyph3D.SetI... | apache-2.0 | Python | |
a865ea3a9557ac3238615db020e742f10a787044 | Add test_settings module | nephila/aldryn-search,aldryn/aldryn-search,nephila/aldryn-search,aldryn/aldryn-search,nephila/aldryn-search,aldryn/aldryn-search | test_settings.py | test_settings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
HELPER_SETTINGS = {
'ALLOWED_HOSTS': ['localhost'],
'CMS_LANGUAGES': {1: [{'code': 'en', 'name': 'English'}]},
'CMS_TEMPLATES': (("whee.html", "Whee Template"),),
'LANGUAGES': (('en', 'English'),),
'LANGUAGE_CODE': 'en',
'TEMPLATE_LOADERS': ('aldry... | bsd-3-clause | Python | |
a3a7e748c106e30b5b8cfeb50ef6722b6af5112c | Add initial test | pmav99/fxr | tests/test_sr.py | tests/test_sr.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# module:
# author: Panagiotis Mavrogiorgos <pmav99,gmail>
"""
"""
import shlex
import subprocess
import pytest
@pytest.fixture
def temp_file(tmpdir):
sample_file = tmpdir.join("file.txt")
return sample_file
@pytest.mark.parametrize("pattern, replacement, co... | bsd-2-clause | Python | |
1aceea20a05b5324ad20bcd3595667f64eedf973 | Add tests for `cms.views`. | dan-gamble/cms,lewiscollard/cms,jamesfoley/cms,jamesfoley/cms,danielsamuels/cms,jamesfoley/cms,lewiscollard/cms,lewiscollard/cms,dan-gamble/cms,danielsamuels/cms,dan-gamble/cms,danielsamuels/cms,jamesfoley/cms | cms/tests/test_views.py | cms/tests/test_views.py | from django.test import TestCase
from ..views import TextTemplateView
class TestViews(TestCase):
def test_texttemplateview_render_to_response(self):
view = TextTemplateView()
view.request = {}
view.template_name = 'templates/base.html'
rendered = view.render_to_response({})
... | bsd-3-clause | Python | |
c3ed60f1fc767e4444a4ee0abdf9a76cd21263d8 | Include example using noise reducer. | jdammers/jumeg,pravsripad/jumeg | examples/preprocessing/plot_noise_reducer.py | examples/preprocessing/plot_noise_reducer.py | #!/usr/bin/env python
'''
Script to show the application of noise reducer on jusample data.
'''
import os
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
from jumeg.jumeg_noise_reducer import noise_reducer
import mne
plt.ion()
# load the jumeg sample data (has to be BTI)
data_dir = os.enviro... | bsd-3-clause | Python | |
717174fcf7d876caba23cdde956f5884f6adc244 | Add module | jni/flatten | flatdir.py | flatdir.py | import os
import sys
import argparse
import re
BYTES_FINDER = re.compile(r'(\d+(?:\.\d+)?)\s?(k|K|m|M|g|G|t|T)?(B|b)?')
POWERS_D = {'k': 10**3, 'm': 10**6, 'g': 10**9, 't': 10**12}
POWERS_B = {'k': 2**10, 'm': 2**20, 'g': 2**30, 't': 2**40}
def r_scandir(path):
'''List files and directories recursively.
Pa... | mit | Python | |
52f0cb0f06a7f7918cfbb2f8ead5e4e725f4072d | add script for correcting Bogotá data (when PDoCInteri is not null, it's the house number and PDoTexto is the unit, otherwise PDoTexto is the house number) | sergiyprotsiv/openaddresses,slibby/openaddresses,sergiyprotsiv/openaddresses,tyrasd/openaddresses,sabas/openaddresses,sabas/openaddresses,sergiyprotsiv/openaddresses,openaddresses/openaddresses,tyrasd/openaddresses,openaddresses/openaddresses,openaddresses/openaddresses,slibby/openaddresses,orangejulius/openaddresses,m... | scripts/co/bogota.py | scripts/co/bogota.py | import json
import sys
import logging
from esridump.dumper import EsriDumper
logging.basicConfig(level=logging.DEBUG)
outfile_name = sys.argv[1] if len(sys.argv) > 1 else 'bogota.geojson'
d = EsriDumper('http://serviciosgis.catastrobogota.gov.co/arcgis/rest/services/Mapa_Referencia/Mapa_Referencia/MapServer/33')
o... | bsd-3-clause | Python | |
e00a0430ceac9439cfc15f1d2c019e3da88f6cf7 | set up data generator | taoalpha/XMate,taoalpha/XMate,taoalpha/XMate,taoalpha/XMate | dataGenerator/dataGenerator.py | dataGenerator/dataGenerator.py | import requests
postUrl = "http://localhost:5000"
def sendUserProfile(profile):
r = requests.post(postUrl+'/user/', data = profile)
if (!checkStatus(r)):
break
def sendScheduleProfile(profile):
r = requests.post(postUrl+'/schedule/', data = profile)
def sendMessageProfile(profile):
r = requests.post(postUrl+'... | mit | Python | |
89c92a02062cf91c4e3e66fe86846e57bc3388b8 | Add new package:py-pytest-check-links (#16503) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-pytest-check-links/package.py | var/spack/repos/builtin/packages/py-pytest-check-links/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPytestCheckLinks(PythonPackage):
"""pytest plugin that checks URLs for HTML-containing ... | lgpl-2.1 | Python | |
f98acc57f7ca18c21744d03cbad8f5239b4eceab | add script to create command list | kontron/python-ipmi | bin/supported_cmds.py | bin/supported_cmds.py | import sys
from collections import OrderedDict, namedtuple
from pyipmi.msgs.registry import DEFAULT_REGISTRY
def make_table(grid):
col_length = map(list, zip(*[[len(item) for item in row] for row in grid]))
max_cols = [max(out) for out in col_length]
rst = table_div(max_cols, 1)
for i, row in enume... | lgpl-2.1 | Python | |
9f0e49a7523bc48529155b8f22f89a8c893026ce | add display | will127534/AFE4400,will127534/AFE4400 | AFE4400_display.py | AFE4400_display.py |
import numpy as np
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt
import serial
from serial.tools import list_ports
import matplotlib.animation as animation
import time
print list(list_ports.comports())
#x = raw_input(">>> Input Com port name: ")
Serial = serial.Serial("COM13",115200)
long_ave = [... | mit | Python | |
fda2eeb1b16ccd13b18d0badb5c3bcf93e08ea38 | Add initial code to obtain haplographs. | AbeelLab/phasm,AbeelLab/phasm | phasm/walker.py | phasm/walker.py | """
Obtain graph representations for chromosomes from the total assembly graph.
This module contains functions to obtain "fused" haplotype contigs. Or in other
words: it helps in obtaining subgraphs from the assembly graph that represent
a set of chromosome copies. This subgraph may contain bubbles and other
non-linea... | mit | Python | |
31f4974482f1652b00324c9bc5760689ed4dd0fa | Create __init__.py | robertclf/FAFT,robertclf/FAFT | FAFT_64-points_R2C/__init__.py | FAFT_64-points_R2C/__init__.py | bsd-3-clause | Python | ||
4d465ba648ce4af7547818574bd2b08be835eb09 | Add initial template of zenodo-deposit.py | libscie/liberator,libscie/liberator,libscie/liberator,libscie/liberator | bin/zenodo-deposit.py | bin/zenodo-deposit.py | import requests
headers = {"Content-Type": "application/json"}
r = requests.post('https://zenodo.org/api/deposit/depositions',
params={'access_token': ZENODO_KEY}, json={},
headers=headers)
# Get the deposition id from the previous response
deposition_id = r.json()['id']
# Upload fi... | cc0-1.0 | Python | |
8411eb2ee14718141b7242e54b60c3e8da906e4d | Add grep plugin | tomleese/smartbot,Cyanogenoid/smartbot,thomasleese/smartbot-old,Muzer/smartbot | plugins/grep.py | plugins/grep.py | import io
import re
import unittest
class Plugin:
def on_command(self, bot, msg, stdin, stdout, reply):
pattern_str = " ".join(msg["args"][1:])
if pattern_str:
pattern = re.compile(pattern_str)
for line in map(str.strip, stdin):
if pattern_str in line or re.... | mit | Python | |
299f08729c1a1c2d1893809a7ae7e53d51054d90 | Add realtime.py | toomore/goristock | realtime.py | realtime.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class twsk:
def __init__(self,no = None):
self.stock = ''
if no is None:
no = random.randrange(1000,8000)
ok = 1
ok_times = 0
while ok:
ok = 0
try:
page = urllib2.urlopen('http://mis.tse.com.tw/data/%s.csv?r=%s' % (no,random... | mit | Python | |
cca86b7dc339719863fb5cf66388a18b4f40b9c1 | Create plugin.py | architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst | cea/plugin.py | cea/plugin.py | """
A base class for creating CEA plugins. Subclass this class in your own namespace to become a CEA plugin.
"""
### NOTE / FIXME: have this class read in the scripts.yml and schemas.yml. plots need to be python classes.
class CeaPlugin(object):
"""
A CEA Plugin defines a list of scripts and a list of plots -... | mit | Python | |
5084957b070e19334d7256a727ff995989f0e14e | add tar raw loader | shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3 | src/loaders/tarraw.py | src/loaders/tarraw.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017 shmilee
'''
Contains TarFile raw loader class.
'''
import os
import tarfile
from ..glogger import getGLogger
from .base import BaseRawLoader
__all__ = ['TarRawLoader']
log = getGLogger('L')
class TarRawLoader(BaseRawLoader):
# https://docs.python.org/3/library/tarf... | mit | Python | |
3eccb0323590c876735fe8c664cd2e4866bd3089 | Add SKeys function | funkybob/kopytka,funkybob/kopytka,funkybob/kopytka | kopytka/transforms.py | kopytka/transforms.py | from django.db.models import CharField, Func
from django.contrib.postgres.fields import ArrayField
class SKeys(Func):
function = 'skeys'
arity = 1
output_field = ArrayField(CharField())
| mit | Python | |
d56d2b2db736b9160c49ea7694732b047a398f3d | Add version.py | xlhtc007/blaze,caseyclements/blaze,maxalbert/blaze,dwillmer/blaze,ContinuumIO/blaze,ChinaQuants/blaze,ChinaQuants/blaze,jdmcbr/blaze,nkhuyu/blaze,ContinuumIO/blaze,nkhuyu/blaze,jcrist/blaze,cpcloud/blaze,alexmojaki/blaze,jcrist/blaze,caseyclements/blaze,mrocklin/blaze,scls19fr/blaze,LiaoPan/blaze,cowlicks/blaze,jdmcbr/... | conda.recipe/version.py | conda.recipe/version.py | def main():
inp = sys.stdin.read().strip().split('-')
try:
inp[1] = 'post%03d' % int(inp[1])
except IndexError:
pass
print('.'.join(inp))
return 0
if __name__ == '__main__':
import sys
sys.exit(main())
| bsd-3-clause | Python | |
18c93f4c70a2247bcce8a853c30038097cb9f7b2 | Add test for optional page admin registrations for Country and CountryGroup. | jamesfoley/cms,jamesfoley/cms,danielsamuels/cms,lewiscollard/cms,jamesfoley/cms,dan-gamble/cms,lewiscollard/cms,danielsamuels/cms,danielsamuels/cms,lewiscollard/cms,dan-gamble/cms,jamesfoley/cms,dan-gamble/cms | cms/apps/pages/tests/test_admin_destructive.py | cms/apps/pages/tests/test_admin_destructive.py | from django.conf import settings
from django.contrib import admin
from django.test import TestCase
from ..models import Country, CountryGroup, Page
import sys
class TestArticleAdminBase(TestCase):
def test_article_admin(self):
NEW_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES + (
'cms.mi... | bsd-3-clause | Python | |
06e0c4663dd9dcc99778b80ad288a5b845bb9d2f | add default string length for tutorial method (mysql requires it) | zejn/cubes,zejn/cubes,she11c0de/cubes,cesarmarinhorj/cubes,jell0720/cubes,cesarmarinhorj/cubes,jell0720/cubes,zejn/cubes,noyeitan/cubes,ubreddy/cubes,ubreddy/cubes,cesarmarinhorj/cubes,noyeitan/cubes,ubreddy/cubes,jell0720/cubes,pombredanne/cubes,she11c0de/cubes,she11c0de/cubes,pombredanne/cubes,pombredanne/cubes,noyei... | cubes/tutorial/sql.py | cubes/tutorial/sql.py | import sqlalchemy
import csv
def create_table_from_csv(connectable, file_name, table_name, fields, create_id = False, schema = None):
"""Create a table with name `table_name` from a CSV file `file_name` with columns corresponding
to `fields`. The `fields` is a list of two string tuples: (name, type) where type... | import sqlalchemy
import csv
def create_table_from_csv(connectable, file_name, table_name, fields, create_id = False, schema = None):
"""Create a table with name `table_name` from a CSV file `file_name` with columns corresponding
to `fields`. The `fields` is a list of two string tuples: (name, type) where type... | mit | Python |
4607b954ea9c2abb58e084d12179d42868fc12d0 | Create hash-digest-rename.py | ammongit/scripts,ammongit/scripts,ammongit/scripts,ammongit/scripts | hash-digest-rename.py | hash-digest-rename.py | #!/usr/bin/env python3
import hashlib
import os
import sys
def normalize_algorithm(name):
# Since the name might be caps or have dashes,
# we normalize to lowercase as used by Python's hashlib.
return name.lower().replace("-", "")
def plural(number):
return "" if number == 1 else "s"
def hash_re... | mit | Python | |
06c9a86ab4fd12c319d35d64a135740077e1d93a | modify pkg_info | volterra-luo/django-oss-storage | storages/pkg_info.py | storages/pkg_info.py | package = "django-oss-storage"
version = "0.3.5"
url = "http://oss.aliyun.com"
license = "The MIT License (MIT)"
short_description = 'Django Aliyun OSS storage backend.' | mit | Python | |
cee4d852003a1ec8f19714ee1503888068cf9749 | Create svm.py | lingcheng99/kagge-digit-recognition | svm.py | svm.py | import numpy as np
import pandas as pd
from sklearn import metrics,cross_validation
from sklearn.cross_validation import train_test_split
from sklearn import svm
#Read training data and split into train and test data
data=pd.read_csv('train.csv')
data1=data.values
X=data1[:,1:]
y=data1[:,:1]
y=np.ravel(y)
Xtrain,Xtest... | mit | Python | |
ade401c1f988542344f62b73498d5a7a31554698 | update setup.py | dxq-git/nghttp2,wzyboy/nghttp2,serioussam/nghttp2,minhoryang/nghttp2,lukw00/nghttp2,kelbyludwig/nghttp2,syohex/nghttp2,tatsuhiro-t/spdylay,bxshi/nghttp2,serioussam/nghttp2,thinred/nghttp2,mixianghang/spdylay,dxq-git/nghttp2,bxshi/nghttp2,syohex/nghttp2,thinred/nghttp2,bxshi/nghttp2,icing/nghttp2,serioussam/nghttp2,ohye... | python/setup.py | python/setup.py | from distutils.core import setup
from distutils.extension import Extension
setup(
name = 'python-spdylay',
# Also update __version__ in spdylay.pyx
version = '0.1.0',
description = 'Python SPDY library on top of Spdylay C library',
author = 'Tatsuhiro Tsujikawa',
author_email = 'tatsuhiro.t@gma... | from distutils.core import setup
from distutils.extension import Extension
setup(
name = 'python-spdylay',
# Also update __version__ in spdylay.pyx
version = '0.1.0',
description = 'SPDY library',
author = 'Tatsuhiro Tsujikawa',
author_email = 'tatsuhiro.t@gmail.com',
url = 'http://spdylay.... | mit | Python |
d5364fe87c4491bc564ba1406604ee423788a8a8 | Add lc01161_maximum_level_sum_of_a_binary_tree.py | bowen0701/algorithms_data_structures | lc01161_maximum_level_sum_of_a_binary_tree.py | lc01161_maximum_level_sum_of_a_binary_tree.py | """Leetcode 1161. Maximum Level Sum of a Binary Tree
Medium
URL: https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/
Given the root of a binary tree, the level of its root is 1,
the level of its children is 2, and so on.
Return the smallest level X such that the sum of all the values of nodes
at level... | bsd-2-clause | Python | |
e6a972e4a5f0be7c78439f8437c693cfb3381e54 | create class Level - basic class methods | ana-balica/meow_letters_py | meow_letters/level.py | meow_letters/level.py | class Level(object):
"""Represents user level
"""
def __init__(self, level=1):
"""Level class initializer
:param level: int positive number that represents level
"""
self.level = level
def __repr__(self):
return "<Level '{0}' at {1}>".format(self.level, hex(id(s... | mit | Python | |
8053701daf9abdb35c870b1b70940bb60d60328c | Create annotate_gwas_results_from_vcf.py | christopher-gillies/VCFScripts,christopher-gillies/VCFScripts | annotate_gwas_results_from_vcf.py | annotate_gwas_results_from_vcf.py | #!/usr/bin/python
import argparse
import re
import pysam
import os
import string
from pysam import VariantFile
import itertools
"""
annotate_gwas_results_from_vcf.py This script will take a vcf file and gwas results and add additional columns from a
SnpEff annotated VCF
"""
| apache-2.0 | Python | |
ac720cc02d35c3baa8e1c09c2639126ae7173f2b | Add NLDN file reader | deeplycloudy/lmatools | NLDN.py | NLDN.py | from datetime import datetime
import numpy as np
from numpy.lib.recfunctions import drop_fields, append_fields
class NLDNdataFile(object):
stroke_DC3 = {'columns':[ ('date','S10'), ('time','S20'),
('lat','f4'), ('lon','f4'),
('peakCurrent','f4'), (... | bsd-2-clause | Python | |
5c834d19a113301e3bdc07dc03fb1486825825c5 | Add an initial moksha.api.hub API, with a dumb send_message method. | ralphbean/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,ralphbean/moksha,pombredanne/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,mokshaproject/moksha | moksha/api/hub/hub.py | moksha/api/hub/hub.py | from orbited import json
from moksha.hub import MokshaHub
def send_message(topic, message):
""" Send a `message` to a specific `topic` """
# Right now we're instantiating a new connection & channel each message..
# we could potentially do this in the DataStreamer...
# each could have their own Connect... | apache-2.0 | Python | |
d34ad4b0b969dd6c10fc7c1646f934016ba8ddd7 | Add a script to list undocumented files and directories | makdharma/grpc,yugui/grpc,simonkuang/grpc,dklempner/grpc,matt-kwong/grpc,apolcyn/grpc,kumaralokgithub/grpc,geffzhang/grpc,ctiller/grpc,thinkerou/grpc,chrisdunelm/grpc,ejona86/grpc,donnadionne/grpc,yugui/grpc,nicolasnoble/grpc,dgquintas/grpc,adelez/grpc,PeterFaiman/ruby-grpc-minimal,kpayson64/grpc,grani/grpc,makdharma/g... | tools/distrib/c-ish/check_documentation.py | tools/distrib/c-ish/check_documentation.py | #!/usr/bin/env python2.7
# Copyright 2015, Google Inc.
# 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
# notice, this li... | apache-2.0 | Python | |
fd4074160a943fb8841780211395a58ff5719dc1 | Add `settings.py` | avinassh/kekday,avinassh/kekday | settings.py | settings.py | import os
user_agent = 'when is my cakeday by /u/avinassh'
scopes = ['identity']
app_key = os.environ['APP_KEY']
app_secret = os.environ['APP_SECRET']
refresh_token = os.environ['REFRESH_TOKEN']
access_token = os.environ['ACCESS_TOKEN']
| mit | Python | |
d3ce90054a85c8711b95f6cf1fb975d78b8a2101 | add first try to understand stew api | mencattini/ideal-pancake,mencattini/ideal-pancake | core.py | core.py | from stew.types.nat import Nat
print(Nat(10))
| apache-2.0 | Python | |
b363b20440e564b2909736c64cb543cd632b4ae4 | Print daily form submission counts | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/covid/management/commands/fetch_form_case_counts.py | custom/covid/management/commands/fetch_form_case_counts.py | import itertools
from datetime import date, datetime, timedelta
from django.core.management.base import BaseCommand
from corehq.apps.enterprise.models import EnterprisePermissions
from corehq.apps.es import CaseES, FormES
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(... | bsd-3-clause | Python | |
447720e9f18447476bc3d4f8b16a9eed018b260e | Add lc074_search_a_2d_matrix.py | bowen0701/algorithms_data_structures | lc074_search_a_2d_matrix.py | lc074_search_a_2d_matrix.py | """Leetcode 74. Search a 2D Matrix.
Medium
URL: https://leetcode.com/problems/search-a-2d-matrix/
Write an efficient algorithm that searches for a value in an m x n matrix.
This matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the... | bsd-2-clause | Python | |
b6ac5540021dd7de2a97d4cb9f668059a16a7e94 | Write edit preparation test | osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api | whats_fresh/whats_fresh_api/tests/views/entry/test_edit_preparation.py | whats_fresh/whats_fresh_api/tests/views/entry/test_edit_preparation.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from whats_fresh_api.models import *
from django.contrib.gis.db import models
from django.contrib.auth.models import User
import json
class EditPreparationTestCase(TestCase):
"""
Test that the Edit Preparation page works as expected... | apache-2.0 | Python | |
ae8226b969a792f8a1018394ee193a186e13ba1e | Create azuretranslator.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/hairygael/GESTURES/azuretranslator.py | home/hairygael/GESTURES/azuretranslator.py | #CREDITS : PAPAOUTAI
# your keys here ( put in config file ) : https://datamarket.azure.com/dataset/bing/microsofttranslator
AzureTranslator=Runtime.createAndStart("AzureTranslator", "AzureTranslator")
sleep(0.1)
#initiate azure
#AzureTranslator.setCredentials(Azure_client_id,Azure_client_secret)
AzureTranslator.setC... | apache-2.0 | Python | |
8354354be70851b91a66e11a784d19684345df4d | Add triangular distribution. | Effective-Quadratures/Effective-Quadratures | equadratures/distributions/triangular.py | equadratures/distributions/triangular.py | """The Triangular distrubution."""
from equadratures.distributions.template import Distribution
from equadratures.distributions.recurrence_utils import custom_recurrence_coefficients
import numpy as np
from scipy.stats import triang
RECURRENCE_PDF_SAMPLES = 8000
class Triangular(Distribution):
"""
The class de... | lgpl-2.1 | Python | |
e451343922251b552e902b84aa925b0a04ae958f | Add test script | ianknowles/EarTimeWrangler | src/test.py | src/test.py | import wrangler
if __name__ == '__main__':
wrangler.test_task()
| mit | Python | |
b438141932dc32c2bb0749ad0bf1cafaed09c711 | Add dynamic resizing support. | peterbrittain/asciimatics,peterbrittain/asciimatics | asciimatics/exceptions.py | asciimatics/exceptions.py | class ResizeScreenError(Exception):
"""
Asciimatics raises this Exception if the terminal is resized while playing
a Scene (and the Screen has been told not to ignore a resizing event).
"""
def __init__(self, message):
"""
:param message: Error message for this exception.
""... | apache-2.0 | Python | |
d3e90e4dca1cce2f27ccf9c24c1bb944f9d708b9 | Add a unit test file for MessageDirectory | tofu-rocketry/ssm,apel/ssm,tofu-rocketry/ssm,stfc/ssm,apel/ssm,stfc/ssm | test/test_message_directory.py | test/test_message_directory.py | """
Created on 18 May 2018.
@author: Greg Corbett
"""
import shutil
import tempfile
import unittest
from ssm.message_directory import MessageDirectory
class TestMessageDirectory(unittest.TestCase):
"""Class used for testing the MessageDirectory class."""
def setUp(self):
"""Create a MessageDirecto... | apache-2.0 | Python | |
25bb3511e6b06f739e4ebe8aed79ec25d1ecae29 | use get_total_case_count | puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | corehq/ex-submodules/casexml/apps/case/tests/test_multi_case_submits.py | corehq/ex-submodules/casexml/apps/case/tests/test_multi_case_submits.py | from django.test import TestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.dbaccessors import get_total_case_count
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests import delete_all_xforms, delete_all_cases
from couchforms.tests.testutils import post_... | from django.test import TestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests import delete_all_xforms, delete_all_cases
from couchforms.tests.testutils import post_xform_to_couch
from casexml.apps.case.xform import process_case... | bsd-3-clause | Python |
2414789b86be5303e95ce8a4b98bca345d224bd9 | Add pythondoc HTMLParser code | brockuniera/PhoneBrowser,brockuniera/PhoneBrowser | html.py | html.py | import HTMLParser
import requests
class WikiParse(HTMLParser.HTMLParser):
def handle_starttag(self, tag, attrs):
print "start tag", tag
def handle_endtag(self, tag):
print "end tag", tag
def handle_data(self, data):
print "data", data
if __name__ == "__main__":
parser = Wik... | mit | Python | |
499127a1dcb4edce3a823fb3fd1787db3a5b96b2 | Add util.py to add helpers to mailchimp handlers | tforrest/soda-automation,tforrest/soda-automation | app/mailchimp/util.py | app/mailchimp/util.py | import re
resp_match = lambda status: re.match(r"^[4,5][0-9][0-9]$",status)
def handle_response(func):
"""Utility function that pre processes a
mailchimp response
"""
r = func()
try:
if resp_match(r["status"]):
raise ChimpException(r["status"],r["title"],r["detail"])
exc... | mit | Python | |
70958a1573f2eb0987ce26fe6807896edb1c987a | Add script to allow download of images using new media API | mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData | external_tools/src/main/python/images/downloadimages_using_media_api.py | external_tools/src/main/python/images/downloadimages_using_media_api.py | #!/usr/bin/python
"""Download images from DCC using media API
Allows download of images using the media API provided by the DCC instead
of the solr core which the original downloadimages.py script uses. This is
necessary sometimes to get a headstart on the data-release.
See also downloadimages.py and downloadimages_u... | apache-2.0 | Python | |
11b8fee12d0c4ccaa6c922e00e601efdf1706a89 | Add proof-of-concept video tracking | sigvartmh/CamPal-TDT4140,sigvartmh/CamPal-TDT4140 | videoconcept.py | videoconcept.py | import numpy as np
import sys
sys.path.append('/usr/local/Cellar/opencv3/3.2.0/lib/python2.7/site-packages')
from imutils.object_detection import non_max_suppression
import imutils
import cv2
import time
hog = cv2.HOGDescriptor()
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
camera = cv2.VideoCaptu... | mit | Python | |
5d128562c1f90537e6c4164b7651cae6b7f2838b | Add missing import | dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild | python/qitoolchain/actions/convert_package.py | python/qitoolchain/actions/convert_package.py | ## Copyright (c) 2012-2014 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.
"""Convert a binary archive into a qiBuild package.
"""
import os
from qisys import ui
import qisys
import qisys.parsers
from qitoolchain.conver... | ## Copyright (c) 2012-2014 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.
"""Convert a binary archive into a qiBuild package.
"""
import os
import qisys
import qisys.parsers
from qitoolchain.convert import convert_pack... | bsd-3-clause | Python |
b4305e843ecfec33640762e5698cd36b38912707 | Add a utility script for encoding packet traces | vovojh/gem5,pombredanne/http-repo.gem5.org-gem5-,vovojh/gem5,hoangt/tpzsimul.gem5,pombredanne/http-repo.gem5.org-gem5-,hoangt/tpzsimul.gem5,hoangt/tpzsimul.gem5,vovojh/gem5,vovojh/gem5,vovojh/gem5,pombredanne/http-repo.gem5.org-gem5-,hoangt/tpzsimul.gem5,vovojh/gem5,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http... | util/encode_packet_trace.py | util/encode_packet_trace.py | #!/usr/bin/env python
# Copyright (c) 2013 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation... | bsd-3-clause | Python | |
7fd09bd791661ab0b12921dfd977591690d9c01a | Add form tests for LoginForm | randomic/aniauth-tdd,randomic/aniauth-tdd | accounts/tests/test_forms.py | accounts/tests/test_forms.py | """accounts app unittests for views
"""
from django.test import TestCase
from accounts.forms import LoginForm
class LoginFormTest(TestCase):
"""Tests the form which validates the email used for login.
"""
def test_valid_email_accepted(self):
form = LoginForm({'email': 'newvisitor@example.com'})... | mit | Python | |
a719f3b15664555543266f0575210f750d8cb631 | Add hwmon instrument | lisatn/workload-automation,lisatn/workload-automation,setrofim/workload-automation,lisatn/workload-automation,ARM-software/workload-automation,ARM-software/workload-automation,setrofim/workload-automation,setrofim/workload-automation,setrofim/workload-automation,ARM-software/workload-automation,ARM-software/workload-au... | wa/instrumentation/hwmon.py | wa/instrumentation/hwmon.py | # Copyright 2017 ARM Limited
#
# 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 writin... | apache-2.0 | Python | |
dc6b7da10f8da0adad984a24b9c3f5904fe48de5 | Add simpler video playback example. | infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore | examples/video.py | examples/video.py | #!/usr/bin/env python
'''Simple example of video playback.
Usage::
video.py <filename>
See the Programming Guide for a partial list of supported video formats.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import sys
import pyglet
if len(sys.argv) < 2:
print __doc__
sys.exit(1)
source ... | bsd-3-clause | Python | |
28a7077b7f05f52d0bff7a849f8b50f82f73dbdb | Add a script to convert an index to a md5 file. | RKrahl/photo-tools | idx2md5.py | idx2md5.py | #! /usr/bin/python
from __future__ import print_function
import sys
import photo.index
idx = photo.index.Index(idxfile=sys.argv[1])
for i in idx:
print("%s %s" % (i.md5, i.filename))
| apache-2.0 | Python | |
05e2b100512a9c9b06c5d7d2701867f155c5e3f0 | Add API tests for profile validation | openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin | senlin/tests/tempest/api/profiles/test_profile_validate.py | senlin/tests/tempest/api/profiles/test_profile_validate.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 t... | apache-2.0 | Python | |
98d215599a722ec2784d8795d521eb40bb35c1fe | Create iphone_chat_server.py | stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests | iphone_chat_server.py | iphone_chat_server.py | #StephaneAG - 2012
#simple chat server for iphone socket communication using python
# to run : sudo Python iphone_chat_server.py # > Using sudo as it requires administer access to listen on a port on the machine
# to test : telnet localhost 80
# Chat events: >we use a simple format to exchange messages : strings sep... | mit | Python | |
baeaa2b2e9ed7b6d932adae9aee0517a0e73428f | Add __init__ file to iso_639_3/ | noumar/iso639,noumar/iso639 | iso_639_3/__init__.py | iso_639_3/__init__.py | from __future__ import absolute_import
from iso_639_3.iso_639_3 import iso_639_3
languages = iso_639_3()
| agpl-3.0 | Python | |
923b32c3ff66539db01fd4f3008ee23f61348507 | Add files via upload | guillochon/MOSFiT,guillochon/MOSFiT,bmockler/MOSFiT,guillochon/FriendlyFit,mnicholl/MOSFiT,mnicholl/MOSFiT,mnicholl/MOSFiT,villrv/MOSFiT,guillochon/MOSFiT,bmockler/MOSFiT,villrv/MOSFiT | friendlyfit/modules/seds/envelopecore.py | friendlyfit/modules/seds/envelopecore.py | from math import pi
import numpy as np
import numexpr as ne
from astropy import constants as c
from ...constants import DAY_CGS, FOUR_PI, KM_CGS, M_SUN_CGS
from .sed import SED
CLASS_NAME = 'EnvelopeCore'
class EnvelopeCore(SED):
"""Expanding/receding photosphere with a core+envelope
morphology and a black... | mit | Python | |
35662cf6a174f1924f20d6b78241e6095fa9fb3e | Fix syntax error in build/all_android.gyp | anirudhSK/chromium,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,ltilve/chromium,dushu1203/chromium.src,ondra-novak/chromium.src,crosswalk-project/chromium-crosswalk-efl,patrickm/chromium.src,bright-sparks/chromium-spacewalk,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,mohamed-... | build/all_android.gyp | build/all_android.gyp | # 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.
# TODO(thakis): Remove this file after https://codereview.chromium.org/139743016
# has been in the tree for a while.
{
'targets': [
{
'target... | # 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.
# TODO(thakis): Remove this file after https://codereview.chromium.org/139743016
# has been in the tree for a while.
{
'targets': [
{
'target... | bsd-3-clause | Python |
8751397275a6de993b2c317e85aee26c0ce3d9a9 | add tests for middleware | avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf | src/python/expedient_geni/tests.py | src/python/expedient_geni/tests.py | '''
Created on Oct 8, 2010
@author: jnaous
'''
from expedient.common.tests.manager import SettingsTestCase
from django.core.urlresolvers import reverse
from django.conf import settings
import os
from expedient_geni.utils import get_user_cert_fname, get_user_key_fname
from django.contrib.auth.models import User
from ex... | bsd-3-clause | Python | |
4053948ba58b266ef66e181776c2fe4bc37b4760 | Create Anagrams.py | UmassJin/Leetcode | Array/Anagrams.py | Array/Anagrams.py | Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
Reference: http://blog.csdn.net/linhuanmars/article/details/21664747
# Notes: anagrams definition: two strings, which have the same character, maybe different order
# 1) Save the SORTED string as the key... | mit | Python | |
98e7f719b379ad4bdb87e6cb077b3d9d6340107b | Monitor for nexus | CiscoSystems/os-sqe,CiscoSystems/os-sqe,CiscoSystems/os-sqe | lab/monitors/nexus.py | lab/monitors/nexus.py |
def monitor(context, log, args):
import time
import logging
import json
import requests
nexus_name = args.get('name', 'Nexus_'.format(args['ip']))
def _nxapi(commands):
request = [{"jsonrpc": "2.0", "method": "cli", "params": {"cmd": command, "version": 1}, "id": 1} for command in com... | apache-2.0 | Python | |
adc12504811dff0318f085887e207517d780862b | add merge migration | felliott/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,erinspace/osf.io,erinspace/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,adlius/osf.io,felliott/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,erinspace/osf.io,mattclark/osf.io,caseyrollins/osf.io,HalcyonChimera/osf.io,mfraezz/osf.io,pattisdr/osf.io,saradbo... | osf/migrations/0106_merge_20180531_0919.py | osf/migrations/0106_merge_20180531_0919.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-31 14:19
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0105_merge_20180525_1529'),
('osf', '0104_merge_20180524_1257'),
]
operatio... | apache-2.0 | Python | |
cac9e9fa65a9b7f1055f193822a66e5edcad88ee | Create twitch.py | TingPing/plugins,TingPing/plugins | HexChat/twitch.py | HexChat/twitch.py | import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'TingPing'
__module_version__ = '0'
__module_description__ = 'Better integration with Twitch.tv'
# Very much a work in progress...
# Best used with my 'mymsg.py' script so you can sync your messages with the web clients.
# Commands from http://help.twitch... | mit | Python | |
53d1e2ca188fbcae1899b6190ad3e59bdf5911bb | Create base64_enc_dec.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | Encryption/base64_enc_dec.py | Encryption/base64_enc_dec.py | """
Name : Bas 64 Encryption, encoder and decoder
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/
Pow... | agpl-3.0 | Python | |
94500a279da6f03362c82961e9a97d0223175bd7 | Create LabelPerimeter.py | DigitalSlideArchive/HistomicsTK,DigitalSlideArchive/HistomicsTK | LabelPerimeter.py | LabelPerimeter.py | import numpy as np
def LabelPerimeter(L, Connectivity=4):
"""Converts a label or binary mask image to a binary perimeter image.
Uses 4-neighbor or 8-neighbor shifts to detect pixels whose values do
not agree with their neighbors.
Parameters
----------
L : array_like
A label or binary... | apache-2.0 | Python | |
cf6cf3433cbc816a14534f12bad36d20c908d869 | Create Subset.py | OLAPLINE/TM1py,MariusWirtz/TM1py | Samples/Subset.py | Samples/Subset.py | import uuid
from TM1py import Subset, TM1Queries
random_string1 = str(uuid.uuid4())
random_string2 = str(uuid.uuid4())
q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True)
# create dynamic subset
s = Subset(dimension_name='plan_business_unit', subset_name=random_string1,
expression='... | mit | Python | |
bf6737d8ddd8c0ff21a550da44d23b8ec39c70eb | Add 1-4.py, simple hashing in set 1 | SingingTree/WarGames | set1/1-4.py | set1/1-4.py | # This is a hack to make sure Python 2.x and 3.x behave the same
# You can ignore this bit
try:
input = raw_input
except NameError:
pass
# Real program starts here
def hash_password(string):
return str(len(string) % 10)
hashed_password = "6"
print("Please enter the password")
password_input = input()
... | mit | Python | |
861a5fcda82fefbe10c844fda4075688dc6baf8e | Save submissions, and redirect user to the submission detail page after completing form. | patricmutwiri/pombola,hzj123/56th,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,mysociety/pombola,ken-muturi/pombola,patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,geoffkilpin/pombola,mysociety/pombola,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,patricmutwiri/pombola,geoffkilpin/pombo... | mzalendo/votematch/views.py | mzalendo/votematch/views.py | import models
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
def quiz_detail (request, slug):
quiz = get_object_or_404(
models.Quiz,
slug=slug
)
# If this is a POST then extract all the answers
if reques... | import models
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
def quiz_detail (request, slug):
quiz = get_object_or_404(
models.Quiz,
slug=slug
)
return render_to_response(
'votematch/quiz_detail.html',... | agpl-3.0 | Python |
4653596825bf00fe403e77c4b11a0def6bac2649 | add settings.py | koox00/scalable-py,koox00/scalable-py,koox00/scalable-py | settings.py | settings.py | #!/usr/bin/env python
"""settings.py
Udacity conference server-side Python App Engine app user settings
$Id$
created/forked from conference.py by wesc on 2014 may 24
"""
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = ''
ANDROID_CLIENT_ID = 'replace... | apache-2.0 | Python | |
dc6ac64817d9eb1022c4b8e8a0bba399104c2bbc | Set HOME too | ceibal-tatu/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,samdroid-apps/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit,quozl/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,i5o/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,manuq/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit-gtk3,Daksh/sugar-toolkit-gtk3,ceib... | spawn-test-env.py | spawn-test-env.py | #!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%s' does not exist." % user)
uid = pwrec[2]
os.setuid(uid)
return (pwrec[6], pwrec[5])
def shell_watch_cb(pid, condition, user_da... | #!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%s' does not exist." % user)
uid = pwrec[2]
os.setuid(uid)
return pwrec[6]
def shell_watch_cb(pid, condition, user_data=None):
g... | lgpl-2.1 | Python |
08ec17c3ad674ff249307d03be8decb9c241a5d6 | add simple test | twdb/sdi | test/test_normalized_intensities.py | test/test_normalized_intensities.py | import os
import unittest
import numpy as np
from sdi.binary import Dataset
class TestRead(unittest.TestCase):
""" Test basic reading of binary files
"""
def setUp(self):
self.test_dir = os.path.dirname(__file__)
def test_normalized_intensities(self):
""" Test that normalized inten... | bsd-3-clause | Python | |
9bad5f9233519f55a8fcdf74f8ce67a280529594 | Add a storage class for ProfileData | SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange | app/soc/profiling/storage.py | app/soc/profiling/storage.py | #!/usr/bin/python2.5
#
# Copyright 2010 the Melange authors.
# Copyright 2009 Jake McGuire.
#
# 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 | |
5681936147081229eba1b4c0dc7faff89a281b21 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/maxium_subarray/py/solution.py | leetcode/easy/maxium_subarray/py/solution.py | class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 0
maxSub = nums[0]
maxSoFar = nums[0]
for index in range(1, len(nums)):
... | mit | Python | |
71a1a8efe93312373f2ec83536b265be0246c895 | Add "xcsoar.flightpath.FlightPathFix" constructor tests | Harry-R/skylines,skylines-project/skylines,Turbo87/skylines,RBE-Avionik/skylines,skylines-project/skylines,Turbo87/skylines,shadowoneau/skylines,RBE-Avionik/skylines,Turbo87/skylines,skylines-project/skylines,Harry-R/skylines,Harry-R/skylines,shadowoneau/skylines,shadowoneau/skylines,RBE-Avionik/skylines,shadowoneau/sk... | tests/lib/xcsoar/flightpath_test.py | tests/lib/xcsoar/flightpath_test.py | from datetime import datetime
from skylines.lib.xcsoar_ import FlightPathFix
from pytest import approx
def test_list_to_fix():
values = [datetime(2016, 5, 4, 8, 10, 50), 29450,
dict(latitude=50.82191666668235, longitude=6.181650000001908),
230, 48, None, None, 0, None, None, 8, None,... | agpl-3.0 | Python | |
3b3294f337c1658b952ea05a385252bd618d4def | Create ThrSumClose_001.py | Chasego/codirit,Chasego/codirit,Chasego/cod,Chasego/cod,Chasego/codi,cc13ny/algo,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/codi,Chasego/codirit,Chasego/codi,Chasego/cod,cc13ny/algo,Chasego/cod,cc13ny/algo,Chasego/codirit,cc13ny/Allin,Chasego/cod,Chasego/codi,cc13ny/algo,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,cc1... | leetcode/016-3Sum-Closest/ThrSumClose_001.py | leetcode/016-3Sum-Closest/ThrSumClose_001.py | #@author: cchen
#It will be updated later
class Solution:
# @return an integer
def threeSumClosest(self, num, target):
num.sort()
mindiff=100000
res=0
for i in range(len(num)):
left=i+1; right=len(num)-1
while left<right:
sum=num[i]+num[le... | mit | Python | |
1d9dac555897f408fc2216a315b6f48dea94583a | add github auth | feilaoda/dojang | auth/github.py | auth/github.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 th... | mit | Python | |
8ae846689b03d11cd9c231cffa7113339948df99 | Create simple_join_Spark.py | sammath/Hadoop-Platform,sammath/Hadoop-Platform | MapReduce_Examples/simple_join_Spark.py | MapReduce_Examples/simple_join_Spark.py | apache-2.0 | Python | ||
0571c0828f8a39d080d804e32e937b65bfe897ef | add development.py configuration | aacanakin/glim | glim/prototype/app/config/development.py | glim/prototype/app/config/development.py | """
Here, "development" is the environment. You can run configuration
using the following;
$ glim start --env development # loads the development configuration
"""
import os
import glim.paths
config = {
# the configurations of extensions
'extensions': {
# 'gredis' : {
# 'default' : {... | mit | Python | |
c4e6b2b68e6acd8f83091fc055897628b8df05bb | Add migration for django-simple-history == 1.9.0 | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | lowfat/migrations/0105_auto_20170615_1400.py | lowfat/migrations/0105_auto_20170615_1400.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-15 14:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lowfat', '0104_auto_20170607_1428'),
]
operations = [
migrations.AddField(
... | bsd-3-clause | Python | |
9b91aa78fcb541f03deb137dc9c5c02918e7ffe0 | Add widget | GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | geotrek/maintenance/widgets.py | geotrek/maintenance/widgets.py | from mapentity.widgets import LeafletWidget
from .models import Topology
class InterventionWidget(LeafletWidget):
""" A widget allowing to create topologies on a map.
"""
is_point_topology = True
def serialize(self, value):
if value:
return value.geom.transform(4326, clone=True).... | bsd-2-clause | Python | |
11b2bc33fe08e116347c21cc8ae5baa6e9352bb8 | add scheduler module __init__ | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,wwitzel3/awx | awx/main/scheduler/__init__.py | awx/main/scheduler/__init__.py | # Copyright (c) 2017 Ansible, Inc.
#
from awx.main.scheduler.task_manager import TaskManager # noqa
| apache-2.0 | Python | |
97781668a6ae80d4fa6330ccd70a6d01fe9a44a1 | Add C11 executor support; #276 | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/executors/C11.py | dmoj/executors/C11.py | from .gcc_executor import GCCExecutor
class Executor(GCCExecutor):
command = 'gcc11'
flags = ['-std=c11']
ext = '.c'
name = 'C11'
test_program = '''
#include <stdio.h>
int main() {
int ch;
while ((ch = getchar()) != EOF)
putchar(ch);
return 0;
}
'''
| agpl-3.0 | Python | |
22946180e9e5e660be14d453ddf5bb37564ddf33 | Add a script to build a map of all the tiles | simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic | build-tile-map.py | build-tile-map.py | #!/usr/bin/env python
from osgeo import ogr
from osgeo import osr
from glob import glob
import os
driver = ogr.GetDriverByName("ESRI Shapefile")
ds = driver.CreateDataSource("tile-map.shp")
srs = osr.SpatialReference()
srs.ImportFromEPSG(26915)
layer = ds.CreateLayer("tiles", srs, ogr.wkbPolygon)
field_name = ogr.F... | mit | Python | |
e56dcf595a646d03dbd9d49ab27a37adfe87f3e5 | Add shell command | ramaxlo/cerbero,sdroege/cerbero,shoreflyer/cerbero,BigBrother-International/gst-cerbero,EricssonResearch/cerbero,davibe/cerbero,EricssonResearch/cerbero,atsushieno/cerbero,freedesktop-unofficial-mirror/gstreamer__cerbero,ikonst/cerbero,brion/cerbero,multipath-rtp/cerbero,BigBrother-International/gst-cerbero,freedesktop... | cerbero/commands/shell.py | cerbero/commands/shell.py | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | lgpl-2.1 | Python | |
ef0410257af6787724e2e31471e465052dd8e4e3 | add sample to get entropy | echizentm/CompactDataStructures,echizentm/CompactDataStructures,echizentm/CompactDataStructures | chapter_02/get_entropy.py | chapter_02/get_entropy.py | # coding: utf-8
import sys
import math
def shannon_ent(probs):
return sum(
map(lambda p: -p*math.log2(p if p > 0 else 1), probs)
)
def seq2dic(seq):
dic = {}
for ch in seq:
if ch in dic:
dic[ch] += 1
else:
dic[ch] = 1
return dic
def worst_case_en... | apache-2.0 | Python | |
96163bd46069142b69748ecc658d52497108a745 | add example client implementation using requests | elliotpeele/pyramid_oauth2_provider | example/client.py | example/client.py | #
# Copyright (c) Elliot Peele <elliot@bentlogic.net>
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# This program is distributed in the hope that it... | mit | Python | |
006e5a686a594efd4c0f7c19cd70395a8534d894 | index set tests done, working on sparse quads | joshua-cogliati-inl/raven,idaholab/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,idaholab/raven,idaholab/raven,idaholab/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,idaholab/raven,idaholab/raven,idaholab/raven,joshua-cogliati-inl/raven | framework/TestSparseGrid.py | framework/TestSparseGrid.py | from __future__ import division, print_function, unicode_literals, absolute_import
import warnings
warnings.simplefilter('default',DeprecationWarning)
import xml.etree.ElementTree as ET
import numpy as np
import sys, os
from copy import copy as copy
from utils import find_crow
find_crow(os.path.dirname(os.path.abspa... | apache-2.0 | Python | |
f0762de9a941745e199ba6ed3e02a475e9838d13 | Package for integration tests | huntxu/fuel-web,dancn/fuel-main-dev,zhaochao/fuel-main,zhaochao/fuel-main,SmartInfrastructures/fuel-web-dev,huntxu/fuel-web,Fiware/ops.Fuel-main-dev,nebril/fuel-web,koder-ua/nailgun-fcert,SmartInfrastructures/fuel-web-dev,zhaochao/fuel-main,AnselZhangGit/fuel-main,SmartInfrastructures/fuel-web-dev,ddepaoli3/fuel-main-d... | nailgun/nailgun/test/integration/__init__.py | nailgun/nailgun/test/integration/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.