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
175b36b0eb1e84378e350ddc31da3ef7fcae32c2
Add test.
test/test.py
test/test.py
#!/usr/bin/env python # Test PyCharlockHolmes # from charlockholmes import detect TEST_FILES = { "py": [ "file/test.py", {'confidence': 34, 'type': 'text', 'language': 'en', 'encoding': 'ISO-8859-1'} ], "txt": [ "file/test.txt", {'confidence': 16, 'type': 'text', 'language...
Python
0.000001
829defd825d5e311ad187569ba61381ecb40dd08
Add q1 2019
2019/q1.py
2019/q1.py
""" BIO 2019 Q1: Palindromes This ended up being surprisingly difficult, for whatever reason I found it surprisingly difficult to reason about. I found it easier to think about how, given a palindrome, I would calculate the following palindrome. There are ~2 cases: Odd number of digits: [left][middle][right = revers...
Python
0.000002
a5ff7dfacfb151297636bcdc1a4b45400bf27085
Add script to extract features from TPNModel.
src/tpn/recurrent_extract_features.py
src/tpn/recurrent_extract_features.py
#!/usr/bin/env python import os import os.path as osp import numpy as np import tensorflow as tf from model import TPNModel import argparse import glog as log import glob from data_io import tpn_test_iterator import cPickle def bbox_transform_inv(boxes, deltas): if boxes.shape[0] == 0: return np.zeros((0,...
Python
0
77cb3a711170d0f37a0d5d5cf9744ffc8f7242fd
Add test for comparing performance on virtual machines
henrste/test-vm.py
henrste/test-vm.py
#!/usr/bin/env python3 from framework.test_framework import Testbed, TestEnv, require_on_aqm_node from framework.test_utils import * import time def test_compose(): udp_rate = 0 def branch_udp_rate(rate_list, title='UDP-rate: %d Mb/s'): def branch(testdef): nonlocal udp_rate ...
Python
0
5a1518bc2bd8b509bc5c00850ba1da59989147f8
Add basic tests
test_main.py
test_main.py
#!/usr/bin/env python import sys from io import StringIO from jproperties import Properties def _test_deserialize(*data): for s, items in data: props = Properties() props.load(StringIO(s)) assert list(props.items()) == items def test_eq_separator(): _test_deserialize( ("a=b", [("a", "b")]), ("a= b", [("...
Python
0.000004
4249c6456ca21ad6bbec0eccdf66aef629deb511
Add basic tag testing script
test_tags.py
test_tags.py
import sys import requests from wikibugs import Wikibugs2 from channelfilter import ChannelFilter import configfetcher conf = configfetcher.ConfigFetcher() w = Wikibugs2(conf) c = ChannelFilter() print("\n\n\n\n\n\n\n\n") page = requests.get(sys.argv[1]).text tags = w.get_tags(page) for tag in tags: print(tag,...
Python
0.000006
377f44ea05d8fc550be5916a1ca6c085df8f8cdc
add mysql database backup script
backupmysql.py
backupmysql.py
#!/usr/bin/python # -*- coding: utf-8 -*- #Author: Andrew McDonald andrew@mcdee.com.au http://mcdee.com.au # Example: config file #[client] #host = localhost #user = root #password = root-pass from datetime import datetime import sys, os, subprocess, tarfile import zipfile, glob, logging date_format = [ "%A %...
Python
0.000001
07c5ed48d107c7ec88a990698647a70187d277a1
Update cms_helper.py
cms_helper.py
cms_helper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from tempfile import mkdtemp gettext = lambda s: s HELPER_SETTINGS = dict( NOSE_ARGS=[ '-s', ], ROOT_URLCONF='tests.test_utils.urls', INSTALLED_APPS=[ 'admin_enhancer', 'filer', 'parler', 'taggit', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from tempfile import mkdtemp gettext = lambda s: s HELPER_SETTINGS = { 'NOSE_ARGS': [ '-s', ], 'ROOT_URLCONF': 'tests.test_utils.urls', 'INSTALLED_APPS': [ 'admin_enhancer', 'filer', 'parler', 'taggit', ...
Python
0.000001
a3a2f645d3154334e8ae6af93fe56a3f2368c4c7
Add multiprocessing pool example
multiprocessing_pool.py
multiprocessing_pool.py
from multiprocessing.pool import ThreadPool as Pool from multiprocessing import Queue as PQueue import Queue my_dict = { 'url1': 'url2', 'url3': 'url4', } my_q = PQueue() def test_p(uq): q, url = uq[0], uq[1] q.put(url, False) def main(): global my_dict global my_q print "Going to proc...
Python
0
b117fbc82de4fb6acd8a044651c95e2425d9e71c
Create preprocess_MS_dataset_utils_test.py
preprocess_MS_dataset_utils_test.py
preprocess_MS_dataset_utils_test.py
# Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000004
6bf43087967dee2bfb9f31a5de61c91ed0664586
update get ids and columns in pecanstreet, much faster
proto/pylearn2/create_ev_dataset.py
proto/pylearn2/create_ev_dataset.py
import sys import os.path sys.path.append(os.path.join(os.pardir,os.pardir)) import disaggregator as da import disaggregator.PecanStreetDatasetAdapter as psda db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres" psda.set_url(db_url) schema = 'shared' table_names = psda.get_table_names(schema) ...
Python
0.000001
10524dd2c42ef499d36b3f64e31150885d45e51b
Add slot_usage command for checking cluster balance
streamparse/cli/slot_usage.py
streamparse/cli/slot_usage.py
""" Display slots used by every topology on the cluster """ from __future__ import absolute_import, print_function from collections import Counter, defaultdict from pkg_resources import parse_version from prettytable import PrettyTable from six import iteritems from .common import add_environment from ..util import...
Python
0
b69cc15467456a070333ff00f886f27ca391b85b
Add script for appending entries to .gitignore.
webrtc/build/extra_gitignore.py
webrtc/build/extra_gitignore.py
#!/usr/bin/env python # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All c...
Python
0.000005
5e07a21cce64e1845832641b6de1951182d41ea0
add back module changed mixin
core/mixins.py
core/mixins.py
""" core.mixins - Mixins available to use with models """ from django.db.models.signals import post_save def on_changed(sender, **kwargs): """ Calls the `model_changed` method and then resets the state. """ instance = kwargs.get("instance") is_new = kwargs.get("created") dirty_fields = instanc...
Python
0
87413a50fa61761f8e669eda641635a0ab7bede3
Create migration for message
API/chat/migrations/0005_auto_20160511_1921.py
API/chat/migrations/0005_auto_20160511_1921.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('chat', '0004_auto_20150905_1700'), ] operations = [ migrations.RenameField( model_name='message', ol...
Python
0
b38527cccf970e069f55c531a4490cdb6eb7042b
Add a widget.
python/pyqt/pyqt5/hello_as_class.py
python/pyqt/pyqt5/hello_as_class.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including witho...
Python
0
b41b2edde5ac7c786b5ce23adec116fe8311d5d7
Add tests for createaccount command
tests/test_account_service_account.py
tests/test_account_service_account.py
from unittest.mock import ANY, Mock import requests from django.core.management import call_command from saleor.account.models import ServiceAccount from saleor.core.permissions import get_permissions def test_createaccount_command_creates_service_account(): name = "SA name" permissions = ["account.manage_u...
Python
0.000001
1390de93f8f9703416dc465fc546a8883e96bada
add a header generator
EMControllerManagerHeaderGenerator.py
EMControllerManagerHeaderGenerator.py
#!/usr/bin/env python #coding:utf8 import getopt import json import sys def generate_definition(input_file, output_path, prefix): with open(input_file, 'r') as json_file: json_string = json_file.read() config_dict = json.loads(json_string) if not isinstance(config_dict,dict): sys.stderr.write('configuration...
Python
0
10b8043463b6bcc89d4ce559548fa113f3d26190
drop tables no longer needed by application
gem/migrations/0044_remove_deprecated_tables.py
gem/migrations/0044_remove_deprecated_tables.py
# Generated by Django 2.2.15 on 2020-08-14 11:23 from django.db import migrations TABLES = [ 'surveys_articletagrule', 'surveys_combinationrule', 'surveys_groupmembershiprule', 'surveys_molosurveyformfield', 'surveys_molosurveypage', 'surveys_molosurveypage_translated_pages', 'surveys_molo...
Python
0
9a678f5e856a5fcba82a1a9017dfbc841a660686
Create ompotdar.py
Python/ompotdar.py
Python/ompotdar.py
print("Hello World!")
Python
0.000002
0f23004da949b974a071a788ff084c2cb685b95d
use a similar `repair_wheel.py` script as cmake
scripts/repair_wheel.py
scripts/repair_wheel.py
import argparse import shutil import subprocess import sys import tempfile from pathlib import Path from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel def main(): if sys.platform.startswith("linux"): os_ = "linux" elif sys.platform == "darwin": os_ = "macos" e...
Python
0.000002
cafb83befb2cee459d44a1332e5fc7e57edf81a6
Add script to update cvsanaly databases
updateGit.py
updateGit.py
from jiradb import * if __name__ == "__main__": log.setLevel(logging.DEBUG) # Add console log handler ch = logging.StreamHandler() ch.setLevel(logging.INFO) ch.setFormatter(logging.Formatter('%(message)s')) log.addHandler(ch) # Add file log handler fh = logging.FileHandler('updateGit.lo...
Python
0
23c65cc59f1cdf595090a7f25e80c03828aaba68
add `examples/references`
src/openbandparams/examples/references.py
src/openbandparams/examples/references.py
# # Copyright (c) 2013-2015, Scott J Maddox # # This file is part of openbandparams. # # openbandparams 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 # ...
Python
0.000001
574659044cb501a2ac61006ddc1c389622172207
add script to calculate cv from energy intervals
compute_cv.py
compute_cv.py
import argparse import numpy as np def compute_Z(energies, T, K): beta = 1./T N = len(energies) Z = 0. U = 0. U2 = 0. Cv = 0. Emin = energies[-1] Ediff = energies - Emin for n in xrange(1, len(energies)-2): # Z += (np.exp(-float(n-1) / K) - np.exp(-float(n+1) / K)) * np.exp(...
Python
0
df6aa6962dd9e265786e7337de69964f2fadfb1d
Create professor.py
djspace/registration/form_models/professor.py
djspace/registration/form_models/professor.py
# -*- coding: utf-8 -*- from django.conf import settings from django.db import models, connection from django.contrib.auth.models import User from djspace.registration.base_models import * from djtools.fields import BINARY_CHOICES, SALUTATION_TITLES, STATE_CHOICES from djtools.fields import GENDER_CHOICES EMPLOYER =...
Python
0.000001
998acbd4b490ef3807d79c245c27700d3e44d5da
Add a dummy pavement file.
tools/win32/build_scripts/pavement.py
tools/win32/build_scripts/pavement.py
options( setup=Bunch( name = "scipy-superpack", ) ) @task def setup(): print "Setting up package %s" % options.name
Python
0.999859
4f6b1a4dae7701cc79a523e96fe812efaa54745b
Add optimizers tests
tests/auto/test_optimizers.py
tests/auto/test_optimizers.py
from __future__ import print_function import numpy as np np.random.seed(1337) from keras.utils.test_utils import get_test_data from keras.optimizers import SGD, RMSprop, Adagrad, Adadelta, Adam from keras.models import Sequential from keras.layers.core import Dense, Activation from keras.utils.np_utils import to_categ...
Python
0
751b596482cdb473b1a7f9172501e25d00f15724
Use default loop on TCP benchmark
tests/benchmark-tcp.py
tests/benchmark-tcp.py
import sys sys.path.insert(0, '../') import signal import threading import pyuv RESPONSE = "HTTP/1.1 200 OK\r\n" \ "Content-Type: text/plain\r\n" \ "Content-Length: 12\r\n" \ "\r\n" \ "hello world\n" def on_client_shutdown(client): client.close() clients.remove(c...
import sys sys.path.insert(0, '../') import signal import threading import pyuv RESPONSE = "HTTP/1.1 200 OK\r\n" \ "Content-Type: text/plain\r\n" \ "Content-Length: 12\r\n" \ "\r\n" \ "hello world\n" def on_client_shutdown(client): client.close() clients.remove(c...
Python
0
fb29bf9d1fdc1dc3cebb3d6034cb177479bef8c5
Add some tests for virtool.db.iface.Collection
tests/db/test_iface.py
tests/db/test_iface.py
import pymongo.results import pytest from aiohttp.test_utils import make_mocked_coro import virtool.db.iface import virtool.utils @pytest.fixture async def create_test_collection(mocker, test_motor): def func(name="samples", projection=None, silent=False) -> virtool.db.iface.Collection: processor = mocke...
Python
0
53ca4755b2bb9dbe3bc0bcdc15e9b4d07a13952f
Add tests for disklabel type selection and partition weight.
tests/platform_test.py
tests/platform_test.py
from collections import namedtuple import unittest from unittest import mock from blivet import platform Weighted = namedtuple("Weighted", ["fstype", "mountpoint", "cls", "weight"]) weighted = [Weighted(fstype=None, mountpoint="/", cls=platform.Platform, weight=0), Weighted(fstype=None, mountpoint="/boot...
Python
0
6dbd81fb4b59e7394318cbd0b0f0fdb31fcd6dd2
Add unit test to ensure we don't diff bare repos
tests/unit/states/test_git.py
tests/unit/states/test_git.py
# -*- coding: utf-8 -*- ''' :codeauthor: Erik Johnson <erik@saltstack.com> ''' # Import Python libs from __future__ import absolute_import import logging import os # Import Salt Testing Libs from tests.support.helpers import with_tempdir from tests.support.mixins import LoaderModuleMockMixin from tests.support.un...
Python
0
469eedab89d22a1051e9d3f6f7f6c94ba946fb37
Add server tests for JOIN.
irctest/server_tests/test_channel_operations.py
irctest/server_tests/test_channel_operations.py
""" Section 3.2 of RFC 2812 <https://tools.ietf.org/html/rfc2812#section-3.2> """ from irctest import cases from irctest.irc_utils.message_parser import Message class JoinTestCase(cases.BaseServerTestCase): def testJoin(self): """“If a JOIN is successful, the user receives a JOIN message as confir...
Python
0
ede8282eed8c198fc728985515e886e5a67ba3e0
To create appropriate Dir structure
MROCPdjangoForm/ocpipeline/createDirStruct.py
MROCPdjangoForm/ocpipeline/createDirStruct.py
import os import argparse from shutil import move, rmtree # For moving files ''' Module creates a directory structure as defined by a string userDefProjectDir & moves files in tuple args to the userDefProjectDir ''' def createDirStruct(userDefProjectDir, uploadDirPath, endingDir, tempDirPath, moveFileNames): ''' ...
Python
0.998603
21742da132aeb9b834b128f7a7d01b7a2173137a
Add a tcp_server which simulates graphite-relay
tcp_server.py
tcp_server.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # """ A very simple TCP server for simulating a graphite relay, copied-paste from Python documentation. Few things were adjusted to make pylint happy and print incoming data. """ import asyncio class EchoServerClientProtocol(asyncio.Protocol): """ ...
Python
0.000005
ef52b314eb5e15c34d8b034d7e6f7bdd727b6586
Add sp500_extractor_v1 version that does not use BeautifulSoup.
Code/sp500_extractor_v1_no_bs.py
Code/sp500_extractor_v1_no_bs.py
import csv from lxml import html import time import requests """ Make it work, make it right, make it fast Extract the tickers from the S&P 500 table on Wikipedia, process them into a list and save them into a CSV file. # Retrieve HTML from URL with requests http://docs.python-requests.org/en/master/user/quickstart/...
Python
0
d98eebda6b3b0e42ac7ca34c6a1dd6cc8b05d342
add functions and refactor fibonacci
quickTour/function.py
quickTour/function.py
def fibonacci(n): a,b = 0,1 if(n==a): return a if(n==b): return b return fibonacci(n-1)+fibonacci(n-2) for n in range(0,10): print(fibonacci(n))
Python
0.00001
fefb13108a151c5cbfe8c6acd5b94a480dac98ec
Add test for NPairLossScheme
tests/test_datasets.py
tests/test_datasets.py
# -*- coding: utf-8 -*- """ Created on Tue Feb 21 20:30:26 2017 @author: sakurai """ import unittest import numpy as np from ..datasets.data_provider import NPairLossScheme class TestNPairLossScheme(unittest.TestCase): def test_pairs_of_indexes(self): batch_size = 20 labels = sum([[i]*10 for ...
Python
0
33375a9333852eafa1bf262fb30f5d827c4534f7
Create networkx.py
networkx.py
networkx.py
import networkx
Python
0.000007
1c2330d9e45b9e87ed70848fd0ce192b0d06c904
Update build_status.py
infra/auto-setup/build_status.py
infra/auto-setup/build_status.py
#!/usr/bin/env python import codecs import datetime import os import subprocess import sys import traceback import jenkins import jinja2 from jinja2 import Environment, FileSystemLoader JENKINS_SERVER = ('localhost', 8080) LOGS_BUCKET = 'oss-fuzz-build-logs' SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) ...
#!/usr/bin/env python import codecs import datetime import os import subprocess import sys import jenkins import jinja2 from jinja2 import Environment, FileSystemLoader JENKINS_SERVER = ('localhost', 8080) LOGS_BUCKET = 'oss-fuzz-build-logs' SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) class Result(obj...
Python
0.000002
98a053f945e2c7cc01d8fbdec374ab90305bc11f
Create new files.
ospathex.py
ospathex.py
#!/usr/bin/python #_*_coding:utf-8_*_ import os for tmpdir in ('temp', r'c:\windows\temp'): if os.path.isdir(tmpdir): break else: print 'no temp directory available' tmpdir = '' if tmpdir: os.chdir(tmpdir) cwd = os.getcwd() print '*** current temporary directory' print...
Python
0
65717865460c725e033d3aa81695c64a92e31a5b
Add test scripts.
test/sniff.py
test/sniff.py
# Test transmitting data after exiting sniff mode import time import bluetool from bluetool.core import HCICoordinator, HCIWorker, HCIWorkerProxy, HCITask, BREDRHelper from bluetool.bluez import ba2str from bluetool.error import HCICommandError, TestError, HCITimeoutError import bluetool.bluez as bluez import bluetool...
Python
0
81ade3168faa68ef43456cc35a122b9ef493a23e
Add script to plot MS flag rate and acq fail rate
plot_ms_flag_acq_fails.py
plot_ms_flag_acq_fails.py
from __future__ import division import matplotlib.pyplot as plt from astropy.table import Table import numpy as np from Ska.DBI import DBI from chandra_aca import star_probs db = DBI(dbi='sybase', server='sybase', user='aca_read') stats = db.fetchall('SELECT * from trak_stats_data ' 'WHERE kalman...
Python
0
f2413f05bc64818297541112f42e2a8d5ae72cbe
Create test_setup.py
test_setup.py
test_setup.py
import wget import os test_files_path = os.getcwd() + '/image-analysis/test/test_data/' # test files will be here whether is data, images, videos ect. test_files = ["https://s3.amazonaws.com/testcodas/test_video.mp4"] for file_path in test_files: wget.download(file_path, test_files_path)
Python
0
c54c948531cd73b0c0dd78b6bc8a1c5245886c97
add visualise.py
visualize.py
visualize.py
#!/usr/bin/env python import json import math import numpy import os import re import sys if __name__ == '__main__': if len(sys.argv) < 3: print('usage: %s [result dir] [output html]' % sys.argv[0]) sys.exit() result = [[], [], [], []] for filename in os.listdir(sys.argv[1]): matc...
Python
0.000024
6c61c2d367e698861657d4cfc9bba0ba3789f197
add naive bayes
nb.py
nb.py
import numpy as np class NaiveBayes: def __init__(self): self._prior = None self._mat = None def train(self, X, y): y = np.matrix(y) p1 = y*X p2 = (1-y)*X p = np.vstack([ np.log(p1+1) - np.log(p1.sum() + p1.shape[1]), np.log(p2+1) - np.lo...
Python
0.999993
9a33761f33c4f49a27d72944c231cb447353d81e
Add problem 10
010.py
010.py
#!/usr/bin/env python3 # Author: Severin Kaderli <severin.kaderli@gmail.com> # # Project Euler - Problem 10: # Find the sum of all the primes below two million. def get_prime_numbers(n): """Gets all prime numbers below n.""" primes, sieve = [], [True] * n for i in range(2, n): if sieve[i]: ...
Python
0
d075d188d541090ad8d3a5c4cf583ba10063aa88
Move timing to right location for staging.
project/project/timing.py
project/project/timing.py
import time from django.utils.deprecation import MiddlewareMixin class TimingMiddleware(object): """Times a request and adds timing information to the content. Adds an attribute, `_timing`, onto the request, and uses this at the end of the rendering chain to find the time difference. It replaces a token...
Python
0
2e503a58a1f9893d25cf2dbb2c885bc9834faebf
Create urls.py
tests/urls.py
tests/urls.py
from django.conf.urls import url, include from webhook.base import WebhookBase class WebhookView(WebhookBase): def process_webhook(self, data, meta): pass urlpatterns = [ url(r'^webhook-receiver', WebhookView.as_view(), name='web_hook'), ]
Python
0.000017
0b3bfeb06a4594a2c188e623835c3a54262cca5d
Write initial Bible book HTML parser
utilities/book_parser.py
utilities/book_parser.py
# utilities.book_parser # coding=utf-8 from __future__ import unicode_literals import yvs.shared as shared from HTMLParser import HTMLParser class BookParser(HTMLParser): # Resets parser variables (implicitly called on instantiation) def reset(self): HTMLParser.reset(self) self.depth = 0 ...
Python
0
7b2d3aedbc2f78119974c9e724b37b2b336297d1
Add device_hive_api.py
devicehive/device_hive_api.py
devicehive/device_hive_api.py
from devicehive.handler import Handler from devicehive.device_hive import DeviceHive class ApiCallHandler(Handler): """Api call handler class.""" def __init__(self, api, call, *call_args, **call_kwargs): super(ApiCallHandler, self).__init__(api) self._call = call self._call_args = cal...
Python
0.000029
1d4e462188e95b1270d45f95112c2458cbeb7b2f
Add definitions.py
definitions.py
definitions.py
def API_launch(): global app_config global tweepy # Twitter API configuration consumer_key = app_config.twitter["consumer_key"] consumer_secret = app_config.twitter["consumer_secret"] access_token = app_config.twitter["access_token"] access_token_secret = app_config.twitter["access_token...
Python
0
32067112c7e0d681b84975b0e9b2fe974f1440ac
Add IINet module
i3pystatus/iinet.py
i3pystatus/iinet.py
import requests from i3pystatus import IntervalModule from i3pystatus.core.color import ColorRangeModule __author__ = 'facetoe' class IINet(IntervalModule, ColorRangeModule): """ Check IINet Internet usage. Requires `requests` and `colour` Formatters: * `{percentage_used}` — percentage ...
Python
0
36d7960e5899b6b85c311fcf0b47f6adb93b702d
put gui in class
config/gui.py
config/gui.py
from IPython import display from ipywidgets import widgets import cv2 def video(core): import cv2 cv2.namedWindow('Video') core.startContinuousSequenceAcquisition(1) while True: img = core.getLastImage() if core.getRemainingImageCount() > 0: # img = core.popNextImage() ...
Python
0
045a10457cd87e37ef5862de55e344db5e9228cf
Add configfile.py
configfile.py
configfile.py
# vim: set et ts=4 sw=4 fdm=marker """ MIT License Copyright (c) 2016 Jesse Hogan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to u...
Python
0.000003
2275ae52e336bd2e07e32fa3a2559926734c3567
add pyunit for PUBDEV-1480
h2o-py/tests/testdir_jira/pyunit_NOPASS_INTERNAL_pubdev_1480_medium.py
h2o-py/tests/testdir_jira/pyunit_NOPASS_INTERNAL_pubdev_1480_medium.py
import sys, os sys.path.insert(1, "../../") import h2o, tests def pubdev_1480(): if not tests.hadoop_namenode_is_accessible(): raise(EnvironmentError, "Not running on H2O internal network. No access to HDFS.") train = h2o.import_file("hdfs://mr-0xd6/datasets/kaggle/sf.crime.train.gz") test = h2o.import_f...
Python
0
b16f6ea8a723fa064a78e014ab767be1a797e613
Create cab.py
cab.py
cab.py
""" Work with *.cab files """ from ctypes import pythonapi from ctypes import cdll from ctypes import cast import ctypes as _ctypes libc = cdll[_ctypes.util.find_library('c')] libcab = cdll[_ctypes.util.find_library('cabinet')] PyMem_Malloc = pythonapi.PyMem_Malloc PyMem_Malloc.restype = _ctypes.c_size_t PyMem_Malloc...
Python
0.000006
e6abd6a44de8687d88672ba80388afbe0cdb029a
习题 1: 第一个程序
ex1.py
ex1.py
# --coding:utf8-- print("Hello world") print("Hello Again") print("I like type this.") print("This is fun") print('Yay! Printing') print("I'd much rather you 'not'.") print('I "said" do not touch this') print('妳好,我是Python!') print('這是我的練習題') print('下面要加上#的註釋') # This is pound # This is hash # This is mesh
Python
0.997795
e17adde73c146ded7ed5a1a347f104a5e7a09f62
Add bzl macro.
tools/testing/python/py23.bzl
tools/testing/python/py23.bzl
"""Macro to generate python 2 and 3 binaries.""" def py23_binary(name, **kwargs): """Generates python 2 and 3 binaries. Accepts any py_binary arguments.""" native.py_binary( name = name + "2", python_version = "PY2", **kwargs ) native.py_binary( name = name + "3", ...
Python
0.000066
596f432eb7d4b3fa5d1bf5dec33cc882546e8233
Add a script to convert a GRLevelX colortable file to a dict data structure (and optionally boundaries for norm) for use with Matplotlib.
trunk/metpy/vis/util/gr2_to_mpl_colortable.py
trunk/metpy/vis/util/gr2_to_mpl_colortable.py
#!/usr/bin/env python # This script is used to convert colortables from GRLevelX to data for a # matplotlib colormap import sys from optparse import OptionParser #Set up command line options opt_parser = OptionParser(usage="usage: %prog [options] colortablefile") opt_parser.add_option("-s", "--scale", action="store_tr...
Python
0.000006
a041c683475f78d6101fe1741a561a6c00492007
add pautils, to host various utility functions like loading the P2TH keys into the local or remote node over JSON-RPC.
pypeerassets/pautils.py
pypeerassets/pautils.py
'''miscellaneous utilities.''' def testnet_or_mainnet(node): '''check if local node is configured to testnet or mainnet''' q = node.getinfo() if q["testnet"] is True: return "testnet" else: return "mainnet" def load_p2th_privkeys_into_node(node): if testnet_or_mainnet(node) is ...
Python
0
7012a90cd1468da95c8939a0f0c1193766595ae8
Add event spooler module
pytest_watch/spooler.py
pytest_watch/spooler.py
# -*- coding: utf-8 from multiprocessing import Queue, Process, Event class Timer(Process): def __init__(self, interval, function, args=[], kwargs={}): super(Timer, self).__init__() self.interval = interval self.function = function self.args = args self.kwargs = kwargs ...
Python
0
0ff9373de6e11d7040b6b289cb3239a9ee9a924d
Fix haproxy agent unit test to be runnable alone by tox
neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py
neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 New Dream Network, LLC (DreamHost) # # 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/li...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 New Dream Network, LLC (DreamHost) # # 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/li...
Python
0.000001
e4ef868660878e1ad1749be915b88ab6fea929b5
Add asyncio example
examples/async.py
examples/async.py
""" w1thermsensor ~~~~~~~~~~~~~ A Python package and CLI tool to work with w1 temperature sensors. :copyright: (c) 2020 by Timo Furrer <tuxtimo@gmail.com> :license: MIT, see LICENSE for more details. """ import asyncio from w1thermsensor import AsyncW1ThermSensor async def main(): # initialize sensor with fir...
Python
0.000001
ef4aeb1e16245c76e7d10091b6fc8b0b289d635f
Split IP validation to a module
validateIp.py
validateIp.py
#!/usr/bin/env python import socket def parse(ip): # parse and validate ip address try: socket.inet_pton(socket.AF_INET,ip) return "valid" except socket.error, e: try: socket.inet_pton(socket.AF_INET6,ip) return "valid" except: print "ERRO...
Python
0
d0ce887da3043106da1b875a46b6fe1bc0ce7145
Create 0018_auto_20201109_0655.py
herders/migrations/0018_auto_20201109_0655.py
herders/migrations/0018_auto_20201109_0655.py
# Generated by Django 2.2.17 on 2020-11-09 14:55 import django.contrib.postgres.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('herders', '0017_auto_20200808_1642'), ] operations = [ migrations.AlterField( model_name=...
Python
0.000008
f9db946f9b067495d2785d46efe447371e22eb26
Add tex2pdf function
docstamp/pdflatex.py
docstamp/pdflatex.py
# coding=utf-8 # ------------------------------------------------------------------------------- # Author: Alexandre Manhaes Savio <alexsavio@gmail.com> # Grupo de Inteligencia Computational <www.ehu.es/ccwintco> # Universidad del Pais Vasco UPV/EHU # # 2015, Alexandre Manhaes Savio # Use this at your own risk! # -----...
Python
0.000001
96a9d00ea20dee3ffd9114b4a094868ed7ae2413
add createmask.py
createMask.py
createMask.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' python createmask.py [voc-like dir] ''' import os, sys import numpy as np import cv2 def parsexml(xmlfile): tree = ET.parse(xmlfile) width = int(tree.find('size').find('width').text) height = int(tree.find('size').find('height').text) objs = tree.finda...
Python
0.000002
8ba179518a5901a250fdc7f864f79667c319cf2a
Enhance test
utest/api/test_exposed_api.py
utest/api/test_exposed_api.py
import unittest from os.path import join from robot import api, model, parsing, reporting, result, running from robot.api import parsing as api_parsing from robot.utils.asserts import assert_equal, assert_true class TestExposedApi(unittest.TestCase): def test_execution_result(self): assert_equal(api.E...
import unittest from os.path import join from robot import api, model, parsing, reporting, result, running from robot.api import parsing as api_parsing from robot.utils.asserts import assert_equal, assert_true class TestExposedApi(unittest.TestCase): def test_execution_result(self): assert_equal(api.E...
Python
0.000001
45bc2562d3afd3674929e56425b597b54e74ba24
Create Legends.py
Legends.py
Legends.py
#Draws Legends, Titles and Labels using matplotlib import matplotlib.pyplot as plt x = [1, 2, 3] y = [5, 7, 4] x1 = [1, 2, 3] y1 = [10, 14, 12] plt.plot(x, y, label='First Line') plt.plot(x1, y1, label='Second Line') plt.xlabel('X Axis') plt.ylabel('Y Axis') plt.title('This is a Title') plt.legend() plt.show()
Python
0
3adbcb8bc7fb4c805e7933a362b62f70873d4f9f
Add emergency_scale module
paasta_tools/paasta_cli/cmds/emergency_scale.py
paasta_tools/paasta_cli/cmds/emergency_scale.py
#!/usr/bin/env python # Copyright 2015 Yelp Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
Python
0
29090add692e6c32a75e123be6cd201949efd6ce
Add elasticsearch-administer
scripts/elasticsearch-administer.py
scripts/elasticsearch-administer.py
""" Utilities for administering elasticsearch """ from argparse import ArgumentParser, RawDescriptionHelpFormatter from collections import namedtuple import json import sys from elasticsearch import Elasticsearch from elasticsearch.client import ClusterClient, NodesClient, CatClient def pprint(data): print json....
Python
0
eee700f46e1edee1133722ee94992abda1ad6a4c
Add GYP build for zlib
deps/zlib.gyp
deps/zlib.gyp
{ 'target_defaults': { 'conditions': [ ['OS != "win"', { 'defines': [ '_LARGEFILE_SOURCE', '_FILE_OFFSET_BITS=64', '_GNU_SOURCE', 'HAVE_SYS_TYPES_H', 'HAVE_STDINT_H', 'HAVE_STDDEF_H', ], }, { # windows 'defines':...
Python
0
c46962f8055dc1c9d45a35b21afaac363ec3eb46
add home view
simple_media_service/views/pages.py
simple_media_service/views/pages.py
# # Copyright (c) Elliot Peele <elliot@bentlogic.net> # # This program is distributed under the terms of the MIT License as found # in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licenses/mit-license.php. # # This program is distributed in the hope that it...
Python
0
597e9d6f3d5804d403e3cd58a380ea882cbd5267
Add tracker init support
home/iot/tracker.py
home/iot/tracker.py
import functools from flask import abort, request from flask_login import login_required from flask_socketio import join_room, emit from home.core.models import get_device from home.settings import DEBUG from home.web.utils import api_auth_required from home.web.web import socketio, app class TrackedDevice: def ...
Python
0
860f6b612c39bb5b569b0fae8279134bca264e70
Add 2017-faust/toilet
2017-faust/toilet/toilet.py
2017-faust/toilet/toilet.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import re import dateutil.parser from pwn import * context(arch='amd64', os='linux') def get_latest_shas(io): io.sendline('8') io.recvuntil('#################################################################################################') logs = io.recvu...
Python
0.000001
571334df8e26333f34873a3dcb84441946e6c64c
Bump version number to 0.12.2
flask/__init__.py
flask/__init__.py
# -*- coding: utf-8 -*- """ flask ~~~~~ A microframework based on Werkzeug. It's extensively documented and follows best practice patterns. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ __version__ = '0.12.2' # utilities we import from Werkzeug and...
# -*- coding: utf-8 -*- """ flask ~~~~~ A microframework based on Werkzeug. It's extensively documented and follows best practice patterns. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ __version__ = '0.12.2-dev' # utilities we import from Werkzeug...
Python
0.000153
a5188b4a172e17ac755ba4ce8d8890c7b211eb74
Create ex11.py
learningpythonthehardway/ex11.py
learningpythonthehardway/ex11.py
print "How old are you brother ?" age = raw_input() # will get some text ;def print "How tall are you ?" height = raw_input() print "do you eat enough ?" eat = raw_input() print "So, you're a %r years old and %r tall guy that says : '%r' to the food, right ?" % (age, height, eat) # Nb: to get a number from the return...
Python
0.000001
e652ef42e5645671cde6522254c2b86d4a71114c
Add a new migration to rename key and secret columns.
allaccess/migrations/0004_rename_key_secret.py
allaccess/migrations/0004_rename_key_secret.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models from ..compat import get_user_model, AUTH_USER_MODEL User = get_user_model() class Migration(SchemaMigration): def forwards(self, orm): # ...
Python
0
e4bc9684c10a360ad8df32b2c6bfb8f013ea4b77
Add Composite.py
Python/Composite/Composite.py
Python/Composite/Composite.py
#! /usr/bin/python # -*- coding: utf-8 -*- ''' Composite Pattern Author: Kei Nakata Data: Oct.10.2014 ''' import abc import exceptions class Component(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def __init__(self, name): pass @abc.abstractmethod def add(self, child): ...
Python
0.000001
ac3b5be9a6f71afb402db2f293e1198bce973440
Create the login server using Flask
flask/login.py
flask/login.py
from abc import ABCMeta, ABC, abstractmethod, abstractproperty from flask import Flask, app import flask from flask_login import LoginManager class User(ABC): authenticated = False active = False anonymous = False id = None def is_authenticated(self): return self.authenticated def is...
Python
0.000001
e15f59f29907d740d0a0f8dab46d77aa833ef802
fix "peru -v"
peru/main.py
peru/main.py
#! /usr/bin/env python3 import os import sys from . import runtime from . import module def main(): peru_file_name = os.getenv("PERU_FILE_NAME") or "peru.yaml" if not os.path.isfile(peru_file_name): print(peru_file_name + " not found.") sys.exit(1) r = runtime.Runtime() m = module.par...
#! /usr/bin/env python3 import os import sys from . import runtime from . import module def main(): peru_file_name = os.getenv("PERU_FILE_NAME") or "peru.yaml" if not os.path.isfile(peru_file_name): print(peru_file_name + " not found.") sys.exit(1) r = runtime.Runtime() m = module.par...
Python
0
0d2c04790fb6c97b37f6e0700bb0162796e3dc4c
Add unit tests for AmountTaxScale serialization
tests/web_api/test_scale_serialization.py
tests/web_api/test_scale_serialization.py
# -*- coding: utf-8 -*- from openfisca_web_api.loader.parameters import walk_node from openfisca_core.parameters import ParameterNode, Scale def test_amount_scale(): parameters = [] metadata = {'location':'foo', 'version':'1', 'repository_url':'foo'} root_node = ParameterNode(data = {}) amount_scale_d...
Python
0
b0f8064d0d6a747aac5b45bc44c3c4abda7873ad
Add unit test
apps/sam/python/src/i2p/test/test_select.py
apps/sam/python/src/i2p/test/test_select.py
# ----------------------------------------------------- # test_select.py: Unit tests for select.py. # ----------------------------------------------------- # Make sure we can import i2p import sys; sys.path += ['../../'] import time import traceback, sys from i2p import socket, select import i2p.socket import socke...
Python
0.000001
a04d5745257c16e127711fbded6899f8f226aeba
add html generator using pdoc3
doc/py/gen.py
doc/py/gen.py
import os import pdoc import clingo import clingo.ast import re ctx = pdoc.Context() cmod = pdoc.Module(clingo, context=ctx) amod = pdoc.Module(clingo.ast, supermodule=cmod, context=ctx) cmod.doc["ast"] = amod pdoc.link_inheritance(ctx) def replace(s): s = s.replace('href="clingo.html', 'href="clingo/') s = ...
Python
0
e4efaa947533e6d63eb7518306e31386ec688c73
write testing test
bioinformatics/tests/test_frequent_words.py
bioinformatics/tests/test_frequent_words.py
def test_sanity_check_pass(): assert True def test_sanity_check_fail(): assert False def test_sanity_check_error(): assert 0/0
Python
0.000095
42f614e7f22dfa93c07c09e6e2fedb5546f8d236
read pwscf occupations and evals
qe_reader.py
qe_reader.py
import numpy as np from mmap import mmap def retrieve_occupations(nscf_outfile, max_nbnd_lines=10): """ read the eigenvalues and occupations of DFT orbitals at every available kpoint in an non-scf output produced by pwscf """ fhandle = open(nscf_outfile,'r+') mm = mmap(fhandle.fileno(),0) # read num...
Python
0
aee6afe48bf4d2992c39a22d9e492377dcec527c
Add migrations
dash/orgs/migrations/0029_auto_20211025_1504.py
dash/orgs/migrations/0029_auto_20211025_1504.py
# Generated by Django 3.2.6 on 2021-10-25 15:04 import functools from django.db import migrations, models import dash.utils class Migration(migrations.Migration): dependencies = [ ("orgs", "0028_alter_org_config"), ] operations = [ migrations.AlterField( model_name="org", ...
Python
0.000001
6b9933cce4cac3131d603880969e1d9b78b1e4f0
Remove party_affiliation table
alembic/versions/138c92cb2218_feed.py
alembic/versions/138c92cb2218_feed.py
"""Remove PartyAffiliation Revision ID: 138c92cb2218 Revises: 3aecd12384ee Create Date: 2013-09-28 16:34:40.128374 """ # revision identifiers, used by Alembic. revision = '138c92cb2218' down_revision = '3aecd12384ee' from alembic import op import sqlalchemy as sa def upgrade(): op.drop_table(u'party_affiliati...
Python
0.000002
6f7afea4aed4dd77cd06e8dce66e9ed1e6390a00
Add a dummy label printer server.
dummyprint.py
dummyprint.py
#!/usr/bin/env python3 # It does work with Python 2.7, too. from __future__ import print_function from __future__ import unicode_literals try: from SocketServer import TCPServer, BaseRequestHandler except ImportError: # Python 3 from socketserver import TCPServer, BaseRequestHandler class DummyHandler(BaseRe...
Python
0
d173374a2bb0b3336a44c204f250ee1fa928051f
Add CLI mechanics stub.
grafcli/cli.py
grafcli/cli.py
from grafcli.config import config from grafcli.elastic import Elastic from grafcli.filesystem import FileSystem ROOT_PATH = "/" PROMPT = "> " class GrafCLI(object): def __init__(self): self._elastic = Elastic() self._filesystem = FileSystem() self._current_path = ROOT_PATH def run...
Python
0
e937e461e7e130dc80e1a4403b0a810db0e04b29
Create an environment based on a config file.
wmtexe/env.py
wmtexe/env.py
from os import path, pathsep import subprocess def find_babel_libs(): try: return subprocess.check_output(['cca-spec-babel-config', '--var', 'CCASPEC_BABEL_LIBS']).strip() except (OSError, subprocess.CalledProcessError): return None def python_version(...
Python
0
590f9b896be367ded589c90ac5eacd4d3006ebc8
Create Combinations_001.py
leetcode/077-Combinations/Combinations_001.py
leetcode/077-Combinations/Combinations_001.py
class Solution: # @param {integer} n # @param {integer} k # @return {integer[][]} def combine(self, n, k): if k < 1 or k > n: return [] if k == 1: return [[i] for i in range(1, n+1)] res = self.combine(n - 1, k -1) [i.append(n) for i in re...
Python
0.000004
e515b4000c42f1947519118772e22c09e692289d
Manage schemas on ACI MultiSite (#47758)
lib/ansible/modules/network/aci/msc_schema.py
lib/ansible/modules/network/aci/msc_schema.py
#!/usr/bin/python # -*- coding: utf-8 -*- # 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', 'status': ['preview'], ...
Python
0
0f0116be7870490447bbfa794c118205e8eca120
Add an adapter for pecan.
wsme/pecan.py
wsme/pecan.py
import inspect import sys import json import xml.etree.ElementTree as et import wsme import wsme.protocols.commons import wsme.protocols.restjson import wsme.protocols.restxml pecan = sys.modules['pecan'] class JSonRenderer(object): def __init__(self, path, extra_vars): pass def render(self, temp...
Python
0
9a1bf2ed13ed5b719472ba87fca7697b0612924e
Implement class for managing a set of libraries
bundle.py
bundle.py
import os import shutil import sqlite3 class Package: def __init__(self, name, version, deps, files_rel, files_dbg=[], files_dev=[]): self.name = name self.version = version self.deps = deps self.files_rel = files_rel self.files_dbg = files_dbg self.files_dev = f...
Python
0.000002
b113689db8b845471728a336b0fae30b45333022
Create hilightresponses.py
HexChat/hilightresponses.py
HexChat/hilightresponses.py
import hexchat __module_name__ = 'Hilight Responses' __module_version__ = '0.0.1' __module_description__ = 'Highlights messages after yours' __module_author__ = 'Vlek' _lastresponder = {} def check_for_highlight(word, word_to_eol, userdata): global _lastresponder context = hexchat.get_context() channelna...
Python
0.000002
8f3f9d79d8ce1960ad225e236ca3e11c72de28e0
Add test for dials.report on integrated data
test/command_line/test_report.py
test/command_line/test_report.py
from __future__ import absolute_import, division, print_function import os import procrunner def test_report_integrated_data(dials_regression, run_in_tmpdir): """Simple test to check that dials.symmetry completes""" result = procrunner.run( [ "dials.report", os.path.join(dial...
Python
0
74329cd397e9dc4593333591700923e0ba7453a1
Create __init__.py (#148)
robosuite/environments/manipulation/__init__.py
robosuite/environments/manipulation/__init__.py
Python
0.000006
6167ef40df491985749102bd4ca3f3f656f71f6c
Add migrations
mainapp/migrations/0030_auto_20210125_1431.py
mainapp/migrations/0030_auto_20210125_1431.py
# Generated by Django 3.1.5 on 2021-01-25 13:31 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mainapp', '0029_auto_20201206_2026'), ] operations = [ migrations.AddField( model_name='file', name='manually_delete...
Python
0.000001
7f94b7fa328583c7b0bf617c6c69c06af78b49d8
Add files via upload
src/getCAPMemberInfo.py
src/getCAPMemberInfo.py
#!/usr/bin/env /usr/bin/python3 # # Find a member or members and print all contacts # # Input: CAPID or first letters of last name to search for, # plus optional first name. # # History: # 18Aug19 MEG Search by CAPID, better agg pipeline handling. # 17Aug19 MEG Made parseable for data extraction by other scripts...
Python
0