commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
78e758925bff73e52867b671b246a391f87cf945
remove commented lines.
homeassistant/components/sensor/speedtest.py
homeassistant/components/sensor/speedtest.py
""" homeassistant.components.sensor.speedtest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Speedtest.net sensor based on speedtest-cli. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.speedtest/ """ import logging import sys import re from datetime imp...
""" homeassistant.components.sensor.speedtest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Speedtest.net sensor based on speedtest-cli. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.speedtest/ """ import logging import sys import re from datetime imp...
Python
0
90dbc7695af9cc4b83273e774a8e3f6eb0847170
Maximum sum of any given path
Arrays/maximum_sum_path.py
Arrays/maximum_sum_path.py
import unittest """ Given two sorted arrays such that the arrays may have some common elements, find the maximum sum path to reach from beginning of any array to end of any array. We can switch from one array to another array only at common elements. Input: arr1: 2 3 7 10 12 arr2: 1 5 7 8 Output: 35 (1 + 5 + 7 + 10 + 1...
Python
0.999862
ef06864a991572d7ae610f9a249b024f967b1eb9
Add test.util.mock_call_with_name
linkins/test/util.py
linkins/test/util.py
import mock class mock_call_with_name(object): """Like mock.call but takes the name of the call as its first argument. mock.call requires chained methods to define its name. This can be a problem, for example, if you need create mock.call().__enter__().__iter__(). You can optionally use mock._Call...
Python
0.000008
dba311375a0f4cda1a3c522f5ac261dfb601b9c5
Create gee_init.py
pyEOM/gee_init.py
pyEOM/gee_init.py
MY_SERVICE_ACCOUNT = '' MY_PRIVATE_KEY_FILE = ''
Python
0.000044
e3a62fcc29fb8473a70dd6d3c82f51f8f1fc4d92
Add unit tests.
P2B_Tests.py
P2B_Tests.py
from difflib import context_diff import glob import os import ProQuest2Bepress as P2B import shutil import subprocess import sys import unittest from collections import Counter class TestFileMethods(unittest.TestCase): def setUp(self): P2B.load_config() rm_files = glob.glob(P2B.UPL...
Python
0
148991a27670d26a2eb29f0964078b4d656bbcec
Create __init__.py
pydyn/__init__.py
pydyn/__init__.py
# Copyright (C) 2014-2015 Julius Susanto. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """ PYPOWER-Dynamics Time-domain simulation engine """
Python
0.000429
06e4fd4b7d4cc4c984a05887fce00f7c8bbdc174
Add missing tests for messaging notifer plugin
tests/notifiers/test_messaging.py
tests/notifiers/test_messaging.py
# Copyright 2014 Mirantis Inc. # 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...
Python
0.000002
fb2af0db2fc6d2d63bb377d7818ed1d03cb5cc9a
add nqueens.py
python/nqueens.py
python/nqueens.py
#!/usr/bin/python # http://code.activestate.com/recipes/576647-eight-queens-six-lines/ from itertools import permutations N = 8 cols = range(N) for perm in permutations(cols): if (N == len(set(perm[i]-i for i in cols)) == len(set(perm[i]+i for i in cols))): print perm
Python
0.001659
4bfe33373ebf095623173f945757693997a65ce3
Add a simple test for the new AWS::LanguageExtensions transform (#2074)
tests/test_language_extensions.py
tests/test_language_extensions.py
import unittest from troposphere import AWSHelperFn, Parameter, Template from troposphere.sqs import Queue class TestServerless(unittest.TestCase): def test_transform(self): t = Template() t.set_version("2010-09-09") t.set_transform("AWS::LanguageExtensions") self.assertEqual( ...
Python
0.000706
157a7d00a9d650728495726e9217591a678ec5a9
add docstrings for response
mailthon/response.py
mailthon/response.py
""" mailthon.response ~~~~~~~~~~~~~~~~~ Implements the Response objects. """ class Response(object): """ Encapsulates a (status_code, message) tuple returned by a server when the ``NOOP`` command is called. :param pair: A (status_code, message) pair. """ def __init__(self, p...
class Response(object): def __init__(self, pair): status, message = pair self.status_code = status self.message = message @property def ok(self): return self.status_code == 250 class SendmailResponse(Response): def __init__(self, pair, rejected): Response.__ini...
Python
0.000001
1ee32dab5a8c90c857a127ba831be250ad153198
Create rftest.py
mark_ii/pi/rftest.py
mark_ii/pi/rftest.py
#!/usr/bin/python import piVirtualWire.piVirtualWire as piVirtualWire import time import pigpio import struct import requests import logging import logging.handlers LOG_FILENAME = '/tmp/rftest.log' def calcChecksum(packet): checkSum = sum([ int(i) for i in packet[:13]]) return checkSum % 256 def sendToWeb(ur...
Python
0
3f43a5358bb58269846e21207bd570046b6aa711
Create main_queue_thread.py
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 ...
Python
0.000028
2b2ff2a528f6effd219bd13cd754c33b55e82e61
add __init__.py, initialized bootstrap extension
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) ...
Python
0.000019
387b5732c0b2231580ae04bf5088ef7ce59b0d84
Add script to normalize the spelling in a dataset
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...
Python
0.000008
dee535c8566d0e542891ed10939eec6448483a6f
read in cenque galaxy catalog
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...
Python
0
65e689dd66124fcaa0ce8ab9f5029b727fba18e2
Add solution for compare version numbers
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...
Python
0
0da01e405849da1d5876ec5a758c378aaf70fab2
add the canary
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. """ # ...
Python
0.999998
c370edc980a34264f61e27d0dd288a7d6adf2d7e
Create consumer.py
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)
Python
0.000005
70b312bde16a8c4fca47e4782f2293f0b96f9751
Add test_datagen2.py
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) ...
Python
0.000213
2dd5afae12dc7d58c3349f2df2694eeb77ca0298
Test driving robot via serial input
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) ...
Python
0
f1826205782eb56ba6b478c70e671acae6872d35
Read similarity graph
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_...
Python
0.000016
e598608f21e30aeeec1ea9a8f452047a270fdc4d
add setup.py to build C module 'counts'; in perspective, it should setup cbclib on various systems
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"])] )
Python
0.000002
22769c9d84de432034ef592f94c77b5d5111599d
Create argparser.py
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...
Python
0.000418
ee52a96c5d0b6c08cb4e97210f3f995f78951fdc
add relay file to project
cgi-bin/moneywatch-relay.py
cgi-bin/moneywatch-relay.py
#!/usr/bin/python #=============================================================================== # Code written by James Ottinger #=============================================================================== import sys sys.path.append('/dirsomewhere/') import moneywatchengine #==================================...
Python
0
dbe76ab17e795540de6a53b22f90c8af0cb15dbe
Add constants example
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'...
Python
0.000011
d777a19bb804ae1a4268702da00d3138b028b386
Add a python script to start sysmobts-remote and dump docs
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...
Python
0.000001
436119b2ef8ea12f12b69e0d22dd3441b7e187cd
add ratelimit plugin
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...
Python
0
83579a7e10d66e29fc65c43ba317c6681a393d3e
Add simple hub datapath
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...
Python
0
d753fe46507d2e829c0b6ffc3120ec8f9472c4f1
Add Problem 59 solution.
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...
Python
0.000007
d1fcf47d62671abbb2ec8a278460dd64a4de03c2
Create cryptoseven.py
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 ...
Python
0.000001
a890be194cfcb69fb4b847d7ec06cf324d868bc9
Create base-code.py
base-code.py
base-code.py
#Base Code of project written in Python 3 import binascii import re import random BIGCOUNT = 1 div = 0 effcount = 0 while (BIGCOUNT <= 1000000): n = 2 binary = str(bin(int.from_bytes('The quick brown fox jumps over the lazy dog THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG!!@#$%^&*()<>?:"{} . , / \ |[] 0 1 2 3 ...
Python
0.000017
baeecbd66e1acd48aa11fdff4c65567c72d88186
Create client.py
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_...
Python
0.000001
22494a45d2bce6774bdc50409a71f259841287f5
add initial GlimError
glim/exception.py
glim/exception.py
class GlimError(Exception): pass
Python
0.01808
151599dd242eb0cb0da4771ca3798d66314719f0
add queue module
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 ...
Python
0.000001
8d5059fcd672fb4f0fcd7a2b57bf41f57b6269e5
add mongo handler
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)...
Python
0.000001
90ec9def45bcc50047d3511943c463f57f771f00
Bump to 3.2.0
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...
Python
0.00008
2c29829bb6e0483a3dc7d98bc887ae86a3a233b7
Fix dir name of preprocess
pyPanair/preprocess/__init__.py
pyPanair/preprocess/__init__.py
Python
0.998086
3e7f8c5b87a85958bd45636788215db1ba4f2fd8
Create __init__.py
src/site/app/model/__init__.py
src/site/app/model/__init__.py
# -*- coding: utf-8 -*-
Python
0.000429
38c2291ab23d86d220446e594d52cce80ea4ec2a
Create Count_Inversions_Array.py
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...
Python
0.000003
cebee9931f38531717f907502a1da04da659c5c2
Add missing migration
app/groups/migrations/0008_auto__add_groupcategory__add_field_groupinformation_category.py
app/groups/migrations/0008_auto__add_groupcategory__add_field_groupinformation_category.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'GroupCategory' db.create_table('groups_groupcategory', ( ('id', self.gf('django....
Python
0.0002
59b531e11266b2ff8184c04cda92bcc2fad71fa0
Create core.py
crispy/actions/core.py
crispy/actions/core.py
from crispy.actions.attacks import Attack, Melee, Ranged, Throw, Shoot
Python
0.000001
d6dc45756cbb30a8f707d683943ccd4ee0391e6b
Add an aws settings for the cms
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...
Python
0
b32d659b85901a8e04c6c921928483fda3b3e6e0
Add the storage utility for parsing the config file structure in a more readable fashion.
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 ...
Python
0
49a4d3d5bfed0bb12a0e4cdee50672b23533c128
move data to new table
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_...
Python
0.000003
412de29818c955d878895ab31f54ef3079aa8d0e
Compute the quantity of fuel consumed
openfisca_france_indirect_taxation/example/example_ticpe/compute_quantite_carburants.py
openfisca_france_indirect_taxation/example/example_ticpe/compute_quantite_carburants.py
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 14:32:30 2015 @author: thomas.douenne """ from __future__ import division import numpy as np from openfisca_france_indirect_taxation.example.utils_example import simulate_df from openfisca_france_indirect_taxation.model.get_dataframe_from_legislation.get_accises imp...
Python
0.999989
7c8f2464b303b2a40f7434a0c26b7f88c93b6ddf
add migration
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', ...
Python
0.000001
5e765ecf387d52c22371a69df82beacddcd12e38
Test COREID is read-only.
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...
Python
0
6af41b8b1ff4a6eb28167a063668a1f173999e5c
Create cornersMapping.py
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...
Python
0.000001
b2d0eaca41f6c697006eeaef38b72af649415d2b
Create models.py
{{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
Python
0.000001
d1b4cbfbc3956fc72bd183dbc219c4e7e8bdfb98
add reproducer for LWT bug with static-column conditions
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...
Python
0.000043
89c17110f9d17e99ea7686e884cfba91b4762d57
Add starter code for Lahman db
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...
Python
0
8eafb1b613363f85c9b105812cd5d0047e5ca6ff
Add warp example script
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], ...
Python
0
77dfcc41b718ed26e9291b9efc47b0589b951fb8
Create 0001.py
pylyria/0001/0001.py
pylyria/0001/0001.py
1
Python
0.000252
d412ec65777431cdd696593ddecd0ee37a500b25
Create 0011.py
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()...
Python
0.000054
0f4700ee5fccb0cc3996f19f4d6afae7fe1da3a0
Add file for concatenating and splitting bzip files
python/split_bzip.py
python/split_bzip.py
#!/usr/bin/env python ####### ####### split_bzip.py ####### ####### Copyright (c) 2011 Ben Wing. ####### import sys, re import math import fileinput from subprocess import * from nlputil import * import itertools import time import os.path import traceback ############################################################...
Python
0
db38238b26c4050122c0902f162c1dc84358e66d
Create features.py
dasem/features.py
dasem/features.py
"""features. Usage: dasem.features lines-to-feature-matrix [options] Options: --debug Debug messages. -h --help Help message -i --input=<file> Input file --ie=encoding Input encoding [default: utf-8] --oe=encoding Output encoding [default: utf-8] -o --output=<file> O...
Python
0
5052318d2802284a0331fc77fd7d02bdaca39f42
test if a layer is working fine
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...
Python
0.000004
47ebaa10068313c9b8fbbf2e3ffcf06597f88ff6
add npy2png file converter
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)) ...
Python
0
211e9e9352234f5638036b5b1ec85f998609d587
Add a primitive MITM proxy
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...
Python
0.000066
e6c60057a3c5d3f985633bdcbc0a6477d9ebe6c4
Add MediaSaver.py
tools/tcam-capture/tcam_capture/MediaSaver.py
tools/tcam-capture/tcam_capture/MediaSaver.py
# Copyright 2018 The Imaging Source Europe GmbH # # 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 ...
Python
0
d890ef34b11200738687ec49a4a005bb9ebe7c2a
make the module executable
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:
Python
0
768b61316a10726a3281a514823f280abc142356
move wild into its own folder
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...
Python
0
c193aebdc76eae285df402463c149bef328c05ef
Add backwards-compatible registration.urls, but have it warn pending deprecation.
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 *
Python
0
fe88e0d8dc3d513cd11ef9ab4cb3ea332af99202
Add migration
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...
Python
0.000002
b82c7343af06c19e6938bd27359289ab067db1e9
add expectation core (#4357)
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...
Python
0
10001d5c611e59dd426d829fa7c2242b5f93df0d
add element collection base
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): ...
Python
0
a27c9a8ddf6ab1cd264b02afc95754da6b4bb058
Add partial indexes
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...
Python
0.000056
2f582fa86aa5a8d47a066b4b47fd3425377dc05c
question 1.8
crack_1_8.py
crack_1_8.py
''' according http://hawstein.com/posts/1.8.html algorithm is that str1= "12345",str2= "51234" str1 = str1 + str1 = "1234512345" as a result, str2 is subString of str1 ''' str1 = 'abcdefghi' str2 = 'ihgfedcba' def isSubString(str1, str2): if str2 in str1: return True return False def isRotation(str1, str2): if i...
Python
0.999705
07fcdfe3da7d5ffda3ff7139b2f8cd0f02a5ad06
Create xml_to_text_new.py
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 ...
Python
0.000001
48e4b9692b29d3fb9f43f37fef70ccc41f47fc0e
Add tests for the errors utility functions
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,...
Python
0.000001
e88795cb11503261c111a0f2c8353a29a7dc1ccc
Add face-aware average
average.py
average.py
import os import sys import numpy as np import time import cv2 # Deterimens if a photo is a face and returns a scaled image if it is. Returns # False if it is not a face. # Params: # path - path to the image # haar_map - path to the haar_cascade training data # pw - the picture width # ph - the picture height ...
Python
0.998734
4c225ec7cdafc45840b2459e8804df5818fecd71
add util module
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
Python
0.000001
ddfc28360941a435ae22705dbc46b44cced588e7
Add demo file.
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...
Python
0
0f9488588ea66b881cdebf11a42377cb44845a5c
added day6-1a.py. combines transposing input list and function call into single list comprehension
day6/day6-1a.py
day6/day6-1a.py
"""--- Day 6: Signals and Noise --- Something is jamming your communications with Santa. Fortunately, your signal is only partially jammed, and protocol in situations like this is to switch to a simple repetition code to get the message through. In this model, the same message is sent repeatedly. You've recorded the ...
Python
0.999998
8003f9f643b90cf42bdd8ba0ec8d5dc2f96ba191
Create list-aws-queue.py
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...
Python
0.00003
298f297410b9db8b2d211b1d0edddb595f1fa469
Add timestamp2str()
datetime/datetime.py
datetime/datetime.py
import datetime # ============================================================================== # TIMESTAMP 2 STR # ============================================================================== def timestamp2str(t, pattern="%Y-%m-%d %H:%M:%S"): """ ...
Python
0.000258
130b0b5d70c6f94caa1e6dbd98aa4361a9ce4d1d
add tips for relax time...
dictate_num/train.py
dictate_num/train.py
import os import sys import pyttsx import random from data import * EXIT_TAG = 'n' class CTrain(object): def __init__(self): self._eng = pyttsx.init() def pre(self): print "*"*10,"DICTATE NUMBER TRAING", "*"*10 name = raw_input("Please enter your name: ") data = CData(nam...
import os import sys import pyttsx import random from data import * EXIT_TAG = 'n' class CTrain(object): def __init__(self): self._eng = pyttsx.init() def pre(self): print "*"*10,"DICTATE NUMBER TRAING", "*"*10 name = raw_input("Please enter your name: ") data = CData(nam...
Python
0
0e9e63a48c5f3e02fb49d0068363ac5442b39e37
Add a body to posts
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...
Python
0.000001
62beb09ca1ecde8be4945016ae09beaad2dad597
Create disemvowel_trolls.py
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']])
Python
0.000001
078bc9ea1375ac8ff7b2bbb92553ae63e5190cd3
add var.py in package structData to save vars
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
Python
0
a26f0cc1af189686a24518510095f93b064a36a4
Add two utility functions for group membership
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 ( ...
Python
0.000001
316d0518f2cf81ce3045335b79bc993020befce1
create main class `FlaskQuik` for bridging quik and flask
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...
Python
0
4844ac93326186ded80147a3f8e1e1429212428b
add user's launcher
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 ...
Python
0.000001
20d77f66e0287b3aab08b4cf14f23e7e5672aefd
Create database import script for the Picks table (each NFLPool Player's picks for a given season)
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...
Python
0
ed1cd0f7de1a7bebaaf0f336ba52e04286dd87de
Create my_mapper.py
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...
Python
0.000014
8ad4627973db344e228a9170aef030ab58efdeb9
Add column order and importable objects lists
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...
Python
0
53926f18fb4f058bba9dd23fb75721d3dfa1d24b
add hashes directory
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...
Python
0.000001
8141d6cafb4a1c8986ec7065f27d536d98cc9916
Add little script calculate sample spectra.
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...
Python
0
ec0cf9c6eb8ecc69482ed08f22a760d73f420619
Add API tests
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...
Python
0.000001
55aae76ae3813045542b8f94736fdfb1e08592f2
Add chrome driver path.
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...
Python
0
56422abd9e5dbc1b17b009d84fd5e4b028719b94
add basic IPC traffic analyzer
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 ...
Python
0
561957a2492714e1b6d76b13daeced66a90aba1d
Create __init__.py
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...
Python
0.000429
3018a418b24da540f259a59a578164388b0c2686
add examples/call-gtk.py
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...
Python
0
c979fe37cc5f3dd83933893a1e7774c4aa7d061c
Add test script.
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 ...
Python
0
11bd97a647507645f90e259dd8000eb6a8001890
Add index to log_once table, make cleanup run with db cleanup event. refs #1167
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...
Python
0.000008
b3977289de72421530614ff4f28cdf7333d743e4
Add region migration validation
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):...
Python
0
f0e092b060d9afb700f027197fdf44eeb2fdd91b
Create __init__.py
__ini__.py
__ini__.py
Python
0.000429
660fc806d11c6a8af321bb14caec21ca7cba4141
add kafka streaming consumer
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'))...
Python
0
4c96e1eb17a5cbb4c1a33cef5c37aac00b4ec8e0
Update test_api.py
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...
Python
0.000004
c831e7cec02e06d9346bf6fdf0dcdf553f4f479e
Add test for interpolating NaNs
metpy/calc/tests/test_tools.py
metpy/calc/tests/test_tools.py
# Copyright (c) 2008-2015 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Tests for `calc.tools` module.""" import numpy as np import pytest from metpy.calc import (find_intersections, interpolate_nans, nearest_intersection_idx, ...
# Copyright (c) 2008-2015 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Tests for `calc.tools` module.""" import numpy as np import pytest from metpy.calc import find_intersections, nearest_intersection_idx, resample_nn_1d from metpy.testing im...
Python
0.000033