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 |
|---|---|---|---|---|---|---|---|---|
3f43a5358bb58269846e21207bd570046b6aa711 | Create main_queue_thread.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | gateway/src/main_queue_thread.py | gateway/src/main_queue_thread.py | #!/usr/bin/env python
import threading, time
import queue
q = queue.Queue()
def Producer():
n = 0
while n < 1000:
n += 1
q.put(n)
# print('Producer has created %s' % n)
# time.sleep(0.1)
def Consumer():
count = 0
while count < 1000:
count += 1
data = q.get()
# print('Consumer has used ... | mit | Python | |
2b2ff2a528f6effd219bd13cd754c33b55e82e61 | add __init__.py, initialized bootstrap extension | michaelgichia/Twezana,michaelgichia/Twezana | app/__init__.py | app/__init__.py | from flask import Flask
from flask.ext.bootstrap import Bootstrap
from config import config
bootstrap = Bootstrap()
moment = Moment()
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
bootstrap.init_app(app)
moment.init_app(app)
... | mit | Python | |
387b5732c0b2231580ae04bf5088ef7ce59b0d84 | Add script to normalize the spelling in a dataset | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | normalize_dataset.py | normalize_dataset.py | """Create multilabel data set with normalized spelling.
The input consists of a directory of text files containing the dataset in
historic spelling.
The data set consists of:
<sentence id>\t<sentence>\tEmotie_Liefde (embodied emotions labels separated by
_)
<sentence id>\t<sentence>\tNone ('None' if no words were tagg... | apache-2.0 | Python | |
dee535c8566d0e542891ed10939eec6448483a6f | read in cenque galaxy catalog | changhoonhahn/centralMS,changhoonhahn/centralMS | code/centralms.py | code/centralms.py | '''
'''
import h5py
import numpy as np
# --- local ---
import util as UT
class CentralMS(object):
def __init__(self, cenque='default'):
''' This object reads in the star-forming and quenching
galaxies generated from the CenQue project and is an object
for those galaxies. Unlike CenQu... | mit | Python | |
65e689dd66124fcaa0ce8ab9f5029b727fba18e2 | Add solution for compare version numbers | chancyWu/leetcode | src/compare_version_numbers.py | src/compare_version_numbers.py | """
Source : https://oj.leetcode.com/problems/compare-version-numbers/
Author : Changxi Wu
Date : 2015-01-23
Compare two version numbers version1 and version2.
if version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and contain on... | mit | Python | |
0da01e405849da1d5876ec5a758c378aaf70fab2 | add the canary | carlini/cleverhans,cleverhans-lab/cleverhans,openai/cleverhans,cleverhans-lab/cleverhans,cleverhans-lab/cleverhans,carlini/cleverhans | cleverhans/canary.py | cleverhans/canary.py | import numpy as np
import tensorflow as tf
from cleverhans.utils_tf import infer_devices
def run_canary():
"""
Runs some code that will crash if the GPUs / GPU driver are suffering from
a common bug. This helps to prevent contaminating results in the rest of
the library with incorrect calculations.
"""
# ... | mit | Python | |
c370edc980a34264f61e27d0dd288a7d6adf2d7e | Create consumer.py | kyanyoga/iot_kafka_datagen | bin/consumer.py | bin/consumer.py | # Consumer example to show the producer works: J.Oxenberg
from kafka import KafkaConsumer
consumer = KafkaConsumer(b'test',bootstrap_servers="172.17.136.43")
#wait for messages
for message in consumer:
print(message)
| mit | Python | |
70b312bde16a8c4fca47e4782f2293f0b96f9751 | Add test_datagen2.py | aidiary/keras_examples,aidiary/keras_examples | cnn/test_datagen2.py | cnn/test_datagen2.py | import os
import shutil
import numpy as np
from scipy.misc import toimage
import matplotlib.pyplot as plt
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
def draw(X, filename):
plt.figure()
pos = 1
for i in range(X.shape[0]):
plt.subplot(4, 4, pos)
... | mit | Python | |
2dd5afae12dc7d58c3349f2df2694eeb77ca0298 | Test driving robot via serial input | ctn-waterloo/nengo_pushbot,ctn-waterloo/nengo_pushbot | examples/test_spinn_tracks4.py | examples/test_spinn_tracks4.py | import nengo
import nengo_pushbot
import numpy as np
model = nengo.Network()
with model:
input = nengo.Node(lambda t: [0.5*np.sin(t), 0.5*np.cos(t)])
a = nengo.Ensemble(nengo.LIF(100), dimensions=2)
#b = nengo.Ensemble(nengo.LIF(100), dimensions=2)
#c = nengo.Ensemble(nengo.LIF(100), dimensions=2)
... | mit | Python | |
f1826205782eb56ba6b478c70e671acae6872d35 | Read similarity graph | charanpald/APGL | exp/influence2/GraphReader2.py | exp/influence2/GraphReader2.py | try:
ctypes.cdll.LoadLibrary("/usr/local/lib/libigraph.so")
except:
pass
import igraph
import numpy
from apgl.util.PathDefaults import PathDefaults
import logging
class GraphReader2(object):
"""
A class to read the similarity graph generated from the Arnetminer dataset
"""
def __init_... | bsd-3-clause | Python | |
e598608f21e30aeeec1ea9a8f452047a270fdc4d | add setup.py to build C module 'counts'; in perspective, it should setup cbclib on various systems | isrusin/cbcalc,isrusin/cbcalc | cbclib/setup.py | cbclib/setup.py | from distutils.core import setup, Extension
setup(
name="counts", version="0.1",
ext_modules=[Extension("counts", ["countsmodule.c", "countscalc.c"])]
)
| mit | Python | |
22769c9d84de432034ef592f94c77b5d5111599d | Create argparser.py | ccjj/andropy | argparser.py | argparser.py | def get_args():
import argparse
import os
from sys import exit
parser = argparse.ArgumentParser(description='Automates android memory dumping')
parser.add_argument('-n', '--samplepath', required=True,help='path of the malware sample-apk')
parser.add_argument('-i', '--interval', required=True, type=int, help='in... | mit | Python | |
dbe76ab17e795540de6a53b22f90c8af0cb15dbe | Add constants example | ogroleg/svhammer | constants.example.py | constants.example.py | # coding: utf-8
from __future__ import unicode_literals
token = '123456789:dfghdfghdflugdfhg-77fwftfeyfgftre' # bot access_token
sn_stickers = ('CADAgADDwAu0BX', 'CAADA',
'CDAgADEQADfvu0Bh0Xd-rAg', 'CAADAgAADfvu0Bee9LyXSj1_fAg',) # ids
some2_stickers = ('CAADAKwADd_JnDFPYYarHAg', 'CAADAgADJmEyMU5rGAg'... | mit | Python | |
d777a19bb804ae1a4268702da00d3138b028b386 | Add a python script to start sysmobts-remote and dump docs | osmocom/osmo-bts,telenoobie/osmo-bts,shimaore/osmo-bts,geosphere/osmo-bts,telenoobie/osmo-bts,shimaore/osmo-bts,osmocom/osmo-bts,shimaore/osmo-bts,geosphere/osmo-bts,geosphere/osmo-bts,telenoobie/osmo-bts,shimaore/osmo-bts,geosphere/osmo-bts,telenoobie/osmo-bts,osmocom/osmo-bts | contrib/dump_docs.py | contrib/dump_docs.py | #!/usr/bin/env python
"""
Start the process and dump the documentation to the doc dir
"""
import socket, subprocess, time,os
env = os.environ
env['L1FWD_BTS_HOST'] = '127.0.0.1'
bts_proc = subprocess.Popen(["./src/osmo-bts-sysmo/sysmobts-remote",
"-c", "./doc/examples/osmo-bts.cfg"], env = env,
stdin=None, stdo... | agpl-3.0 | Python | |
436119b2ef8ea12f12b69e0d22dd3441b7e187cd | add ratelimit plugin | Rj48/ircbot,Rouji/Yui | plugins/ratelimit.py | plugins/ratelimit.py | import time
buckets = {}
last_tick = time.time()
timeframe = float(yui.config_val('ratelimit', 'timeframe', default=60.0))
max_msg = float(yui.config_val('ratelimit', 'messages', default=6.0))
ignore_for = 60.0 * float(yui.config_val('ratelimit', 'ignoreMinutes', default=3.0))
@yui.event('postCmd')
def ratelimit(use... | mit | Python | |
83579a7e10d66e29fc65c43ba317c6681a393d3e | Add simple hub datapath | MurphyMc/pox,MurphyMc/pox,MurphyMc/pox,noxrepo/pox,noxrepo/pox,noxrepo/pox,noxrepo/pox,MurphyMc/pox,MurphyMc/pox | pox/datapaths/hub.py | pox/datapaths/hub.py | # Copyright 2017 James McCauley
#
# 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 writi... | apache-2.0 | Python | |
d753fe46507d2e829c0b6ffc3120ec8f9472c4f1 | Add Problem 59 solution. | robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles | project-euler/059.py | project-euler/059.py | '''
Problem 59
19 December 2003
Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) = 42, and lowercase k = 107.
A modern encryption method is to take a text file, convert the bytes... | mit | Python | |
d1fcf47d62671abbb2ec8a278460dd64a4de03c2 | Create cryptoseven.py | Laserbear/Python-Scripts | cryptoseven.py | cryptoseven.py | import sys
def strxor(a, b): # xor two strings of different lengths
if len(a) > len(b):
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)])
else:
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])])
def printAscii(msg):
z = [chr(ord(x)) for x ... | apache-2.0 | Python | |
baeecbd66e1acd48aa11fdff4c65567c72d88186 | Create client.py | Poogles/ohesteebee | ohesteebee/client.py | ohesteebee/client.py | """Ohessteebee client."""
import requests
from typing import Dict
PutDict = Dict[str, str]
class Ohessteebee:
def __init__(self, endpoint, port=4242):
self.session = requests.Session()
self.req_path = "http://{endpoint}:{port}".format(
endpoint=endpoint, port=port)
def _generate_... | apache-2.0 | Python | |
22494a45d2bce6774bdc50409a71f259841287f5 | add initial GlimError | aacanakin/glim | glim/exception.py | glim/exception.py |
class GlimError(Exception):
pass | mit | Python | |
151599dd242eb0cb0da4771ca3798d66314719f0 | add queue module | dhain/greennet | greennet/queue.py | greennet/queue.py | import time
from collections import deque
from py.magic import greenlet
from greennet import get_hub
from greennet.hub import Wait
class QueueWait(Wait):
__slots__ = ('queue',)
def __init__(self, task, queue, expires):
super(QueueWait, self).__init__(task, expires)
self.queue = queue
... | mit | Python | |
8d5059fcd672fb4f0fcd7a2b57bf41f57b6269e5 | add mongo handler | telefonicaid/orchestrator,telefonicaid/orchestrator | src/orchestrator/core/mongo.py | src/orchestrator/core/mongo.py | #
# Copyright 2018 Telefonica Espana
#
# This file is part of IoT orchestrator
#
# IoT orchestrator 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)... | agpl-3.0 | Python | |
90ec9def45bcc50047d3511943c463f57f771f00 | Bump to 3.2.0 | django-dbbackup/django-dbbackup,mjs7231/django-dbbackup,ZuluPro/django-dbbackup,mjs7231/django-dbbackup,ZuluPro/django-dbbackup,django-dbbackup/django-dbbackup | dbbackup/__init__.py | dbbackup/__init__.py | "Management commands to help backup and restore a project database and media"
VERSION = (3, 2, 0)
__version__ = '.'.join([str(i) for i in VERSION])
__author__ = 'Michael Shepanski'
__email__ = 'mjs7231@gmail.com'
__url__ = 'https://github.com/django-dbbackup/django-dbbackup'
default_app_config = 'dbbackup.apps.Dbbackup... | "Management commands to help backup and restore a project database and media"
VERSION = (3, 1, 3)
__version__ = '.'.join([str(i) for i in VERSION])
__author__ = 'Michael Shepanski'
__email__ = 'mjs7231@gmail.com'
__url__ = 'https://github.com/django-dbbackup/django-dbbackup'
default_app_config = 'dbbackup.apps.Dbbackup... | bsd-3-clause | Python |
2c29829bb6e0483a3dc7d98bc887ae86a3a233b7 | Fix dir name of preprocess | SaTa999/pyPanair | pyPanair/preprocess/__init__.py | pyPanair/preprocess/__init__.py | mit | Python | ||
3e7f8c5b87a85958bd45636788215db1ba4f2fd8 | Create __init__.py | AlanOndra/Waya | src/site/app/model/__init__.py | src/site/app/model/__init__.py | # -*- coding: utf-8 -*-
| bsd-3-clause | Python | |
38c2291ab23d86d220446e594d52cce80ea4ec2a | Create Count_Inversions_Array.py | UmassJin/Leetcode | Experience/Count_Inversions_Array.py | Experience/Count_Inversions_Array.py | '''
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion count is the maximum.
Formally speaking, two elements a[i] and a[j] form an inversion if a[i] > a[j] and i < j
Exampl... | mit | Python | |
59b531e11266b2ff8184c04cda92bcc2fad71fa0 | Create core.py | thegreathippo/crispy | crispy/actions/core.py | crispy/actions/core.py | from crispy.actions.attacks import Attack, Melee, Ranged, Throw, Shoot
| mit | Python | |
d6dc45756cbb30a8f707d683943ccd4ee0391e6b | Add an aws settings for the cms | doganov/edx-platform,nanolearningllc/edx-platform-cypress-2,4eek/edx-platform,defance/edx-platform,utecuy/edx-platform,halvertoluke/edx-platform,andyzsf/edx,IndonesiaX/edx-platform,kursitet/edx-platform,rationalAgent/edx-platform-custom,edry/edx-platform,tiagochiavericosta/edx-platform,hkawasaki/kawasaki-aio8-2,arifset... | cms/envs/aws.py | cms/envs/aws.py | """
This is the default template for our main set of AWS servers.
"""
import json
from .logsettings import get_logger_config
from .common import *
############################### ALWAYS THE SAME ################################
DEBUG = False
TEMPLATE_DEBUG = False
EMAIL_BACKEND = 'django_ses.SESBackend'
SESSION_ENGI... | agpl-3.0 | Python | |
b32d659b85901a8e04c6c921928483fda3b3e6e0 | Add the storage utility for parsing the config file structure in a more readable fashion. | kalikaneko/leap_mx,kalikaneko/leap_mx-1,leapcode/leap_mx,kalikaneko/leap_mx-1,leapcode/leap_mx,micah/leap_mx,meskio/leap_mx,meskio/leap_mx,kalikaneko/leap_mx,micah/leap_mx,isislovecruft/leap_mx,isislovecruft/leap_mx | src/leap/mx/util/storage.py | src/leap/mx/util/storage.py |
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`.
>>> o = Storage(a=1)
>>> o.a
1
>>> o['a']
1
>>> o.a = 2
>>> o['a']
2
>>> del o.a
>>> o.a
None
... | agpl-3.0 | Python | |
49a4d3d5bfed0bb12a0e4cdee50672b23533c128 | move data to new table | geometalab/G4SE-Compass,geometalab/G4SE-Compass,geometalab/G4SE-Compass,geometalab/G4SE-Compass | compass-api/G4SE/api/migrations/0005_auto_20161010_1253.py | compass-api/G4SE/api/migrations/0005_auto_20161010_1253.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3.dev20161004124613 on 2016-10-10 12:53
from __future__ import unicode_literals
from django.db import migrations
from django.utils import timezone
from api.models import GEO_SERVICE_METADATA_AGREED_FIELDS
def _extract_publication_year(record_kwargs):
if record_... | mit | Python | |
7c8f2464b303b2a40f7434a0c26b7f88c93b6ddf | add migration | qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/accounting/migrations/0036_subscription_skip_invoicing_if_no_feature_charges.py | corehq/apps/accounting/migrations/0036_subscription_skip_invoicing_if_no_feature_charges.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounting', '0035_kill_date_received'),
]
operations = [
migrations.AddField(
model_name='subscription',
... | bsd-3-clause | Python | |
5e765ecf387d52c22371a69df82beacddcd12e38 | Test COREID is read-only. | futurecore/revelation,futurecore/revelation,futurecore/revelation | revelation/test/test_storage.py | revelation/test/test_storage.py | from revelation.test.machine import StateChecker, new_state
def test_coreid_read_only():
state = new_state(rfCOREID=0x808)
# Change by writing to register.
state.rf[0x65] = 0x100
expected_state = StateChecker(rfCOREID=0x808)
expected_state.check(state)
# Change by writing to memory.
# This... | bsd-3-clause | Python | |
6af41b8b1ff4a6eb28167a063668a1f173999e5c | Create cornersMapping.py | ipeluffo/itba-infovis-2015 | cornersMapping.py | cornersMapping.py |
import csv
import requests
import time
import json
username = ""
def requestGeoName(row):
#parts = row.split(',')
lng = row[0]
lat = row[1]
r = requests.get("http://api.geonames.org/findNearestIntersectionOSMJSON?lat="+lat+"&lng="+lng+"&username="+username)
if (r.status_code == 200):
retu... | apache-2.0 | Python | |
b2d0eaca41f6c697006eeaef38b72af649415d2b | Create models.py | illagrenan/django-cookiecutter-template,illagrenan/django-cookiecutter-template,illagrenan/django-cookiecutter-template,illagrenan/django-cookiecutter-template | {{cookiecutter.repo_name}}/{{cookiecutter.src_dir}}/{{cookiecutter.main_app}}/models.py | {{cookiecutter.repo_name}}/{{cookiecutter.src_dir}}/{{cookiecutter.main_app}}/models.py | # -*- encoding: utf-8 -*-
# ! python2
| mit | Python | |
d1b4cbfbc3956fc72bd183dbc219c4e7e8bdfb98 | add reproducer for LWT bug with static-column conditions | scylladb/scylla,scylladb/scylla,scylladb/scylla,scylladb/scylla | test/cql-pytest/test_lwt.py | test/cql-pytest/test_lwt.py | # Copyright 2020-present ScyllaDB
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#############################################################################
# Various tests for Light-Weight Transactions (LWT) support in Scylla.
# Note that we have many more LWT tests in the cql-repl framework:
# ../cql/lwt*_test.cql... | agpl-3.0 | Python | |
89c17110f9d17e99ea7686e884cfba91b4762d57 | Add starter code for Lahman db | jldbc/pybaseball | pybaseball/lahman.py | pybaseball/lahman.py | ################################################
# WORK IN PROGRESS: ADD LAHMAN DB TO PYBASEBALL
# TODO: Make a callable function that retrieves the Lahman db
# Considerations: users should have a way to pull just the parts they want
# within their code without having to write / save permanently. They should
# also ha... | mit | Python | |
8eafb1b613363f85c9b105812cd5d0047e5ca6ff | Add warp example script | sergionr2/RacingRobot,sergionr2/RacingRobot,sergionr2/RacingRobot,sergionr2/RacingRobot | image_processing/warp_image.py | image_processing/warp_image.py | import argparse
import cv2
import numpy as np
import matplotlib.pyplot as plt
from constants import MAX_WIDTH, MAX_HEIGHT
# Transform Parameters
y = 90
a = 0.75
delta = (MAX_HEIGHT - y) * a
height, width = 500, 320
# Orignal and transformed keypoints
pts1 = np.float32(
[[delta, y],
[MAX_WIDTH - delta, y],
... | mit | Python | |
77dfcc41b718ed26e9291b9efc47b0589b951fb8 | Create 0001.py | Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python | pylyria/0001/0001.py | pylyria/0001/0001.py | 1
| mit | Python | |
d412ec65777431cdd696593ddecd0ee37a500b25 | Create 0011.py | Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2 | pylyria/0011/0011.py | pylyria/0011/0011.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
def is_sensitive(word):
sensitive_words = [line.strip() for line in open('sensitive.txt', encoding='utf-8')]
word = word.strip()
if word.lower() in sensitive_words:
return True
else:
return False
if __name__ == "__main__":
while 1:
if is_sensitive(input()... | mit | Python | |
5052318d2802284a0331fc77fd7d02bdaca39f42 | test if a layer is working fine | tejaskhot/ConvAE-DeSTIN,Tejas-Khot/ConvAE-DeSTIN | scripts/feature_extract_test.py | scripts/feature_extract_test.py | """Feature extraction test"""
import numpy as np;
import sys
import theano;
import theano.tensor as T;
sys.path.append("..")
import scae_destin.datasets as ds;
from scae_destin.convnet import ReLUConvLayer;
from scae_destin.convnet import LCNLayer
n_epochs=1;
batch_size=100;
Xtr, Ytr, Xte, Yte=ds.load_CIFAR10("/ho... | apache-2.0 | Python | |
47ebaa10068313c9b8fbbf2e3ffcf06597f88ff6 | add npy2png file converter | ecell/bioimaging | convert_npy2image.py | convert_npy2image.py | import sys
import math
import copy
import pylab
import numpy
from Image import fromarray
from scipy.misc import imread, toimage
cmin = 0
cmax = 2**8 - 1
def convert(file_in, file_out, index=None) :
i = 0
max_count = 0
while (True) :
try :
input_image = numpy.load(file_in + '/image_%07d.npy' % (i))
... | bsd-3-clause | Python | |
211e9e9352234f5638036b5b1ec85f998609d587 | Add a primitive MITM proxy | prophile/libdiana | diana/utils/proxy.py | diana/utils/proxy.py | from diana import packet
import argparse
import asyncio
import sys
import socket
from functools import partial
class Buffer:
def __init__(self, provenance):
self.buffer = b''
self.provenance = provenance
def eat(self, data):
self.buffer += data
packets, self.buffer = packet.dec... | mit | Python | |
d890ef34b11200738687ec49a4a005bb9ebe7c2a | make the module executable | ferreum/distanceutils,ferreum/distanceutils | distance/__main__.py | distance/__main__.py | #!/usr/bin/env python
from . import __version__
print(f"distanceutils version {__version__}")
# vim:set sw=4 ts=8 sts=4 et:
| mit | Python | |
768b61316a10726a3281a514823f280abc142356 | move wild into its own folder | graingert/vcrpy,mgeisler/vcrpy,poussik/vcrpy,agriffis/vcrpy,graingert/vcrpy,gwillem/vcrpy,kevin1024/vcrpy,aclevy/vcrpy,poussik/vcrpy,IvanMalison/vcrpy,kevin1024/vcrpy,bcen/vcrpy,yarikoptic/vcrpy,ByteInternet/vcrpy,ByteInternet/vcrpy | tests/integration/test_wild.py | tests/integration/test_wild.py | import pytest
requests = pytest.importorskip("requests")
import vcr
def test_domain_redirect():
'''Ensure that redirects across domains are considered unique'''
# In this example, seomoz.org redirects to moz.com, and if those
# requests are considered identical, then we'll be stuck in a redirect
# loo... | mit | Python | |
c193aebdc76eae285df402463c149bef328c05ef | Add backwards-compatible registration.urls, but have it warn pending deprecation. | dinie/django-registration,FundedByMe/django-registration,dinie/django-registration,FundedByMe/django-registration,Avenza/django-registration | registration/urls.py | registration/urls.py | import warnings
warnings.warn("Using include('registration.urls') is deprecated; use include('registration.backends.default.urls') instead",
PendingDeprecationWarning)
from registration.backends.default.urls import *
| bsd-3-clause | Python | |
fe88e0d8dc3d513cd11ef9ab4cb3ea332af99202 | Add migration | Ircam-Web/mezzanine-organization,Ircam-Web/mezzanine-organization | organization/network/migrations/0112_auto_20180502_1742.py | organization/network/migrations/0112_auto_20180502_1742.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2018-05-02 15:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization-network', '0111_auto_20180307_1152'),
]
operations = [
migrati... | agpl-3.0 | Python | |
b82c7343af06c19e6938bd27359289ab067db1e9 | add expectation core (#4357) | great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations | contrib/experimental/great_expectations_experimental/expectations/expect_column_sum_to_be.py | contrib/experimental/great_expectations_experimental/expectations/expect_column_sum_to_be.py | """
This is a template for creating custom ColumnExpectations.
For detailed instructions on how to use it, please see:
https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_aggregate_expectations
"""
from typing import Dict, Optional
from great_expecta... | apache-2.0 | Python | |
10001d5c611e59dd426d829fa7c2242b5f93df0d | add element collection base | lmtierney/watir-snake | watir_snake/element_collection.py | watir_snake/element_collection.py | from importlib import import_module
import watir_snake
class ElementCollection(object):
# TODO: include Enumerable
def __init__(self, query_scope, selector):
self.query_scope = query_scope
self.selector = selector
self.as_list = []
self.elements = []
def __iter__(self):
... | mit | Python | |
a27c9a8ddf6ab1cd264b02afc95754da6b4bb058 | Add partial indexes | ashleywaite/django-more | django-more/indexes.py | django-more/indexes.py | """ Define custom index types useful for SID and utils """
import hashlib
from django.db.models import Index, Q
from django.db import DEFAULT_DB_ALIAS
__all__ = ['PartialIndex']
class PartialIndex(Index):
suffix = "par"
def __init__(self, *args, fields=[], name=None, **kwargs):
self.q_filters = [ar... | bsd-3-clause | Python | |
07fcdfe3da7d5ffda3ff7139b2f8cd0f02a5ad06 | Create xml_to_text_new.py | BSchilperoort/BR-DTS-Processing | xml_conversion/xml_to_text_new.py | xml_conversion/xml_to_text_new.py | ##Imports
import xml.etree.cElementTree as ET
from glob import glob
from time import time
import os
#############################################################################
# NOTE: When importing xml files, make sure the distances do not change #
# between files in the same folder. This will lead to errors ... | mit | Python | |
48e4b9692b29d3fb9f43f37fef70ccc41f47fc0e | Add tests for the errors utility functions | Yaco-Sistemas/yith-library-server,Yaco-Sistemas/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server | yithlibraryserver/tests/errors.py | yithlibraryserver/tests/errors.py | import unittest
from pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound
from yithlibraryserver.errors import password_not_found, invalid_password_id
class ErrorsTests(unittest.TestCase):
def test_password_not_found(self):
result = password_not_found()
self.assertTrue(isinstance(result,... | agpl-3.0 | Python | |
4c225ec7cdafc45840b2459e8804df5818fecd71 | add util module | ecreall/dace | dace/util.py | dace/util.py | from pyramid.threadlocal import get_current_request
from substanced.util import find_objectmap
def get_obj(oid):
request = get_current_request()
objectmap = find_objectmap(request.root)
obj = objectmap.object_for(oid)
return obj
| agpl-3.0 | Python | |
ddfc28360941a435ae22705dbc46b44cced588e7 | Add demo file. | ProjetPP/PPP-Spell-Checker,ProjetPP/PPP-Spell-Checker | demo/demo.py | demo/demo.py | #!/usr/bin/env python3
import fileinput
import os
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0,parentdir)
import ppp_spell_checker
if __name__ == "__main__":
corrector = ppp_spell_checker.StringCorrector('en')
while(True):
print(corrector.correctString... | mit | Python | |
8003f9f643b90cf42bdd8ba0ec8d5dc2f96ba191 | Create list-aws-queue.py | kattymo/GITHUB-Repo-lab11 | list-aws-queue.py | list-aws-queue.py | # This script created a queue
#
# Author - Paul Doyle Nov 2015
#
#
import boto.sqs
import boto.sqs.queue
from boto.sqs.message import Message
from boto.sqs.connection import SQSConnection
from boto.exception import SQSError
import sys
# Get the keys from a specific url and then use them to connect to AWS Service
acce... | mit | Python | |
298f297410b9db8b2d211b1d0edddb595f1fa469 | Add timestamp2str() | ronrest/convenience_py,ronrest/convenience_py | datetime/datetime.py | datetime/datetime.py | import datetime
# ==============================================================================
# TIMESTAMP 2 STR
# ==============================================================================
def timestamp2str(t, pattern="%Y-%m-%d %H:%M:%S"):
""" ... | apache-2.0 | Python | |
0e9e63a48c5f3e02fb49d0068363ac5442b39e37 | Add a body to posts | incuna/django-discussion,lehins/lehins-discussion,lehins/lehins-discussion,incuna/django-discussion,lehins/lehins-discussion | discussion/models.py | discussion/models.py | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | bsd-2-clause | Python |
62beb09ca1ecde8be4945016ae09beaad2dad597 | Create disemvowel_trolls.py | Kunalpod/codewars,Kunalpod/codewars | disemvowel_trolls.py | disemvowel_trolls.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Disemvowel Trolls
#Problem level: 7 kyu
def disemvowel(string):
return ''.join([letter for letter in string if letter.lower() not in ['a', 'e', 'i', 'o', 'u']])
| mit | Python | |
078bc9ea1375ac8ff7b2bbb92553ae63e5190cd3 | add var.py in package structData to save vars | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/structData/var.py | trunk/editor/structData/var.py | #!/usr/bin/env python
class Var(object):
def __init__(self, name, start_value, set_value=None):
self.name = name
self.start_value = start_value
self.set_value = set_value
| mit | Python | |
a26f0cc1af189686a24518510095f93b064a36a4 | Add two utility functions for group membership | prophile/django_split | django_split/base.py | django_split/base.py | import six
import datetime
import inflection
from django.contrib.auth.models import User
from .models import ExperimentGroup
from .validation import validate_experiment
EXPERIMENTS = {}
class ExperimentMeta(type):
def __init__(self, name, bases, dict):
super(ExperimentMeta, self).__init__(name, bases, d... | import six
import inflection
from .validation import validate_experiment
EXPERIMENTS = {}
class ExperimentMeta(type):
def __init__(self, name, bases, dict):
super(ExperimentMeta, self).__init__(name, bases, dict)
# Special case: don't do experiment processing on the base class
if (
... | mit | Python |
316d0518f2cf81ce3045335b79bc993020befce1 | create main class `FlaskQuik` for bridging quik and flask | avelino/Flask-Quik | flask_quik.py | flask_quik.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
flask.ext.quik
~~~~~~~~~~~~~~
Extension implementing Quik Templates support in Flask with support for
flask-babel
:copyright: (c) 2012 by Thiago Avelino <thiago@avelino.xxx>
:license: MIT, see LICENSE for more details.
"""
from quik import File... | mit | Python | |
4844ac93326186ded80147a3f8e1e1429212428b | add user's launcher | tensorflow/tfx,tensorflow/tfx | tfx/experimental/templates/taxi/stub_component_launcher.py | tfx/experimental/templates/taxi/stub_component_launcher.py | # Lint as: python3
# Copyright 2020 Google LLC. 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 ... | apache-2.0 | Python | |
20d77f66e0287b3aab08b4cf14f23e7e5672aefd | Create database import script for the Picks table (each NFLPool Player's picks for a given season) | prcutler/nflpool,prcutler/nflpool | db_setup/nflpool_picks.py | db_setup/nflpool_picks.py | import sqlite3
conn = sqlite3.connect('nflpool.sqlite')
cur = conn.cursor()
# Do some setup
cur.executescript('''
DROP TABLE IF EXISTS Player;
CREATE TABLE Picks (
firstname TEXT NOT NULL,
lastname TEXT NOT NULL,
id INTEGER NOT NULL PRIMARY KEY UNIQUE,
season TEXT NOT NULL UNIQUE,
email TE... | mit | Python | |
ed1cd0f7de1a7bebaaf0f336ba52e04286dd87de | Create my_mapper.py | jnimish77/Cloud-Computing-and-Programming-using-various-tools,jnimish77/Cloud-Computing-and-Programming-using-various-tools,jnimish77/Cloud-Computing-and-Programming-using-various-tools | Hadoop--Project-to-map-new-Your-taxi-data-info/my_mapper.py | Hadoop--Project-to-map-new-Your-taxi-data-info/my_mapper.py | #!/usr/bin/env python
import sys
for line in sys.stdin:
line = line.strip()
unpacked = line.split(",")
stadium, capacity, expanded, location, surface, turf, team, opened, weather, roof, elevation = line.split(",")
#medallion, hack_license, vendor_id, rate_code, store_and_fwd_flag, pickup_datetime, d... | apache-2.0 | Python | |
8ad4627973db344e228a9170aef030ab58efdeb9 | Add column order and importable objects lists | edofic/ggrc-core,hasanalom/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,jmakov/ggrc-core,VinnieJohns/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,hyperNURb/ggrc-... | src/ggrc/converters/__init__.py | src/ggrc/converters/__init__.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
from ggrc.converters.sections import SectionsConverter
from ggrc.models import (
... | # 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
from ggrc.converters.sections import SectionsConverter
all_converters = [('sectio... | apache-2.0 | Python |
53926f18fb4f058bba9dd23fb75721d3dfa1d24b | add hashes directory | TheAlgorithms/Python | hashes/md5.py | hashes/md5.py | import math
def rearrange(bitString32):
if len(bitString32) != 32:
raise ValueError("Need length 32")
newString = ""
for i in [3,2,1,0]:
newString += bitString32[8*i:8*i+8]
return newString
def reformatHex(i):
hexrep = format(i,'08x')
thing = ""
for i in [3,2,1,0]:
thing += hexrep[2*i:2*i+2]
return thin... | mit | Python | |
8141d6cafb4a1c8986ec7065f27d536d98cc9916 | Add little script calculate sample spectra. | RabadanLab/MITKats,MITK/MITK,MITK/MITK,RabadanLab/MITKats,MITK/MITK,MITK/MITK,fmilano/mitk,fmilano/mitk,fmilano/mitk,iwegner/MITK,RabadanLab/MITKats,iwegner/MITK,RabadanLab/MITKats,iwegner/MITK,RabadanLab/MITKats,MITK/MITK,fmilano/mitk,iwegner/MITK,fmilano/mitk,iwegner/MITK,fmilano/mitk,fmilano/mitk,RabadanLab/MITKats,... | Modules/Biophotonics/python/iMC/script_plot_one_spectrum.py | Modules/Biophotonics/python/iMC/script_plot_one_spectrum.py | '''
Created on Oct 12, 2015
@author: wirkert
'''
import pickle
import logging
import numpy as np
import matplotlib.pyplot as plt
import luigi
import tasks_regression as rt
from msi.plot import plot
from msi.msi import Msi
import msi.normalize as norm
import scriptpaths as sp
sp.ROOT_FOLDER = "/media/wirkert/data/D... | bsd-3-clause | Python | |
ec0cf9c6eb8ecc69482ed08f22a760d73f420619 | Add API tests | PyBossa/pybossa,Scifabric/pybossa,Scifabric/pybossa,PyBossa/pybossa | test/test_api/test_api_project_stats.py | test/test_api/test_api_project_stats.py | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2017 Scifabric LTD.
#
# 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 your op... | agpl-3.0 | Python | |
55aae76ae3813045542b8f94736fdfb1e08592f2 | Add chrome driver path. | VinnieJohns/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,jmakov/ggrc-core,AleksNeStu/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,edofic/ggrc-core,jmakov/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,j0gurt/ggrc-core... | src/lib/environment/__init__.py | src/lib/environment/__init__.py | import os
import logging
from lib import constants, file_ops
yaml = file_ops.load_yaml_contents(constants.path.YAML)
PROJECT_ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) + "/../"
VIRTENV_PATH = PROJECT_ROOT_PATH + constants.path.VIRTUALENV_DIR
LOGGING_FORMAT = yaml[constants.yaml.LOGGING][constants.yaml.FOR... | import os
import logging
from lib import constants, file_ops
yaml = file_ops.load_yaml_contents(constants.path.YAML)
PROJECT_ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) + "/../"
VIRTENV_PATH = PROJECT_ROOT_PATH + constants.path.VIRTUALENV_DIR
LOGGING_FORMAT = yaml[constants.yaml.LOGGING][constants.yaml.FOR... | apache-2.0 | Python |
56422abd9e5dbc1b17b009d84fd5e4b028719b94 | add basic IPC traffic analyzer | amccreight/mochitest-logs | ipc-viewer.py | ipc-viewer.py | #!/usr/bin/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/.
# This file analyzes the output of running with MOZ_IPC_MESSAGE_LOG=1
import sys
import re
msgPatt ... | mpl-2.0 | Python | |
561957a2492714e1b6d76b13daeced66a90aba1d | Create __init__.py | Radiergummi/libconfig | docs/_themes/sphinx_rtd_theme/__init__.py | docs/_themes/sphinx_rtd_theme/__init__.py | """Sphinx ReadTheDocs theme.
From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
"""
import os
VERSION = (0, 1, 5)
__version__ = ".".join(str(v) for v in VERSION)
__version_full__ = __version__
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = os.path.abspath(os.path.dirn... | mit | Python | |
3018a418b24da540f259a59a578164388b0c2686 | add examples/call-gtk.py | detrout/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,detrout/telepathy-python,epage/telepathy-python,epage/telepathy-python,PabloCastellano/telepathy-python,max-posedon/telepathy-python,max-posedon/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/t... | examples/call-gtk.py | examples/call-gtk.py |
import sys
import pygtk
pygtk.require('2.0')
import dbus
import gobject
import gtk
from account import read_account, connect
from call import IncomingCall, OutgoingCall, get_stream_engine
from telepathy.interfaces import CONN_INTERFACE
class CallWindow(gtk.Window):
def __init__(self):
gtk.Window.__ini... | lgpl-2.1 | Python | |
c979fe37cc5f3dd83933893a1e7774c4aa7d061c | Add test script. | ieeg-portal/ieegpy | examples/get_data.py | examples/get_data.py | '''
Copyright 2019 Trustees of the University of Pennsylvania
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 ... | apache-2.0 | Python | |
11bd97a647507645f90e259dd8000eb6a8001890 | Add index to log_once table, make cleanup run with db cleanup event. refs #1167 | camon/Flexget,JorisDeRieck/Flexget,tarzasai/Flexget,Danfocus/Flexget,antivirtel/Flexget,drwyrm/Flexget,Pretagonist/Flexget,jacobmetrick/Flexget,ZefQ/Flexget,jawilson/Flexget,malkavi/Flexget,ratoaq2/Flexget,Danfocus/Flexget,antivirtel/Flexget,voriux/Flexget,Flexget/Flexget,tobinjt/Flexget,ianstalk/Flexget,tvcsantos/Flex... | flexget/utils/log.py | flexget/utils/log.py | """Logging utilities"""
import logging
import hashlib
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, DateTime, Index
from flexget import schema
from flexget.utils.sqlalchemy_utils import table_schema
from flexget.manager import Session
from flexget.event import event
log = lo... | """Logging utilities"""
import logging
from flexget.manager import Session, Base
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, DateTime
log = logging.getLogger('util.log')
class LogMessage(Base):
"""Declarative"""
__tablename__ = 'log_once'
id = Column(Intege... | mit | Python |
b3977289de72421530614ff4f28cdf7333d743e4 | Add region migration validation | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/logical/validators.py | dbaas/logical/validators.py | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from logical.models import Database
from django.core.exceptions import ValidationError
from django.core.exceptions import ObjectDoesNotExist
from system.models import Configuration
def validate_evironment(database_name, environment_name):... | bsd-3-clause | Python | |
f0e092b060d9afb700f027197fdf44eeb2fdd91b | Create __init__.py | fcopantoja/turningio_challenge | __ini__.py | __ini__.py | mit | Python | ||
660fc806d11c6a8af321bb14caec21ca7cba4141 | add kafka streaming consumer | zhexiao/mnet,zhexiao/mnet,zhexiao/mnet,zhexiao/mnet | deploy/test/kf_consumer1.py | deploy/test/kf_consumer1.py | import json
from kafka import KafkaConsumer
consumer = KafkaConsumer('testres', bootstrap_servers='192.168.33.50:9092')
for msg in consumer:
val = msg.value.decode()
print(msg.key.decode())
print(json.loads(val).get('word'))
print(json.loads(val).get('count'))
print(json.loads(val).get('window'))... | apache-2.0 | Python | |
4c96e1eb17a5cbb4c1a33cef5c37aac00b4ec8e0 | Update test_api.py | bartTC/dpaste,bartTC/dpaste,rbarrois/xelpaste,SanketDG/dpaste,SanketDG/dpaste,rbarrois/xelpaste,bartTC/dpaste,SanketDG/dpaste,rbarrois/xelpaste | dpaste/tests/test_api.py | dpaste/tests/test_api.py | # -*- encoding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
from ..models import Snippet
from ..forms import EXPIRE_DEFAULT
from ..highlight import LEXER_DEFAULT
class SnippetAPITestCase(TestCase):
def setUp(self):
self.ap... | # -*- encoding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
from ..models import Snippet
from ..forms import EXPIRE_DEFAULT
from ..highlight import LEXER_DEFAULT
class SnippetAPITestCase(TestCase):
def setUp(self):
self.ap... | mit | Python |
49d28814c498d1698c61b8eeae3c3e3e019a09c3 | add recipe3 scrap | zifeo/Food-habits,zifeo/Food-habits,zifeo/Food-habits,zifeo/Food-habits | scrap/recipe3.py | scrap/recipe3.py | import scrapy
class Recipe3Spider(scrapy.Spider):
name = "recipe3"
download_delay = 0.5
start_urls = [
"http://www.cuisineaz.com/recettes/recherche_v2.aspx?recherche={}".format(r)
for r in [
'bases',
'aperitifs',
'entrees',
'plats',
... | apache-2.0 | Python | |
f486343277a94e511ea1e152ca6b69f12fd657a0 | Create droidgpspush.py | bhaumikbhatt/PiDroidGPSTracker,bhaumikbhatt/PiDroidGPSTracker | droidgpspush.py | droidgpspush.py | import androidhelper
import socket
import time
droid = androidhelper.Android()
port=12345
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("10.201.19.201",port)) #connecting to pi as client
droid.makeToast("Starting location fetch") #notify me
while True:
location = droid.getLastKnownLocation().result
... | unlicense | Python | |
fc0d54ff6d6b6ca91727c7aa0832f6c6dfc64967 | Add a prototype WinNT updater | grawity/rwho,grawity/rwho,grawity/rwho,grawity/rwho,grawity/rwho | rwho-update-winnt.py | rwho-update-winnt.py | #!/usr/bin/python
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Half of this hasn't been implemented yet.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
import ctypes as c
import socket as so
import win32api as api
#import win32con as con
import win32ts as... | mit | Python | |
6d25c1958a84eb1a6004ebadec6769511974cca4 | add basic rsa by request | team41434142/cctf-16,team41434142/cctf-16,team41434142/cctf-16 | basic-rsa/rsa.py | basic-rsa/rsa.py | def main():
e = int('3', 16)
n = int('64ac4671cb4401e906cd273a2ecbc679f55b879f0ecb25eefcb377ac724ee3b1', 16)
d = int('431d844bdcd801460488c4d17487d9a5ccc95698301d6ab2e218e4b575d52ea3', 16)
c = int('599f55a1b0520a19233c169b8c339f10695f9e61c92bd8fd3c17c8bba0d5677e', 16)
m = pow(c, d, n)
print(hex(... | agpl-3.0 | Python | |
6be3e0c5264ca2750a77ac1dbd4175502e51fd3c | Add argparse tests for ceph-deploy admin | Vicente-Cheng/ceph-deploy,ceph/ceph-deploy,codenrhoden/ceph-deploy,shenhequnying/ceph-deploy,branto1/ceph-deploy,ghxandsky/ceph-deploy,imzhulei/ceph-deploy,isyippee/ceph-deploy,trhoden/ceph-deploy,zhouyuan/ceph-deploy,Vicente-Cheng/ceph-deploy,zhouyuan/ceph-deploy,ceph/ceph-deploy,osynge/ceph-deploy,SUSE/ceph-deploy-to... | ceph_deploy/tests/parser/test_admin.py | ceph_deploy/tests/parser/test_admin.py | import pytest
from ceph_deploy.cli import get_parser
class TestParserAdmin(object):
def setup(self):
self.parser = get_parser()
def test_admin_help(self, capsys):
with pytest.raises(SystemExit):
self.parser.parse_args('admin --help'.split())
out, err = capsys.readouterr(... | mit | Python | |
2ee5f1e3563e5a7104515adf74e41a8781fbcd9e | Create exercise5.py | pwittchen/learn-python-the-hard-way,pwittchen/learn-python-the-hard-way,pwittchen/learn-python-the-hard-way | exercise5.py | exercise5.py | # -- coding: utf-8 --
my_name = 'Zed A. Shaw'
my_age = 35 # not a lie
my_height = 74 # inches
my_weight = 180 # lbs
my_eyes = 'Blue'
my_teeth = 'White'
my_hair = 'Brown'
print "Let's talk about %s." % my_name
print "He's %d inches tall." % my_height
print "He's %d pounds heavy." % my_weight
print "Actually that's no... | mit | Python | |
2523d34d4f3e26a408c7ec0e43708efea77f03a9 | Add to support the chinese library | Kuniz/alfnaversearch,Kuniz/alfnaversearch | workflow/cndic_naver_search.py | workflow/cndic_naver_search.py | # Naver Search Workflow for Alfred 2
# Copyright (C) 2013 Jinuk Baek
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later versi... | mit | Python | |
ac0e7cb6ff2885457ccbe9f7311489edf7c9406b | create train object utils | hycis/Mozi | mozi/utils/train_object_utils.py | mozi/utils/train_object_utils.py | from __future__ import absolute_import
from __future__ import print_function
import matplotlib
# matplotlib.use('Agg')
import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
from theano.compile.ops import as_op
from mozi.utils.progbar import Progbar
import tarfile, inspect, os
from... | mit | Python | |
1768a69163c50e5e964eaf110323e590f13b4ff0 | add 0000 file | Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python | Drake-Z/0000/0000.py | Drake-Z/0000/0000.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果'
__author__ = 'Drake-Z'
from PIL import Image, ImageDraw, ImageFont
def add_num(filname, text = '4', fillcolor = (255, 0, 0)):
img = Image.open(filname)
width, height = img.size
myfont = Image... | mit | Python | |
ebc2b419a3cc7cace9c79d1c5032a2ae33b8bff1 | Remove unused imports | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq | custom/up_nrhm/reports/asha_reports.py | custom/up_nrhm/reports/asha_reports.py | from corehq.apps.reports.filters.select import MonthFilter, YearFilter
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin
from corehq.apps.reports.filters.dates import DatespanFilter
from custom.up_nrhm.filters import DrillDownOptionF... | import datetime
from dateutil.relativedelta import relativedelta
from corehq.apps.reports.filters.select import MonthFilter, YearFilter
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin
from corehq.apps.reports.filters.dates import D... | bsd-3-clause | Python |
3d8f02eb7c1b9b363143f25af9eadeb94c43b4ae | increase uwnetid maxlength | uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw | myuw/migrations/0017_netidlen.py | myuw/migrations/0017_netidlen.py | # Generated by Django 2.0.13 on 2020-03-12 17:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myuw', '0016_myuw_notice_group'),
]
operations = [
migrations.AlterField(
model_name='user',
name='uwnetid',
... | apache-2.0 | Python | |
1e7b84155623691fb9fc1cec4efa6386938f3e72 | Add missing migration (updating validators=) | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | core/migrations/0055_update_username_validators.py | core/migrations/0055_update_username_validators.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-22 22:03
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0054_add_provider__cloud_config_and_timezone'),
]
... | apache-2.0 | Python | |
48217e5317412a9b5fb8181b6915963783efeaf2 | Add test for kline result of exact amount | sammchardy/python-binance | tests/test_historical_klines.py | tests/test_historical_klines.py | #!/usr/bin/env python
# coding=utf-8
from binance.client import Client
import pytest
import requests_mock
client = Client('api_key', 'api_secret')
def test_exact_amount():
"""Test Exact amount returned"""
first_res = []
row = [1519892340000,"0.00099400","0.00099810","0.00099400","0.00099810","4806.040... | mit | Python | |
1f3a15b8ae6ffcb96faaf0acab940d9590fe6cb1 | Add migration | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fat/migrations/0064_auto_20160809_1559.py | fat/migrations/0064_auto_20160809_1559.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-09 15:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fat', '0063_auto_20160809_1545'),
]
operations = [
migrations.AlterField(
... | bsd-3-clause | Python | |
5ec3f8dbe9f044d08a80563c05b648590fabdda7 | add fibonnaci example | llllllllll/toolz,JNRowe/toolz,berrytj/toolz,simudream/toolz,Julian-O/toolz,karansag/toolz,cpcloud/toolz,obmarg/toolz,machinelearningdeveloper/toolz,jdmcbr/toolz,quantopian/toolz,simudream/toolz,pombredanne/toolz,pombredanne/toolz,karansag/toolz,machinelearningdeveloper/toolz,llllllllll/toolz,bartvm/toolz,Julian-O/toolz... | examples/fib.py | examples/fib.py | # / 0 if i is 0
# fib(i) = | 1 if i is 1
# \ fib(i - 1) + fib(i - 2) otherwise
def fib(n):
""" Imperative definition of Fibonacci numbers """
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return b
# This is intuitive but ... | bsd-3-clause | Python | |
c663f6b6e31832fae682c2c527955b13682b701e | Remove learner_testimonials column from course_metadata course run table | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py | course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-07 17:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0126_course_has_ofac_restrictions'),
]
operations = [
migration... | agpl-3.0 | Python | |
8b1bd5995ff4c95335e25e19962724e6d8c399d7 | Create 0003_auto_20150930_1132.py | illing2005/django-cities,illing2005/django-cities | cities/migrations/0003_auto_20150930_1132.py | cities/migrations/0003_auto_20150930_1132.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cities', '0002_auto_20150811_1912'),
]
operations = [
migrations.AddField(
model_name='city',
name='... | mit | Python | |
b75e10f3235e9215458071279b67910627a95180 | Add celery based job runner | ihmeuw/vivarium | ceam/framework/celery_tasks.py | ceam/framework/celery_tasks.py | import os
from time import time
import logging
import pandas as pd
from celery import Celery
from billiard import current_process
app = Celery()
@app.task(autoretry_for=(Exception,), max_retries=2)
def worker(draw_number, component_config, branch_config, logging_directory):
worker = current_process().index
... | bsd-3-clause | Python | |
164f43f902b89b84b4f0d474f4d3e0a18924110d | Add test of randomized select algorithm | timpel/stanford-algs,timpel/stanford-algs | selection_test.py | selection_test.py | import quicksort.quicksort
import random_selection.random_selection
import sys
import time
from random import randint
def main(max_len, check):
for n in [2**(n+1) for n in range(max_len)]:
arr = [randint(0, 2**max_len) for n in range(n)]
median = int((len(arr)+1)/2) - 1
current_time = time.time()
result = r... | mit | Python | |
80651fc7dba6a390091dc0f0908ec165cf33c0bb | make diagnostic plots for a star | adrn/TwoFace,adrn/TwoFace | scripts/plot_star.py | scripts/plot_star.py | """ Make diagnostic plots for a specified APOGEE ID """
# Standard library
from os import path
# Third-party
import h5py
import matplotlib.pyplot as plt
from sqlalchemy.orm.exc import NoResultFound
# Project
from twoface.log import log as logger
from twoface.db import db_connect
from twoface.db import (JokerRun, All... | mit | Python | |
b528956e9394dc56951c2fb0894fefd7ee6872ff | Create cnn_evaluation.py | jdvala/ProjectTF | Convolutional_Neural_Network/cnn_evaluation.py | Convolutional_Neural_Network/cnn_evaluation.py | """ Using an Convolutional Nural Network on MNIST handwritten digits, and evaluating its performance with different scores
References:
Tflearn.org/examples
Tensorflow.org
Links:
[MNIST Dataset] http://yann.lecun.com/exdb/mnist/
Method and Examples Used:
[1] An simple example from Tflean, which is an hi... | mit | Python | |
9168807db69372ffb93430991fc4e666fa53a8f5 | Add missing example file | sklam/numba,stonebig/numba,pitrou/numba,sklam/numba,cpcloud/numba,IntelLabs/numba,pitrou/numba,pombredanne/numba,pitrou/numba,numba/numba,gmarkall/numba,pombredanne/numba,stonebig/numba,numba/numba,ssarangi/numba,jriehl/numba,jriehl/numba,GaZ3ll3/numba,gdementen/numba,sklam/numba,stefanseefeld/numba,gdementen/numba,num... | examples/movemean.py | examples/movemean.py | """
A moving average function using @guvectorize.
"""
import numpy as np
from numba import guvectorize
@guvectorize(['void(float64[:], intp[:], float64[:])'], '(n),()->(n)')
def move_mean(a, window_arr, out):
window_width = window_arr[0]
asum = 0.0
count = 0
for i in range(window_width):
asum... | bsd-2-clause | Python | |
82d34111295fdfa35d0e9815053498e935d415af | Add example script to store & read datetime | h5py/h5py,h5py/h5py,h5py/h5py | examples/store_datetimes.py | examples/store_datetimes.py | import h5py
import numpy as np
arr = np.array([np.datetime64('2019-09-22T17:38:30')])
with h5py.File('datetimes.h5', 'w') as f:
# Create dataset
f['data'] = arr.astype(h5py.opaque_dtype(arr.dtype))
# Read
print(f['data'][:])
| bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.