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
6e199bec3816a4a36d891e72f8de9819848bda65
Define ResourceDuplicatedDefinedError.
soasme/electro
electro/errors.py
electro/errors.py
# -*- coding: utf-8 -*- class ResourceDuplicatedDefinedError(Exception): pass
mit
Python
f527eeb4792ea5630965d72ae73b0331fd465dea
add indicator migration
mercycorps/TolaActivity,toladata/TolaActivity,mercycorps/TolaActivity,toladata/TolaActivity,mercycorps/TolaActivity,mercycorps/TolaActivity,toladata/TolaActivity,toladata/TolaActivity
indicators/migrations/0002_auto_20170105_0205.py
indicators/migrations/0002_auto_20170105_0205.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2017-01-05 10:05 from __future__ import unicode_literals from decimal import Decimal from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('indicators', '0001_initial'), ] operations = [ m...
apache-2.0
Python
103de382d7c9c0dde7aa4bc2f4756dc71ee45335
define pytest fixture for path to PR2 database
hurwitzlab/muscope-18SV4,hurwitzlab/muscope-18SV4
test/conftest.py
test/conftest.py
# content of conftest.py import pytest def pytest_addoption(parser): parser.addoption("--uchime-ref-db-fp", action="store", help="path to PR2 database") @pytest.fixture def uchime_ref_db_fp(request): return request.config.getoption("--uchime-ref-db-fp")
mit
Python
d15564cf234def0f37c958915e0d7a99cad439e4
add a test for overflow
kived/pyjnius,jk1ng/pyjnius,Konubinix/pyjnius,niavlys/pyjnius,ibobalo/pyjnius,physion/pyjnius,benson-basis/pyjnius,kived/pyjnius,ibobalo/pyjnius,physion/pyjnius,kivy/pyjnius,benson-basis/pyjnius,jk1ng/pyjnius,aolihu/pyjnius,jaykwon/pyjnius,jelford/pyjnius,Konubinix/pyjnius,aolihu/pyjnius,kivy/pyjnius,kivy/pyjnius,physi...
tests/test_jnitable_overflow.py
tests/test_jnitable_overflow.py
# run it, and check with Java VisualVM if we are eating too much memory or not! from jnius import autoclass Stack = autoclass('java.util.Stack') i = 0 while True: i += 1 stack = Stack() stack.push('hello')
mit
Python
5d3918c885f430e79e8283533ad5eb3a84ffecc7
Add migration code for updating lease status
openstack/blazar,stackforge/blazar,openstack/blazar,ChameleonCloud/blazar,ChameleonCloud/blazar,stackforge/blazar
blazar/db/migration/alembic_migrations/versions/75a74e4539cb_update_lease_status.py
blazar/db/migration/alembic_migrations/versions/75a74e4539cb_update_lease_status.py
# Copyright 2018 OpenStack Foundation. # # 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 ...
apache-2.0
Python
308e34b686686d3c42466012c864d7cc5d0f6799
Create go_fixup_fptrs.py
williballenthin/idawilli
scripts/go/go_fixup_fptrs.py
scripts/go/go_fixup_fptrs.py
""" when IDA's auto-discovery of functions in 64-bit Windows Go executables fails, scan for global (.rdata) pointers into the code section (.text) and assume these are function pointers. """ import idc import ida_name import ida_auto import ida_bytes import idautils def enum_segments(): for segstart in idautils.S...
apache-2.0
Python
08fcba713315b4ac29ed30f437b7c5c0b1da5a9d
Create make_upper_case.py
joshavenue/python_notebook
make_upper_case.py
make_upper_case.py
def sillycase(string): half = round(len(string)/2) // Find the half index return string[:half].lower() + string[half:].upper() // If you only want certain letters to be upper case //
unlicense
Python
9e986214aaf6beef5b1778254cc348006a828c04
Create MaximalSquare_001.py
Chasego/codirit,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/codirit,cc13ny/algo,cc13ny/algo,Chasego/codirit,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/codi,cc13ny/Allin,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/codi,Chasego/cod,Chasego/cod,Ch...
leetcode/221-Maximal-Square/MaximalSquare_001.py
leetcode/221-Maximal-Square/MaximalSquare_001.py
# brute force, optimized later class Solution(object): def maximalSquare(self, matrix): """ :type matrix: List[List[str]] :rtype: int """ if len(matrix) == 0 or len(matrix[0]) == 0: return 0 maxv = 0 for i in range(len(matrix)): ...
mit
Python
6b6c5b836b282c53fc5a337942d187769d0a87ed
Add cli module.
liwushuo/fapistrano
fapistrano/cli.py
fapistrano/cli.py
# -*- coding: utf-8 -*- import click import yaml from fabric.api import env as fabenv, local, execute from fapistrano.app import init_cli from fapistrano.utils import with_configs, register_role, register_env, _apply_env_role_config from fapistrano import deploy @click.group() @click.option('-d', '--deployfile', defa...
mit
Python
9341d2192da8cbaea734641aec9567a1035aa1ee
Add suffix list
brinchj/RndPhrase,brinchj/RndPhrase,brinchj/RndPhrase
scripts/update-suffixlist.py
scripts/update-suffixlist.py
#!/usr/bin/env python import os import urllib2 as urllib import anyjson as json URL_LIST = "http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/src/effective_tld_names.dat?raw=1" # generate json print 'downloading suffix list..' rules = {} lst = urllib.urlopen(URL_LIST).read() print 'processing list..' lines =...
bsd-2-clause
Python
a1d95beccd0f0f332005cd133bdd660fbe649467
Add a benchmarking script.
materialsvirtuallab/pyhull,materialsvirtuallab/pyhull,materialsvirtuallab/pyhull,materialsvirtuallab/pyhull
benchmarking/perf_cmp.py
benchmarking/perf_cmp.py
#!/usr/bin/env python """ TODO: Change the module doc. """ from __future__ import division __author__ = "shyuepingong" __version__ = "0.1" __maintainer__ = "Shyue Ping Ong" __email__ = "shyuep@gmail.com" __status__ = "Beta" __date__ = "11/19/12" import numpy as np from scipy.spatial import Delaunay from pyhull.qco...
mit
Python
8de30c6d4b5784af406d75e04feeb7c6431243d6
add fermi setup
ceb8/astroquery,imbasimba/astroquery,imbasimba/astroquery,ceb8/astroquery
astroquery/fermi/setup_package.py
astroquery/fermi/setup_package.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os def get_package_data(): paths_test = [os.path.join('data', '*.html')] return { 'astroquery.fermi.tests': paths_test, }
bsd-3-clause
Python
fc32e0d04569dab20cfc1b3b991bfbd8b067d62e
Add the manager to persist the data received from the OSM adapters
SeGarVi/moveon-web,SeGarVi/moveon-web,SeGarVi/moveon-web
moveon/managers.py
moveon/managers.py
from django.db import models from moveon.models import Line, Station, Node class OSMLineManager(models.Manager): def __init__(self, osmline): self.osmline = osmline self.stations = dict() self.routes = [] self.nodes = dict() self.stretches = dict() def save(self): ...
agpl-3.0
Python
59a05f592ffc4423023f1803efcf427896ab5d41
Add lc0695_max_area_of_island.py
bowen0701/algorithms_data_structures
lc0695_max_area_of_island.py
lc0695_max_area_of_island.py
"""Leetcode 695. Max Area of Island Medium URL: https://leetcode.com/problems/max-area-of-island/ Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. Find...
bsd-2-clause
Python
b8b191a380ef4ab0701793c2e0ac664b05c4c505
Add simple word2vec to train model
chuajiesheng/twitter-sentiment-analysis
analysis/word2vec.py
analysis/word2vec.py
import numpy as np import re from nltk.corpus import stopwords import nltk import logging from gensim.models import word2vec def get_dataset(): files = ['./analysis/input/negative_tweets.txt', './analysis/input/neutral_tweets.txt', './analysis/input/positive_tweets.txt'] x = [] for file in files: ...
apache-2.0
Python
a0333aa80dd6a6baeb24e32deeecd0288419328e
Initialize P3_seatingCards
JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials
books/AutomateTheBoringStuffWithPython/Chapter17/PracticeProjects/P3_seatingCards.py
books/AutomateTheBoringStuffWithPython/Chapter17/PracticeProjects/P3_seatingCards.py
# Chapter 13 included a practice project to create custom invitations from a list of # guests in a plaintext file. As an additional project, use the pillow module to # create images for custom seating cards for your guests. For each of the guests listed # in the guests.txt, generate an image file with the guest name an...
mit
Python
1e45df8375c4e72257defc82137fa570fbb44249
add StringOperation to repository
liu0g/python_web,liu0g/python_web
StringOperation.py
StringOperation.py
#encoding = utf-8 __author__ = 'lg' list1 = ['java','python','ruby','perl','mac'] list2 = ['linux','mac','windows','ruby'] #两个list的交集(法一) 时间复杂度为O(n^2) def intersect(a,b): listRes = [] for i in range(len(a)): for j in range(len(b)): if a[i] == b[j]: if a[i] not in listRes: ...
mit
Python
59d55a5911e99a0886b8c3cc48ee92f247e96e0a
add Voronoi
PKU-Dragon-Team/Datalab-Utilities
Voronoi/Voronoi.py
Voronoi/Voronoi.py
import numpy as np import matplotlib.pyplot as plt from scipy.spatial import Voronoi, voronoi_plot_2d import csv COUNT_LIMIT = None SAMPLE_LIMIT = 100 Points = [] with open('cell_info.csv', 'r', encoding='utf_8') as obj_file: csv_file = csv.reader(obj_file) for cnt, line in enumerate(csv_file): if CO...
mit
Python
de0265b609ab56035544018e368a108b573ae503
define the index of filters to prune by examining the classification activations
shuang1330/tf-faster-rcnn,shuang1330/tf-faster-rcnn,shuang1330/tf-faster-rcnn,shuang1330/tf-faster-rcnn
tools/prune_with_classification_guidance.py
tools/prune_with_classification_guidance.py
import os.path import numpy as np # define th CLASSES and indices CLASSES = ('__background__', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sof...
mit
Python
5068c02e50c54c08a6991e45584c6c9b9bdd5dba
add import script for Midlothian
chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_midlothian.py
polling_stations/apps/data_collection/management/commands/import_midlothian.py
from data_collection.management.commands import BaseScotlandSpatialHubImporter class Command(BaseScotlandSpatialHubImporter): council_id = 'S12000019' council_name = 'Midlothian' elections = ['local.midlothian.2017-05-04'] def district_record_to_dict(self, record): code = str(record[0]).strip(...
bsd-3-clause
Python
db846aaa0f35e8888b0b3423539c0a70c9ae16fa
Add Source Files
SAP/lumira-extension-da-googledocs
source/GoogleSpreadsheets.py
source/GoogleSpreadsheets.py
# -*- coding: utf-8 -*- import sys import requests import easygui def enum(*sequential, **named): enums = dict(zip(sequential, range(len(sequential))), **named) return type('Enum', (), enums) Mode = enum('PREVIEW', 'EDIT', 'REFRESH') mode = 0 size = 0 params = '' key = '' i = 0 for i in range(len(sys.ar...
apache-2.0
Python
c185786a189b2934e69334089e180c725d59a391
Add a test that exposes the association copy/paste issue
amolenaar/gaphor,amolenaar/gaphor
tests/test_multiple_associations.py
tests/test_multiple_associations.py
""" Test issues where associations are copied and pasted, deleted, etc. Scenario's: * Class and association are pasted in a new diagramg * Class and association are pasted in a new diagram and original association is deleted * Class and association are pasted in a new diagram and new association is deleted * Associati...
lgpl-2.1
Python
107f86c8c20c4d7cc4c81db464ac20607bb31ba9
add DBusTube constants to constants.py
community-ssu/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,j...
tests/twisted/constants.py
tests/twisted/constants.py
""" Some handy constants for other tests to share and enjoy. """ HT_CONTACT = 1 CHANNEL = "org.freedesktop.Telepathy.Channel" CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group" CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes" CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT" CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Ty...
""" Some handy constants for other tests to share and enjoy. """ HT_CONTACT = 1 CHANNEL = "org.freedesktop.Telepathy.Channel" CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group" CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes" CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT" CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Ty...
lgpl-2.1
Python
b9b246e1feb728a257b343d4a07fc42ba10bac13
Add a wsgi app to our test tg2 app
ralphbean/moksha,pombredanne/moksha,mokshaproject/moksha,lmacken/moksha,ralphbean/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha,lmacken/moksha,pombredanne/moksha,mokshaproject/moksha,pombredanne/moksha,ralphbean/moksha,pombredanne/moksha
moksha/tests/quickstarts/tg2app/tg2app/wsgi.py
moksha/tests/quickstarts/tg2app/tg2app/wsgi.py
import os from paste.deploy import loadapp cfg_path = os.path.join(os.path.dirname(__file__), '..', 'development.ini') application = loadapp('config:' + cfg_path)
apache-2.0
Python
3299cd9a931e6b564ebb5031a7e515155dab97c9
Create blast.py
jfoox/venninator
blast.py
blast.py
#! /bin/bash/env python from Applications import NcbiblastpCommandline import math import os from decimal import * import settings added = [] class Blaster(object): def __init__(self): pass def blast(self, evalue): # create a database and conduct the all-vs-all BLAST search against it print 'Creating databas...
mit
Python
550ce185895a7b32f6bdb0750338ea6d2416ee2a
Add merged migration
Ircam-Web/mezzanine-organization,Ircam-Web/mezzanine-organization
organization/projects/migrations/0006_merge.py
organization/projects/migrations/0006_merge.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-09-07 14:02 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('organization-projects', '0005_auto_20160907_1046'), ('organization-projects', '0005_auto_2016...
agpl-3.0
Python
f6148d7a4e2d080da93d21de2f13b601465c7528
Add tf.contrib.checkpoint.CheckpointableBase for isinstance checks.
alsrgv/tensorflow,apark263/tensorflow,davidzchen/tensorflow,asimshankar/tensorflow,adit-chandra/tensorflow,jhseu/tensorflow,gojira/tensorflow,cxxgtxy/tensorflow,xzturn/tensorflow,karllessard/tensorflow,ghchinoy/tensorflow,xzturn/tensorflow,manipopopo/tensorflow,snnn/tensorflow,tensorflow/tensorflow-experimental_link_st...
tensorflow/contrib/checkpoint/__init__.py
tensorflow/contrib/checkpoint/__init__.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
Python
7ef03c975566b92fd97b7071b39cf3d8c242e480
Create brick.py
petehopkins/Untitled-CSET1100-Project
brick.py
brick.py
# Class: Brick # Represents a single brick as displayed on screen. # Used as a target for the Ball to break # Requires pygame import pygame class Brick(pygame.sprite.Sprite): __borderWidth = 2 __hitsRemaining = 1 __position = {"x": 0, "y": 0} __size = 25 __whRatio = {"width": 2, "height": 1} _...
mit
Python
c1d3a8d15d3e50a14ff765e7abd063cc1b390063
add new test case TestAssociator
alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl
tests/unit/EventReader/test_Associator.py
tests/unit/EventReader/test_Associator.py
from AlphaTwirl.EventReader import Associator import unittest ##____________________________________________________________________________|| class MockReader(object): def __init__(self): self.content = [ ] ##____________________________________________________________________________|| class MockCollect...
bsd-3-clause
Python
6a4152e805be0ba061529841fb84442d8a23ff9f
add label transform cpn
FederatedAI/FATE,FederatedAI/FATE,FederatedAI/FATE
python/federatedml/components/label_transform.py
python/federatedml/components/label_transform.py
# # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
apache-2.0
Python
99ab22cf5fcba719dd7d9d87c18c8d93de5591a4
Add IO Class
yasn77/whitepy
whitepy/ws_io.py
whitepy/ws_io.py
import readchar import sys class IO(object): def __init__(self, stack): self.stack = stack def i_chr(self, heap): self.stack.push(readchar.readchar()) heap.set() def i_int(self, heap): num = None while type(num) is not int: try: num = i...
apache-2.0
Python
6279341682ae45a228302972dbd106a2e44e0b12
Add example usage of the JsonTestResponse.
craig552uk/flask-json
examples/example_test.py
examples/example_test.py
import unittest from flask import Flask from flask_json import json_response, FlaskJSON, JsonTestResponse def our_app(): app = Flask(__name__) app.test_value = 0 FlaskJSON(app) @app.route('/increment') def increment(): app.test_value += 1 return json_response(value=app.test_value)...
bsd-3-clause
Python
1fd997bc11b62cb760470fb749c2a4f0261b3e00
Add db2es.py to sync data
SHSIDers/oclubs,SHSIDers/oclubs,SHSIDers/oclubs,SHSIDers/oclubs
db2es.py
db2es.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # from __future__ import unicode_literals, absolute_import import time from elasticsearch.helpers import scan from elasticsearch.exceptions import NotFoundError from oclubs.app import app from oclubs.access import database, elasticsearch, done from oclubs.objs import Ac...
mit
Python
43e019ff26e04a6464cad3a10045ba600e98610e
Add __init__.py for monitorlib module.
krux/monitorlib
monitorlib/__init__.py
monitorlib/__init__.py
### -*- coding: utf-8 -*- ### ### © 2012 Krux Digital, Inc. ### Author: Paul Lathrop <paul@krux.com> ### """Library for creating monitoring scripts/plugins."""
mit
Python
2427dbad4fc0cfe7685dc2767069748d37262796
Add initial version of identification algorithm
divijbindlish/movienamer
movienamer/identify.py
movienamer/identify.py
import os.path as path import re import Levenshtein from .sanitize import sanitize from .tmdb import search def _gather(filename, directory=None, titles={}): # Sanitize the input filename name, year = sanitize(filename) # Start with a basic search results = search(name, year) if year is not No...
mit
Python
2ac52ea39a7a8db6cab756e3af2f65b228bb1c09
Add registration test
zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,DannyArends/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,zsloa...
test/requests/test-registration.py
test/requests/test-registration.py
import sys import unittest import requests import logging from elasticsearch import Elasticsearch, TransportError #from utility.tools import ELASTICSEARCH_HOST, ELASTICSEARCH_PORT GN2_SERVER = None ES_SERVER = None class TestRegistration(unittest.TestCase): def setUp(self): self.url = GN2_SERVER+"/n...
agpl-3.0
Python
ee3e0d444dd706858a3a30cf52ebc2a960bcfb56
add a just for funsies pygame renderer
pusscat/refNes
renderer-pygame.py
renderer-pygame.py
import pygame class Palette(): def __init__(self, ppu): self.ppu = ppu self.colors = [(0x7C,0x7C,0x7C),(00,00,0xFC),(00,00,0xBC),(44,28,0xBC),(94,00,84),(0xA8,00,20),(0xA8,10,00),(88,14,00),(50,30,00),(00,78,00),(00,68,00),(00,58,00),(00,40,58),(00,00,00),(00,00,00),(00,00,00),(0xBC,0xBC,0xBC),(00,...
bsd-2-clause
Python
669a4880da91b93c0ba00a2c44ce02e583505f6c
Add a script to generate optical flow for vid files.
myfavouritekk/TPN
tools/data/gen_vid_optical_flow.py
tools/data/gen_vid_optical_flow.py
#!/usr/bin/env python import argparse import cv2 import os import glob import sys import numpy as np import scipy.io as sio import time from vdetlib.utils.protocol import proto_load, frame_path_at def cvReadGrayImg(img_path): return cv2.cvtColor(cv2.imread(img_path), cv2.COLOR_BGR2GRAY) def saveOptFlowToImage(flo...
mit
Python
75f666ad189c5a799582ce567f0df8b7848066d5
replace spy solved
xala3pa/Computer-Science-cs101
Lesson3/replace_spy.py
Lesson3/replace_spy.py
# Define a procedure, replace_spy, # that takes as its input a list of # three numbers, and modifies the # value of the third element in the # input list to be one more than its # previous value. spy = [0,0,7] def replace_spy(spy): spy[2] = spy[2] + 1 return spy # In the test below, the first line calls yo...
mit
Python
83e136a0e0d93d1dde4966322a3b51f453d0a1ba
Add simple CSV exporter to examples.
SeNeReKo/TCFlib
tcflib/examples/csv_exporter.py
tcflib/examples/csv_exporter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import csv from io import StringIO from collections import OrderedDict from tcflib.service import ExportingWorker, run_as_cli class CSVExporter(ExportingWorker): def export(self): columns = OrderedDict() columns['tokenID'] = [token.id for token in...
mit
Python
75cedb719385b70d08805483fbeda07222031f98
Add comparison MID generator script.
jmtd/freedoom,CWolfRU/freedoom,jmtd/freedoom,CWolfRU/freedoom,jmtd/freedoom
lumps/dmxgus/comparison.py
lumps/dmxgus/comparison.py
# Generate comparison MIDI file. # # The comparison MIDI is used for testing and tweaking the similarity # groups in the configuration file. In each group, the instruments in # the group should sound broadly similar, and the first in the group # should be able to substitute for any member of the group. # # Each similar...
bsd-3-clause
Python
a509828f5d5040b1b005fe602ad0e53675b8cb52
add to test
banzo/mongo-connector,wzeng/mongo-connector,LonelyPale/mongo-connector,apicht-spireon/mongo-connector,lchqfnu/mongo-connector,Sebmaster/mongo-connector,silver-/mongo-connector,imclab/mongo-connector,dgsh/mongo-connector,turbidsoul/mongo-connector,sailthru/mongo-connector,tonyzhu/mongo-connector,10gen-labs/mongo-connect...
test/solr_doc_manager_tester.py
test/solr_doc_manager_tester.py
import unittest import time from solr_doc_manager import SolrDocManager from pysolr import Solr class SolrDocManagerTester(unittest.TestCase): def __init__(self): super(SolrDocManagerTester, self).__init__() self.solr = Solr("http://localhost:8080/solr/") def runTest(self): #Invalid...
apache-2.0
Python
4ca2ca05232357776e64a1e6eb76c0b26663a59e
add semigroup law tester
przemyslawjanpietrzak/pyMonet
testers/semigroup_law_tester.py
testers/semigroup_law_tester.py
class SemigroupLawTester: def __init__(self, semigroup, value1, value2, value3): self.semigroup = semigroup self.value1 = value1 self.value2 = value2 self.value3 = value3 def associativity_test(self): x = self.semigroup(self.value1)\ .concat(self.semigr...
mit
Python
e0a037a6418b31275b5a00a1f78959e6dc25be17
Add a script to fix bad svn properties
jrochas/scale-proactive,mnip91/proactive-component-monitoring,ow2-proactive/programming,paraita/programming,PaulKh/scale-proactive,acontes/programming,acontes/programming,mnip91/programming-multiactivities,mnip91/programming-multiactivities,PaulKh/scale-proactive,PaulKh/scale-proactive,acontes/programming,lpellegr/prog...
dev/scripts/fix_svn_properties.py
dev/scripts/fix_svn_properties.py
#!/usr/bin/evn python import sys import os import subprocess mapping = { '.c': [['svn:eol-style', 'native']], '.cpp': [['svn:eol-style', 'native']], '.h': [['svn:eol-style', 'native']], '.sh': [['svn:eol-style', 'native'], ['svn:executable', '']], '.cmd': [['svn:mime-type', 'text/plain'...
agpl-3.0
Python
1c5fef3a34ed421610a4e9a38feb07e6545e5d13
Add tests for the `dirty_untar` rule
PLNech/thefuck,AntonChankin/thefuck,SimenB/thefuck,gogobebe2/thefuck,BertieJim/thefuck,lawrencebenson/thefuck,barneyElDinosaurio/thefuck,vanita5/thefuck,mcarton/thefuck,redreamality/thefuck,subajat1/thefuck,mbbill/thefuck,vanita5/thefuck,qingying5810/thefuck,thinkerchan/thefuck,bigplus/thefuck,mlk/thefuck,AntonChankin/...
tests/rules/test_dirty_untar.py
tests/rules/test_dirty_untar.py
import os import pytest import tarfile from thefuck.rules.dirty_untar import match, get_new_command, side_effect from tests.utils import Command @pytest.fixture def tar_error(tmpdir): def fixture(filename): path = os.path.join(str(tmpdir), filename) def reset(path): with tarfile.TarFi...
mit
Python
c5276d469b08b3262490047f2372a477814cb2fc
add server test for statelessCompute
radiasoft/sirepo,radiasoft/sirepo,radiasoft/sirepo,radiasoft/sirepo,mkeilman/sirepo,mkeilman/sirepo,mkeilman/sirepo,radiasoft/sirepo,mkeilman/sirepo
tests/stateless_compute_test.py
tests/stateless_compute_test.py
# -*- coding: utf-8 -*- u"""Test statelessCompute API :copyright: Copyright (c) 2021 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function from pykern.pkcollections import PKDict import pytest def test_madx_c...
apache-2.0
Python
9b8069f66988ccdbfc76fdbbc7efb78285ed9900
Bump version to S22.1
AleksNeStu/ggrc-core,hasanalom/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,hyperNURb/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,hasanalom/ggrc-core,NejcZupec/ggrc-core...
src/ggrc/settings/default.py
src/ggrc/settings/default.py
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com DEBUG = False TESTING = False # Flask-SQLAlchemy fix to be less than `wait_time` ...
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com DEBUG = False TESTING = False # Flask-SQLAlchemy fix to be less than `wait_time` ...
apache-2.0
Python
6c22f7bf2fe8db39446cddbd0fa9474486101a27
Add __init__, as django test finder isn't very smart
BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit
toolkit/diary/tests/__init__.py
toolkit/diary/tests/__init__.py
from __future__ import absolute_import from .test_edit_views import * from .test_mailout_view import * from .test_models import * from .test_public_views import *
agpl-3.0
Python
623ea9e3d050f347eb404094d049a402b2bb367a
Create config.py
fnielsen/dasem,fnielsen/dasem
dasem/config.py
dasem/config.py
"""config""" from os.path import expanduser, join def data_directory(): return join(expanduser('~'), 'dasem_data')
apache-2.0
Python
e35586efcfc0af4dcfe02c005a1435767f5ab3ed
add merge_book_lists.py
michael-ruan/crawler
douban_spider/merge_book_lists.py
douban_spider/merge_book_lists.py
# -*- coding: UTF-8 -*- import bloom_filter import sys # 把str编码由默认ascii(python2为ascii,python3为utf8)改为utf8 reload(sys) sys.setdefaultencoding('utf8') """ Merge book list files into one, using bloom filter to remove duplicate books """ def main(): file_name = 'book_list' bf = bloom_filter.BloomFilter(2000,14) with...
mit
Python
62fb38d0860b5feeee39764b6c66f5ceed39b984
Fix versions of protected/unprotected documents
c2corg/v6_api,c2corg/v6_api,c2corg/v6_api
alembic_migration/versions/077ddf78a1f3_fix_protected_docs_versions.py
alembic_migration/versions/077ddf78a1f3_fix_protected_docs_versions.py
"""Fix protected docs versions Revision ID: 077ddf78a1f3 Revises: 9739938498a8 Create Date: 2017-10-30 12:05:51.679435 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '077ddf78a1f3' down_revision = '9739938498a8' branch_labels = None depends_on = None def upgr...
agpl-3.0
Python
ebd8d2fb86b925f3c75ddfea0bbe9d7ab60b50b7
add notes for subprocess module
mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs
abc/sub_process.py
abc/sub_process.py
# -*- coding: UTF-8 -*- __author__ = 'mcxiaoke' import subprocess # 创建子进程并等待它返回,参数是list subprocess.call(['ls', '-a']) # 同上,但是子进程返回值不是0时会抛异常 subprocess.check_call(['ls', '-a']) # subprocess.check_call(['ls2', '-la']) # 同上,但是返回值以字符串的形式返回 # 如果要捕获标准错误输出,可以用stderr=subprocess.STDOUT ret = subprocess.check_output(['ls', '-a...
apache-2.0
Python
36b4e37972501ce9fa84e9d74a3cfe726681209e
Add tests for numpy array ufuncs
stefanseefeld/numba,gdementen/numba,pitrou/numba,gdementen/numba,pitrou/numba,numba/numba,stuartarchibald/numba,GaZ3ll3/numba,GaZ3ll3/numba,GaZ3ll3/numba,GaZ3ll3/numba,ssarangi/numba,stefanseefeld/numba,IntelLabs/numba,gmarkall/numba,pombredanne/numba,ssarangi/numba,stonebig/numba,numba/numba,GaZ3ll3/numba,cpcloud/numb...
numba/tests/test_ufuncs.py
numba/tests/test_ufuncs.py
from __future__ import print_function import unittest import numpy as np from numba.compiler import compile_isolated, Flags from numba import types, utils from numba.tests import usecases enable_pyobj_flags = Flags() enable_pyobj_flags.set("enable_pyobject") force_pyobj_flags = Flags() force_pyobj_flags.set("force_py...
bsd-2-clause
Python
47f61ce40319100b7f226538a466c584d22d4f72
Add character filtering benchmark
coblo/isccbench
iscc_bench/textid/bench_remove.py
iscc_bench/textid/bench_remove.py
# -*- coding: utf-8 -*- """Benchmark Character Removals [Cc] Other, Control [Cf] Other, Format [Cn] Other, Not Assigned (no characters in the file have this property) [Co] Other, Private Use [Cs] Other, Surrogate [LC] Letter, Cased [Ll] Letter, Lowercase [Lm] Letter, Modifier [Lo] Letter, Other [Lt] Letter, Titlecase ...
bsd-2-clause
Python
0e6fb27d26d5f0570baa414e679b96d6c3234491
add correct loop file (#8)
CrookedY/AirPollutionBot
looptogetdata2.py
looptogetdata2.py
from urllib2 import Request, urlopen, URLError import json import pandas def getValidTimeseriesKey(timerseries_keys, offering_id): invalid_offering = '9999999999' if offering_id == invalid_offering: return timeseries_keys[1] else: return timeseries_keys[0] requestpoll = Request ('http://dd.eionet.europa.eu/voc...
apache-2.0
Python
eb46f8046211eff81320faceda0c297b27bb419b
Add a new alert plugin for events from geomodel
mozilla/MozDef,Phrozyn/MozDef,ameihm0912/MozDef,jeffbryner/MozDef,netantho/MozDef,gdestuynder/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,mozilla/MozDef,jeffbryner/MozDef,netantho/MozDef,mpurzynski/MozDef,mozilla/MozDef,ameihm0912/MozDef,netantho/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,gdestuynder/...
alerts/geomodel.py
alerts/geomodel.py
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Copyright (c) 2015 Mozilla Corporation # # Contributors: # Aaron Meihm <ameihm@mozilla.com> fro...
mpl-2.0
Python
6898b9462823449e767aa75b7ab38c3e87b61cc1
Check for page changes
wave2/moinmoinextensions
macro/IsRecent.py
macro/IsRecent.py
# -*- coding: iso-8859-1 -*- u""" IsRecent - Check if a page was recently modified and highlight that fact @copyright: 2012 by Alan Snelson @license: BSD, see LICENSE for details. """ from datetime import datetime from MoinMoin.Page import Page Dependencies = ['pages'] def macro_IsRecent(...
bsd-3-clause
Python
fe5369253a79b9ec42d8b438112cd7e0eb61955a
Add multiple viewport example
Eric89GXL/vispy,sh4wn/vispy,bollu/vispy,inclement/vispy,dchilds7/Deysha-Star-Formation,jdreaver/vispy,dchilds7/Deysha-Star-Formation,julienr/vispy,sh4wn/vispy,QuLogic/vispy,inclement/vispy,srinathv/vispy,michaelaye/vispy,sbtlaarzc/vispy,RebeccaWPerry/vispy,julienr/vispy,drufat/vispy,jdreaver/vispy,ghisvail/vispy,Rebecc...
examples/multiple_viewports/main.py
examples/multiple_viewports/main.py
''' Created on 03/03/2012 @author: adam ''' import math from pyglet.gl import * import pyglet # over-ride the default pyglet idle loop import renderer.idle import renderer.window from renderer.viewport import Viewport from renderer.projection_view_matrix import ProjectionViewMatrix from scene.scene_...
bsd-3-clause
Python
3587666f209a9e88672e9520c033682fcd28035a
add l10n_br_purchase/procurement.py
akretion/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil
l10n_br_purchase/procurement.py
l10n_br_purchase/procurement.py
# -*- encoding: utf-8 -*- ############################################################################### # # # Copyright (C) 2014 Renato Lima - Akretion # # ...
agpl-3.0
Python
b1d643afb07cef02ab607943776ce120a7d47013
move unit test for matrix-vector conversion to new superoperator test module
cgranade/qutip,anubhavvardhan/qutip,zasdfgbnm/qutip,cgranade/qutip,zasdfgbnm/qutip,qutip/qutip,qutip/qutip,anubhavvardhan/qutip
qutip/tests/test_superoperator.py
qutip/tests/test_superoperator.py
# This file is part of QuTIP. # # QuTIP 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 version. # # QuTIP is distributed in the ...
bsd-3-clause
Python
b39dd2afea1f4662e17a927e7e6aa41e850f7470
Add a script for generating jamo character table
GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters
lib/gen-hangul.py
lib/gen-hangul.py
#!/usr/bin/python3 # Input: https://www.unicode.org/Public/UNIDATA/Jamo.txt import io import re class Builder(object): def __init__(self): pass def read(self, infile): chars = [] for line in infile: if line.startswith('#'): continue line = line...
bsd-3-clause
Python
415e3e1ae3a6c5689f3960d2b3f589cf2c733144
Create conf.py
ging/fi-ware-idm,ging/fi-ware-idm,ging/fi-ware-idm
conf.py
conf.py
# -*- coding: utf-8 -*- # import os # on_rtd is whether we are on readthedocs.org on_rtd = os.environ.get('READTHEDOCS', None) == 'True' if not on_rtd: # only import and set the theme if we're building docs locally import sphinx_rtd_theme html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_them...
apache-2.0
Python
72f1dab3fe50a552480df522f6c8c4a7002a0952
Add TimestampsMixin exmples
absent1706/sqlalchemy-mixins
examples/timestamp.py
examples/timestamp.py
from __future__ import print_function import time from datetime import datetime import sqlalchemy as sa from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy_mixins import TimestampsMixin Base = declarative_base() engine = sa.create_engine("s...
mit
Python
7799b7a3ea1b1774ce24376ee918376b422daebd
Create cube.py
botlabio/autonomio,botlabio/autonomio
cube.py
cube.py
import numpy as np import pandas as pd import keras import pandas as pd import keras.preprocessing.text import somecode as some class Cube: ''' INTENDED USE > to be called through FastText() class. Takes in pandas dataframe with at least two columns where one is the dependent variable, ...
mit
Python
67d3b321edab1fe50f666d0ada86c8392be07199
add wire_callback
Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python
pyaudio/wire_callback.py
pyaudio/wire_callback.py
#!/usr/bin/env python """ PyAudio Example: Make a wire between input and output (i.e., record a few samples and play them back immediately). This is the callback (non-blocking) version. """ import pyaudio import time WIDTH = 2 CHANNELS = 2 RATE = 44100 p = pyaudio.PyAudio() def callback(in_data, frame_count, tim...
mit
Python
34815186871e27b977082d9c35dd0adc76d3af9f
update stencilview doc (128 levels, not 8)
Cheaterman/kivy,xiaoyanit/kivy,bliz937/kivy,jffernandez/kivy,tony/kivy,LogicalDash/kivy,xpndlabs/kivy,Shyam10/kivy,manthansharma/kivy,jehutting/kivy,bionoid/kivy,KeyWeeUsr/kivy,jkankiewicz/kivy,bhargav2408/kivy,Cheaterman/kivy,iamutkarshtiwari/kivy,andnovar/kivy,autosportlabs/kivy,CuriousLearner/kivy,bionoid/kivy,iamut...
kivy/uix/stencilview.py
kivy/uix/stencilview.py
''' Stencil View ============ .. versionadded:: 1.0.4 :class:`StencilView` limits the drawing of child widgets to the StencilView's bounding box. Any drawing outside the bounding box will be clipped (trashed). The StencilView uses the stencil graphics instructions under the hood. It provides an efficient way to clip...
''' Stencil View ============ .. versionadded:: 1.0.4 :class:`StencilView` limits the drawing of child widgets to the StencilView's bounding box. Any drawing outside the bounding box will be clipped (trashed). The StencilView uses the stencil graphics instructions under the hood. It provides an efficient way to clip...
mit
Python
e8798ac01d3baed6785ee0683ec4989b97e47003
Implement local.shell operation
Fizzadar/pyinfra,Fizzadar/pyinfra
pyinfra/modules/local.py
pyinfra/modules/local.py
# pyinfra # File: pyinfra/modules/local.py # Desc: run stuff locally, within the context of operations from subprocess import Popen, PIPE import gevent from termcolor import colored from pyinfra.api import operation from pyinfra.api.util import read_buffer def _run_local(code, hostname, host, print_output=False, p...
mit
Python
a2b9a17927d851b368d3ef8e869a295c8bd2e86b
add test for default clustering order of SELECT
scylladb/scylla,scylladb/scylla,scylladb/scylla,scylladb/scylla
test/cql-pytest/test_clustering_order.py
test/cql-pytest/test_clustering_order.py
# Copyright 2022-present ScyllaDB # # SPDX-License-Identifier: AGPL-3.0-or-later ############################################################################# # Tests for clustering key ordering, namely the WITH CLUSTERING ORDER BY # setting in the table schema, and ORDER BY in select. # # We have many other tests for...
agpl-3.0
Python
b602c3467ee5969bc3292b7e494d60b9ccdbbedb
remove sum or c number
anubhavvardhan/qutip,zasdfgbnm/qutip,anubhavvardhan/qutip,zasdfgbnm/qutip,qutip/qutip,cgranade/qutip,cgranade/qutip,qutip/qutip
qutip/tests/test_rand.py
qutip/tests/test_rand.py
#This file is part of QuTIP. # # QuTIP 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 version. # # QuTIP is distributed in the ho...
#This file is part of QuTIP. # # QuTIP 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 version. # # QuTIP is distributed in the ho...
bsd-3-clause
Python
796561ed822d64be6fd2ef299093711a8534d0e9
add package py-lmodule version 0.1.0 (#18856)
iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack
var/spack/repos/builtin/packages/py-lmodule/package.py
var/spack/repos/builtin/packages/py-lmodule/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 PyLmodule(PythonPackage): """Lmodule is a Python API for Lmod module system. It's primary ...
lgpl-2.1
Python
f3bf91c8a9ba3a043f0ba4a11c2347e9b4a3c8be
Add linkins.script
thelinuxkid/linkins
linkins/script.py
linkins/script.py
import logging import subprocess log = logging.getLogger(__name__) log.propagate = False handler = logging.StreamHandler() fmt = logging.Formatter( fmt='%(script)s: %(stream)s: %(message)s', ) handler.setFormatter(fmt) log.addHandler(handler) def _logscript(fp, **kwargs): for line in fp: line = li...
mit
Python
2ff8505db7ee0b4dbf08a2a61d00daaf681f5492
Create dlpp.py
keirwl/dl_poly_parse
dlpp.py
dlpp.py
#!/usr/bin/env python # dl_poly_parse # If ran as script, takes a DL_POLY OUTPUT file and returns the physical properties as a parsed # file of simple columns, for easy readability by plotting software. # # To do: # * give option to output as csv # * give option to return properties as horizontally or vertically sor...
mit
Python
8967d4e0c5cd9adad7244cfc2ea78593be14b113
Add regression test template
explosion/spacy-dev-resources,explosion/spacy-dev-resources
templates/tests/regression_test.py
templates/tests/regression_test.py
# coding: utf-8 from __future__ import unicode_literals import pytest def test_issueXXX(): """Provide a description of what you're testing for here.""" # to use spaCy components, add the fixture names as arguments to the test # for more info, check out the tests README: # https://github.com/explosio...
mit
Python
47734733a7ccbd242979b3c7ac9d792f59ac10d8
Test for HERMES spectra of HD22879
andycasey/precise-objective-differential-spectroscopy
code/test_hd22879.py
code/test_hd22879.py
import cPickle as pickle from stellar_parameters import Star from channel import SpectralChannel class spectrum(object): pass import sick spec = sick.specutils.Spectrum.load("spectra/hermes-sun.fits") blue_channel = spectrum() blue_channel.dispersion = spec.disp blue_channel.flux = spec.flux blue_channel.va...
mit
Python
1a6f702b670a4cad2ec1cd4044759ecfc656c9f2
add thread
gitpythonkaka/test,gitpythonkaka/test,gitpythonkaka/test
thread/thread.py
thread/thread.py
#!/usr/bin/env python import thread from time import sleep, ctime def thread0(): print '1 : start @ ', ctime() sleep(4) print '1 : end @ ', ctime() def thread1(): print '2 : start @ ', ctime() sleep(4) print '2 : end @ ', ctime() def main(): print 'starting at:', ctime() thread....
unlicense
Python
2feed8b291fd4c8081bb81458bedd736c08c448e
Add CNN example script.
openmv/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,iabdalkader/openmv,openmv/openmv,iabdalkader/openmv,openmv/openmv,kwagyeman/openmv,iabdalkader/openmv,kwagyeman/openmv
usr/examples/09-Feature-Detection/cnn.py
usr/examples/09-Feature-Detection/cnn.py
# CMSIS CNN example. import sensor, image, time, os sensor.reset() # Reset and initialize the sensor. sensor.set_contrast(3) sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set...
mit
Python
0080f3a4f93a22b9c563c20d2c93b00ce8b7c382
Set up game structure
Mailea/hexagonal-game-of-life
game.py
game.py
""" A variant of Conway's Game of Life on a hexagonal grid. Rules: B2/S12 - Dead cells with two live neighbours are born. - Live cells with one or two live neighbours survive. - All other live cells die. """ # Rule Configuration STATES = ('DEAD', 'ALIVE') B = (2,) S = (1, 2) class Game: def...
apache-2.0
Python
72e69f3535c7e2cd82cdda62636eabd7421ebddf
Add dump script for all hiddens
judithfan/pix2svg
generative/tests/compare_test/concat_first/dump_hiddens.py
generative/tests/compare_test/concat_first/dump_hiddens.py
from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import subprocess if __name__ == "__main__": for hiddens_dim in [512, 256, 128, 64, 32, 16]: print('Dumping files for (%d)' % hiddens_dim) model_path = '/mnt/visual_communicat...
mit
Python
6e0202bb2385821907627046aef28b042961a2be
Create gate.py
powerboat9/MinecraftCPUBuild
gate.py
gate.py
mit
Python
49b616ce93ba53bc6029145147a077945c18b604
add async example
phrocker/sharkbite,phrocker/sharkbite,phrocker/sharkbite,phrocker/sharkbite,phrocker/sharkbite
examples/asyncexample.py
examples/asyncexample.py
#!/usr/bin/python # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Licens...
apache-2.0
Python
e20e50c7cb1a22907bc83eec6c595a7bbaf8b8b9
Add test_github.py
ymyzk/kawasemi,ymyzk/django-channels
tests/core/backends/test_github.py
tests/core/backends/test_github.py
# -*- coding: utf-8 -*- import pytest import requests from kawasemi.backends.github import GitHubChannel from kawasemi.exceptions import HttpError, ImproperlyConfigured config = { "_backend": "kawasemi.backends.github.GitHubChannel", "token": "token", "owner": "ymyzk", "repository": "kawasemi" } @p...
mit
Python
aa1ca0b500af4ef89ba7ad7982b89ebe15252c1b
add heguilong answer for question3
pythonzhichan/DailyQuestion,pythonzhichan/DailyQuestion
question_3/heguilong.py
question_3/heguilong.py
""" File: heguilong.py Author: heguilong Email: hgleagle@gmail.com Github: https://github.com/hgleagle Description: 统计一个文件中每个单词出现的次数,列出出现频率最多的5个单词。 """ import logging import sys import re from collections import Counter logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s \ ...
mit
Python
69ba3715c762245e83d6b5388af4b77dfcc43dde
Create dataGenCore.py
kyanyoga/iot_kafka_datagen
bin/dataGenCore.py
bin/dataGenCore.py
#!/usr/bin python import time import random import base64 import os import sys start = time.time() # pwd = os.path.dirname(__file__) # outputpath = os.path.normpath(pwd + '/../sample_data/' + sys.argv[1]) outputpath = os.path.normpath(sys.argv[1]) # print outputpath #run for five minutes # while time.time() < st...
mit
Python
df784323d0da737755def4015840d118e3c8e595
Add test that detects censorship in HTTP pages based on HTTP body length
juga0/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,lordappsec/ooni-prob...
nettests/core/http_body_length.py
nettests/core/http_body_length.py
# -*- encoding: utf-8 -*- # # :authors: Arturo Filastò # :licence: see LICENSE from twisted.internet import defer from twisted.python import usage from ooni.templates import httpt class UsageOptions(usage.Options): optParameters = [ ['url', 'u', None, 'Specify a single URL to test.'], ...
bsd-2-clause
Python
e546e055b33c776fddaa244075d59a99978265ea
add reading
jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk
vehicles/management/commands/import_reading.py
vehicles/management/commands/import_reading.py
from ciso8601 import parse_datetime from django.utils.timezone import make_aware from django.contrib.gis.geos import Point from busstops.models import Service from ...models import VehicleLocation, VehicleJourney from ..import_live_vehicles import ImportLiveVehiclesCommand class Command(ImportLiveVehiclesCommand): ...
mpl-2.0
Python
3b00930f9c6e6552bef5b5939916a1b8e737287a
Add a snippet.
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/pyaudio/read.py
python/pyaudio/read.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # See http://people.csail.mit.edu/hubert/pyaudio/docs/#example-blocking-mode-audio-i-o import pyaudio import wave CHUNK = 1024 wf = wave.open("test.wav", 'rb') print(wf.getnchannels()) print(wf.getframerate()) p = pyaudio.PyAudio() print(p.get_device_count()) stream...
mit
Python
0799f888dd67439fa7ba9a3a26427a21ad804c62
Add XML plist module
depp/sglib,depp/sglib
scripts/gen/plistxml.py
scripts/gen/plistxml.py
import xml.dom.minidom import xml.dom as dom # The methods you want to use are 'load' and 'dump' # All keys and strings will be unicode # this will FAIL with non Unicode strings # this is intentional class PlistError(ValueError): pass def checkwhite(obj): if obj.nodeType == dom.Node.TEXT_NODE: if obj....
bsd-2-clause
Python
f970198596d8c20c89701fbcce38fd5736096e86
Set maximal word length limit
cheshirenet/cheshirenet
namegen/markov.py
namegen/markov.py
#!/usr/bin/env python """ Module which produces readble name from 256-bit of random data (i.e. sha-256 hash) """ MAXWORDLEN=12 # # Modules which contain problablity dictionaries # generated by genmarkov script # from surname_hash import surname from female_hash import female from male_hash import male # import operat...
agpl-3.0
Python
3601a0dc9d762e17c24e0dbf86ee1ef4a00c49cd
Add tests for the authorize_user function
lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server,Yaco-Sistemas/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server
yithlibraryserver/tests/test_security.py
yithlibraryserver/tests/test_security.py
from pyramid.httpexceptions import HTTPBadRequest, HTTPUnauthorized from yithlibraryserver import testing from yithlibraryserver.security import authorize_user class AuthorizationTests(testing.TestCase): clean_collections = ('access_codes', 'users') def test_authorize_user(self): request = testing...
agpl-3.0
Python
66db96dc523ab838475eb3826766bb4278c18673
Add tests for remove_display_attributes.
mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju
tests/test_assess_cloud_display.py
tests/test_assess_cloud_display.py
from tests import TestCase from assess_cloud_display import remove_display_attributes from utility import JujuAssertionError class TestRemoveDisplayAttributes(TestCase): def test_remove_display_attributes(self): cloud = { 'defined': 'local', 'description': 'Openstack Cloud', ...
agpl-3.0
Python
6c12786f74c17ab8328fed9bfebbb003f2e9f282
Add always true entry
techbureau/zaifbot,techbureau/zaifbot
zaifbot/rules/entry/always_true_entry.py
zaifbot/rules/entry/always_true_entry.py
from zaifbot.rules.entry.base import Entry class AlwaysTrueEntry(Entry): def __init__(self, currency_pair, amount, action, name=None): super().__init__(currency_pair=currency_pair, amount=amount, action=action, name=name) def can_entry(self): return True
mit
Python
93f0f573c40ed7878f744a9fee2b2a9e85157d5e
append elevations to GPX from SRTM dataset with gpxelevations util in SRTM.py package
tumluliu/mmrp-osm-analyzer,tumluliu/mmrp-osm-analyzer,tumluliu/mmrp-osm-analyzer
src/gpx_elev_enhancer.py
src/gpx_elev_enhancer.py
# Append elevations to GPX files # 2015-05-08 # Lu LIU # from os import listdir from os.path import isfile, join import srtm import gpxpy gpx_file_dir = "/Users/user/Research/data/GPX/Munich" gpx_files = [f for f in listdir(gpx_file_dir) if isfile(join(gpx_file_dir, f))] for gpx_file in gpx_files: print "add elev...
mit
Python
98852758b85c2e6c53cc22dc30b5b4418bece6b5
Add transfer paging unit tests
sirosen/globus-sdk-python,globus/globus-sdk-python,globus/globus-sdk-python,globusonline/globus-sdk-python
tests/unit/test_transfer_paging.py
tests/unit/test_transfer_paging.py
import requests import json import six import pytest from globus_sdk.transfer.paging import PaginatedResource from globus_sdk.transfer.response import IterableTransferResponse N = 25 class PagingSimulator(object): def __init__(self, n): self.n = n # the number of simulated items def simulate_get(...
apache-2.0
Python
7e68ec932cb43fc5a98828a367a51593b419bee0
Add batch normalization
spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc
thinc/neural/_classes/batchnorm.py
thinc/neural/_classes/batchnorm.py
from .model import Model class BatchNormalization(Model): def predict_batch(self, X): N, mu, var = _get_moments(self.ops, X) return _forward(self.ops, X, mu, var) def begin_update(self, X, dropout=0.0): N, mu, var = _get_moments(self.ops, X) Xhat = _forward(self.ops, X, mu,...
mit
Python
c99a476b396422c0a673a78eb795df1cf94b8bb5
Define base Frame object.
lawnmowerlatte/hyper,masaori335/hyper,plucury/hyper,irvind/hyper,plucury/hyper,masaori335/hyper,fredthomsen/hyper,Lukasa/hyper,jdecuyper/hyper,Lukasa/hyper,jdecuyper/hyper,fredthomsen/hyper,irvind/hyper,lawnmowerlatte/hyper
hyper/http20/frame.py
hyper/http20/frame.py
# -*- coding: utf-8 -*- """ hyper/http20/frame ~~~~~~~~~~~~~~~~~~ Defines framing logic for HTTP/2.0. Provides both classes to represent framed data and logic for aiding the connection when it comes to reading from the socket. """ class Frame(object): def __init__(self): self.stream = None def seriali...
mit
Python
1696d6b1f240f8403819e3d817ae8e387ab5d08c
Add FFT checkers.
cournape/numscons,cournape/numscons,cournape/numscons
numscons/checkers/fft_checkers.py
numscons/checkers/fft_checkers.py
#! /usr/bin/env python # Last Change: Tue Dec 04 03:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys import os.path from copy import deepcopy from distutils.util import get_platform # from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config # from numpy.dist...
bsd-3-clause
Python
9b0f4062729d70ec5236ec244d5eaca7e4653b47
Test for functions in utils added
CiscoPSIRT/openVulnAPI,CiscoPSIRT/openVulnAPI,CiscoPSIRT/openVulnAPI,CiscoPSIRT/openVulnAPI,CiscoPSIRT/openVulnAPI
openVulnQuery/tests/test_utils.py
openVulnQuery/tests/test_utils.py
import unittest from openVulnQuery import utils from openVulnQuery import advisory mock_advisory_title = "Mock Advisory Title" mock_advisory = advisory.CVRF(advisory_id="Cisco-SA-20111107-CVE-2011-0941", sir="Medium", first_published="2011-11-07T21:36:55+0000...
mit
Python
88e87392204884102b17a92581c5d5b29a258bb7
add ftpsync
openprocurement/openprocurement.search,imaginal/openprocurement.search
openprocurement/search/ftpsync.py
openprocurement/search/ftpsync.py
# -*- coding: utf-8 -*- import os import sys import signal import os.path import logging import logging.config from ftplib import FTP from ConfigParser import ConfigParser logger = logging.getLogger(__name__) class FTPSyncApp(object): config = { 'host': '127.0.0.1', 'port': 21, 'timeout'...
apache-2.0
Python
eb4294f95cb05337ef432840d9538de1275b22b4
Add routes.
laonawuli/addrest,laonawuli/addrest,laonawuli/addrest,laonawuli/addrest,laonawuli/addrest
web2py/routes.py
web2py/routes.py
routes_in = [ ('/', '/addrest/default/index'), ]
mit
Python
e3757b20ca74e070e57dd251bf60f691922999fe
add new test file
dfdeshom/solrcloudpy,relwell/solrcloudpy,relwell/solrcloudpy,dfdeshom/solrcloudpy
test/test_collection.py
test/test_collection.py
import unittest from solr_instance import SolrInstance from solrcloudpy import Connection class TestCollection(unittest.TestCase): def setUp(self): self.solrprocess = SolrInstance("solr2") self.solrprocess.start() self.solrprocess.wait_ready() self.conn = Connection() d...
bsd-3-clause
Python