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
852ade075e69492ee4a4cd7096709b2724782180
add a management command to export details of users who submitted stories as csv
apps/stories/management/commands/export_stories_csv.py
apps/stories/management/commands/export_stories_csv.py
from django.core.management.base import BaseCommand from stories.models import Story from optparse import make_option import codecs import csv class Command(BaseCommand): args = "" help = """Dump out all comments text for Web SYS Stories python manage.py export_stories_comments --file=<path/to/...
Python
0
1ac09013e8cf89e83418de0be9d83b87a0a20634
Create mp3_exploit.py
mp3_exploit.py
mp3_exploit.py
#!/usr/bin/env python ''' Author: Chris Duffy Date: May 2015 Purpose: To provide a means to demonstrate a simple file upload proof of concept related to exploiting Free MP3 CD Ripper. ''' import struct filename="exploit.wav" fill ="A"*4112 #eip = struct.pack('<I',0x42424242) # EIP overwrite verfication eip = s...
Python
0
68ea60fd87e3e0240f82a42f0f6b4dcd65732f97
Add MQTT server example
mqtt-server.py
mqtt-server.py
#!/usr/bin/python3 # # Copyright (c) 2015-2016, Fabian Affolter <fabian@affolter-engineering.ch> # Released under the MIT license. See LICENSE file for details. # # Source: https://github.com/beerfactory/hbmqtt/blob/develop/samples/broker_start.py # import logging import asyncio import os from hbmqtt.broker import Bro...
Python
0.000001
c0b05a43e10693f8aab87a7f86726d512b7494fc
Add tenant exporter for accounting
bluebottle/clients/management/commands/export_tenants.py
bluebottle/clients/management/commands/export_tenants.py
import json from rest_framework.authtoken.models import Token from django.contrib.contenttypes.models import ContentType from django.core.management.base import BaseCommand from bluebottle.clients import properties from bluebottle.clients.models import Client from bluebottle.clients.utils import LocalTenant class C...
Python
0
dfbf888ca0b56448a4f211900b16e3c85648b241
Add migration for changing docstring of Note.is_private to unicode
editorsnotes/main/migrations/0025_auto_20160628_0913.py
editorsnotes/main/migrations/0025_auto_20160628_0913.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-06-28 09:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0024_topic_ld'), ] operations = [ migrations.AlterField( ...
Python
0
a45a0bb366ae28d38d543ce71f32f625e9b80042
add tools module
modules/tools.py
modules/tools.py
from pandas import DataFrame from pandas.tseries.tools import to_datetime #|Create time series from trade history DataFrame def time_series(df, period): ts = DataFrame(columns=('timestamp', 'price', 'high', 'low', 'open', 'amount')) tmin = int(df['timestamp'].min()) tmax = int(df['timestamp'].max()) for tsmp ...
Python
0.000001
2f4d413e14011847138d6afd27a210fc58823c8a
add certificate and key migrations
rootfs/api/migrations/0004_auto_20160124_2134.py
rootfs/api/migrations/0004_auto_20160124_2134.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-01-24 21:34 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0003_auto_20160114_0310'), ] operations = [ migrations.AlterField( ...
Python
0.000001
d1aa553f739e91cd470eea23042b6c8bcebe9b6f
add mocked integrationtest for the deprecationwarning of makeitem
testing/python/test_deprecations.py
testing/python/test_deprecations.py
import pytest from _pytest.python import PyCollector class PyCollectorMock(PyCollector): """evil hack""" def __init__(self): self.called = False def _makeitem(self, *k): """hack to disable the actual behaviour""" self.called = True def test_pycollector_makeitem_is_deprecated()...
Python
0
e348ec573a4882258466cdc2ab73da8b4dbbe256
Create pillu.py
modules/pillu.py
modules/pillu.py
#test
Python
0.000003
8e726895d1e4e27b0b9548103cd1b202de79c21e
Anonymize nginx logs
ngxtop/anonym.py
ngxtop/anonym.py
import sqlite3 import csv import datetime def main(args): # input fn_database = 'ngxtop.db' # outputs fn_workset = 'workset.csv' fn_scenario = 'scenario.csv' conn = sqlite3.connect(fn_database) cursor = conn.cursor() # Build map filename to anonym filename map_filename = build_map_filename(cursor) map_addr ...
Python
0.999552
1eb2e1390d41c65943e777a66918df87b4ee8799
Add constructive_hierarchy
constructive_hierarchy.py
constructive_hierarchy.py
'''Reason about a directed graph in which the (non-)existance of some edges must be inferred by the disconnectedness of certain vertices. Collect (truthy) evidence for boolean function return values.''' def transitive_closure_set(vertices, edges): '''Find the transitive closure of a set of vertices.''' neighbo...
Python
0.999379
25ff8c6f8bc9d70886d004f8b64f08facb8c12cf
Create Find the Celebrity sol for Leetcode
leetcode/277-Find-the-Celebrity/FindtheCelebrity_sol.py
leetcode/277-Find-the-Celebrity/FindtheCelebrity_sol.py
# The knows API is already defined for you. # @param a, person a # @param b, person b # @return a boolean, whether a knows b # def knows(a, b): class Solution(object): def findCelebrity(self, n): """ :type n: int :rtype: int """ if n < 2: return -1 candi...
Python
0
3eeaa890f0a7afcf7a6f470055c5bc0fda20ae5c
create moistureCaptor.py
captors-enabled/moistureCaptor.py
captors-enabled/moistureCaptor.py
class Captor(): id = 5 def Captor(): self.id = 5 def callback(self): moisture = 0 #start communication with server return moisture def getiId(self): return self.id
Python
0.000034
25aa486fcba631a251db4f0366d4d4f713a86f37
Add missing migration file
SigmaPi/UserInfo/migrations/0003_auto_20170204_1342.py
SigmaPi/UserInfo/migrations/0003_auto_20170204_1342.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('UserInfo', '0002_auto_20161208_1712'), ] operations = [ migrations.AlterModelOptions( name='pledgeclass', ...
Python
0.000002
5e51cda3a7441f6e31477988b1288d1497fe23d9
Add arguments snippet
code/python/snippets/arguments.py
code/python/snippets/arguments.py
""" Add command line arguments to your script. This snippet adds the default command line arguments required for any interaction with the UpGuard API. To Use: 1. Copy snippet to the top of your script 2. Populate description (this is shown when running `--help`) 3. Access arguments with `args` object, for example: `...
Python
0.000007
8bdc9c0685500b822787779b5ebffa46b00d8138
Add script
lightshow.py
lightshow.py
#!/usr/bin/sudo / usr/bin/python import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) leds = {'floor':[], 'top-left':[]} def setupled(name, pins): for i in range(0, 3): GPIO.setup(pins[i], GPIO.OUT) leds[name].append(GPIO.PWM(pins[i], 100)) setupled('floor', [11, 13,...
Python
0.000002
1a4052deb8e0ab2deb7038220ae23d7bb9311ce9
Add initial version of the script
ovf_to_facter.py
ovf_to_facter.py
#!/usr/bin/python #stdlib import json import os import subprocess from xml.dom.minidom import parseString def which(cmd): """Python implementation of `which` command.""" for path in os.environ["PATH"].split(os.pathsep): file = os.path.join(path, cmd) if os.path.exists(file) and os.access(file,...
Python
0.000001
2f0ba9368bc44cffce1dcf2ec483aabf04c2e127
add python #5
python/5.py
python/5.py
#!/usr/bin/env python ''' Problem ======= 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? Latest Run Stats ====== === ===== ''' from math import ceil from m...
Python
0.000032
fdf8cb1f0420eef27592d32f2e10066482304314
Add region protection tests for system readers
keystone/tests/unit/protection/v3/test_regions.py
keystone/tests/unit/protection/v3/test_regions.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Python
0.000001
e4139c81bf914840d7223557f1f6da926a28413b
Add bootstrap script to run playbook locally
local_run.py
local_run.py
#!/usr/bin/env python2 """Deploy CollectD on localhost for monitoring with mist.io""" import os import sys import argparse import subprocess TMP_DIR = "/tmp/mistio" VENV_VERSION = "1.11.6" ANSIBLE_VERSION = "1.7.2" PYPI_URL = "https://pypi.python.org/packages/source/" PLAYBOOK_PATH = "ansible/main.yml" def shellcm...
Python
0
d14af37197c35fa72c13746f4aef8bf296014382
添加数据库迁移 设置name为unique
experiment/migrations/0003_auto__add_unique_lessoncategory_name.py
experiment/migrations/0003_auto__add_unique_lessoncategory_name.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 unique constraint on 'LessonCategory', fields ['name'] db.create_unique(u'experiment_lessoncategory...
Python
0
459f87be465e0f5554c708fe60679494d152c8fd
Create permissions.py
templates/root/main/permissions.py
templates/root/main/permissions.py
from rest_framework import permissions class IsOwnerOrReadOnly(permissions.BasePermission): """ Custom permission to only allow owners of an object to edit it. """ def has_object_permissions(self, request, view, obj): # Read permissions are allowed to any request, # so we'll always allow GET, HEAD, or OPTIONS...
Python
0.000001
4a98686b63563b209456a8933ef34477adcdae43
extend Phabricator class and do nothing
phabricate/phab.py
phabricate/phab.py
from phabricator import Phabricator as _Phabricator class Phabricator(_Phabricator): pass
Python
0
99e2ad1c812d98bb5c952780b78097ef56fdccdc
add netflow listener
utils/netflow.py
utils/netflow.py
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Copyright (c) 2014 Mozilla Corporation # # Contributors: # Anthony Verez averez@mozilla.com imp...
Python
0.000001
cca6b0c28747a3b0307fccd33dee60fcb42d910d
Test Fix.
tests/components/garage_door/test_demo.py
tests/components/garage_door/test_demo.py
""" tests.components.garage_door.test_demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests demo garage door component. """ import unittest import homeassistant.core as ha import homeassistant.components.garage_door as gd LEFT = 'garage_door.left_garage_door' RIGHT = 'garage_door.right_garage_door' class TestGarageDoorDemo(...
""" tests.components.garage_door.test_demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests demo garage door component. """ import unittest import homeassistant.core as ha import homeassistant.components.garage_door as gd LEFT = 'garage_door.left_garage_door' RIGHT = 'garage_door.right_garage_door' class TestGarageDoorDemo(...
Python
0
67d0d381003dc02d5e1eae9d0c8591daee4b93b3
Migrate SnafuComics to single-class module.
dosagelib/plugins/snafu.py
dosagelib/plugins/snafu.py
# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function from ..scraper import _ParserScraper from ..helpers import indirectStarter...
# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function from ..scraper import _ParserScraper from ..helpers import indirectStarter...
Python
0
43cf23e793794fd45322471a52c83785070ac243
add simple_graph
simple_graph.py
simple_graph.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals class Graph(object): def __init__(self): self.gdict = {} def nodes(self): return self.gdict.keys() def edges(self): self.edges = [] for node in self.gdict: for end in self.gdict[node]: ...
Python
0.999579
d7e6291564a5d5683a8b03fc9a761ad3e3dd70ea
Bump version to stable.
usb/__init__.py
usb/__init__.py
# Copyright (C) 2009-2014 Wander Lairson Costa # # The following terms apply to all files associated # with the software unless explicitly disclaimed in individual files. # # The authors hereby grant permission to use, copy, modify, distribute, # and license this software and its documentation for any purpose, provided...
# Copyright (C) 2009-2014 Wander Lairson Costa # # The following terms apply to all files associated # with the software unless explicitly disclaimed in individual files. # # The authors hereby grant permission to use, copy, modify, distribute, # and license this software and its documentation for any purpose, provided...
Python
0
7d9b004b3fb33ed9f16ca657ddb6ee3ddf452802
add dump2pe (t2_08 sample)
elfesteem/t2_08_dump2pe.py
elfesteem/t2_08_dump2pe.py
#! /usr/bin/env python import pe from pe_init import PE import rlcompleter,readline,pdb, sys from pprint import pprint as pp readline.parse_and_bind("tab: complete") import shlex f = open('my_dump.txt', 'r') for i in xrange(27): f.readline() state = 0 funcs = [] dll = "" #parse imprec output new_dll = [] while...
Python
0
0881e326a604977bcaf385db152a96826db52b74
Add class for publishing a service on avahi
wizd/publish.py
wizd/publish.py
import dbus import gobject import avahi import threading import sys from dbus.mainloop.glib import DBusGMainLoop """ Class for publishing a service on DNS-SD using Avahi. Creates a thread to handle requests """ class ServicePublisher (threading.Thread): def __init__(self, name, type, port, txt = "", domain = "", h...
Python
0
062b4d045580adaebf30376cae1b88387dc7f3bb
add test_db
www/test_deb.py
www/test_deb.py
# coding=utf-8 from www.models import User from www.transwarp import db __author__ = 'xubinggui' db.create_engine(user='www-data', password='www-data', database='awesome') u = User(name='Test', email='test@example.com', password='1234567890', image='about:blank') u.insert() print 'new user id:', u.id u1 = User.fi...
Python
0.000001
64c24ee2813e5d85866d14cfdee8258b91c09df6
add debug topology file
evaluation/topo-fattree.py
evaluation/topo-fattree.py
"""Custom topology example Two directly connected switches plus a host for each switch: host --- switch --- switch --- host Adding the 'topos' dict with a key/value pair to generate our newly defined topology enables one to pass in '--topo=mytopo' from the command line. """ from mininet.topo import Topo class M...
Python
0.000001
58ed327ce441f41d3e9a2bff60e0c2a428b51192
add initial disk I/O benchmark script
examples/run_benchmarks.py
examples/run_benchmarks.py
import sys import os import resource import shutil import shlex import time import subprocess import random # this is a disk I/O benchmark script. It runs menchmarks # over different filesystems, different cache sizes and # different number of peers (can be used to find a reasonable # range for unchoke slots). # it a...
Python
0.000004
b3a16addda494428a69b80fe7d32b07520e1d292
Create wikinews-updater.py
wikinews-updater.py
wikinews-updater.py
#!/usr/bin/env python # -- coding: utf-8 -- import time import requests import login wn_API = "https://ru.wikinews.org/w/api.php" wp_API = "https://ru.wikipedia.org/w/api.php" ua = {"User-agent": "pyBot/latestnews (toolforge/iluvatarbot; iluvatar@tools.wmflabs.org) requests (python3)"} token, cookies = login.login(se...
Python
0
d0474ea69c9bcc5b07829603778e0277d1fd733a
fix moved Glottolog identifier of nepa1252
migrations/versions/1715ee79365_fix_missing_nepa1252_identifier.py
migrations/versions/1715ee79365_fix_missing_nepa1252_identifier.py
# coding=utf-8 """fix missing nepa1252 identifier Revision ID: 1715ee79365 Revises: 506dcac7d75 Create Date: 2015-04-15 19:34:27.655000 """ # revision identifiers, used by Alembic. revision = '1715ee79365' down_revision = '506dcac7d75' import datetime from alembic import op import sqlalchemy as sa def upgrade():...
Python
0
18e66983c49c68e9000acd331d6888c4c72a99b3
Fix mypy error.
zerver/signals.py
zerver/signals.py
from __future__ import absolute_import from django.dispatch import receiver from django.contrib.auth.signals import user_logged_in from django.core.mail import send_mail from django.conf import settings from django.template import loader from django.utils import timezone from typing import Any, Dict, Optional from zer...
from __future__ import absolute_import from django.dispatch import receiver from django.contrib.auth.signals import user_logged_in from django.core.mail import send_mail from django.conf import settings from django.template import loader from django.utils import timezone from typing import Any, Dict, Optional def get...
Python
0
2749b4b754562c45a54b3df108c5c40c8d548038
Create __init__.py
web/__init__.py
web/__init__.py
Python
0.000429
1396ff4ab4e6664c265f97958951815a525f7823
Remove confusing navigation tabs from header.
reddit_donate/pages.py
reddit_donate/pages.py
from r2.lib.pages import Reddit from r2.lib.wrapped import Templated class DonatePage(Reddit): extra_stylesheets = Reddit.extra_stylesheets + ["donate.less"] def __init__(self, title, content, **kwargs): Reddit.__init__( self, title=title, content=content, ...
from r2.lib.pages import Reddit from r2.lib.wrapped import Templated class DonatePage(Reddit): extra_stylesheets = Reddit.extra_stylesheets + ["donate.less"] def __init__(self, title, content, **kwargs): Reddit.__init__( self, title=title, content=content, ...
Python
0
307feb3f32fa31faa5754616a1e78c9ad03b0483
test to demonstrate bug 538
tests/text/ELEMENT_CHANGE_STYLE.py
tests/text/ELEMENT_CHANGE_STYLE.py
#!/usr/bin/env python '''Test that inline elements can have their style changed, even after text has been deleted before them. [This triggers bug 538 if it has not yet been fixed.] To run the test, delete the first line, one character at a time, verifying that the element remains visible and no tracebacks are printed...
Python
0
3df697b29931025a9c6f3f809eda2260d4211305
Add LayerNorm class
thinc/neural/_classes/layernorm.py
thinc/neural/_classes/layernorm.py
from ... import describe from .model import Model def _init_to_one(W, ops): W.fill(1.) def _run_child_hooks(model, X, y=None): for hook in model.child.on_data_hooks: hook(model.child, X, y) model.nO = model.child.nO @describe.on_data(_run_child_hooks) @describe.attributes( G=describe.Weight...
Python
0
eefa1f039d935a7242bb14bdb6f672db1ff24302
Create omega-virus.py
omega-virus.py
omega-virus.py
#!/usr/bin/python # # Insert docopt user help menu here? # # # End docopt # def sectors() # Blue # Green # Red # Yellow def roomList() # List of rooms # Green (open rooms) # Blue (requires blue key) # Red (requires red key) # Yellow (requires yellow key) def roomContents() # Each room can have one of: ...
Python
0
2c9ff7a0c84c953b815da9db10cc24bbf34444e0
Create precipitation.py
precipitation.py
precipitation.py
# -*- coding: utf8 -*- import os import numpy as np from myfunctions import station,stationNo,DATAPATH,days36x from variables import R ''' 要素 ''' precipitation = ['累计降水量','日降水量大于等于0.1mm日数','日降水量大于等于1mm日数',\ '小雨日数','中雨日数','大雨日数','暴雨日数'] # 定义函数 R_addtod,调用方式如下: # d = R_addtod(filename,d) def R_addtod(f...
Python
0.000082
04f937a24279699164278d47fc5d0790a9062132
add gunicorn.py
wsgi_gunicorn.py
wsgi_gunicorn.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from werkzeug.contrib.fixers import ProxyFix from app import create_app app = create_app() app.wsgi_app = ProxyFix(app.wsgi_app) if __name__ == '__main__': app.run(host='0.0.0.0')
Python
0.007978
6036f03328d4908b268fa1256b552d588dbcbfc8
Add pytest unit test for Scenario Loop model. Refs #142
tests/unit/test_scenarioloop.py
tests/unit/test_scenarioloop.py
# -*- coding: utf-8 -*- """ radish ~~~~~~ Behavior Driven Development tool for Python - the root from red to green Copyright: MIT, Timo Furrer <tuxtimo@gmail.com> """ from radish.scenarioloop import ScenarioLoop from radish.iterationscenario import IterationScenario from radish.background import Bac...
Python
0
d254428e484172ccd0a0763eb989241b08a26c3b
string compress kata second day
string-compress-kata/day-2.py
string-compress-kata/day-2.py
# -*- codeing: utf-8 -*- class Compressor(object): def compress(self, toCompress): if toCompress is None: return "" else: compressed = [] index = 0 length = len(toCompress) while index < length: counter = 1 ...
Python
0.999077
a81f39089b4c60e2cb05ea892afacbcbea6f1c5d
add tests for oxml_parser
tests/oxml/test___init__.py
tests/oxml/test___init__.py
# encoding: utf-8 """ Test suite for pptx.oxml.__init__.py module, primarily XML parser-related. """ from __future__ import print_function, unicode_literals import pytest from lxml import etree, objectify from pptx.oxml import oxml_parser class DescribeOxmlParser(object): def it_enables_objectified_xml_pars...
Python
0.000001
f8c3feaf3f400cbcf3e04d9705f0cb36d083c6d7
Include migratio for ProductPlan.
conductor/accounts/migrations/0012_productplan.py
conductor/accounts/migrations/0012_productplan.py
# Generated by Django 2.0.9 on 2018-11-08 02:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("accounts", "0011_auto_20180831_0320")] operations = [ migrations.CreateModel( name="ProductPlan", fields=[ ( ...
Python
0
886328640f5665c337bb9dd1f065cc0e350364f0
Convert some cli tests to pytest.
tests/unit/cli/main_test.py
tests/unit/cli/main_test.py
from __future__ import absolute_import from __future__ import unicode_literals import logging import pytest from compose import container from compose.cli.errors import UserError from compose.cli.formatter import ConsoleWarningFormatter from compose.cli.main import build_log_printer from compose.cli.main import conv...
from __future__ import absolute_import from __future__ import unicode_literals import logging from compose import container from compose.cli.errors import UserError from compose.cli.formatter import ConsoleWarningFormatter from compose.cli.main import build_log_printer from compose.cli.main import convergence_strateg...
Python
0.999992
4db13bdab18934bebcfe5b102044f936e0eab892
Add a place to put random stuff and a list of components as a python module.
etc/component_list.py
etc/component_list.py
COMPONENTS = [ "AdaBoost", "AutoInvert", "AutoMlpClassifier", "BiggestCcExtractor", "BinarizeByHT", "BinarizeByOtsu", "BinarizeByRange", "BinarizeBySauvola", "BitDataset", "BitNN", "BookStore", "CascadedMLP", "CenterFeatureMap", "ConnectedComponentSegmenter", "CurvedCutSegmenter", "CurvedCutWithCcSe...
Python
0
f7aeb7a708ef2e40546d27d480073fdc113d639e
Add check_babel_syntax ; see note below
unnaturalcode/check_babel_syntax.py
unnaturalcode/check_babel_syntax.py
#!/usr/bin/python # Copyright 2017 Dhvani Patel # # This file is part of UnnaturalCode. # # UnnaturalCode 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 Licen...
Python
0
3196eeb928c5715ba20d21d0d16a3087938bf6c9
Add tools/compute_bottleneck.py.
tools/compute_bottleneck.py
tools/compute_bottleneck.py
#!/usr/bin/env python # # Copyright 2016 The Open Images Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
Python
0
d7568806a81c52f268673422dbbe60117f4b490c
Add plugins test cases
tests/test_plugin.py
tests/test_plugin.py
from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth import get_user_model from api_bouncer.models import Api User = get_user_model() class ConsumerKeyTests(APITestCase): def setUp(self): self.superuser = User.objects.create_superuser( 'john'...
Python
0.000001
b29fe95eb2cb86a7ae9170fbf8ceb2533bc84578
Add the photo.index module (with minimal functionality so far).
photo/index.py
photo/index.py
"""Provide the class Index which represents an index of photos. """ import os import os.path import fnmatch from collections import MutableSequence import yaml class Index(MutableSequence): defIdxFilename = ".index.yaml" def __init__(self, idxfile=None, imgdir=None): super(Index, self).__init__() ...
Python
0
eff993eac0924299cd273d0c582e24c57f2c4a84
Add 263-ugly-number.py
263-ugly-number.py
263-ugly-number.py
""" Question: Ugly Number Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7. Note that 1 is typically treated as an ugl...
Python
0.999999
063096a5b52945666ec2d61bfe5201ad53461614
Create rhn-channel-add-scl.py
rhn-channel-add-scl.py
rhn-channel-add-scl.py
#!/usr/bin/python import xmlrpclib import sys, array """RHN Satellite API setup""" SATELLITE_URL = "https://rhn.domain.tld/rpc/api" SATELLITE_LOGIN = "username" SATELLITE_PASSWORD = "password" """If the user didn't specify any hosts, show usage.""" if len(sys.argv) < 2: sys.exit("Usage:\n\t"+sys.argv[0]+" <hostna...
Python
0.000002
cd44e4a62e8c8f8ddba0634ccc0bb157f7745726
add 129
vol3/129.py
vol3/129.py
def A(n): if n % 5 == 0: return 1 x = 1 ret = 1 while x != 0: x = (x * 10 + 1) % n ret += 1 return ret if __name__ == "__main__": LIMIT = 10 ** 6 i = LIMIT + 1 while A(i) <= LIMIT: i += 2 print i
Python
0.999994
a8663257ad4b4d0688c54d0e94949ab602c61561
allow validation for empty/missing @brief.
util/py_lib/seqan/dox/validation.py
util/py_lib/seqan/dox/validation.py
#!/usr/env/bin python """Some validation for proc_doc.Proc*""" __author__ = 'Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>' class ProcDocValidator(object): """Validate proc_doc.Proc* objects. Implements the visitor pattern. """ def __init__(self, msg_printer): self.msg_printer = msg_print...
#!/usr/env/bin python """Some validation for proc_doc.Proc*""" __author__ = 'Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>' class ProcDocValidator(object): """Validate proc_doc.Proc* objects. Implements the visitor pattern. """ def __init__(self, msg_printer): self.msg_printer = msg_print...
Python
0
e1087ac3c07e5b25c1f60ef82e8785973fa5bb79
add an event_tracer module
traits/util/event_tracer.py
traits/util/event_tracer.py
# This software is OSI Certified Open Source Software. # OSI Certified is a certification mark of the Open Source Initiative. # # Copyright (c) 2013, Enthought, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following co...
Python
0.000001
0ede4e22370a3f8217fee8ff995a9c7057d8b00b
Add test for redis test helper
vumi_http_retry/tests/test_redis.py
vumi_http_retry/tests/test_redis.py
import json from twisted.trial.unittest import TestCase from twisted.internet.defer import inlineCallbacks from vumi_http_retry.tests.redis import create_client, zitems class TestRedis(TestCase): @inlineCallbacks def setUp(self): self.redis = yield create_client() @inlineCallbacks def tearD...
Python
0
d0237f2b77a49933a4b22b43f967e414be196ff4
Add sysmod module to replace old introspection modules
salt/modules/sysmod.py
salt/modules/sysmod.py
''' The sys module provides information about the available functions on the minion. ''' def __virtual__(): ''' Return as sys ''' return 'sys' def doc(module=''): ''' Return the docstrings for all modules, these strings are aggregated into a single document on the master for easy reading....
Python
0
fa55ceb71ff254f8ed3413a35acfe20da7c03a91
Create BT Comm wrapper class
rxbtcomm.py
rxbtcomm.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2016 F Dou<programmingrobotsstudygroup@gmail.com> # See LICENSE for details. import bluetooth import logging class RxBtComm(object): """BT communication wrapper: Attributes: addy: A string representing the device address. name: A stri...
Python
0
4053aa99100e2fdc1a342a472492f53138a66d6b
Add internal utils module
pies/_utils.py
pies/_utils.py
""" pies/_utils.py Utils internal to the pies library and not meant for direct external usage. Copyright (C) 2013 Timothy Edmund Crosley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in t...
Python
0.000001
dda01f555231b93b91b71a528c210dd722e370d2
Add flat type driver unittests
neutron/tests/unit/ml2/test_type_flat.py
neutron/tests/unit/ml2/test_type_flat.py
# Copyright (c) 2014 Thales Services SAS # 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 r...
Python
0.000001
b52b4cb39029d55a06e15b527cb4789e2988093d
Add word2vec example
word2vec.py
word2vec.py
from pyspark.sql import SparkSession from pyspark.ml.feature import Word2Vec def main(): spark = SparkSession.builder \ .appName("Spark CV-job ad matching") \ .config("spark.some.config.option", "some-value") \ .master("local[*]") \ .getOrCreate() # Input data: Each row is a b...
Python
0.002897
9607c55eacfd58704a4e83a2476471aa2da6124c
add package py-doxypypy (#3284)
var/spack/repos/builtin/packages/py-doxypypy/package.py
var/spack/repos/builtin/packages/py-doxypypy/package.py
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
83fa6b23563903192376a3419b460b9b06479248
Add procstat.py
src/procstat.py
src/procstat.py
import os.path import argparse import logging logging.basicConfig(level=logging.DEBUG) class Procstat(): PROCSTATPATH = '/proc/%d/stat' STATLIST = ( 'pid', 'comm', 'state', 'ppid', 'pgrp', 'session', 'tty_nr', 'tpgid', 'flags', 'minflt', 'cminflt', 'mjflt', 'cmajflt', 'utime', 'stime'...
Python
0
0728e6a4f8f06e1d4d137259f76796d1dbfa1a9d
add a wsgi.py that eagerly reads in POSTdata
edx_ora/wsgi_eager.py
edx_ora/wsgi_eager.py
""" WSGI config for ora project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` sett...
Python
0
fb336764f1a95d591e04f0061009c555b7217274
Create FoodDiversity.py
FoodDiversity.py
FoodDiversity.py
import csv import math import collections from collections import Counter # EntFunc calculates the Shannon index for the diversity of venues in a given zip code. def EntFunc(list,list2): k = 0 Entropy = 0 for k in range(0, len(BusinessName)): if BusinessName[k] != BusinessName[k - 1]: p...
Python
0
388a7eea596fdbcd79005b06d26d54b182b75696
add package
package.py
package.py
# coding=UTF-8 #!/usr/bin/python ''' 文件夹结构 --zip animate unzip.py release ''' import os, sys, zipfile import shutil import commands # Config dir = "equip" output = "output" def texturePacker(floder, oriName): ''' 打包图片 ''' target = "../" + floder + "/" #pwd...
Python
0.000001
40d687be843e3de56eb00a028e07866391593315
Add defaults.py
salt/defaults.py
salt/defaults.py
# -*- coding: utf-8 -*- ''' Default values, to be imported elsewhere in Salt code Do NOT, import any salt modules (salt.utils, salt.config, etc.) into this file, as this may result in circular imports. ''' # Default delimiter for multi-level traversal in targeting DEFAULT_TARGET_DELIM = ':'
Python
0
26db82fd8560d54b1f385814b8871e6fba42fa91
Add Linked List (#71)
utilities/python/linked_list.py
utilities/python/linked_list.py
# Singly-Linked List # # The linked list is passed around as a variable pointing to the # root node of the linked list, or None if the list is empty. class LinkedListNode: def __init__(self, value): self.value = value self.next = None def linked_list_append(linked_list, value): '''Appends a va...
Python
0
e3fada7038509faa7f057d37d485f15f7851196b
Create ProgramCheckAndUpdate.py
scripts/ProgramCheckAndUpdate.py
scripts/ProgramCheckAndUpdate.py
# ------------------------------------------------------------------------------ # Copyright 2013 Esri # 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/LICEN...
Python
0
43510585fcf2d9bd3953f3a4948f3aaebbc00e10
Add pyglet.info
pyglet/info.py
pyglet/info.py
#!/usr/bin/env python '''Get environment information useful for debugging. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: $' _first_heading = True def _heading(heading): global _first_heading if not _first_heading: print else: _first_heading = False print heading print...
Python
0
52dc608438940e098900e1380f11ee3094c118ae
Add log file in script higher_education and add download by year.
scripts/data_download/higher_education/create_files.py
scripts/data_download/higher_education/create_files.py
# -*- coding: utf-8 -*- ''' python scripts/data_download/higher_education/create_files.py en scripts/data/higher_education/en/ 2009 ''' from collections import namedtuple from datetime import datetime import pandas as pd import os import bz2 import sys import logging import imp def local_imports(): global comm...
Python
0
3de2e625af9047b64cc2718e6e79be0c428b6ae7
Solve Code Fights extract each kth problem
CodeFights/extractEachKth.py
CodeFights/extractEachKth.py
#!/usr/local/bin/python # Code Fights Extract Each Kth Problem def extractEachKth(inputArray, k): return [e for i, e in enumerate(inputArray) if (i + 1) % k != 0] def main(): tests = [ [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3, [1, 2, 4, 5, 7, 8, 10]], [[1, 1, 1, 1, 1], 1, []], [[1, 2, 1, ...
Python
0.000853
0f1f96ce23ab89c8de3cf24645c4ea77fa2a9196
add first test with random data
test_window.py
test_window.py
from telescope import LST from windows import TelescopeEventView import tkinter as tk import numpy as np lst = LST(0, 0, 0) root = tk.Tk() viewer1 = TelescopeEventView(root, lst, np.random.normal(size=lst.n_pixel)) viewer2 = TelescopeEventView(root, lst, np.random.normal(size=lst.n_pixel)) viewer1.pack(side=tk.LEFT, ...
Python
0.000001
60b5948508a67cb213ca04b5faacb77e27d8f84c
Add fields expicitly declared in form
samples/forms.py
samples/forms.py
import datetime #for checking renewal date range. from django import forms from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from .models import (Patient, AdmissionNote, FluVaccine, CollectionType, CollectedSample, Symptom, ObservedSymptom, ) from fioc...
import datetime #for checking renewal date range. from django import forms from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from .models import (Patient, AdmissionNote, FluVaccine, CollectionType, CollectedSample, Symptom, ObservedSymptom, ) from fioc...
Python
0
5ca9e468b9709ae2c7358551a19e668e580ea396
add deserialized json object validation functions
src/validate.py
src/validate.py
from collections import Counter modeltypes = set(["asymmetric_beta_bernoulli", "normal_inverse_gamma", "pitmanyor_atom", "symmetric_dirichlet_discrete", "poisson_gamma"])]) def assert_map_consistency(map_1, map_2): assert(len(map_1)==len(map_2)) for key in map_1: assert(key == map_2[map_1[key]]) def ...
Python
0
827828dc479f295e6051d69c919f5f1c97dcb6e2
Add management command to verify MOTECH connection certificates.
corehq/motech/management/commands/verify_motech_connection_certs.py
corehq/motech/management/commands/verify_motech_connection_certs.py
from urllib.parse import urlparse, urlunparse import requests from django.core.management.base import BaseCommand from requests.exceptions import SSLError from corehq.motech.models import ConnectionSettings from corehq.util.log import with_progress_bar IMPLICIT_HTTPS_PORT = 443 class Command(BaseCommand): he...
Python
0
fc017a578a402b3d24523d1a41b7a4fdc0b107ef
add a starter proxy script
scripts/proxy.py
scripts/proxy.py
#!/usr/bin/env python ''' Copyright (C) Kalan MacRow, 2013 This code is distributed with jquery.instagram.js under the MIT license. https://github.com/kmacrow/jquery.instagram.js ''' import os import cgi import sys import cgitb import urllib2 # Base URL for Instagram API endpoints INSTAGRAM_BASE = 'https://...
Python
0
a319f2f1606a5c4d33e846b496e555140607c98d
Add track_name script
track_names.py
track_names.py
import midi import sys def track_name(track): for ev in track: if isinstance(ev, midi.TrackNameEvent): return ''.join(map(chr, ev.data)) name = 'no name, first 6 events:' for ev in track[:6]: name += '\n %s' % ev return name def main(argv): if len(argv) < 2: print 'usage: track_names.py...
Python
0.000002
877a7b7449a1d88c14633376a2dfaca8c619c26a
Add solution to exercis 3.6.
exercises/chapter_03/exercise_03_06/exercise_03_06.py
exercises/chapter_03/exercise_03_06/exercise_03_06.py
# 3-6 Guest List guest_list = ["Albert Einstein", "Isac Newton", "Marie Curie", "Galileo Galilei"] message = "Hi " + guest_list[0] + " you are invited to dinner at 7 on saturday." print(message) message = "Hi " + guest_list[1] + " you are invited to dinner at 7 on saturday." print(message) message = "Hi " + guest_l...
Python
0
5c7538ca1e43eb4529c04169a9a15c513bc3e659
Add segment_tangent_angle tests module
tests/plantcv/morphology/test_segment_tangent_angle.py
tests/plantcv/morphology/test_segment_tangent_angle.py
import pytest import cv2 from plantcv.plantcv import outputs from plantcv.plantcv.morphology import segment_tangent_angle @pytest.mark.parametrize("size", [3, 100]) def test_segment_tangent_angle(size, morphology_test_data): # Clear previous outputs outputs.clear() skel = cv2.imread(morphology_test_data.s...
Python
0.000001
6d2d224d246569a35a7b4ae5d8086e83bbb67155
move server.py to project dir
server/server.py
server/server.py
from datetime import datetime import json from http.server import BaseHTTPRequestHandler, HTTPServer SERVER_PORT = 90 HOST_ADDRESS = '' def save_data(user_email): file = open('users.txt', 'a+') current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') file.write("{}, {}".format(user_email, current_time...
Python
0
a8db8c0448d98e2de0e662581542bd644e673c7c
Add migration removing generated objects with factories
geotrek/core/migrations/0018_remove_other_objects_from_factories.py
geotrek/core/migrations/0018_remove_other_objects_from_factories.py
# Generated by Django 2.0.13 on 2020-04-06 13:40 from django.conf import settings from django.contrib.gis.geos import Point, LineString from django.db import migrations def remove_generated_objects_factories(apps, schema_editor): ComfortModel = apps.get_model('core', 'Comfort') PathSourceModel = apps.get_mod...
Python
0
3ddf1f4a2bcae247978b66fd63848b3ed9782234
add donwloader
MistDownloader.py
MistDownloader.py
#!/usr/bin/python # -*- coding: utf-8 -*- import urllib import os import time import sys import traceback cnt=0 least_cnt=0 if len(sys.argv)==2: least_cnt=int(sys.argv[1]) print least_cnt if not os.path.exists("mp3"): os.mkdir("mp3") for path,dirname,filenames in os.walk("outdir"): for filename in...
Python
0.000014
5f91091456931ed7e95e8aa05ad53134f5784f60
Create summary_plot.py
summary_plot.py
summary_plot.py
## script to plot the output ## from fermipy,given a .npy file ## Sara Buson, Oct. 2017 ## very basic, need to implement better ## the reading of png, laoding the npy import numpy as np import matplotlib.pyplot as plt from matplotlib.legend_handler import HandlerLine2D import sys from matplotlib.cbook import get_sa...
Python
0.000067
54e3d3147feb33f21c5bc78a8f3b4721574fcbb9
Create A.py
Google-Code-Jam/2017-1B/A.py
Google-Code-Jam/2017-1B/A.py
import os import sys script = __file__ scriptPath = os.path.dirname(script) scriptFile = os.path.basename(script)[0] files = [f for f in os.listdir(scriptPath) if scriptFile in f and '.in' in f] if '{}-large'.format(scriptFile) in str(files): size = 'large' elif '{}-small'.format(scriptFile) in str(files): size =...
Python
0.000004
607bd42a40b8f9909e3d889b6b9011b4d14a4e52
add nexpose.py
nexpose.py
nexpose.py
#!/usr/bin/python3 import xml.etree.ElementTree as etree import urllib.request import urllib.parse import sys import ssl __author__ = 'Nick Levesque <nick@portcanary.com>' # Nexpose API wrapper. class Nexpose: def __init__(self, hostname, port): self.hostname = hostname self.port = port self.url = 'https://%s:...
Python
0.000001
a067c18f8534d79a85538eaf11e34e99f9e17286
develop update to pair master, going to rename master now
oh_shit.py
oh_shit.py
from app import app, db from app.mod_sms.models import * ug1 = UserGroup(name='Canyon Time', phone='+17868378095', active=True) ug2 = UserGroup(name='test', phone='+18503783607', active=True) ryan = User(fname='Ryan', lname='Kuhl', phone='+13058985985', active=True) simon = User(fname='Simon', lname='', phone='+1310...
Python
0
01c98087541828421da49295abedd3d894cdb3b5
Create luz.py
opt/luz.py
opt/luz.py
#!/usr/bin/env python # Realizado por: Roberto Arias (@bettocr) # # Permite encender y apagar luces leds # import RPi.GPIO as GPIO, time, os GPIO.setmode(GPIO.BCM) on = 0 # luces encendidas MAX=5200 # luminocidad maxima antes de encender el led, entre mayor mas oscuro PIN=23 # pin al relay PINRC=24 #pin qu...
Python
0.000028
87af377fab216e3db9ad700e124b356b15da492f
add form_register.py
7.验证码处理/1.form_register.py
7.验证码处理/1.form_register.py
#!/usr/bin/env python # coding:utf-8 import csv import string import urllib import urllib2 import cookielib import lxml.html import pytesseract from PIL import Image from io import BytesIO REGISTER_URL = 'http://example.webscraping.com/places/default/user/register' def parse_form(html): """从表单中找到所有的隐匿的input变量属...
Python
0.000002
fe186bf85472cf4e683d9838e36e60c680e6dc77
Add test
python/ql/test/library-tests/PointsTo/new/code/w_function_values.py
python/ql/test/library-tests/PointsTo/new/code/w_function_values.py
def test_conditoinal_function(cond): def foo(): return "foo" def bar(): return "bar" if cond: f = foo else: f = bar sink = f() return sink f_false = test_conditoinal_function(False) f_true = test_conditoinal_function(True) def foo(): return "foo" def ...
Python
0.000319
1afb7bb7b1f3e8ef3070f1100dac683b2b8254ee
remove unused table
xbrowse_server/base/migrations/0003_delete_xhmmfile.py
xbrowse_server/base/migrations/0003_delete_xhmmfile.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('base', '0002_auto_20160117_1843'), ] operations = [ migrations.DeleteModel( name='XHMMFile', ), ]
Python
0.000013
49c673c5c8374867fc9bf026717fe137bdba84bc
Add test file for graph.py and add test of Greengraph class constructor
greengraph/test/test_graph.py
greengraph/test/test_graph.py
from greengraph.map import Map from greengraph.graph import Greengraph from mock import patch import geopy from nose.tools import assert_equal start = "London" end = "Durham" def test_Greengraph_init(): with patch.object(geopy.geocoders,'GoogleV3') as mock_GoogleV3: test_Greengraph = Greengraph(start,end)...
Python
0
54553efa024d74ec60647ea7616191a52fe9948f
Add a command to create collaborator organisations
akvo/rsr/management/commands/create_collaborator_organisation.py
akvo/rsr/management/commands/create_collaborator_organisation.py
# -*- coding: utf-8 -*- # Akvo Reporting is covered by the GNU Affero General Public License. # See more details in the license.txt file located at the root folder of the Akvo RSR module. # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. """Create a collaborator organis...
Python
0
6318c1dd7d3c942bc7702402eb6ae50a86c023b7
add hastad
lab3/hastad/code.py
lab3/hastad/code.py
# https://id0-rsa.pub/problem/11/ import gmpy2 def crt(a, n): """Chinese remainder theorem from: http://rosettacode.org/wiki/Chinese_remainder_theorem#Python x = a[0] % n[0] x = a[1] % n[1] x = a[2] % n[2] Args: a(list): remainders n(list): modules Returns: lo...
Python
0.000212
0fce5f54490d9ae9014280a5e0e96fd53128d299
Add kubevirt_preset module (#52498)
lib/ansible/modules/cloud/kubevirt/kubevirt_preset.py
lib/ansible/modules/cloud/kubevirt/kubevirt_preset.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2019, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
Python
0
a3d837afe6662edb10395baa8851de551d0915a5
add email templates tests
auth0/v3/test/management/test_email_endpoints.py
auth0/v3/test/management/test_email_endpoints.py
import unittest import mock from ...management.email_templates import EmailTemplates class TestClients(unittest.TestCase): @mock.patch('auth0.v3.management.email_templates.RestClient') def test_create(self, mock_rc): mock_instance = mock_rc.return_value c = EmailTemplates(domain='domain', to...
Python
0.000001
39b939551e5530fd1c776dffdc016b715dc6819a
Add bootstrap
bootstrap.py
bootstrap.py
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
Python
0.000003