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 |
|---|---|---|---|---|---|---|---|---|
e9246cc2f3b1093ff8cb564cad4a1dc346b26bcd | Add signature.py from amazon's website | jiocloudservices/jcsclient | src/client/signature.py | src/client/signature.py | # AWS Version 4 signing example
# IAM API (CreateUser)
# See: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
# This version makes a GET request and passes request parameters
# and authorization information in the query string
import sys, os, base64, datetime, hashlib, hmac, urllib
import requests # p... | apache-2.0 | Python | |
867b8f6d6a099b43442c167655a5ea1cb55433ff | Add version.py | SS-RD/pkgcmp | pkgcmp/version.py | pkgcmp/version.py | __version__ = '0.0.1'
| apache-2.0 | Python | |
7d59b4e21ed36c916c66de06488712decf96b110 | Add test for distinct random order filter | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | tests/filter/test_distinct_random_filter.py | tests/filter/test_distinct_random_filter.py | from datetime import date
import pytest
from freezegun import freeze_time
from adhocracy4.filters.filters import DistinctOrderingFilter
from tests.apps.questions.models import Question
@pytest.mark.django_db
def test_random_distinct_ordering_no_seed(question_factory):
questions = [question_factory() for i in ra... | agpl-3.0 | Python | |
cfa9485a06d36e246edab204e917c0a279b96549 | Add Python S3 create_bucket.py example | awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a... | python/example_code/s3/create_bucket.py | python/example_code/s3/create_bucket.py | # snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
# snippet-sourcedescription:[create_bucket.py demonstrates how to create an Amazon S3 bucket in any region.]
# snippet-service:[s3]
# snippet-keyword:[Amazon S3]
# snippet-keyword:[Python]
# snippet-keyword:[Code Sample]
# snippet-... | apache-2.0 | Python | |
270311f6adc754c5a873f352dd3efb94637447dc | Create merge_SORT.py | WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,... | Merge_Sort/merge_SORT.py | Merge_Sort/merge_SORT.py | def merge(a,b):
""" Function to merge two arrays """
c = []
while len(a) != 0 and len(b) != 0:
if a[0] < b[0]:
c.append(a[0])
a.remove(a[0])
else:
c.append(b[0])
b.remove(b[0])
if len(a) == 0:
c += b
else:
c += a
ret... | mit | Python | |
3081aa14230f7374e406e15be992235eaf961551 | Add function to read length of bytes in the buffer from the kernel | arkaitzj/python-butter,dasSOZO/python-butter,wdv4758h/butter | butter/utils.py | butter/utils.py | #!/usr/bin/env python
from cffi import FFI as _FFI
import fcntl
import array
_ffi = _FFI()
_ffi.cdef("""
#define FIONREAD ...
""")
_C = _ffi.verify("""
#include <sys/ioctl.h>
""", libraries=[])
def get_buffered_length(fd):
buf = array.array("I", [0])
fcntl.ioctl(fd, _C.FIONREAD, buf)
return buf[0]
... | bsd-3-clause | Python | |
1c1cc3e4984e1fa7c0fbd87ec779e79224374975 | Add colorspaces tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/visualize/test_colorspaces.py | tests/plantcv/visualize/test_colorspaces.py | import pytest
import cv2
from plantcv.plantcv.visualize import colorspaces
def test_colorspaces(visualize_test_data):
# Read in test data
img = cv2.imread(visualize_test_data.small_rgb_img)
vis_img = colorspaces(rgb_img=img)
assert vis_img.shape == (335, 1000, 3)
def test_colorspaces_bad_input(visua... | mit | Python | |
1d0cece88b5bce0984f4f025cb6431065c187dd4 | Test failer python version2. | utam0k/autoRecorder,utam0k/autoRecorder | test/client/test_main.py | test/client/test_main.py | import socketserver, unittest, threading
from client import main
class DummyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
allow_reuse_address = True
class MyRequestHandlerTest(unittest.TestCase):
def setUp(self):
self.server = TestServer((HOST, PORT), MyRequestHandler)
self.s... | mit | Python | |
8fd80a0ce8b312cefee5e252d4864336bc4a81e5 | Create follow_user.py | ping/twython,Hasimir/twython,Oire/twython,ryanmcgrath/twython,Devyani-Divs/twython,fibears/twython,vivek8943/twython,joebos/twython,akarambir/twython,Fueled/twython | examples/follow_user.py | examples/follow_user.py | from twython import Twython, TwythonError
# Optionally accept user data from the command line (or elsewhere).
#
# Usage: follow_user.py ryanmcgrath
import sys
if len(sys.argv) >= 2:
target = sys.argv[1]
else:
target = raw_input("User to follow: ") # For Python 3.x use: target = input("User to follow: ")
#... | mit | Python | |
674c066992a1b7032d1812751ce0695a10e7947d | Move cfp deadline to midnight | benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2017 | pyconcz_2016/proposals/pyconcz2016_config.py | pyconcz_2016/proposals/pyconcz2016_config.py | from datetime import datetime
from django.utils.timezone import get_current_timezone
from pyconcz_2016.proposals.models import Talk, Workshop, FinancialAid
tz = get_current_timezone()
class TalksConfig:
model = Talk
key = 'talks'
title = 'Talks'
cfp_title = 'Submit your talk'
template_about = '... | from datetime import datetime
from django.utils.timezone import get_current_timezone
from pyconcz_2016.proposals.models import Talk, Workshop, FinancialAid
tz = get_current_timezone()
class TalksConfig:
model = Talk
key = 'talks'
title = 'Talks'
cfp_title = 'Submit your talk'
template_about = '... | mit | Python |
b61b6472f1a9d4d3877f2b7fdc8d7126ff737930 | Add a file. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/beautifulsoup/crawler/http_headers.py | python/beautifulsoup/crawler/http_headers.py | # Ce fichier doit être complété manuellement pour chaque site web cible.
# Pour obtenir la liste des valeurs à inscrire à l'aide de Firefox:
# - Consulter la page racine d'où lancer le téléchargement (s'identifier si besoin)
# - Faire un clic droit sur la page et sélectionner "Examiner l'élément"
# - Aller dans l'ongle... | mit | Python | |
1fdfff95e04678f107775870f0f1b4eda6af8073 | Add test for PR-56(Fix binary decode) | martinkou/bson | bson/tests/test_binary.py | bson/tests/test_binary.py | #!/usr/bin/env python
from unittest import TestCase
from bson import dumps, loads
class TestBinary(TestCase):
def setUp(self):
lyrics = b"""
I've Had Enough - Earth Wind and Fire
Getting down, there's
a party in motion
Everybody's on the scene
And I can hear the s... | bsd-3-clause | Python | |
c8e5f122b48c85f5c234f71c4de3a1e96b4695e8 | Add flask | ofzeng/FoodPool-backend,ofzeng/FoodPool-backend | hello.py | hello.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
| apache-2.0 | Python | |
67fc56a975fd19692d11990042a425d4cbada036 | add new template for optparse | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | python/python/templates/optparse-template.py | python/python/templates/optparse-template.py | #!/usr/bin/env python
'''
Copyright (C) 2013 Bryan Maupin <bmaupincode@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later... | mit | Python | |
60420431a361c4165ccbf61996adbf3c90675b04 | Create __init__.py | archonren/project | preprocess/__init__.py | preprocess/__init__.py | mit | Python | ||
8f7c9b19f80e28a57e770fba6fe03b3d32ec444c | Test matching | ieure/yar | yar/tests/test_device_matcher.py | yar/tests/test_device_matcher.py | # -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure <ian.eure@gmail.com>
#
import unittest
import yar.devices.matcher as m
from yar.devices.unipak2b import DEVICES
class DeviceMatcherTest(unittest.TestCase):
def test_extract(self):
self.assertEqual(("am", "2732dc"),
m... | bsd-3-clause | Python | |
556fae8031e6661ae402e56ebaa4943e03848119 | Create testworld.py | gameplex/game | test/shared/testworld.py | test/shared/testworld.py | import unittest
from game.world import World
from game.player import Player
class TestWorld(unittest.TestCase):
def setUp(self):
self.world = World()
def test_add_player(self):
player = Player()
self.world.add_player(player)
assertTrue(player in self.world.players)
| agpl-3.0 | Python | |
0f7b2ad6b32e0011a04473d8a1565047ef6e4183 | add add_obs_librarian.py | HERA-Team/librarian,HERA-Team/librarian,HERA-Team/librarian | add_obs_librarian.py | add_obs_librarian.py | #!/usr/bin/python
"""
Input a list of files and insert into the librarian.
The files must exist and be findable on the filesystem
NB filenames must be FULL PATH. If the root is not '/' for all files it will exit
KEY NOTE: Assumes all files are contiguous. I sort the files by jd and then match up neighboring pols as n... | bsd-2-clause | Python | |
c3e51aa60e05be0d94d6cbc5de190831b4c47c76 | add binding.gyp file | mcanthony/node-lame,mcanthony/node-lame,dag10/node-lame,EQ4/node-lame,PlayNetwork/node-lame,PlayNetwork/node-lame,EQ4/node-lame,PlayNetwork/node-lame,dag10/node-lame,EQ4/node-lame,mcanthony/node-lame,TooTallNate/node-lame,TooTallNate/node-lame,TooTallNate/node-lame,dag10/node-lame | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'bindings',
'sources': [
'src/bindings.cc',
'src/node_lame.cc'
],
'dependencies': [
'deps/lame/libmp3lame.gyp:mp3lame'
]
}
]
}
| mit | Python | |
9bf945f1b93bd4d0230a79d44a116bb54cb6eae9 | Add transform.dynamic_pack | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/transform.py | nn/transform.py | import tensorflow as tf
from .util import func_scope, static_rank, static_shape
@func_scope()
def dynamic_pack(*tensors):
if tensors[0].dtype == tf.string:
return tf.pack(tensors)
shape = _max_shape(tensors)
return tf.pack([_pad_to_shape(tensor, shape) for tensor in tensors])
@func_scope()
def _pad_to_... | unlicense | Python | |
6122cbdaf9c48b6118fe2d00bdfcde89b0bccaf5 | Add gyp binding | apkudo/niagra,apkudo/niagra,apkudo/niagra | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "niagrad",
"type": "executable",
"sources": [ "./tools/niagrad/src/niagrad.c",
"./tools/niagrad/src/str.c" ],
"include_dirs": [ "./tools/niagrad/src/" ],
}
]
} | mit | Python | |
e1c59e99cf6639cfd843104566b3153a392cb225 | add initial version of basic static application | kezabelle/clastic,kezabelle/clastic | clastic/static.py | clastic/static.py | # -*- coding: utf-8 -*-
import os
import mimetypes
from os.path import isfile, join as pjoin
from datetime import datetime
from werkzeug.wsgi import FileWrapper
from werkzeug.wrappers import Response
from core import Application
# TODO: caching
# TODO: check isdir and accessable on static_roots
default_mimetype = ... | bsd-3-clause | Python | |
647ade19db3be5ed32c8e4a442d751b8ef38aba3 | add client code | tangramor/Airnow,tangramor/Airnow,tangramor/Airnow | client/ReadAir.py | client/ReadAir.py | # -*- coding: utf-8 -*-
import serial, time, MySQLdb, re
from socketIO_client import SocketIO, LoggingNamespace
# open a mysql connection
conn=MySQLdb.connect(host="localhost",user="airnow",passwd="password",db="airnow",charset="utf8")
''' SQL to create table:
CREATE TABLE IF NOT EXISTS `air_logs` (
`id` int(1... | mit | Python | |
9c0810f9fc09b4a3448898beaf9ba4c3fc0d0e9e | Create batch_add_and_delete_fields.py | jamaps/arcpy_scripts | batch_add_and_delete_fields.py | batch_add_and_delete_fields.py | import arcpy
arcpy.env.workspace = ws = r"PATH"
count = 0
for f in arcpy.ListFiles('*.shp'):
print f
#deleting fields
arcpy.DeleteField_management(f, ["AREA","PERIMETER"])
#adding fields
arcpy.AddField_management(f, "CT_NAME", "TEXT", "", "", 7)
arcpy.AddField_management(f, "CTUID", "TEXT", "", "", 11)
... | mit | Python | |
d38b71810f3682bcc261bbe9df519d16e4fbab8a | add contrib/exportOPMLWithTags.py | der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat,der-lyse/newsboat,der-lyse/newsboat,newsboat/newsboat,newsboat/newsboat,der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat,newsboat/newsboat,newsboat/newsboat | contrib/exportOPMLWithTags.py | contrib/exportOPMLWithTags.py | #!/usr/bin/env python3
# this script exports the urls file to OPML, including tags. for that, all feeds must have only one tag
#usage: ./exportOPMLWithTags.py urls > urls.opml
#requeriments (just to get the title from a rss feed if it isn't cached in newsboat):
# pip install feedparser
#input-output example:
#
# $ ... | mit | Python | |
a2f9a972c5ccb4bcecff89c07ee8a9a73ca97fd1 | Add unit test to cover Mako entry point. | thruflo/dogpile.cache,thruflo/dogpile.cache | tests/cache/test_mako.py | tests/cache/test_mako.py | from unittest import TestCase
from dogpile.cache import util
class MakoTest(TestCase):
""" Test entry point for Mako
"""
def test_entry_point(self):
import pkg_resources
for impl in pkg_resources.iter_entry_points("mako.cache", "dogpile.cache"):
print im... | bsd-3-clause | Python | |
4e895df10dff25da3b4b6a510a240ac100c0a62d | Add missing file. | jakesyl/ruby-card,jakesyl/ruby-card | mnemosyne/mnemosyne/script/__init__.py | mnemosyne/mnemosyne/script/__init__.py | #
# script <Peter.Bienstman@UGent.be>
#
from mnemosyne.libmnemosyne import Mnemosyne as MnemosyneParent
from mnemosyne.libmnemosyne.ui_components.review_widget import ReviewWidget
class ScriptReviewWidget(ReviewWidget):
def redraw_now(self):
pass
class Mnemosyne(MnemosyneParent):
def __init__(self... | agpl-3.0 | Python | |
0eae8a12cbbc21469fd4401692223ef51b8bc7a7 | Add simple testcase for identifier | tyb0807/angr,iamahuman/angr,tyb0807/angr,angr/angr,f-prettyland/angr,chubbymaggie/angr,iamahuman/angr,chubbymaggie/angr,f-prettyland/angr,schieb/angr,chubbymaggie/angr,schieb/angr,axt/angr,iamahuman/angr,tyb0807/angr,axt/angr,axt/angr,angr/angr,f-prettyland/angr,angr/angr,schieb/angr | tests/test_identifier.py | tests/test_identifier.py | import angr
import nose
import identifier
import os
bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries-private'))
import logging
logging.getLogger("identifier").setLevel("DEBUG")
def test_palindrome():
'''
Test identification of functions in palindrome.
'''
... | bsd-2-clause | Python | |
b5d9b076942a931c79cbf6a8a1d54ccc0f8878ea | add unit test for matrixfree new function | barbagroup/pygbe,barbagroup/pygbe,barbagroup/pygbe | tests/test_matrixfree.py | tests/test_matrixfree.py | import pytest
from unittest.mock import patch
from pygbe.matrixfree import calc_s_start
Surface = patch('pygbe.classes.Surface')
s_starts = [
(Surface, 'nope', 1, 20),
(Surface, 'nope', 2, 40),
(Surface, 'nope', 3, 60),
(Surface, 'dirichlet_surface', 3, 30),
(Surface, 'neumann_surface', 3, 30),
... | bsd-3-clause | Python | |
8eb12b77585614014061db0331302e2492e262ef | Create organ_list.py | tgbugs/pyontutils,tgbugs/pyontutils,tgbugs/pyontutils,tgbugs/pyontutils | nifstd/development/sparc/organ_list.py | nifstd/development/sparc/organ_list.py | from pyontutils import scigraph
from collections import defaultdict
import pandas as pd
import os
sd = scigraph.Dynamic('https://scicrunch.org/api/1/sparc-scigraph')
sd.api_key = os.environ.get('INTERLEX_API_KEY')
organ_records = {}
organList = sd.prod_sparc_organList()
organList_label_curies = [(node['lbl'], node['... | mit | Python | |
8af2e4a5023beeab22b87b4aab7133fd5a3c5be4 | Copy from my project create-txt-file-by-name. | YiFanChen99/file-walker-for-windows | ConvertFiles.py | ConvertFiles.py | # -*- coding:utf-8 -*-
'''
這個程式能夠為同目錄下的所有檔案(含子資料夾)都建立一個同名的txt檔
'''
import os
def create_txt_file(fileSimpleName):
fileName = (fileSimpleName + ".txt")
fileopen = open(fileName,'w')
#fileopen.write(p)
fileopen.close()
def convert_all_files(path):
for dirPath, dirNames, fileNames in os.walk(path):... | mit | Python | |
686abca3496092d0041cde96391c361643e8064e | Add the missing features.py for interdiff filtering v2. | reviewboard/reviewboard,chipx86/reviewboard,chipx86/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,reviewboard/reviewboard | reviewboard/diffviewer/features.py | reviewboard/diffviewer/features.py | """Diffviewer features."""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from djblets.features import Feature, FeatureLevel
class FilterInterdiffsV2Feature(Feature):
"""A feature for the 2.0 version of interdiff filtering.
This enables the interdiff filteri... | mit | Python | |
2bae72a9ce81bae86d1d4e2b18ab3722aa7e6fd2 | Add a PoC tool for injecting python code on Windows | zeroSteiner/mayhem | tools/python_injector.py | tools/python_injector.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tools/python_injector.py
#
# 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... | bsd-3-clause | Python | |
3b852c14c76a95b386e6644b99a589c0ae4c19ed | Add migration mentioned in last commit... | fsr/course-management,fsr/course-management | course/migrations/0005_auto_20160622_2313.py | course/migrations/0005_auto_20160622_2313.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('course', '0004_auto_20160409_2159'),
]
operations = [
migrations.AlterField(
model_... | bsd-3-clause | Python | |
4c8b56a3f0afdafc29e602d23bd194a0a773b233 | add json formatters for logging | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/utils/formatters.py | bluebottle/utils/formatters.py | import copy
import json
import logging
from collections import OrderedDict
class DictFormatter(logging.Formatter):
"""Used for formatting log records into a dict."""
default_regular_attrs = ["name", "message", "levelname", "module", "asctime"]
ignore_builtin_attrs = ["levelno", "pathname", "filename", "li... | bsd-3-clause | Python | |
d8fb61b3b252695c47b50faa0425cced262f7127 | Add migration | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | timeside/server/migrations/0018_item_external_uri.py | timeside/server/migrations/0018_item_external_uri.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-11-14 15:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timeside_server', '0017_merge'),
]
operations = [
migrations.AddField(
... | agpl-3.0 | Python | |
6cc395945be5a81c070c5630d7f091263e456b5b | update DB migration | swcurran/TheOrgBook,WadeBarnes/TheOrgBook,WadeBarnes/TheOrgBook,swcurran/TheOrgBook,WadeBarnes/TheOrgBook,swcurran/TheOrgBook,WadeBarnes/TheOrgBook,swcurran/TheOrgBook,swcurran/TheOrgBook,WadeBarnes/TheOrgBook | tob-api/api_v2/migrations/0013_auto_20180921_1844.py | tob-api/api_v2/migrations/0013_auto_20180921_1844.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-09-21 18:44
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api_v2', '0012_credential_inactive'),
]
operation... | apache-2.0 | Python | |
b9cabe3b58a639bc69cb3a069b018d6f48b973d7 | Create InputNeuronGroup_multiple_outputs.py | ricardodeazambuja/BrianConnectUDP | examples/InputNeuronGroup_multiple_outputs.py | examples/InputNeuronGroup_multiple_outputs.py | '''
Example of a spike generator (only outputs spikes)
In this example spikes are generated and sent through UDP packages. At the end of the simulation a raster plot of the
spikes is created.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
number_of_neurons_total = 45
numbe... | cc0-1.0 | Python | |
b977be5b70fb92a8a39f4cffbca98f07d09f74ef | Create GTFS_to_geojson.py | jamaps/fun_with_gdal,jamaps/open_geo_scripts,jamaps/gdal_and_ogr_scripts,jamaps/shell_scripts,jamaps/fun_with_gdal,jamaps/gdal_and_ogr_scripts,jamaps/shell_scripts,jamaps/open_geo_scripts,jamaps/open_geo_scripts | GTFS_to_geojson.py | GTFS_to_geojson.py | # converts shapes and stops in GTFS to mappable geojson format
import json, csv
# input gtfs folder name
gtfs_in = "GO_GTFS"
# converting stops.txt to a geojson object
def stops_to_geojson(gtfs_folder_name):
out_geojson_stops = {
'type': 'FeatureCollection',
'features': [
... | mit | Python | |
91dd854694c81300df08b2d20d860c94bbe2d28c | Update to 4.5.0 (#3497) | mfherbst/spack,EmreAtes/spack,mfherbst/spack,lgarren/spack,EmreAtes/spack,LLNL/spack,krafczyk/spack,matthiasdiener/spack,krafczyk/spack,matthiasdiener/spack,TheTimmy/spack,EmreAtes/spack,tmerrick1/spack,TheTimmy/spack,EmreAtes/spack,LLNL/spack,iulian787/spack,TheTimmy/spack,tmerrick1/spack,LLNL/spack,skosukhin/spack,LL... | var/spack/repos/builtin/packages/jemalloc/package.py | var/spack/repos/builtin/packages/jemalloc/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
b83f9f95d060fc2b720bd914403d33638222728f | Add makepolys.py - generates polygons from shapefile | googlearchive/js-v2-samples,googlearchive/js-v2-samples,cureHsu/js-v2-samples,feeilk1991/promenad,googlearchive/js-v2-samples,feeilk1991/promenad,alexander0205/js-v2-samples,cureHsu/js-v2-samples,alexander0205/js-v2-samples,feeilk1991/promenad,googlearchive/js-v2-samples,bawg/js-v2-samples,stephenmcd/js-v2-samples,step... | elections/2008/shapes/makepolys.py | elections/2008/shapes/makepolys.py | #!/usr/bin/env python
# maketiles.py
#from geo import Geo
import math
import os
import random
import shutil
import stat
import sys
import time
import shpUtils
def loadshapefile( filename ):
print 'Loading shapefile %s' % filename
t1 = time.time()
shapefile = shpUtils.loadShapefile( filename )
t2 = time.time()
p... | apache-2.0 | Python | |
b6761bcca558f85f19caab99f786e6a23df83e0d | Create index.py | LongTianPy/UI-of-arabdopsis-DB | index.py | index.py | #! /usr/bin/python
import cgi
if __name__=='__main__':
print 'Content-type: text/html'
print
print '<html><head><title>'
print 'Arabdopsis Athaliana Microarray Data Browser'
print '</title></head>'
print '<body>'
print '<div id="topbanner">'
print '<h1>Welcome to Arabidopsis Athaliana Microarray Database!</h1>... | apache-2.0 | Python | |
389b9607984b0b21e8a2f769172ccd5862d8e139 | Add a scripts folder with a unit test script | fnivek/Pop-a-Gator,fnivek/Pop-a-Gator,fnivek/Pop-a-Gator | scripts/run_unit_test.py | scripts/run_unit_test.py | #!/usr/bin/env python
import serial
print "I'm a python script" | mit | Python | |
955eb8df563076f74b50383acccf09997ded28f6 | add a stats interface to pylogd | hiidef/logd,hiidef/logd,hiidef/logd | pylogd/pylogd/stats.py | pylogd/pylogd/stats.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Logd's stats implementation. Similar to the python_example in statsd's
repository."""
import msgpack
import random
import socket
import traceback
import logging
logger = logging.getLogger(__name__)
COUNTER = 2
TIMER = 3
class Logd(object):
def __init__(self, h... | mit | Python | |
2e0fb8a0bea3fca5a5b9ef032664bfbc4697b67a | add geojson migration | unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome | datapoints/migrations/0010_ingest_geojson.py | datapoints/migrations/0010_ingest_geojson.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import json
from django.db import models, migrations, IntegrityError
from django.core.exceptions import ObjectDoesNotExist
from datapoints.models import Location, LocationPolygon
def ingest_geo(apps, schema_editor):
GEO_JSON_DIR = '/Users... | agpl-3.0 | Python | |
c6b9bb93f268b7c1dc100c75a7c36326d63450d5 | Add all test runner for command line. Now every test can be run for commandline | kyamaguchi/SublimeObjC2RubyMotion,kyamaguchi/SublimeObjC2RubyMotion | tests/all_test.py | tests/all_test.py | import glob
import unittest
import os, sys
if __name__ == '__main__':
PROJECT_ROOT = os.path.dirname(__file__)
test_file_strings = glob.glob(os.path.join(PROJECT_ROOT, 'test_*.py'))
module_strings = [os.path.splitext(os.path.basename(str))[0] for str in test_file_strings]
suites = [unittest.defaultTest... | mit | Python | |
e9b4fbd5e439a4f8991bd79d19331f8ab05a378a | Add code to check Eigenfaces with same face loaded by OpenCV and PIL. Project (tp). Signed-off-by: Vlad Morariu <vlad.morariu@gmail.com> | bwhite/picarus,bwhite/picarus,bwhite/picarus,bwhite/picarus,bwhite/picarus | face_feature/test_identity_face.py | face_feature/test_identity_face.py | #!/u85;95;0csr/bin/env python
# (C) Copyright 2011 Dapper Vision, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program... | apache-2.0 | Python | |
3b1029c47b6c7b59340e03833f945553c8cb24ee | copy from Dipsys zip | usc-isi-i2/dig-crf,usc-isi-i2/dig-crf | data/zip/__init__.py | data/zip/__init__.py | __author__ = 'philpot'
| apache-2.0 | Python | |
df97e56c415df490e5095af37de19ff917982c17 | add qq backend | duoduo369/django-social-auth | social_auth/backends/contrib/qq.py | social_auth/backends/contrib/qq.py | from social.backends.qq import QQOAuth2 as QQBackend
| bsd-3-clause | Python | |
094aba3c2ed430460f67282f049326710cbeed66 | add osync-test.sh | ajnelson/ceph,ajnelson/ceph,ajnelson/ceph,ajnelson/ceph,ajnelson/ceph,ajnelson/ceph | src/osync/osync-test.py | src/osync/osync-test.py | #!/usr/bin/env python
#
# Ceph - scalable distributed file system
#
# Copyright (C) 2011 New Dream Network
#
# This is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software
# Foundation. See file COPYING.
#
... | lgpl-2.1 | Python | |
891c53eee0c6e6487ab0ba0e9d1e92d117678c9a | Add example read of previously written LCIO using Python | petricm/LCIO,petricm/LCIO,petricm/LCIO,iLCSoft/LCIO,petricm/LCIO,iLCSoft/LCIO,petricm/LCIO,petricm/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO | src/python/read_back.py | src/python/read_back.py | import lcio
fac = lcio.LCFactory.getInstance()
rdr = fac.createLCReader()
rdr.open("write_test.slcio")
evt = rdr.readNextEvent()
coll = evt.getSimCalorimeterHitCollection("hits")
print repr(coll)
hit=coll.getElementAt(0)
print repr(hit)
| bsd-3-clause | Python | |
d3ac521b63aad890b1fdcb9ae7321b658d5c4764 | add count_number_of_one_bits.py (#4195) | TheAlgorithms/Python | bit_manipulation/count_number_of_one_bits.py | bit_manipulation/count_number_of_one_bits.py | def get_set_bits_count(number: int) -> int:
"""
Count the number of set bits in a 32 bit integer
>>> get_set_bits_count(25)
3
>>> get_set_bits_count(37)
3
>>> get_set_bits_count(21)
3
>>> get_set_bits_count(58)
4
>>> get_set_bits_count(0)
0
>>> get_set_bits_count(256)... | mit | Python | |
2a5c513c1916b42a044aef15f0d407229c7adc7e | Add script to decode an internal error backtrace | gil0mendes/Initium,gil0mendes/Initium,gil0mendes/Initium | utilities/decodetrace.py | utilities/decodetrace.py | '''
Script to decode an internal error backtrace
'''
import sys
from subprocess import Popen, PIPE
if len(sys.argv) != 2 and len(sys.argv) != 3:
print 'Usage: %s <path to initium.elf> [<path to addr2line>] << <output>' % (sys.argv[0])
sys.exit(1)
loader = sys.argv[1]
if len(sys.argv) == 3:
addr2line = sys.argv... | mit | Python | |
cfdcc53a4f516847b7c31b27cdb2053142387f85 | Implement plugin for Telakka. | weezel/BandEventNotifier | venues/plugin_telakka.py | venues/plugin_telakka.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import lxml.html
import re
import time
class PluginParseError(Exception): pass
class Telakka(object):
def __init__(self):
self.url = "http://www.telakka.eu/ravintola/ohjelma"
self.name = "Telakka"
self.city = "Tampere"
self.country =... | isc | Python | |
7f060760e1df66d666b35dd1083549d6b9ba3bcc | Add `mozillians` to the python path when using wsgi. | mozilla/mozillians,akatsoulas/mozillians,akatsoulas/mozillians,johngian/mozillians,mozilla/mozillians,fxa90id/mozillians,fxa90id/mozillians,fxa90id/mozillians,mozilla/mozillians,akatsoulas/mozillians,fxa90id/mozillians,akatsoulas/mozillians,johngian/mozillians,mozilla/mozillians,johngian/mozillians,johngian/mozillians | wsgi/playdoh.wsgi | wsgi/playdoh.wsgi | import os
import site
try:
import newrelic.agent
except ImportError:
newrelic = False
if newrelic:
newrelic_ini = os.getenv('NEWRELIC_PYTHON_INI_FILE', False)
if newrelic_ini:
newrelic.agent.initialize(newrelic_ini)
else:
newrelic = False
os.environ['CELERY_LOADER'] = 'django'
os.... | import os
try:
import newrelic.agent
except ImportError:
newrelic = False
if newrelic:
newrelic_ini = os.getenv('NEWRELIC_PYTHON_INI_FILE', False)
if newrelic_ini:
newrelic.agent.initialize(newrelic_ini)
else:
newrelic = False
os.environ['CELERY_LOADER'] = 'django'
os.environ.setd... | bsd-3-clause | Python |
09559a6dfa522a310f04fc009ef25bb827693913 | add script to MajorOperatingSystemVersion and MajorSubsystemVersion in PE header from 6 to 5 | dynm/capstone,techvoltage/capstone,AmesianX/capstone,pyq881120/capstone,bughoho/capstone,NeilBryant/capstone,zuloloxi/capstone,zuloloxi/capstone,bSr43/capstone,angelabier1/capstone,pranith/capstone,krytarowski/capstone,code4bones/capstone,8l/capstone,pranith/capstone,sephiroth99/capstone,code4bones/capstone,bowlofstew/... | suite/patch_major_os_version.py | suite/patch_major_os_version.py | #!/usr/bin/env python
# By Nguyen Anh Quynh
import sys, struct
if len(sys.argv) < 2:
print("Usage: %s <pe_file_path>" % sys.argv[0])
sys.exit(0)
pe_file_path = sys.argv[1]
with open(pe_file_path, "rb") as f:
b = f.read()
if not b.startswith("MZ"):
print("Not a PE file")
sys.exit(0)
e_lfanew =... | bsd-3-clause | Python | |
53f259b909c266a031ac2d531ea1467fd447ce33 | Add a bogus hostname to the test suite. | mathstuf/fedmsg,chaiku/fedmsg,mathstuf/fedmsg,vivekanand1101/fedmsg,fedora-infra/fedmsg,vivekanand1101/fedmsg,maxamillion/fedmsg,maxamillion/fedmsg,pombredanne/fedmsg,vivekanand1101/fedmsg,chaiku/fedmsg,chaiku/fedmsg,cicku/fedmsg,cicku/fedmsg,pombredanne/fedmsg,fedora-infra/fedmsg,mathstuf/fedmsg,pombredanne/fedmsg,fed... | fedmsg/tests/fedmsg-test-config.py | fedmsg/tests/fedmsg-test-config.py | """ Test config. """
import os
import socket
import random
SEP = os.path.sep
here = os.getcwd()
hostname = socket.gethostname()
ssl_enabled_for_tests = True
try:
import M2Crypto
import m2ext
except ImportError:
ssl_enabled_for_tests = False
# Pick random ports for the tests so travis-ci doesn't flip out.... | """ Test config. """
import os
import socket
import random
SEP = os.path.sep
here = os.getcwd()
hostname = socket.gethostname()
ssl_enabled_for_tests = True
try:
import M2Crypto
import m2ext
except ImportError:
ssl_enabled_for_tests = False
# Pick random ports for the tests so travis-ci doesn't flip out.... | lgpl-2.1 | Python |
9d4ceb53c68e63d0e9a814022ac67d868af1a91d | add task module | Shatnerz/rhc,robertchase/rhc,robertchase/rhc,Shatnerz/rhc | rhc/task.py | rhc/task.py | class Task(object):
def __init__(self, callback):
self.callback = callback
self.is_done = False
def defer(self, task_cmd, partial_callback):
def on_defer(rc, result):
if rc == 0:
task_cmd(self, result)
else:
self.error(result)
... | mit | Python | |
23da61b3887b98df4d4f943101a2673f39920b7e | Add new collector Get JSON and transform it into flat metrics | Ormod/Diamond,Netuitive/Diamond,zoidbergwill/Diamond,thardie/Diamond,sebbrandt87/Diamond,codepython/Diamond,stuartbfox/Diamond,MichaelDoyle/Diamond,thardie/Diamond,gg7/diamond,hamelg/Diamond,krbaker/Diamond,zoidbergwill/Diamond,gg7/diamond,cannium/Diamond,Netuitive/Diamond,jaingaurav/Diamond,tuenti/Diamond,disqus/Diamo... | src/collectors/jsoncommon/jsoncommon.py | src/collectors/jsoncommon/jsoncommon.py | # coding=utf-8
"""
Simple collector which get JSON and parse it into flat metrics
#### Dependencies
* urllib2
"""
import urllib2
import json
import diamond.collector
class JSONCommonCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = super(JSONCommonCollector, s... | mit | Python | |
4816e8a6b2c1c9ef416bab5cd7d53005cd6d72c2 | Add script to demo Sense HAT buttons | claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code | hardware/sense_hat/demo_buttons.py | hardware/sense_hat/demo_buttons.py | #!/usr/bin/env python
# from https://pythonhosted.org/sense-hat/api/#joystick
from sense_hat import SenseHat, ACTION_PRESSED, ACTION_HELD, ACTION_RELEASED
from signal import pause
x = 3
y = 3
sense = SenseHat()
def clamp(value, min_value=0, max_value=7):
return min(max_value, max(min_value, value))
def pushed_... | mit | Python | |
5ed73a5794e854566682368013058e2ec327467b | Remove test APPLICATION_ROOT value | urbanairship/tessera,urbanairship/tessera,section-io/tessera,jmptrader/tessera,jmptrader/tessera,jmptrader/tessera,aalpern/tessera,aalpern/tessera,Slach/tessera,tessera-metrics/tessera,tessera-metrics/tessera,section-io/tessera,urbanairship/tessera,aalpern/tessera,tessera-metrics/tessera,urbanairship/tessera,urbanairsh... | tessera/config.py | tessera/config.py | DEBUG = True
SECRET_KEY = 'REPLACE ME'
DEFAULT_FROM_TIME = '-3h'
DEFAULT_THEME = 'light'
DASHBOARD_APPNAME = 'Tessera'
SQLALCHEMY_DATABASE_URI = 'sqlite:///tessera.db'
MIGRATION_DIR = 'migrations'
GRAPHITE_URL = 'http://lo... | DEBUG = True
SECRET_KEY = 'REPLACE ME'
DEFAULT_FROM_TIME = '-3h'
DEFAULT_THEME = 'light'
DASHBOARD_APPNAME = 'Tessera'
SQLALCHEMY_DATABASE_URI = 'sqlite:///tessera.db'
MIGRATION_DIR = 'migrations'
GRAPHITE_URL = 'http://lo... | apache-2.0 | Python |
9b90637413b0c31820a70a96e67adbe1b2445442 | Add missing migration | pinax/pinax-lms-activities,pinax/pinax-lms-activities | pinax/lms/activities/migrations/0004_auto_20160206_1021.py | pinax/lms/activities/migrations/0004_auto_20160206_1021.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-06 10:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pinax_lms_activities', '0003_auto_20160115_2305'),
]
operations = [
migrations.Renam... | mit | Python | |
16695438da2b16234b55882466025edbf2a7f94d | update issues epic link example (#635) | MattAgile/atlassian-python-api,AstroTech/atlassian-python-api,AstroTech/atlassian-python-api | examples/jira/jira_issue_update_epic_link.py | examples/jira/jira_issue_update_epic_link.py | """
Update the Epic Link for issue(s)
"""
from atlassian.jira import Jira
# the Issues which we want to place to a certain EPIC
update_issues = ["ARA-1233", "ARA-1234"]
def main():
jira = Jira(url="https://jira.example.com/", username="user", password="pass123")
epic_link_custom_field_id = "customfield... | apache-2.0 | Python | |
4e0a68a1c530bab6881bab3bb5c2582207cbb666 | Add dummy production conf. | m0r13/hpi-quotedb,m0r13/hpi-quotedb,m0r13/hpi-quotedb | hpi_quotedb/settings/production.py | hpi_quotedb/settings/production.py | from .development import *
| mit | Python | |
aa3d3015339a078f2347eda3da00da9fb6e92598 | Create SysViewModel.py | shaharzeira/System-Monitor-GUI-based | SysViewModel.py | SysViewModel.py | #!/usr/bin/python
from memorySysViewModel import *
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
import time
import threading
guiWorking = True
xRange = range(LEN_Y_CHART)
GuiCpuDataArray = [0] * LEN_Y_CHART
GuiMemoryDataArray = [0] * LEN_Y_CHART
# First set up the figure,... | apache-2.0 | Python | |
40c29d98fe2e7d3d9874c9c2fc72de34b9090e2b | Add alg_peak_2D.py | bowen0701/algorithms_data_structures | alg_peak_2D.py | alg_peak_2D.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def find_peak_naive():
pass
def find_peak():
pass
def main():
pass
if __name__ == '__main__':
main()
| bsd-2-clause | Python | |
912a43df0fd09bd8e34d685d44bfa215279211cd | Store all OCR languages | alephdata/ingestors | ingestors/support/ocr_languages.py | ingestors/support/ocr_languages.py |
LANGUAGES = {
'afr': [],
'amh': [],
'ara': [],
'asm': [],
'aze': [],
'aze_cyrl': [],
'bel': [],
'ben': [],
'bod': [],
'bos': [],
'bul': [],
'cat': [],
'ceb': [],
'ces': [],
'chi_sim': [],
'chi_tra': [],
'chr': [],
'cym': [],
'deu': [],
'dz... | mit | Python | |
c64fe6fa94a43ca3bdd1c696e9d49443812baff6 | Create Anagram.py | tejasnikumbh/Algorithms,tejasnikumbh/Algorithms,tejasnikumbh/Algorithms | Strings/Anagram.py | Strings/Anagram.py | import sys
def parseInt(s):
return int(s.readline().rstrip())
def parseString(s):
return s.readline().rstrip()
def makeAnagram(s):
s1 = s[:len(s)/2]
s2 = s[len(s)/2:]
fs1 = [0]*26
for i in range(len(list(s1))):
fs1[ord(s1[i]) - ord('a')] += 1
for i in range(len(list(s2))):
... | bsd-2-clause | Python | |
9809bf9cd2945bde185237eb0b6792fec5c4a2bc | add missing Devince migration | vIiRuS/Lagerregal,MPIB/Lagerregal,vIiRuS/Lagerregal,vIiRuS/Lagerregal,MPIB/Lagerregal,MPIB/Lagerregal | devices/migrations/0007_device_used_in_rm_default.py | devices/migrations/0007_device_used_in_rm_default.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-28 19:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('devices', '0006_device_used_in'),
]
operations = ... | bsd-3-clause | Python | |
1a269b81073f819e5e0050ab328a080ef9511870 | Add tests for case_importer lookup_case(...) | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/case_importer/tests/test_util.py | corehq/apps/case_importer/tests/test_util.py | from django.conf import settings
from django.test import TestCase
from corehq.form_processor.tests.test_cases import _create_case
from corehq.form_processor.tests.utils import FormProcessorTestUtils, sharded
from corehq.sql_db.tests.utils import new_id_in_different_dbalias
from .. import util
from ..const import Look... | bsd-3-clause | Python | |
6a13793df0fa8edd272fcd439520c5d012a2968c | implement 13 (13) 非公式RTのツイートの中で,RT先へのコメント部分のみを抽出せよ. | mihyaeru21/nlp100 | set02/13.py | set02/13.py | # -*- coding: utf-8 -*-
# (13) 非公式RTのツイートの中で,RT先へのコメント部分のみを抽出せよ.
# 非公式RTの形式を '[comment] RT @screen_name: [original_tweet]' として実装した
import sys
import csv
import re
re_rt = re.compile(u'(\A\w+) RT @[a-zA-Z0-9_]+: ', re.UNICODE)
for row in csv.reader(sys.stdin):
tweet = row[5].decode('utf-8')
match = re_rt.sear... | unlicense | Python | |
8b14ebe79920dee3a1cd57bd66f75f239deabb61 | Add SDB driver for salt cache | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/sdb/cache.py | salt/sdb/cache.py | # -*- coding: utf-8 -*-
'''
cache Module
:maintainer: SaltStack
:maturity: New
:platform: all
.. versionadded:: Nitrogen
This module provides access to Salt's cache subsystem.
Like all sdb modules, the cache module requires a configuration profile to
be configured in either the minion or master configu... | apache-2.0 | Python | |
5e93fbd48ae2e3012a565566e90459972b87b058 | Add Tmon script that reads the LabJack temperatures | HERA-Team/Monitor_and_Control,HERA-Team/hera_mc,HERA-Team/hera_mc | scripts/Tmon.py | scripts/Tmon.py | #! /usr/bin/env python
import ue9
import LabJackPython
from time import time, sleep
import hera_mc.mc as mc
import argparse
list_of_registers = range(240, 253, 2)
list_of_registers += range(96, 109, 2)
list_of_registers += range(144, 157, 2)
list_of_registers += range(192, 205, 2)
default_config_file = os.path.expan... | bsd-2-clause | Python | |
b365d7b90d013d9a236a6332cc2431eefd762898 | Create 1W2MQTT.py | Anton04/owfs2MQTT,Anton04/owfs2MQTT | 1W2MQTT.py | 1W2MQTT.py | #!/usr/bin/python
import sys
import mosquitto
class OwEventHandler(mosquitto.Mosquitto):
def __init__(self,ip = "localhost", port = 1883, clientId = "owfs2MQTT", user = None, password = None, prefix = "hardware/1-wire/"):
mosquitto.Mosquitto.__init__(self,clientId)
self.prefix = prefix
self.ip = ip
... | mit | Python | |
5aad08aff3e1a171ef9263af4488d175139085a0 | add test plot | aje/POT,rflamary/POT,rflamary/POT,aje/POT | test/test_plot.py | test/test_plot.py |
import ot
import numpy as np
# import pytest
def test_plot1D_mat():
n = 100 # nb bins
# bin positions
x = np.arange(n, dtype=np.float64)
# Gaussian distributions
a = ot.datasets.get_1D_gauss(n, m=20, s=5) # m= mean, s= std
b = ot.datasets.get_1D_gauss(n, m=60, s=10)
# loss matrix
... | mit | Python | |
c93b8f20a65fbb2e6a2e23aad7de0c496778aa23 | Add py solution for 540. Single Element in a Sorted Array | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/single-element-in-a-sorted-array.py | py/single-element-in-a-sorted-array.py | class Solution(object):
def singleNonDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
ln = len(nums)
L, U = -1, ln
while L + 1 < U:
mid = L + (U - L) / 2
if mid == ln - 1:
return nums[mid]
oth... | apache-2.0 | Python | |
19035f9dc2f4bc7d3c05141501556f997c9062d5 | Add unittests for decorators. | Dioptas/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,ctoher/pymatgen,yanikou19/pymatgen,yanikou19/pymatgen,Bismarrck/pymatgen,Bismarrck/pymatgen,rousseab/pymatgen,migueldiascosta/pymatgen,rousseab/pymatgen,ctoher/pymatgen,sonium0/pymatgen,migueldiascosta/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,ctoher/pymatgen,B... | pymatgen/util/tests/test_decorators.py | pymatgen/util/tests/test_decorators.py | #!/usr/bin/env python
"""
TODO: Modify module doc.
"""
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "2/24/13"
import unittest
import warnings
fro... | mit | Python | |
6cadfdc476ab1287a018f0ceaf2f4d4e1e5243de | Create BISHOPS.py | chashmeetsingh/SPOJ-SOLUTIONS,chashmeetsingh/SPOJ-SOLUTIONS | BISHOPS.py | BISHOPS.py | import sys
for s in sys.stdin:
x = int(s) - 1
print(x << 1 if x else 1)
| mit | Python | |
92c1d124a8208796125b04f27295ce1bf75d98e9 | Create __init__.py | JGoutin/compilertools | tests/__init__.py | tests/__init__.py | bsd-2-clause | Python | ||
f2401a0a3716b08ad9d9e2681082f2da4322b4ca | Document how the (nonexisting) API would need to be used at the moment | marcelm/cutadapt | tests/test_api.py | tests/test_api.py | """
Cutadapt doesn’t have a stable API, yet. This is an attempt to document how
one currently needs to use Cutadapt from Python to do certain things,
mostly in order to figure out where improvements need to be made.
The tests in this module do not check results, they are just here to
ensure that the code as shown can ... | mit | Python | |
ef782a38c5f1a9fed2a532eeb57a50f3965df258 | Add email classes based on django-templated-mail | akalipetis/djoser,sunscrapers/djoser,akalipetis/djoser,sunscrapers/djoser,sunscrapers/djoser | djoser/email.py | djoser/email.py | from django.contrib.auth.tokens import default_token_generator
from templated_mail.mail import BaseEmailMessage
from djoser import utils
from djoser.conf import settings
class ActivationEmail(BaseEmailMessage):
template_name = 'email/activation.html'
def set_context_data(self):
super(ActivationEmai... | mit | Python | |
4ed18076840e4b60277f475ebebf754a127ed159 | Update pi config 02 | jobcpf/cosy,jobcpf/cosy | bin/cosydpi.py | bin/cosydpi.py | #!/usr/bin/python
"""
Call Daemon for cosy on Pi
@Author:
@Date:
"""
################## Packages #################################### Packages #################################### Variables ##################
import sys
sys.path.append("/home/pi/cosy/cosy") # append python project directory root
# Standard import... | bsd-3-clause | Python | |
5d2c489066b16c4c6fb41ed1c1bfd22526c7dcbf | Create media.py | ne9een/Movie-Trailer-Website | media.py | media.py | import webbrowser
class Movie():
"""This program is a web page represent my favorite movies I watched recently. you also are able to watch the trailer of each by clicking on poster image"""
def __init__(self,movie_title,movie_storyline,poster_image,trailer_youtube):
self.title = movie_title
self.stor... | unlicense | Python | |
63cd60242114cf3fea9cda070aa671902be68f50 | Create MyoControlTelepresence.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Alessandruino/MyoControlTelepresence.py | home/Alessandruino/MyoControlTelepresence.py | from org.myrobotlab.math import Mapper
mapperPitch = Mapper(-80.0,80.0,-0.8,0.8)
mapperRoll = Mapper(-80.0,40.0,-0.5,0.5)
mapperArm = Mapper(80.0,-80.0,5.0,180.0)
arduino = Runtime.createAndStart("arduino","Arduino")
arduino.serial.refresh()
sleep(2)
arduino.connect("/dev/ttyUSB0")
i01 = Runtime.start("i01","InMoov"... | apache-2.0 | Python | |
02c833fe31a31f0dd8cefe28f81a5feee0f9bedd | Add and Search Word - Data structure design: cheat with `re` | feigaochn/leetcode | add_and_search_word_data_structure_design.py | add_and_search_word_data_structure_design.py | # coding: utf-8
# author: Fei Gao
#
# Add And Search Word Data Structure Design
# Design a data structure that supports the following two operations:
# void addWord(word)
# bool search(word)
# search(word) can search a literal word or a regular expression string containing only letters a-z or .. A . means it can repr... | mit | Python | |
a2b08ba7f575bde42c57d24b4effaceea0ac4829 | Add initial version of the MT-940 parser | headcr4sh/django-banking | django_banking/parsers.py | django_banking/parsers.py | # -*- coding: utf-8 -*-
from django_banking.models import MT940
def parse_mt940(input):
messages = []
message = None
for line in input:
if line.startswith(':20:'):
message = MT940()
message.trn = line[4:]
continue
if line.startswith('-'):
... | bsd-3-clause | Python | |
a1311278f24df9ff2afdc058817a76335f8cf904 | debug stuff | pignacio/django_factorize | django_factorize/debug.py | django_factorize/debug.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import collections
import logging
from pprint import PrettyPrinter # pylint: disable=unused-import
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class MyPrettyPrinter(PrettyPrinter):
def _forma... | bsd-3-clause | Python | |
af94bf5599869ec181713d06fc0db8372e67e1fa | Use thread.join instead of Event.wait | alexandrul-ci/robotframework,alexandrul-ci/robotframework,xiaokeng/robotframework,ashishdeshpande/robotframework,jorik041/robotframework,un33k/robotframework,suvarnaraju/robotframework,yahman72/robotframework,xiaokeng/robotframework,JackNokia/robotframework,Colorfulstan/robotframework,dkentw/robotframework,stasiek/robo... | src/robot/utils/robotthread.py | src/robot/utils/robotthread.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | apache-2.0 | Python |
7cdde1179b58a7338d545f58eed3f174de88af47 | Create problem1.py | Amapolita/MITx--6.00.1x- | W2/PS2/problem1.py | W2/PS2/problem1.py | '''
PROBLEM 1: PAYING THE MINIMUM (10.0/10.0 points)
Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.
The following variables contain values as described below:
balance - the outstanding balance on t... | unlicense | Python | |
e5bee224cdef758d4e01fd56040eccb5922961f3 | Create passwords.py | waynecrasta/UIUC-Course-Hunter | passwords.py | passwords.py | details = {'email': 'example@example.com', 'password': 'example', 'recipient': 'example@example.com'}
| bsd-2-clause | Python | |
f33aa55e07f33a0c9af41c12501e837b062e0211 | Add compiler script. | djc/jasinja,djc/jasinja | compile.py | compile.py | import codegen, jinja2, sys
def compile(path, templates):
env = jinja2.Environment(loader=jinja2.FileSystemLoader(path))
print codegen.generate(env, templates)
if __name__ == '__main__':
compile(sys.argv[1], sys.argv[2:])
| bsd-3-clause | Python | |
a7d66bd0d9ba8bbd7e6bf385df49e8855e146b9e | add custom subjects to Paleoarix | baylee-d/osf.io,HalcyonChimera/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,aaxelb/osf.io,adlius/osf.io,Johnetordoff/osf.io,adlius/osf.io,aaxelb/osf.io,sloria/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,erinspace/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,mfraezz/osf.io,HalcyonChimera/osf.io,bay... | scripts/add_taxonomies_to_paleoarix.py | scripts/add_taxonomies_to_paleoarix.py | import os
import json
import logging
import sys
from django.db import transaction
from django.apps import apps
from scripts import utils as script_utils
from scripts.populate_preprint_providers import update_or_create
from osf.models import PreprintProvider, Subject
from website.app import init_app
from website impor... | apache-2.0 | Python | |
3e173463a20276005bab67975452d49c7ee07b6f | Create sol.py | quietshu/leetcode-sol,quietshu/LeetCodeSol,quietshu/leetcode-sol,quietshu/LeetCodeSol,quietshu/LeetCodeSol,quietshu/leetcode-sol | algorithm/4sum/sol.py | algorithm/4sum/sol.py | class Solution(object):
def fourSum(self, nums, target):
sum = {}
ans = []
nums.sort()
for j in range(len(nums)):
for i in range(j):
x = nums[i]
y = nums[j]
if sum.get(target - x - y):
fo... | mit | Python | |
87fab1ef97da0f54a3866e375ec242c34e14b6af | add solution for 3 Sum | zhyu/leetcode,zhyu/leetcode | src/3Sum.py | src/3Sum.py | class Solution:
# @return a list of lists of length 3, [[val1,val2,val3]]
def threeSum(self, num):
pos = {}
n = len(num)
num.sort()
for i in xrange(n):
for j in xrange(i+1, n):
s = num[i]+num[j]
if s not in pos:
pos... | mit | Python | |
f0a0deee46919880d3bf51c664c2d429d0980ca2 | Create database_lookup.py | muhdamrullah/air-auth,muhdamrullah/air-auth,muhdamrullah/air-auth | scripts/hello_again/database_lookup.py | scripts/hello_again/database_lookup.py | from astropy.io import ascii
import numpy as np
import datetime
import time
from time import strftime
import sys
import os
import glob
import calendar
while True:
try:
database = ascii.read("local_database.dat")
live= ascii.read("live_stream.dat")
current = np.array(live["macs"])
... | mit | Python | |
5d743690e1d236090064c7bb95f872d1fa279b52 | Add a test for a film deletting. | bsamorodov/selenium-py-training-samorodov | php4dvd/test_deletefilm.py | php4dvd/test_deletefilm.py | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import unittest
class AddFilm(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(10)
self.base_url = "http://hub.wart.ru/"
... | bsd-2-clause | Python | |
e26a10dc91a705a4aec7ff73cc084876d13eec30 | test rnn | yujiali/pynn | _test_/test_rnn.py | _test_/test_rnn.py | """
Test RNN training on some simple tasks.
Yujia Li, 05/2015
"""
import pynn.rnn as rnn
import pynn.layer as ly
import pynn.loss as ls
import pynn.nn as nn
import numpy as np
def num_to_bin_array(n):
s = bin(n)[2:]
x = np.zeros(len(s), dtype=np.float)
for i in xrange(len(s)):
x[i] = float(s[i])
... | mit | Python | |
067373171142dcffff2d7a344efefc34021c4145 | add plugin template to reduce duplicate code | coyle5280/honeypot,laurenmalone/honeypot,laurenmalone/honeypot,coyle5280/honeypot,ckaz18/honeypot,theplue/honeypot,ckaz18/honeypot,theplue/honeypot,theplue/honeypot,coyle5280/honeypot,laurenmalone/honeypot,laurenmalone/honeypot,ckaz18/honeypot,theplue/honeypot,ckaz18/honeypot,coyle5280/honeypot | plugins/plugin_template.py | plugins/plugin_template.py | import GeoIP
import json
import geojson
class Template(object):
def __init__(self):
self.geo_ip = None
self.PORT = 0
self.geoIp_feature_json_string = None
self.giDB = GeoIP.open("../GeoLiteCity.dat", GeoIP.GEOIP_INDEX_CACHE | GeoIP.GEOIP_CHECK_CACHE)
self.description = Non... | mit | Python | |
f9a9ce064f9a09ee0e039239aebdb742c8683a3c | Add Python script to read mouse delta position events | cschulee/ee542-code,cschulee/ee542-code,cschulee/ee542-code | readMouse.py | readMouse.py | import struct
file = open ("/dev/input/mice","rb");
def getMouseEvent():
buf = file.read(3);
x,y = struct.unpack("bb", buf[1:] );
print ("x:%d, y:%d\n" % (x,y));
while(1):
getMouseEvent()
file.close;
| mit | Python | |
6f751038f374f2b5562c6fa073e7a69ed9164495 | add httpdate.py for backward compatibility; mark it as deprecated | tempbottle/eventlet,lindenlab/eventlet,collinstocks/eventlet,lindenlab/eventlet,tempbottle/eventlet,lindenlab/eventlet,collinstocks/eventlet | eventlet/httpdate.py | eventlet/httpdate.py | from wsgi import format_date_time
import warnings
warnings.warn("httpdate module is deprecated; its contents is moved to wsgi.py", DeprecationWarning, stacklevel=2)
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.