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
49b3c91ffdbd04fbce523599320820278bb5d8aa
Add data file.
michaelpacer/scipy_proceedings,katyhuff/scipy_proceedings,mikaem/euroscipy_proceedings,euroscipy/euroscipy_proceedings,katyhuff/scipy_proceedings,sbenthall/scipy_proceedings,sbenthall/scipy_proceedings,SepidehAlassi/euroscipy_proceedings,katyhuff/scipy_proceedings,dotsdl/scipy_proceedings,Stewori/euroscipy_proceedings,...
data.py
data.py
# Ignore this file {'paper_abstract': 'An abstract', 'authors': [{'first_names': 'XX', 'surname': 'XXX', 'address': 'XXX', 'country': 'XXX', 'email_address': 'xxx@XXX', 'institution': 'XXX'}], 'title': ''}
bsd-2-clause
Python
885ed1e8e3256352d2fde771bef57997809c3c1e
Remove monthly_billing table from the database
alphagov/notifications-api,alphagov/notifications-api
migrations/versions/0209_remove_monthly_billing_.py
migrations/versions/0209_remove_monthly_billing_.py
""" Revision ID: 0209_remove_monthly_billing Revises: 84c3b6eb16b3 Create Date: 2018-07-27 14:46:30.109811 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision = '0209_remove_monthly_billing' down_revision = '84c3b6eb16b3' def upgrade(): # ### commands auto gen...
mit
Python
324f670e747af0b949bc2c9fb503c875b7f20a7b
Initialize 06.sameName3
JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials
books/AutomateTheBoringStuffWithPython/Chapter03/06.sameName3.py
books/AutomateTheBoringStuffWithPython/Chapter03/06.sameName3.py
# This program demonstrates global and local variable rules def spam(): global eggs eggs = 'spam' # this is the global (global statement) def bacon(): eggs = 'bacon' # this is a local (assignment) def ham(): print(eggs) # this is the global (no assignment) eggs = 42 # this is the global (outsi...
mit
Python
6987558cefb1179c4501ee5f43e39618f67c49c7
Initialize P02_writeCSV
JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials
books/AutomateTheBoringStuffWithPython/Chapter14/P02_writeCSV.py
books/AutomateTheBoringStuffWithPython/Chapter14/P02_writeCSV.py
# This program uses the csv module to manipulate .csv files import csv # Writer Objects outputFile = open("output.csv", "w", newline='') outputWriter = csv.writer(outputFile) print(outputWriter.writerow(['spam', 'eggs', 'bacon', 'ham'])) print(outputWriter.writerow(['Hello, world!', 'eggs', 'bacon', 'ham'])) print(ou...
mit
Python
b8ddb1b64ef2216add5b0b136b09b72d91506767
Add initial msgpack renderer
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/renderers/msgpack.py
salt/renderers/msgpack.py
# -*- coding: utf-8 -*- from __future__ import absolute_import # Import third party libs import msgpack def render(msgpack_data, saltenv='base', sls='', **kws): ''' Accepts JSON as a string or as a file object and runs it through the JSON parser. :rtype: A Python data structure ''' if not is...
apache-2.0
Python
e665e9cb374fd67baec7ec598bfd352e04192210
add gripper class to pick up pieces with electromagnet
joeymeyer/raspberryturk
raspberryturk/embedded/motion/gripper.py
raspberryturk/embedded/motion/gripper.py
import RPi.GPIO as GPIO from time import sleep electromagnet_pin = 40 servo_pin = 38 class Gripper(object): def __init__(self): self.previous_z = None GPIO.setmode(GPIO.BOARD) GPIO.setup(servo_pin, GPIO.OUT) GPIO.setup(electromagnet_pin, GPIO.OUT) def calibrate(self): ...
mit
Python
b790a10de84d0ffb40e9834c7393a8d905d1aab5
Add missing migration
defivelo/db,defivelo/db,defivelo/db
apps/challenge/migrations/0052_auto_20190225_1631.py
apps/challenge/migrations/0052_auto_20190225_1631.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-02-25 15:31 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('challenge', '0051_auto_20...
agpl-3.0
Python
b94e4f369b5881f579ca47e48ae191324c19990e
Add .bmp image encoder
LonamiWebs/Py-Utils
image-generation/bmp.py
image-generation/bmp.py
#!/usr/bin/python3 import struct def encode_bmp(f, width, height, data, bpp=24): # 'bpp' stands for "bits per pixel" (usually 24 for RGB, 8+8+8) # 'data' should be a bi-dimensional array matching 'width' and 'height' # Calculate the BMP data size and the required padding (% 4) bytes_per_row = wi...
mit
Python
59837bda53b958c7fdb50a3b2808a42fd667cd96
Create z07-dnn_autoencoder_iris.py
hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow
skflow-examples/z07-dnn_autoencoder_iris.py
skflow-examples/z07-dnn_autoencoder_iris.py
# Copyright 2015-present The Scikit Flow 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 require...
mit
Python
96eba676abeb8c70dcaddb692133a9314e2255c3
Add harvester for pcom
erinspace/scrapi,felliott/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,mehanig/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,alexgarciac/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi
scrapi/harvesters/pcom.py
scrapi/harvesters/pcom.py
''' Harvester for the DigitalCommons@PCOM for the SHARE project Example API call: http://digitalcommons.pcom.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class PcomHarvester(OAIHarvester): short_name = 'pcom' long_name = ...
apache-2.0
Python
e0b93ff74ee6eeabf29567a13d2e31de11a3b68a
Make migration
mfcovington/djangocms-lab-carousel,mfcovington/djangocms-lab-carousel
cms_lab_carousel/migrations/0003_auto_20150827_0111.py
cms_lab_carousel/migrations/0003_auto_20150827_0111.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import filer.fields.image class Migration(migrations.Migration): dependencies = [ ('cms_lab_publications', '0001_initial'), ('cms_lab_carousel', '0002_auto_20150508_1300'), ] operati...
bsd-3-clause
Python
aefd4009393e5ebf05ea9e485a1723776689ed70
add node and node to container link
echinopsii/net.echinopsii.ariane.community.cli.python3
tests/acceptance/mapping/node_at.py
tests/acceptance/mapping/node_at.py
# Ariane CLI Python 3 # Node acceptance tests # # Copyright (C) 2015 echinopsii # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) an...
agpl-3.0
Python
84ae279c0044e63e00c7d21823c3159e34c73d03
Add a memory test script
HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata
scripts/uvfits_memtest.py
scripts/uvfits_memtest.py
#!/usr/bin/env python2.7 # -*- mode: python; coding: utf-8 -*- from __future__ import print_function, division, absolute_import from memory_profiler import profile import numpy as np from astropy import constants as const from astropy.io import fits from pyuvdata import UVData @profile def read_uvfits(): filena...
bsd-2-clause
Python
6bb1d3939a076d7b7fe799cdac8885a5f67219e3
add ex32
AisakaTiger/Learn-Python-The-Hard-Way,AisakaTiger/Learn-Python-The-Hard-Way
ex32.py
ex32.py
the_count = [1, 2, 3, 4, 5] fruits = ['apples', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] # this first kind of for-loop goes through a list for number in the_count for number in the_count: print "This is count %d" % number #same as above for fruit in fruits: print "A f...
mit
Python
ef21221842ac401bfd083614d879a7b6c19b816a
add song.py: add Song class
hypergravity/hrs,hypergravity/hrs,hypergravity/hrs
song/song.py
song/song.py
# -*- coding: utf-8 -*- """ Author ------ Bo Zhang Email ----- bozhang@nao.cas.cn Created on ---------- - Fri Feb 24 16:00:00 2017 Modifications ------------- - Aims ---- - Song class """ import glob import sys import numpy as np from astropy.io import fits from astropy.table import Table, Column from tqdm imp...
bsd-3-clause
Python
46a71071ed4982b02d0e49818a678dc2744c1b23
Bump version number to 1.0
mitsuhiko/flask,pallets/flask,fkazimierczak/flask,pallets/flask,mitsuhiko/flask,fkazimierczak/flask,drewja/flask,drewja/flask,pallets/flask,drewja/flask,fkazimierczak/flask
flask/__init__.py
flask/__init__.py
# -*- coding: utf-8 -*- """ flask ~~~~~ A microframework based on Werkzeug. It's extensively documented and follows best practice patterns. :copyright: © 2010 by the Pallets team. :license: BSD, see LICENSE for more details. """ __version__ = '1.0' # utilities we import from Werkzeug and Ji...
# -*- coding: utf-8 -*- """ flask ~~~~~ A microframework based on Werkzeug. It's extensively documented and follows best practice patterns. :copyright: © 2010 by the Pallets team. :license: BSD, see LICENSE for more details. """ __version__ = '1.0-dev' # utilities we import from Werkzeug an...
bsd-3-clause
Python
59b1995789ede7da1757f23b5920e627e1d7818d
add maximum product subarray
haandol/algorithm_in_python
interview/amazon/mps.py
interview/amazon/mps.py
class Solution: def maxProduct(self, A): r = A[0] n = len(A) imin = r imax = r for i in xrange(1, n): if A[i] < 0: imax, imin = imin, imax imax = max(A[i], imax * A[i]) imin = min(A[i], imin * A[i]) r = max(r,...
mit
Python
4c9af992891ac5d39be50f9876a807f131a922e4
prepare the organism annotation details
vipints/genomeutils,vipints/genomeutils,vipints/genomeutils
gfftools/gff_db.py
gfftools/gff_db.py
#!/usr/bin/env python """ Fetch the details about the features explained in a GFF type file. Usage: python feature_info.py in.gff Requirements: gfftools : https://github.com/vipints/genomeutils/blob/master/gfftools """ import re import sys import GFFParser def Intron_det(TDB): """ get the intron feature...
bsd-3-clause
Python
a7787c60af7059f3b1a4dc3773da04dfc72631e2
Add tools.ping
giserh/grab,shaunstanislaus/grab,istinspring/grab,alihalabyah/grab,shaunstanislaus/grab,alihalabyah/grab,raybuhr/grab,liorvh/grab,huiyi1990/grab,SpaceAppsXploration/grab,subeax/grab,codevlabs/grab,maurobaraldi/grab,lorien/grab,istinspring/grab,lorien/grab,raybuhr/grab,subeax/grab,maurobaraldi/grab,giserh/grab,pombredan...
grab/tools/ping.py
grab/tools/ping.py
from grab import Grab import logging import os from grab.tools import html from grab.tools.pwork import make_work from grab.tools.encoding import smart_str PING_XML = """<?xml version="1.0"?> <methodCall> <methodName>weblogUpdates.ping</methodName> <params> <param><value>%(name)s</value></param> <p...
mit
Python
f31a735ce54f74e7a38edaeb7c404a2dec8e5584
add script
ashumeow/MeowRTC,ashumeow/MeowRTC,ashumeow/MeowRTC,ashumeow/MeowRTC,ashumeow/MeowRTC,ashumeow/MeowRTC
MeowRTC/cloud/stack/python/scripts/sample-p2p.py
MeowRTC/cloud/stack/python/scripts/sample-p2p.py
import logging import jinja2 import webapp2 import os import random import json from google.appengine.api import channel jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__))) logging.getLogger().setLevel(logging.DEBUG) users = set() def random_string(): str = '' for _...
mit
Python
4c60f8f643fe05b69ca475242d8c46b02697d5d4
Add example for type-checking chain
spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc
examples/howto/type_chain.py
examples/howto/type_chain.py
from thinc.api import chain, ReLu, MaxPool, Softmax, chain # This example should be run with mypy. This is an example of type-level checking # for network validity. # # We first define an invalid network. # It's invalid because MaxPool expects Floats3d as input, while ReLu produces # Floats2d as output. chain has typ...
mit
Python
f6bdab51054b08d203251b0e7e73ed7818613c8d
add models.py file so test runner will recognize the app
byteweaver/django-eca-catalogue
eca_catalogue/text/models.py
eca_catalogue/text/models.py
# Hello test runner
bsd-3-clause
Python
ce792a1b167b268ba1f798b3b08e08679d962d02
Create distributeOnSurface.py
aaronfang/personal_scripts
af_scripts/tmp/distributeOnSurface.py
af_scripts/tmp/distributeOnSurface.py
import random import maya.mel class distributeOnSurface(object): def __init__(self): pass def _UI(self): if cmds.window('dosWin',exists=True): cmds.deleteUI('dosWin',window=True) w=300 w2=180 cmds.window('dosWin',t="Distribute On Surface",s=0,rtf=1...
mit
Python
e484b67372be22dae78a526c21e62661e4602913
Add todo files with incomplete fixes
Vauxoo/autopep8,hhatto/autopep8,vauxoo-dev/autopep8,SG345/autopep8,SG345/autopep8,vauxoo-dev/autopep8,MeteorAdminz/autopep8,hhatto/autopep8,MeteorAdminz/autopep8,Vauxoo/autopep8
test/todo.py
test/todo.py
raise KeyError, key def foo(a , b): pass
mit
Python
c669d498fa81ffb399d7d7c42654f5ac69428a28
Update templates.py
googlefonts/oss-fuzz,kcc/oss-fuzz,skia-dev/oss-fuzz,google/oss-fuzz,google/oss-fuzz,ssbr/oss-fuzz,skia-dev/oss-fuzz,oliverchang/oss-fuzz,robertswiecki/oss-fuzz,googlefonts/oss-fuzz,google/oss-fuzz,googlefonts/oss-fuzz,oliverchang/oss-fuzz,robertswiecki/oss-fuzz,skia-dev/oss-fuzz,robertswiecki/oss-fuzz,kcc/oss-fuzz,kcc/...
infra/templates.py
infra/templates.py
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
apache-2.0
Python
47f7fa72ab3ba75ad4182592f6413702fd509ba7
Create middleware to redirect users when accessing certain paths
praekelt/molo-iogt,praekelt/molo-iogt,praekelt/molo-iogt
iogt/middleware.py
iogt/middleware.py
from django.conf import settings from django.http import HttpResponsePermanentRedirect class SSLRedirectMiddleware(object): def process_request(self, request): HTTPS_PATHS = getattr(settings, 'HTTPS_PATHS', []) response_should_be_secure = self.response_should_be_secure( request, HTTPS_...
bsd-2-clause
Python
eeab27ecc6843136938e7607a619baef8626118a
Make contest_ranking visible
DMOJ/site,Minkov/site,DMOJ/site,monouno/site,Minkov/site,DMOJ/site,Minkov/site,Phoenix1369/site,Minkov/site,Phoenix1369/site,monouno/site,DMOJ/site,Phoenix1369/site,monouno/site,monouno/site,monouno/site,Phoenix1369/site
judge/views/contests.py
judge/views/contests.py
from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponseRedirect, Http404 from django.shortcuts import render_to_response from django.template import RequestContext from judge.comments import comment_form, contest_comments from judge.models import Contest __all__ = ['contest_list', 'c...
from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponseRedirect, Http404 from django.shortcuts import render_to_response from django.template import RequestContext from judge.comments import comment_form, contest_comments from judge.models import Contest __all__ = ['contest_list', 'c...
agpl-3.0
Python
65e4659ccd3f22f817403dc39869626873f9fb34
Add test_runner.py
datamicroscopes/lda,datamicroscopes/lda,datamicroscopes/lda
test/test_runner.py
test/test_runner.py
from microscopes.lda.definition import model_definition from microscopes.lda import model, runner from microscopes.common.rng import rng def test_runner_simple(): defn = model_definition(n=10, v=20) r = rng() data = [[1, 2, 3, 4, 5], [2, 3, 4]] view = data latent = model.initialize(defn=defn, data...
bsd-3-clause
Python
2bd52d823c9ae039dd0cc0adbabe7a47f003138e
Add unit tests
google/flax,google/flax
examples/ppo/unit_tests.py
examples/ppo/unit_tests.py
import jax import flax from flax import nn import numpy as onp import numpy.testing as onp_testing from absl.testing import absltest #test GAE from main import gae_advantages class TestGAE(absltest.TestCase): def test_gae_random(self): # create random data, simulating 4 parallel envs and 20 time_steps envs...
apache-2.0
Python
f6fb9266ec9a2acebae31b042647437e922648d1
Add spinning cube example with texture From Euroscipy tutorial
hronoses/vispy,julienr/vispy,michaelaye/vispy,jdreaver/vispy,kkuunnddaannkk/vispy,ghisvail/vispy,RebeccaWPerry/vispy,jdreaver/vispy,sbtlaarzc/vispy,QuLogic/vispy,Eric89GXL/vispy,sbtlaarzc/vispy,sh4wn/vispy,sh4wn/vispy,hronoses/vispy,bollu/vispy,srinathv/vispy,bollu/vispy,julienr/vispy,QuLogic/vispy,srinathv/vispy,incle...
examples/spinning-cube2.py
examples/spinning-cube2.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Show spinning cube using VBO's, and transforms, and texturing. """ import numpy as np from vispy import app, gl, oogl, io from transforms import perspective, translate, rotate VERT_CODE = """ uniform mat4 u_model; uniform mat4 u_view; uniform mat4 u_projection;...
bsd-3-clause
Python
4c76f9bc68451eb41338173ffbda460098d1e24e
make form reprocessing more error tolerant and verbose
SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,qeds...
corehq/apps/cleanup/management/commands/reprocess_error_forms.py
corehq/apps/cleanup/management/commands/reprocess_error_forms.py
from django.core.management.base import BaseCommand, CommandError, LabelCommand from corehq.apps.cleanup.xforms import iter_problem_forms, reprocess_form_cases from optparse import make_option from dimagi.utils.parsing import string_to_datetime class Command(BaseCommand): args = '<domain> <since>' help = ('Rep...
from django.core.management.base import BaseCommand, CommandError, LabelCommand from corehq.apps.cleanup.xforms import iter_problem_forms, reprocess_form_cases from optparse import make_option from dimagi.utils.parsing import string_to_datetime class Command(BaseCommand): args = '<domain> <since>' help = ('Rep...
bsd-3-clause
Python
d344c91008198927d45cd7a3330915bd9e8fd89f
Add The Fucking Weather module from yano
Uname-a/knife_scraper,Uname-a/knife_scraper,Uname-a/knife_scraper
willie/modules/fuckingweather.py
willie/modules/fuckingweather.py
""" fuckingweather.py - Willie module for The Fucking Weather Copyright 2013 Michael Yanovich Copyright 2013 Edward Powell Licensed under the Eiffel Forum License 2. http://willie.dftba.net """ from willie import web import re def fucking_weather(willie, trigger): text = trigger.group(2) if not text: ...
mit
Python
27c955963bfc640f5e91d103a4aff8e2a897597c
Implement profiling
JayTeeGeezy/jtgpy
jtgpy/profiling.py
jtgpy/profiling.py
from datetime import datetime import logging def log_time(target, message, log_method=None, target_args=None, target_kwargs=None): """Execute target and log the start/elapsed time before and after execution""" logger = logging.info if log_method is not None: logger = log_method start_time = datetime.now() lo...
mit
Python
d9a6ea57ad7bb1d7f3716fe16a49a8a24edceb67
Fix migrations for python3
praekeltfoundation/ndoh-hub,praekeltfoundation/ndoh-hub,praekeltfoundation/ndoh-hub
registrations/migrations/0010_auto_20180212_0802.py
registrations/migrations/0010_auto_20180212_0802.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2018-02-12 08:02 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('registrations', '0009_auto_20171027_0928'), ] operations = [ migrations.Alte...
bsd-3-clause
Python
e3c6ebd09af5292c496e3a69af499d2a507ce7dd
add demo main file
jettify/aiohttp_admin,aio-libs/aiohttp_admin,jettify/aiohttp_admin,jettify/aiohttp_admin,aio-libs/aiohttp_admin,jettify/aiohttp_admin,aio-libs/aiohttp_admin
demos/blog/main.py
demos/blog/main.py
import asyncio import logging import pathlib import yaml import aiopg.sa import aiohttp_jinja2 import jinja2 from aiohttp import web import aiohttp_admin from aiohttp_admin.backends.sa import SAResource import db PROJ_ROOT = pathlib.Path(__file__).parent.parent TEMPLATES_ROOT = pathlib.Path(__file__).parent / 'templ...
apache-2.0
Python
c4ee87fa4398eca3193331888086cb437436722e
Add some tests for hil_client
mghpcc-projects/user_level_slurm_reservations,mghpcc-projects/user_level_slurm_reservations
test/hil_client_test.py
test/hil_client_test.py
""" General info about these tests The tests assusme that the nodes are in the <from_project> which is set to be the "slurm" project, since that is what we are testing here. If all tests pass successfully, then nodes are back in their original state. Class TestHILReserve moves nodes out of the slurm project and into...
mit
Python
ed3ea4c4a03927bc351951aa325958db8103441c
Test CLI
jupe/mbed-ls,jupe/mbed-ls
test/base.py
test/base.py
#!/usr/bin/env python """ mbed SDK Copyright (c) 2011-2015 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable ...
apache-2.0
Python
63b6dca1f3c72e81468a79afde19bb6a84d14791
Add Landscape inventory plugin
thaim/ansible,thaim/ansible
plugins/inventory/landscape.py
plugins/inventory/landscape.py
#!/usr/bin/env python # (c) 2015, Marc Abramowitz <marca@surveymonkey.com> # # This file is part of Ansible. # # Ansible 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 # (...
mit
Python
4f036669d604a902530e00ecc800b9baca6e69d1
Initialize stream getter for current dates games
kshvmdn/nba.js,kshvmdn/nba-scores,kshvmdn/NBAScores
streams.py
streams.py
import praw import collections r = praw.Reddit('Getter for stream links from /r/nbastreams by /u/me')
mit
Python
50383f51794babceb89503d091d520c5c3032db3
add gc testing code
mehdisadeghi/saga-python,telamonian/saga-python,mehdisadeghi/saga-python,telamonian/saga-python,luis-rr/saga-python,luis-rr/saga-python,luis-rr/saga-python
tests/_andre/test_gc.py
tests/_andre/test_gc.py
__author__ = "Andre Merzky" __copyright__ = "Copyright 2012-2013, The SAGA Project" __license__ = "MIT" import gc import sys import saga from pprint import pprint as pp try : if True : js1 = saga.job.Service ('ssh://localhost/bin/sh') print sys.getrefcount (js1) pp (gc.get_referr...
mit
Python
b04e10af3c0ecc3258b476dbe58c758ece888349
add migration file required by new paperclip/mapentity
GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin
geotrek/common/migrations/0002_auto_20170323_1433.py
geotrek/common/migrations/0002_auto_20170323_1433.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import embed_video.fields class Migration(migrations.Migration): dependencies = [ ('common', '0001_initial'), ] operations = [ migrations.AddField( model_name='attachment...
bsd-2-clause
Python
c556ac78efe4b9a9453016dfdf39219852b42676
test app, certain to fail
phndiaye/graphnado,phndiaye/graphnado
tests/app.py
tests/app.py
import tornado.ioloop import tornado.web from graphnado import GraphQLHandler if __name__ == '__main__': application = tornado.web.Application([ (r'/graphql', GraphQLHandler) ]) application.listen(8888) tornado.ioloop.IOLoop.current().start()
mit
Python
15eb41ba9ac22eb2ecc60b82807ca7f333f578b9
Add basic methods for accessing user data
pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality
iatidq/dqusers.py
iatidq/dqusers.py
# IATI Data Quality, tools for Data QA on IATI-formatted publications # by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith # # Copyright (C) 2013 Publish What You Fund # # This programme is free software; you may redistribute and/or modify # it under the terms of the GNU Affero General Public License v3...
agpl-3.0
Python
8c287ca7b3f184c692356c81a93007936a7a5b01
fix import torngas but not found tornado
bukun/torngas,mqingyn/torngas,bukun/torngas,mqingyn/torngas
torngas/__init__.py
torngas/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'mqingyn' __version__ = '1.8.2' version = tuple(map(int, __version__.split('.'))) try: from settings_manager import settings from webserver import Server, run from exception import ConfigError, ArgumentError from urlhelper import Url, route, in...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'mqingyn' __version__ = '1.8.1' version = tuple(map(int, __version__.split('.'))) from settings_manager import settings from webserver import Server, run from exception import ConfigError, ArgumentError from urlhelper import Url, route, include from utils imp...
bsd-3-clause
Python
19b588e4ac9811879fba7e98943cf5925a774a00
add migration 102bbf265d4
voltaire/website
migrations/versions/102bbf265d4_.py
migrations/versions/102bbf265d4_.py
"""empty message Revision ID: 102bbf265d4 Revises: 3d1138bbc68 Create Date: 2015-06-12 01:35:12.398937 """ # revision identifiers, used by Alembic. revision = '102bbf265d4' down_revision = '3d1138bbc68' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - plea...
mit
Python
dd25e263b099b86e7b9538e474ad875798514be5
Add StorageDevice class
onitake/Uranium,onitake/Uranium
Cura/StorageDevice.py
Cura/StorageDevice.py
## Encapsulates a number of different ways of storing file data. # class StorageDevice(object): def __init__(self): super(StorageDevice, self).__init__() self._properties = {} ## Open a file so it can be read from or written to. # \param file_name The name of the file to open. Can be ...
agpl-3.0
Python
a4a54ee5c86a09b5f01efe57b013fdc25648d326
Add morango full facility sync management command.
benjaoming/kolibri,indirectlylit/kolibri,lyw07/kolibri,christianmemije/kolibri,lyw07/kolibri,DXCanas/kolibri,indirectlylit/kolibri,jonboiser/kolibri,lyw07/kolibri,learningequality/kolibri,DXCanas/kolibri,DXCanas/kolibri,jonboiser/kolibri,indirectlylit/kolibri,mrpau/kolibri,christianmemije/kolibri,benjaoming/kolibri,DXC...
kolibri/auth/management/commands/fullfacilitysync.py
kolibri/auth/management/commands/fullfacilitysync.py
from django.utils.six.moves import input from kolibri.auth.models import FacilityUser from kolibri.core.device.utils import device_provisioned from kolibri.core.device.models import DevicePermissions, DeviceSettings from kolibri.tasks.management.commands.base import AsyncCommand from morango.controller import MorangoPr...
mit
Python
0543bfa278e1bb2a8eb37bc0c8f065ddde2ed21f
Add object doubling as lxml Element and string #274
monouno/site,monouno/site,Minkov/site,Minkov/site,Minkov/site,DMOJ/site,DMOJ/site,monouno/site,Phoenix1369/site,Phoenix1369/site,monouno/site,Phoenix1369/site,DMOJ/site,Minkov/site,monouno/site,DMOJ/site,Phoenix1369/site
judge/lxml_tree.py
judge/lxml_tree.py
from lxml import html class HTMLTreeString(object): def __init__(self, str): self.tree = html.fromstring(str) def __getattr__(self, attr): return getattr(self.tree, attr) def __unicode__(self): return html.tostring(self.tree)
agpl-3.0
Python
1d5f23bf090e4a6d51beb310b5ecf4048afcc347
add debug runner
missionpinball/mpf,missionpinball/mpf
tools/debug_run_game.py
tools/debug_run_game.py
import logging import sys from mpf.core.config_loader import YamlMultifileConfigLoader from mpf.core.machine import MachineController machine_path = sys.argv[1] config_loader = YamlMultifileConfigLoader(machine_path, ["config.yaml"], False, False) config = config_loader.load_mpf_config() options = { 'force_plat...
mit
Python
5468beaaf18ea8ac1b955b25bcea0aea1c650af0
Add test for linear model
spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc
thinc/tests/linear/test_linear.py
thinc/tests/linear/test_linear.py
from __future__ import division import numpy import pytest import pickle import io from ...linear.linear import LinearModel from ...neural.optimizers import SGD from ...neural.ops import NumpyOps from ...neural.util import to_categorical @pytest.fixture def instances(): lengths = numpy.asarray([5,4], dtype='int...
mit
Python
d4a5feaaddb88b79809646b7ddab36d29ebf0830
Create swig.py
vadimkantorov/wigwam
wigs/swig.py
wigs/swig.py
class swig(Wig): tarball_uri = 'https://github.com/swig/swig/archive/rel-$RELEASE_VERSION$.tar.gz' last_release_version = 'v3.0.10' git_uri = 'https://github.com/swig/swig'
mit
Python
956aff18c4791e0fda10b8e0a1103f3a0d53e4f1
Add simple performance test suite
df3n5/redact-py,df3n5/redact
tests/perf/perf.py
tests/perf/perf.py
import redact class Prisoner(redact.BaseModel): def __init__(self, key, name=None, password=None): super(Prisoner, self).__init__(key) self.name = redact.KeyValueField('n', name) self.password = redact.KeyValueField('p', password) i = 0 def save_model(): global i prisoner = Pris...
mit
Python
68c664117612b15dab5add78e7b5614daf1c2c18
Add missing __init__.py
elopezga/ErrorRate,dracorpg/python-ivi,getzze/python-ivi,sephalon/python-ivi,alexforencich/python-ivi,dracorpg/python-ivi,Diti24/python-ivi,margguo/python-ivi,python-ivi/python-ivi,adrianschlatter/python-ivi
ivi/agilent/test/__init__.py
ivi/agilent/test/__init__.py
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2014 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the righ...
mit
Python
4f1b7b2a29fcb8802fbdee6ce832d9c5fb4a6f89
add jobq tests
kalessin/python-hubstorage,scrapinghub/python-hubstorage,torymur/python-hubstorage
tests/test_jobq.py
tests/test_jobq.py
""" Test JobQ """ from hstestcase import HSTestCase class ActivityTest(HSTestCase): def setUp(self): super(ActivityTest, self).setUp() self.jobq = self.hsclient.get_jobq(self.projectid) def test_basic(self): #authpos(JOBQ_PUSH_URL, data="", expect=400) spider1 = self.jobq.pus...
bsd-3-clause
Python
ff698bf20eb400f9e6f6cadb3e809fcb684bdcc9
Add simple main test
kingarmery/gnurr
tests/test_main.py
tests/test_main.py
from unittest import TestCase from src.main.main import main class TestMain(TestCase): def test_read_commands(self): s0 = main([]) s1 = main(["one"]) s2 = main(["one", "-2"]) self.assertTrue(0 == 0, "Testing if 0 equals 0.") self.assertFalse(0 == 1, "Testing if 0 doesn't e...
mit
Python
a22f713ff4a366c0f05ffd6a7e513bc8fda7aa26
add a maxcall test
joshspeagle/dynesty
tests/test_misc.py
tests/test_misc.py
import numpy as np import dynesty """ Run a series of basic tests of the 2d eggbox """ # seed the random number generator np.random.seed(56432) nlive = 100 def loglike(x): return -0.5 * np.sum(x**2) def prior_transform(x): return (2 * x - 1) * 10 def test_maxcall(): # hard test of dynamic sampler wi...
mit
Python
0ce616d3c787060c6d1bfeacb0a53c5085494927
Create tutorial2.py
tiggerntatie/empty-app
tutorial2.py
tutorial2.py
placeholder
mit
Python
287cd795c92a86ee16a623230d0c59732a2f767d
Add demo on how to write unstructured point meshes in Vtk.
inducer/pyvisfile,inducer/pyvisfile,inducer/pyvisfile
examples/vtk-unstructured-points.py
examples/vtk-unstructured-points.py
import numpy as np from pyvisfile.vtk import ( UnstructuredGrid, DataArray, AppendedDataXMLGenerator, VTK_VERTEX, VF_LIST_OF_VECTORS, VF_LIST_OF_COMPONENTS) n = 5000 points = np.random.randn(n, 3) data = [ ("p", np.random.randn(n)), ("vel", np.random.randn(3, n)), ] file_name = "points.vt...
mit
Python
11111351f67afd3dc8ee2ec904a9cea595d68fb3
Add script to calculate perplexity results
NLeSC/cptm,NLeSC/cptm
DilipadTopicModelling/experiment_calculate_perplexity.py
DilipadTopicModelling/experiment_calculate_perplexity.py
import pandas as pd import logging from CPTCorpus import CPTCorpus from CPT_Gibbs import GibbsSampler logger = logging.getLogger(__name__) logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO) # load corpus data_dir = '/home/jvdzwaan/data/tmp/generated/test_exp/' corpus = CPTCorpus.load('{}c...
apache-2.0
Python
2ed913c0add7740b9c8eb6ee8320b6924907e48f
Create q5.py
pollseed/python_script_lib,pollseed/script_lib,pollseed/script_lib,pollseed/script_lib,pollseed/script_lib,pollseed/python_script_lib,pollseed/python_script_lib,pollseed/python_script_lib,pollseed/python_script_lib,pollseed/script_lib,pollseed/script_lib,pollseed/python_script_lib
work/q5.py
work/q5.py
import itertools def max_array(): return [x for x in range(0, 10)] def compute(): return ['+', '-', ''] def sum(arr): for i in itertools.product(compute(), repeat=10): result = ''.join(map(str, union(max_array(), i))) if result[len(result) - 1] in compute(): result = result[:le...
mit
Python
240274ea82db24dca578692a609a262497107ccc
Prepare for interview questions
noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit
decorator_examples.py
decorator_examples.py
def identity_decorator(fn): def wrapper(*args): return fn(*args) return wrapper @identity_decorator def stringify(obj): return str(obj) print(stringify(78)) def uppercase(fn): def wrapper(*args): result = fn(*args) return result.upper() return wrapper @uppercase def s...
mit
Python
caf8ab5d11d63a3850c5ad4f87e7334422014c88
Break out HLS fetcher to module
OakNinja/svtplay-dl,OakNinja/svtplay-dl,selepo/svtplay-dl,spaam/svtplay-dl,leakim/svtplay-dl,OakNinja/svtplay-dl,leakim/svtplay-dl,olof/svtplay-dl,selepo/svtplay-dl,olof/svtplay-dl,qnorsten/svtplay-dl,dalgr/svtplay-dl,leakim/svtplay-dl,qnorsten/svtplay-dl,iwconfig/svtplay-dl,spaam/svtplay-dl,iwconfig/svtplay-dl,dalgr/s...
lib/svtplay/hls.py
lib/svtplay/hls.py
import sys import os import re import time from datetime import timedelta from svtplay.utils import get_http_data, select_quality from svtplay.output import progressbar, progress_stream from svtplay.log import log if sys.version_info > (3, 0): from io import BytesIO as StringIO else: from StringIO import Stri...
mit
Python
cd85c85b492de74a5dd049e610efeb85e2222326
Create FoundationPlist.py
aysiu/OldMunkiPackages
FoundationPlist/FoundationPlist.py
FoundationPlist/FoundationPlist.py
#!/usr/bin/python # encoding: utf-8 # # Copyright 2009-2014 Greg Neagle. # # 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 require...
apache-2.0
Python
71a55a1252ef87629f10e48c1041416c34742ea7
Add input handling for ssh connections
halfbro/juliet
modules/juliet_input.py
modules/juliet_input.py
from threading import Thread class Juliet_Input (Thread): def __init(self): Thread.__init(self) def run(self): while True: char = raw_input() if char == 'q': break
bsd-2-clause
Python
02887eb26b1c95abf6e26f30228c524d61335e40
Add download_protected_file view
rtrembecky/roots,tbabej/roots,rtrembecky/roots,tbabej/roots,matus-stehlik/glowing-batman,matus-stehlik/glowing-batman,matus-stehlik/roots,matus-stehlik/roots,matus-stehlik/roots,tbabej/roots,rtrembecky/roots
downloads/views.py
downloads/views.py
from sendfile import sendfile from django.conf import settings from django.core.exceptions import PermissionDenied def download_protected_file(request, model_class, path_prefix, path): """ This view allows download of the file at the specified path, if the user is allowed to. This is checked by calling th...
mit
Python
0115d088061595fe6c6f8589d0599d1b8e970813
Add dummy Keras inputs builder
lwtnn/lwtnn,jwsmithers/lwtnn,jwsmithers/lwtnn,jwsmithers/lwtnn,lwtnn/lwtnn,lwtnn/lwtnn
scripts/lwtnn-build-dummy-inputs.py
scripts/lwtnn-build-dummy-inputs.py
#!/usr/bin/env python3 """Generate fake NN files to test the lightweight classes""" import argparse import json import h5py import numpy as np def _run(): args = _get_args() _build_keras_arch("arch.json") _build_keras_inputs_file("inputs.json") _build_keras_weights("weights.h5", verbose=args.verbose)...
mit
Python
fdcfd4fbd2f94e646ba3716c20f7518c28e5a0c5
Add files via upload
pjtatlow/geneysis,pjtatlow/geneysis,pjtatlow/geneysis,pjtatlow/geneysis
python/GenBankParser.py
python/GenBankParser.py
from sys import argv from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from Bio.Alphabet import IUPAC from Bio.SeqFeature import FeatureLocation, SeqFeature import random startCodons = ["ATG", "GTG", "TTG"] revStartCodons = ["CAT", "CAC", "CAA"] def randShiftForward(seqLoc, genomeSeq):...
mit
Python
ad1defca2f4d16cc5e13c579c945858b9f77c450
Rename script
davidgasquez/kaggle-airbnb
snippets/clean_users_data_frames.py
snippets/clean_users_data_frames.py
import pandas as pd train_users = pd.read_csv('../datasets/processed/processed_train_users.csv') test_users = pd.read_csv('../datasets/processed/processed_test_users.csv') percentage = 0.95 train_mask = train_users.isnull().sum() > train_users.shape[0] * percentage train_to_remove = list(train_users.isnull().sum()[t...
mit
Python
874323b53790ee2121b82bd57b9941d4562995d0
Add reddit downvoting script
voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts
reddit-downvoter.py
reddit-downvoter.py
#!/usr/bin/env python import praw import time settings = { 'username': 'username', 'password': 'password', 'user_agent': 'angry /r/politics robot', 'subreddit': 'politics', } r = praw.Reddit(user_agent=settings['user_agent']) r.login(settings['username'], settings['password']) submissions = r.get_s...
mit
Python
d7b7056b483d52e4d94321019f8e520c166511be
Add singleton decorator.
bueda/django-comrade
comrade/core/decorators.py
comrade/core/decorators.py
def singleton(cls): instances = {} def getinstance(): if cls not in instances: instances[cls] = cls() return instances[cls] return getinstance
mit
Python
4bcc8ddb7df762155402cb1229f16849c03666c1
Check DB consistence
Billy4195/electronic-blackboard,chenyang14/electronic-blackboard,SWLBot/electronic-blackboard,Billy4195/electronic-blackboard,stvreumi/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,chenyang14/electronic-blackboard,Billy4195/electronic-blackboard,stvreumi/electronic-blackboard,Billy41...
DB_consist.py
DB_consist.py
from mysql import mysql from env_init import create_data_type import os def create_user_data_file(): print("check user_data dir and file...") try: if not os.path.exists("static/user_data"): print('create dir "static/user_data"') os.makedirs('static/user_data') if not os....
apache-2.0
Python
cb98b4a1580e4976de375722012483bf51ef9254
Add interactive script to get papers from Mendeley API
isb-cgc/ISB-CGC-Webapp,isb-cgc/ISB-CGC-Webapp,isb-cgc/ISB-CGC-Webapp,isb-cgc/ISB-CGC-Webapp
scripts/get_mendeley_papers.py
scripts/get_mendeley_papers.py
### # Copyright 2015-2020, Institute for Systems Biology # # 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 la...
apache-2.0
Python
8ab0a37794cd131d4baef5f6ceecffc568947505
Create FocusStack.py
cmcguinness/focusstack
FocusStack.py
FocusStack.py
""" Simple Focus Stacker Author: Charles McGuinness (charles@mcguinness.us) Copyright: Copyright 2015 Charles McGuinness License: Apache License 2.0 This code will take a series of images and merge them so that each pixel is taken from the image with the sharpest focus at that location. The log...
apache-2.0
Python
731bc1308e94cdb341511618ba5739f6fd37b0b7
Add a base regressions package
jhumphry/regressions
regressions/__init__.py
regressions/__init__.py
# regressions """A package which implements various forms of regression.""" import numpy as np try: import scipy.linalg as linalg linalg_source = 'scipy' except ImportError: import numpy.linalg as linalg linalg_source = 'numpy' class ParameterError(Exception): """Parameters passed to a regression...
isc
Python
2cdece43768e6bf9613020ae71785f9f158fd72d
Add lc0443_string_compression.py
bowen0701/algorithms_data_structures
lc0443_string_compression.py
lc0443_string_compression.py
"""Leetcode 443. String Compression Easy URL: https://leetcode.com/problems/string-compression/ Given an array of characters, compress it in-place. The length after compression must always be smaller than or equal to the original array. Every element of the array should be a character (not int) of length 1. After ...
bsd-2-clause
Python
e88ef8f047fc1c6d005f78a40da864a575c1cbe7
Add tests from `index_brief`
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
tests/test_brief_utils.py
tests/test_brief_utils.py
import mock from app.brief_utils import index_brief from app.models import Brief, Framework from tests.bases import BaseApplicationTest @mock.patch('app.brief_utils.index_object', autospec=True) class TestIndexBriefs(BaseApplicationTest): def test_live_dos_2_brief_is_indexed(self, index_object, live_dos2_framewor...
mit
Python
b9593297bef14fba20a0eaa4ce384c76447aa3ce
Add tests for deepgetattr
lumapps/lumbda,lumapps/lumbda
tests/test_deepgetattr.py
tests/test_deepgetattr.py
from lumbda.collection import deepgetattr class MyClass(object): def __init__(self, **kwargs): for key, value in kwargs.iteritems(): setattr(self, key, value) def test_object_hasattr(): """ Test that the looked for attribute is found when present """ my_object = MyClass(attri...
mit
Python
7abd4c3893e8c1ced664315ee561ae19d3b04191
Add test_mods_import.py
nansencenter/DAPPER,nansencenter/DAPPER
tests/test_mods_import.py
tests/test_mods_import.py
import pytest import os from pathlib import Path from importlib import import_module HMMs = [] for root, dir, files in os.walk("."): if "mods" in root: for f in files: if f.endswith(".py"): filepath = Path(root) / f lines = "".join(open(filepath).readlines()) ...
mit
Python
c6c87e1aafa6b8a4f7929c491398574921417bd4
Add initial framerate webcam test structure
daveol/Fedora-Test-Laptop,daveol/Fedora-Test-Laptop
tests/webcam_framerate.py
tests/webcam_framerate.py
#!/usr/bin/env python import qrtools, gi, os gi.require_version('Gtk', '3.0') gi.require_version('Gst', '1.0') from gi.repository import Gtk, Gst from avocado import Test from utils import webcam class WebcamReadQR(Test): """ Uses the camera selected by v4l2src by default (/dev/video0) to get the framerat...
mit
Python
764f819d5288abcece33c75934bbaa43bf29e055
Add merge migration
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
corehq/apps/users/migrations/0017_merge_20200608_1401.py
corehq/apps/users/migrations/0017_merge_20200608_1401.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-06-08 14:01 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('users', '0016_webappspermissions'), ('users', '0016_hqapikey'), ] operations = [ ...
bsd-3-clause
Python
278bfd665c2537587b7743783e1da17772a4b1d9
Implement q:lines
ElementalAlchemist/txircd,Heufneutje/txircd
txircd/modules/core/bans_qline.py
txircd/modules/core/bans_qline.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from txircd.modules.xlinebase import XLineBase from txircd.utils import durationToSeconds, ircLower, now from zope.interface import implements from fnmatch import fnm...
bsd-3-clause
Python
0d67251672b6bfd818e6c1f9391f77a35fce9e0e
Create words2vec.py
Lopsy/word2vec-stream
words2vec.py
words2vec.py
""" V is an object behaving like a function. V("rabbit") is the 300-element vector for rabbit. You can also query whether strings are in the word2vec database: > "rabbit" in V (V also kind of behaves like a dict -- V[word] returns the word's location in the big file -- but ignore that.) nd is the normalized...
mit
Python
b522fed0a1ca2570b8652ddb64b8c847d5964d11
Add a script to generate all known codes and their decoding
baruch/lsi_decode_loginfo
list_all_codes.py
list_all_codes.py
#!/usr/bin/env python import lsi_decode_loginfo as loginfo def generate_values(data): title = data[0] mask = data[1] sub = data[2] for key in sub.keys(): v = sub[key] key_name = v[0] key_sub = v[1] key_detail = v[2] if key_sub is None: yield [(title...
mit
Python
a86150c016fd88da9849c8abe58e7a3cf9233521
Add sleepytime plugin
tomleese/smartbot,Muzer/smartbot,Cyanogenoid/smartbot,thomasleese/smartbot-old
smartbot/plugins/sleepytime.py
smartbot/plugins/sleepytime.py
from datetime import datetime, timedelta import smartbot.plugin class Plugin(smartbot.plugin.Plugin): """Check when you should wake up.""" names = ['sleepytime', 'sleepyti.me'] @staticmethod def calculate_wake_up_times(now=None, time_to_sleep=14, sleep_cycle_duration...
mit
Python
86ea6884d381f9153d088c634f5353537b967403
solve 1 problem
Shuailong/Leetcode
solutions/binary-tree-paths.py
solutions/binary-tree-paths.py
#!/usr/bin/env python # encoding: utf-8 """ binary-tree-paths.py Created by Shuailong on 2016-03-04. https://leetcode.com/problems/binary-tree-paths/. """ from collections import deque # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = ...
mit
Python
4f4ea5b8c76f35e70368fef0e932f1630788a64a
read json data from file and parse out the good stuff
levisimons/CRASHLACMA,levisimons/CRASHLACMA
parse_info_from_json.py
parse_info_from_json.py
import json from pprint import pprint import re json_data=open('crashlacma.20140524-102001.json') data = json.load(json_data) # TODO: handle test cases # testcases: # hollywood & vine, hollywood and vine # order of operations: hashtag, img, address, other text. # hashtag allcaps or lowercase # uploaded image, link t...
cc0-1.0
Python
510adb95228852456e7a8074aee10d6d1dad167a
add metadata class for handling guppy geometry attributes
fortyninemaps/karta,fortyninemaps/karta,fortyninemaps/karta
vector/metadata.py
vector/metadata.py
""" Metadata management """ # Metadata objects should # - maintain internal consistency # - be concatenable # - be iterable import copy class GeoMetadata(object): """ Class for handling collections of metadata """ _dict = {} _fieldtypes = [] def __init__(self, data): """ Create a colle...
mit
Python
fb1d3cd2898a37049ac5be11462bdb54727065e6
Test auditlog auth.
inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,PyBossa/pybossa,stefanhahmann/pybossa,jean/pybossa,stefanhahmann/pybossa,Scifabric/pybossa,Scifabric/pybossa,OpenNewsLabs/pybossa,geotagx/pybossa,inteligencia-coletiva-lsd/pybossa,jean/pybossa,geotagx/pybossa,PyBossa/pybossa
test/test_authorization/test_auditlog_auth.py
test/test_authorization/test_auditlog_auth.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2014 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
agpl-3.0
Python
093a029ae8607f15b9b446f54293e15f13d44c0e
Create led.py
CMDann/learning-banana-pi,CMDann/learning-banana-pi,CMDann/learning-banana-pi,CMDann/learning-banana-pi
Python/led.py
Python/led.py
import RPi.GPIO as GPIO import time # blinking function def blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(1) GPIO.output(pin,GPIO.LOW) time.sleep(1) return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GPIO.setup(21, GPIO.OUT...
apache-2.0
Python
38452a8a2f95852f8ab7f0910ff875a5b894c2c9
add shell_builder.py
wez/watchman,wez/watchman,facebook/watchman,facebook/watchman,wez/watchman,wez/watchman,facebook/watchman,wez/watchman,nodakai/watchman,nodakai/watchman,facebook/watchman,facebook/watchman,wez/watchman,nodakai/watchman,nodakai/watchman,nodakai/watchman,facebook/watchman,wez/watchman,nodakai/watchman,nodakai/watchman,we...
build/fbcode_builder/shell_builder.py
build/fbcode_builder/shell_builder.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals ''' shell_builder.py allows running the fbcode_builder logic on the host rather than in a container. It emits a bash script with set -exo pipefail ...
mit
Python
30bc00ce84355cc40e62b1f46d32a17c6b07ac0c
Create GreenHat.py
SangramChavan/Ubuntu-16.04-new-installation,SangramChavan/Scripts,SangramChavan/Scripts,SangramChavan/Ubuntu-16.04-new-installation
GreenHat.py
GreenHat.py
# Copyright (c) 2015 Angus H. (4148) # Distributed under the GNU General Public License v3.0 (GPLv3). from datetime import date, timedelta from random import randint from time import sleep import sys import subprocess import os # returns a date string for the date that is N days before STARTDATE def get_date_string(n...
mit
Python
985f23ee5e107c647d5f5e5b245c3fb7ff2d411b
Write script to convert PMF-based result to expected value
kemskems/otdet
bin/to_expected.py
bin/to_expected.py
#!/usr/bin/env python import argparse import numpy as np import pandas as pd if __name__ == '__main__': parser = argparse.ArgumentParser(description='Convert result from PMF' ' to expected value') parser.add_argument('file', type=str, help='Result...
mit
Python
3f6ec1a3e9bcdd2dee714e74fac7215b19ae432f
Add an example of a blocking tcp server
facundovictor/non-blocking-socket-samples
blocking_socket.py
blocking_socket.py
""" A Simple example for testing the SimpleServer Class. A simple telnet server. It is for studying purposes only. """ from server import SimpleServer __author__ = "Facundo Victor" __license__ = "MIT" __email__ = "facundovt@gmail.com" def handle_message(sockets=None): """ Handle a simple TCP connection. ...
mit
Python
22fd64e88700fb8cb0c86eef10df1ae0c5fb91c9
Create parse_large_file.py
WanghongLin/miscellaneous,WanghongLin/miscellaneous
tools/parse_large_file.py
tools/parse_large_file.py
#!/usr/bin/evn python # -*- encoding: utf-8 -*- # # Simple example for processing large file in multiple threads line by line # # Copyright 2019 Wanghong Lin # # 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...
apache-2.0
Python
3a11d1c5235fcc7f40aca4395a183d7e1316117a
Add documentation support for swagger
faith0811/makiki,faith0811/makiki
makiki/documentation.py
makiki/documentation.py
# -*- coding: utf-8 -*- import json class Documentation(object): HUG_TYPE_TRANSLATION = { 'A Whole number': 'integer', 'Accepts a JSON formatted data structure': 'object', 'Basic text / string value': 'string', 'Multiple Values': 'array', } def __init__(self, hug_doc, ve...
mit
Python
591e9f15a3b9da59f80f81fcf0d6ddad4aeb7d6a
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/pyside/pyside6/widget_QSqlRelationalTableModel_sqlite_from_file.py
python/pyside/pyside6/widget_QSqlRelationalTableModel_sqlite_from_file.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Ref: https://doc.qt.io/qtforpython/PySide6/QtSql/QSqlRelationalTableModel.html?highlight=qsqlrelationaltablemodel import sys import sqlite3 from PySide6 import QtCore, QtWidgets from PySide6.QtCore import Qt from PySide6.QtWidgets import QApplication, QTableView from ...
mit
Python
99ffed2a53c5266f312127b7a09f86254891234e
Create 4-LDR.py
CamJam-EduKit/EduKit2
Code/4-LDR.py
Code/4-LDR.py
# Import Libraries import time import RPi.GPIO as GPIO # Set the GPIO Mode and set the pin to use for the GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) # A variable with the LDR reading pin number PINLDR = 27 def ReadLDR(): LDRCount = 0 # Sets the count to 0 GPIO.setup(PINLDR, GPIO.OUT) GPIO.output(PI...
mit
Python
0c4095d9b370da41f653927dc92cc4233aca2beb
Add untested LedStrip driver
lbuchy/marvin_door,lbuchy/marvin_door
LedStrip.py
LedStrip.py
import RPi.GPIO as GPIO, time, os class RGB: r = 0xff g = 0xff b = 0xff def __init__(self, r, g, b): self.r = r self.g = g self.b = b class LedStrip: spidev = None height = 10 def __init__(self): self.spidev = file("/dev/spidev0.0", "w") def WriteStri...
apache-2.0
Python
35e8133dbf0f95a511c2eb219ba408af464afc2b
Create file
QuantifyingUncertainty/GMHConfigure,QuantifyingUncertainty/GMHConfigure
jupyter_notebook_config_template.py
jupyter_notebook_config_template.py
c.NotebookApp.ip = '*' c.NotebookApp.port = 8998 c.NotebookApp.open_browser = False c.NotebookApp.keyfile = u'/home/ubuntu/.certificates/jupyterkey.pem' c.NotebookApp.certfile = u'/home/ubuntu/.certificates/jupytercert.pem' c.NotebookApp.password = u'sha2:PASSWORDHASH'
mit
Python
2d66bc24c883f135a9a22cd40a8b2682ec572373
Add count_bits
muddyfish/PYKE,muddyfish/PYKE
node/count_bits.py
node/count_bits.py
from nodes import Node class CountBits(Node): char = "./" args = 2 results = 1 contents = 2000 @Node.test_func([8,2], [[1, 3]]) @Node.test_func([12, 3], [[0, 2, 1]]) def count_bits(self, num: int, base: int): """Count the number of times each digit occurs in `base`""" ...
mit
Python