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
f22abf2b8a31d9621a891191db84364edb167390
Add a management command to create realm administrators.
zephyr/management/commands/knight.py
zephyr/management/commands/knight.py
from __future__ import absolute_import import sys from optparse import make_option from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ValidationError from django.db.utils import IntegrityError from django.core import validators from guardian.shortcuts import assign_p...
Python
0
4aeba707e8bec6e5cfc8cebf08f307044e145bf3
Add script to meas TS dispersion
apsuite/commissioning_scripts/measure_disp_ts.py
apsuite/commissioning_scripts/measure_disp_ts.py
#!/usr/bin/env python-sirius """.""" import time as _time import numpy as np from epics import PV import pyaccel from pymodels.middlelayer.devices import SOFB, RF from apsuite.commissioning_scripts.base import BaseClass class ParamsDisp: """.""" def __init__(self): """.""" self.energy_delt...
Python
0
c577c001c096a93df156153ecba124a173c0ec7d
Add algorithms for LK
menpofit/lk/algorithm.py
menpofit/lk/algorithm.py
from scipy.linalg import norm import abc import numpy as np from .result import LKAlgorithmResult # TODO: implement Linear, Parts interfaces? Will they play nice with residuals? # TODO: implement sampling? # TODO: handle costs for all LKAlgorithms # TODO: document me! class LKAlgorithm(object): r""" """ d...
Python
0.000345
ee1beb9b4bd51ab8f0bcb473d329275c68430919
Ajoute un script remplaçant des extraits d’enregistrement par les enregistrements entiers.
scripts/remplacement_extraits_AFO.py
scripts/remplacement_extraits_AFO.py
# coding: utf-8 """ Copie les fichiers listés dans "Campagne num° 2012-13.xlsx" (chemin : filepath) depuis dir_source vers dir_dest. """ from __future__ import print_function import os import shutil import pandas as pd from scripts.import_AFO_11_2014 import path, NOM_FICHIER, REMARQUE, EXCL_MSG def run(dir_source, d...
Python
0
7eef45621d3e917cf09101b309a7c839008dde76
Fix indentation
tensorflow/core/platform/default/build_config_root.bzl
tensorflow/core/platform/default/build_config_root.bzl
# Lower-level functionality for build config. # The functions in this file might be referred by tensorflow.bzl. They have to # be separate to avoid cyclic references. def tf_cuda_tests_tags(): return ["local"] def tf_sycl_tests_tags(): return ["local"] def tf_additional_plugin_deps(): return select({ "//...
# Lower-level functionality for build config. # The functions in this file might be referred by tensorflow.bzl. They have to # be separate to avoid cyclic references. def tf_cuda_tests_tags(): return ["local"] def tf_sycl_tests_tags(): return ["local"] def tf_additional_plugin_deps(): return select({ "//...
Python
0.017244
cfc11472f16040d06915a58c3dd3c027b77fdd80
set up testing with py.test
scripts/tests/test_identify_locus.py
scripts/tests/test_identify_locus.py
import sys sys.path.append("..") from identify_locus import * def test_answer(): assert 5 == 5
Python
0.000001
4f1e1874f3ed9af8922aa26eb20230dbee5e6d73
Add some example code for creation of disk partitions.
examples/partitioning.py
examples/partitioning.py
import logging import sys import os from common import set_up_logging from common import create_sparse_file from common import tear_down_disk_images from common import print_devices # doing this before importing blivet gets the logging from format class # registrations and other stuff triggered by the import set_up_l...
Python
0
d35dd563b25f85d23191169e8f87882129f64adb
Add images admin
features/images/admin.py
features/images/admin.py
from django.contrib import admin from . import models admin.site.register(models.Image)
Python
0
dc3f2b1e3a10c2d186b99a00553607845ac80c68
Add an icon handler the MediaWiki processor
fedmsg/text/mediawiki.py
fedmsg/text/mediawiki.py
# This file is part of fedmsg. # Copyright (C) 2012 Red Hat, Inc. # # fedmsg is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. #...
# This file is part of fedmsg. # Copyright (C) 2012 Red Hat, Inc. # # fedmsg is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. #...
Python
0.000001
a0c23d3fc448f916ffdd668a2daf56408dd9c0c0
Add simple implementation for a pre-commit hook
mothermayi/pre_commit.py
mothermayi/pre_commit.py
import mothermayi.entryway import mothermayi.git def handle_plugins(entries): for entry in entries: result = entry() def run(): with mothermayi.git.stash(): entries = mothermayi.entryway.get_entries('pre-commit') handle_plugins(entries)
Python
0
d9c283c37f350c8b1629e671f38ef447ef1bbd1f
Add inventory unit tests
shade/tests/unit/test_inventory.py
shade/tests/unit/test_inventory.py
# -*- coding: utf-8 -*- # 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, softw...
Python
0.000069
ec69c9260a2205ab0b7b9b7c4903ae2ced6029a1
add settings file
msschem_settings.py
msschem_settings.py
import os.path from msschem.models import CAMSRegDriver from msschem.download import CAMSRegDownload register_datasources = { 'CAMSReg_ENSEMBLE': CAMSRegDriver( dict( dldriver=CAMSRegDownload( token='MYTOKEN', modelname='ENSEMBLE'), force=False, ...
Python
0
e8d579177ee9fae714dcc3dfc36b5a5c234dfa0e
Create simulator_follow_blue.py
simulator/simulator_follow_blue.py
simulator/simulator_follow_blue.py
from Myro import * init("sim") setPictureSize("small") autoCamera() #''' #chase blue setting ylow = 0 yhigh = 255 ulow = 170 #130 for the straw # originally 134 uhigh = 250 # up to 158, really 145, 157 for the straw #142 originally vlow = 90 # down to 109, really 114, 110 for the straw #114 originally vhigh = 120 #r...
Python
0.000001
7ebded009386fe5b9ef4a6719fe100fa0a3836ba
Create 0013.py
Liez-python-code/0013/0013.py
Liez-python-code/0013/0013.py
# 网址:http://tieba.baidu.com/p/4341640851 import os import re import urllib.request def pic_collector(url): content = urllib.request.urlopen(url).read() r = re.compile('<img class="BDE_Image" pic_type="1" width="450" height="450" src="(.*?)" ') pic_list = r.findall(content.decode('utf-8')) os.mkdir('p...
Python
0.000026
cc488a5082a98f9e0a5a60a86815cb8c518fcc2d
Add test for PosRecChiSquareGamma
tests/test_posrecchisquaregamma.py
tests/test_posrecchisquaregamma.py
import unittest import numpy as np from pax import core, plugin from pax.datastructure import Event, Peak from pax.utils import empty_event class TestPosRecChiSquareGamma(unittest.TestCase): def setUp(self): self.pax = core.Processor(config_names='posrecChi', just_testi...
Python
0.000002
d8eb3d1f840dbcfbe32bf98e757b841fd062ad9e
Create ContainDupII_001.py
leetcode/219-Contains-Duplicate-II/ContainDupII_001.py
leetcode/219-Contains-Duplicate-II/ContainDupII_001.py
class Solution: # @param {integer[]} nums # @param {integer} k # @return {boolean} def containsNearbyDuplicate(self, nums, k): tb = {} for i in range(len(nums)): num = nums[i] if num not in tb: tb[num] = i elif i - tb[num] <= k: ...
Python
0
a678694e0203cd7529e28789afca49d0ae7085df
Fix a bug in trust middleware
senlin/api/middleware/trust.py
senlin/api/middleware/trust.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 # distributed unde...
# 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 # distributed unde...
Python
0.00006
16615d7794b127e9752b1a2b0bd8e70adfb0954c
Add tests for inplace subset
anndata/tests/test_inplace_subset.py
anndata/tests/test_inplace_subset.py
import numpy as np import pytest from sklearn.utils.testing import ( assert_array_equal ) from scipy import sparse from anndata.tests.helpers import ( gen_adata, subset_func, asarray ) @pytest.fixture( params=[np.array, sparse.csr_matrix, sparse.csc_matrix], ids=["np_array", "scipy_csr", "scip...
Python
0
db660f2a155b490f6a7f553ef19b8eaf8f9c9776
Create สร้าง-LINE-Bot-ด้วย-Python.py
สร้าง-LINE-Bot-ด้วย-Python.py
สร้าง-LINE-Bot-ด้วย-Python.py
# อ่าบทความ https://python3.wannaphong.com/blog/2016/10/02/สร้าง-line-bot-ด้วย-python/ from flask import Flask, request import json import requests app = Flask(__name__) @app.route('/') def index(): return "Hello World!" # ส่วน callback สำหรับ Webhook @app.route('/callback', methods=['POST']) def callback(): ...
Python
0.000005
e27bc1f295e9e3f41f5d1fc8b964283188e6e5d5
add GP classification implementation
h3lib.learn.api/H3GPC.py
h3lib.learn.api/H3GPC.py
__author__ = 'morgan' import numpy as np from H3Kernels import kernel class H3GPC(object): ''' Gaussian process classification main class The implementation is referred to Rasmussen & Williams' GP book. Note: we use Laplace appriximation and logistic function for GPC. ''' def __init__(self, s...
Python
0.000001
8f227ebc4900b931a90e0c87d9f61b4c6ea0e084
add simple topology example
src/emuvim/examples/sonata_simple_topology.py
src/emuvim/examples/sonata_simple_topology.py
""" Copyright (c) 2015 SONATA-NFV 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 applicable law or agreed to...
Python
0.000002
eb87d38a65620c7e4a716dca8a8b9488b3a338d3
Fix syntax error in collector test
src/collectors/numa/test/testnuma.py
src/collectors/numa/test/testnuma.py
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import patch from diamond.collector import Collector from numa import NumaCollector ##########...
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import patch from diamond.collector import Collector from numa import NumaCollector ##########...
Python
0.000022
e238d7cfe1a4eace62ba6a9d199813f317c34c6a
Create AnalyticalDistributions.py
effective_quadratures/AnalyticalDistributions.py
effective_quadratures/AnalyticalDistributions.py
#!/usr/bin/env python import numpy as np from scipy.special import erf """ Analytical definitions for some sample PDFs. Functions in this file are called by PolyParams when constructing "custom" orthogonal polynomials, which require Stieltejes procedure for computing the recurrence coefficients. Pranay S...
Python
0
17ba5378934d043052c3e368b4b5468c3a24a7e2
Test example to specify initial harmonies
examples/2-D_continuous_initial_harmonies_set.py
examples/2-D_continuous_initial_harmonies_set.py
#!/usr/bin/env python """ Copyright (c) 2013, Los Alamos National Security, LLC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the abov...
Python
0
0263eb5a96f610b5a2e77d11ad26e892d78c9eda
add 191
vol4/191.py
vol4/191.py
if __name__ == "__main__": lst = [1, 3, 0, 2, 1, 0, 0, 1] while lst[0] < 30: n, t, a, b, c, d, e, f = lst lst = [n + 1, 2 * t + b - a, c, 2 * b - a + d, t - (a + c), e, f, t] print lst[1]
Python
0.999998
0e063285f592127b2fe8ec4e8ad516d65b97e39e
Support for KDE
pasters/kde.py
pasters/kde.py
# -*- coding: utf-8 -*- import json import urllib from base import BasePaster class KdePaster(BasePaster): _host = 'paste.kde.org' _uri = '/' _method = 'POST' _ssl = False def paste(self): data = { 'paste_user': self.poster(), 'paste_lang': self.prepare_syntax(keepWhenMissing = False), 'paste_data':...
Python
0
84d3e73fd7ff79e36268fce4b470af8fa3617f0c
Add couple of routes for the admin blueprint
app/admin/routes.py
app/admin/routes.py
from flask import render_template, redirect, url_for, flash, request from flask.ext.login import login_required, current_user from . import admin from .forms import ProfileForm from .. import db from ..models import User @admin.route('/') @login_required def index(): return render_template('admin/user.html', user=...
Python
0
12bb21ca19a36465241c85b4f69838294c817630
Update to version 3.4.2
lib/ansiblelint/version.py
lib/ansiblelint/version.py
__version__ = '3.4.2'
__version__ = '3.4.1'
Python
0
4e4d4365a0ef1a20d181f1015152acb116226e3d
Add device class for low battery (#10829)
homeassistant/components/binary_sensor/__init__.py
homeassistant/components/binary_sensor/__init__.py
""" Component to interface with binary sensors. For more details about this component, please refer to the documentation at https://home-assistant.io/components/binary_sensor/ """ import asyncio from datetime import timedelta import logging import voluptuous as vol from homeassistant.helpers.entity_component import ...
""" Component to interface with binary sensors. For more details about this component, please refer to the documentation at https://home-assistant.io/components/binary_sensor/ """ import asyncio from datetime import timedelta import logging import voluptuous as vol from homeassistant.helpers.entity_component import ...
Python
0
4d2b0fdb4ee3289c7a2ba435f77f70c978cdd166
add script to fetch recursively [bug] infinite loop
fetch_recursively.py
fetch_recursively.py
#!/usr/bin/env python from sys import argv import random import urllib def fetch(src_url): ## first fetch the source HTML page num = 100000 * random.random() filename = str(num) urllib.urlretrieve(src_url, filename=filename) txt = open(filename, "r") for line in txt: index = line.find(".pdf") inde...
Python
0
2ea9f36c8eaf796011d93c361e663b01ba259842
Call new doc sync in repair command
src/sentry/runner/commands/repair.py
src/sentry/runner/commands/repair.py
""" sentry.runner.commands.repair ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import os import click from sentry.runner.decorators import configuration @cl...
""" sentry.runner.commands.repair ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import click from sentry.runner.decorators import configuration @click.comman...
Python
0
eec339635bee64d3e50a29167a639a93bc40a3a3
Create set selections for debconf
genes/debconf/set.py
genes/debconf/set.py
import os from subprocess import call from functools import partial #TODO: stop using sudo or ensure it exists #TODOE: specify user to run as #TODO: utilize functools partial to handle some of the above functionality class Config: SET_SELECTIONS = ['sudo', '-E', 'debconf-set-selections'] ENV = os.environ.copy(...
Python
0
7a4857682567b5a23f940e05189e02d797599d51
Add tests/test_00_info.py that simply reports the icat version number and package directory to the terminal.
tests/test_00_info.py
tests/test_00_info.py
"""Report version info about python-icat being tested. """ from __future__ import print_function import pytest import os.path import icat class Reporter(object): """Cumulate messages and report them later using a terminalreporter. """ def __init__(self, terminalreporter): super(Reporter, self).__...
Python
0.000006
9afbdbb0fa7f77269b08680e9290fa2628d88caf
add problem 069
problem_069.py
problem_069.py
#!/usr/bin/env python #-*-coding:utf-8-*- ''' Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=...
Python
0.000088
292fd8b37f9f0b28176ceb3c41f3b2f85b227049
bump version in __init__.py
oneflow/__init__.py
oneflow/__init__.py
VERSION = '0.20.11.15'
VERSION = '0.20.11.14'
Python
0.000023
9df7b7e49c5f7ec9d8962cc28f1b19f18dda114c
Add custom exceptions for api errors
overwatch/errors.py
overwatch/errors.py
class InvalidFilter(Exception): """ Raise when 'filter' key word argument is not recognized """ pass class InvalidHero(Exception): """ Raise when 'hero' key word argument is not recognized """ pass class InvalidCombination(Exception): """ Raise when 'filter' and 'hero' key wo...
Python
0
0d3343300d62afc37ba7a3bc1ec6e81bb8f8c648
add parent.py to be forked
worker/namespace/parent.py
worker/namespace/parent.py
#TODO make sure listening on the pipe blocks correctly, better error handling import os, sys, ns, time from subprocess import check_output sys.path.append('/handler') # assume submitted .py file is /handler/lambda_func def handler(args, path): import lambda_func try: ret = lambda_func(args) excep...
Python
0.000002
1b7cce5b8dd274b904466dc6deeac312238fc857
add test_comp.py, add test function stubs
wradlib/tests/test_comp.py
wradlib/tests/test_comp.py
#!/usr/bin/env python # ------------------------------------------------------------------------------- # Name: test_comp.py # Purpose: testing file for the wradlib.comp module # # Authors: wradlib developers # # Created: 26.02.2016 # Copyright: (c) wradlib developers # Licence: The MIT License...
Python
0
80089ad2856b60383692a8dd5abe8520f61a0895
Create write_OME-XML_from_file.py
write_OME-XML_from_file.py
write_OME-XML_from_file.py
# -*- coding: utf-8 -*- """ @author: Sebi File: write_OME-XML_from_file.py Date: 17.12.2015 Version. 1.0 """ import bfimage as bf from lxml import etree as etl def create_omexml(testdata, method=1, writeczi_metadata=True): # creates readable xml files from image data files. Default method should be = 1. if...
Python
0
5f5f48f2f6f8c82d97858230219f67229d3165a4
patch to add match_ids to history
patch-rating-history2.py
patch-rating-history2.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # from datetime import datetime from dump_qlstats_data import connect_to_database GAMETYPES_AVAILABLE = ["ad", "ctf", "tdm"] def main(args): try: db = connect_to_database() except Exception as e: print("error: " + str(e)) return 1 for gametype in GA...
Python
0
38375800cee8c02051d7d8212ccc5fc843a109f1
Create client.py
client.py
client.py
import socket def Main(): host = '192.168.43.130' port = 5000 s = socket.socket() s.connect((host, port)) message = raw_input('-->') while message != 'q': s.send(message) data = s.recv(1024) print "server: " + str(data) message = raw_input('-->') s.close() if __name__ == '__main__': Main()
Python
0.000001
901d430e3f6705af372974b6e1b42e36884ba47f
Add mplimporthook.py
jupyter/mplimporthook.py
jupyter/mplimporthook.py
"""Startup script for IPython kernel. Installs an import hook to configure the matplotlib backend on the fly. Originally from @minrk at https://github.com/minrk/profile_default/blob/master/startup/mplimporthook.py Repurposed for docker-stacks to address repeat bugs like https://github.com/jupyter/docker-stacks/issues...
Python
0.000001
baaeee7b003030ded5336c7da9e01c04beea46f3
add swscale dependency
autoconf/swscale.py
autoconf/swscale.py
from _external import * swscale = LibWithHeaderChecker( 'swscale', 'libswscale/swscale.h', 'c', )
Python
0
626ce0dbd2450812e0cbac12293133e12bae0daf
Add parsing module
autosort/parsing.py
autosort/parsing.py
import ast import textwrap import tokenize from collections import namedtuple from tokenize import COMMENT, DEDENT, ENDMARKER, INDENT, NEWLINE, STRING, NAME class Name(namedtuple('Name', 'name asname')): CAMEL, SNAKE, CONST = range(3) @property def kind(self): name = self.name.split('.')[-1] ...
Python
0.000001
059dae76827ac016524925d94c10e5ed0a83f2c2
Create PreFilterExample.py
home/Alessandruino/PreFilterExample.py
home/Alessandruino/PreFilterExample.py
from org.myrobotlab.opencv import OpenCVFilterAffine affine = OpenCVFilterAffine("affine") affine.setAngle(180.0) leftPort= "/dev/cu.wchusbserial1450" i01 = Runtime.start("i01","InMoov") headTracking = i01.startHeadTracking(leftPort) eyesTracking = i01.startEyesTracking(leftPort,10,12) i01.headTracking.addPreFilter(...
Python
0
c24fb3b6b41b2f06cee79fd21b090403f3a67457
Add TwrSearch class
twitter/twr_search.py
twitter/twr_search.py
#!/usr/bin/env python # # Copyright (c) 2013 Martin Abente Lahaye. - tch@sugarlabs.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 without limitation the righ...
Python
0
49edeac697b6c4457f2f55ff4086c9dbacedaa71
add try implementation
pymonet/try.py
pymonet/try.py
class Try: def __init__(self, value, is_success): self.value = value self.is_success = is_success def __eq__(self, other): return self.value == other.value and self.is_success == other.is_success @classmethod def of(cls, fn, *args): try: return cls(fn(*args...
Python
0
3f35e9b3913bb99cf7b299c36528eefa878337f4
Add method to determine output name
mopidy/outputs/__init__.py
mopidy/outputs/__init__.py
import pygst pygst.require('0.10') import gst import logging logger = logging.getLogger('mopidy.outputs') class BaseOutput(object): """Base class for providing support for multiple pluggable outputs.""" def get_bin(self): """ Build output bin that will attached to pipeline. """ ...
import pygst pygst.require('0.10') import gst import logging logger = logging.getLogger('mopidy.outputs') class BaseOutput(object): """Base class for providing support for multiple pluggable outputs.""" def get_bin(self): """ Build output bin that will attached to pipeline. """ ...
Python
0.001316
ea6458a88079b939188d0e5bf86eedeb62247609
add src/cs_utime.py
src/cs_utime.py
src/cs_utime.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- '''cs_utime os.stat(fn).st_ctime # 978307200.0 tt=time.strptime('20010101T090000', '%Y%m%dT%H%M%S') # (2001,1,1,9,0,0,0,1,-1) t=time.mktime(tt) # 978307200.0 os.utime(fn, (t, t)) # (atime, mtime) ''' import sys, os, stat import time FSENC = 'cp932' UPATH = u'/tmp/tmp' F...
Python
0
a2a268ea8b9b2876011453476baedaa4bca01559
Create ball.py
python/ball.py
python/ball.py
#!/usr/bin/env python from rgbmatrix import RGBMatrix import sys, time import math rows = 16 chains = 1 parallel = 1 ledMatrix = RGBMatrix(rows, chains, parallel) numRows = 16 height = ledMatrix.height width = ledMatrix.width try: print "Press Ctrl + C to stop executing" while True: nextFrame = ledMatrix.CreateF...
Python
0.000011
5eb0dce7f2c287203ace05b6989785b7e4fdac75
add script to track xmin in the database
nagios/check_pgsql_xmin.py
nagios/check_pgsql_xmin.py
""" Return the maximum xmin in the database """ import os import sys import stat import psycopg2 IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody') icursor = IEM.cursor() def check(): icursor.execute(""" SELECT datname, age(datfrozenxid) FROM pg_database ORDER by age DESC LIMIT 1 """)...
Python
0
c373bbb351de421881d9f0e2f8a16d541bb21347
add test-receive-file-ipv6.py
tests/twisted/avahi/test-receive-file-ipv6.py
tests/twisted/avahi/test-receive-file-ipv6.py
import avahi import urllib import BaseHTTPServer import SocketServer import socket from saluttest import exec_test from file_transfer_helper import ReceiveFileTest from avahitest import AvahiListener from xmppstream import connect_to_stream6 from twisted.words.xish import domish class TestReceiveFileIPv6(ReceiveFil...
Python
0.000002
f296eb4a87a1130cb72e00099f7e9441425548ec
add device handler
ncclient/devices/huawei.py
ncclient/devices/huawei.py
""" Handler for Cisco Nexus device specific information. Note that for proper import, the classname has to be: "<Devicename>DeviceHandler" ...where <Devicename> is something like "Default", "Huawei", etc. All device-specific handlers derive from the DefaultDeviceHandler, which implements the generic information...
Python
0.000001
401fbbd7440f16c462ca31150d9873da5f052356
create app.py
reddit2telegram/channels/r_freegamefindings/app.py
reddit2telegram/channels/r_freegamefindings/app.py
#encoding:utf-8 subreddit = 'freegamefindings' t_channel = '@r_freegamefindings' def send_post(submission, r2t): return r2t.send_simple(submission)
Python
0.000004
c29b548145ad0e235ebdc1fa9f43fcdd714f3ca0
Add 110-balanced-binary-tree.py, refer to SolutionFromJw2013, but I improve the code style and document
110-balanced-binary-tree.py
110-balanced-binary-tree.py
""" Question: Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1. Performance: 1. Total Accepted: 75753 Total Submiss...
Python
0
412828bea81f5aad917188881c1e7e4d6ce52400
Add tests for the management views
usingnamespace/tests/test_views_management.py
usingnamespace/tests/test_views_management.py
import unittest from pyramid import testing class ManagementViewsTest(unittest.TestCase): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown() def makeOne(self, context, request): from usingnamespace.views.management import Management retu...
Python
0
5d17ab74ae3169d9efcd69aab481b8da69ec1686
merge dev-dhh
examples/cifar/desc_cifar_resnet.py
examples/cifar/desc_cifar_resnet.py
# -*- coding:utf8 -*- # File : desc_cifar.py # Author : Jiayuan Mao # Honghua Dong # Email : maojiayuan@gmail.com # dhh19951@gmail,com # Date : 2/27/17 # # This file is part of TensorArtist import tensorflow as tf from tartist.core import get_env, get_logger from tartist.core.utils.naming impor...
Python
0
50d84e5b134b69cebcb4935da24a3cc702e1feef
Add coverage for resolve_ref_for_build
tests/zeus/tasks/test_resolve_ref.py
tests/zeus/tasks/test_resolve_ref.py
from zeus import factories from zeus.tasks import resolve_ref_for_build def test_resolve_ref_for_build(mocker, db_session, default_revision): build = factories.BuildFactory.create( repository=default_revision.repository, ref=default_revision.sha ) assert build.revision_sha is None resolve_re...
Python
0.000001
fbb8bffd5e1cb633cc59eb5b1e61fef2067e836a
add empty unit test for viewimage module
supvisors/tests/test_viewimage.py
supvisors/tests/test_viewimage.py
#!/usr/bin/python #-*- coding: utf-8 -*- # ====================================================================== # Copyright 2016 Julien LE CLEACH # # 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 Lice...
Python
0
0f395ca18526ea4c6675bd772cc9af88a6baf006
Create __init__.py
channels/r_gonewild30plus/__init__.py
channels/r_gonewild30plus/__init__.py
Python
0.000429
10fe17255335e16aac9f828764050bd2c0874175
Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/79deb43ff6fe999bc7767f19ebdc20814b1dfe80.
third_party/tf_runtime/workspace.bzl
third_party/tf_runtime/workspace.bzl
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "79deb43ff6fe999bc7767f19ebdc20814b1dfe80" TFRT_SHA256 = "3b9a217602bd20258595ebe997a2...
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "0ca0913cd468b657b76a001b74ffa6e91e4eed03" TFRT_SHA256 = "a85d109a5ca7daee97115903784b...
Python
0
430b5daebbd5385551203c2a0cf23bb355a2c027
Add a script that uses the Flickr API.
doc/source/scripts/06-cat-of-cats.py
doc/source/scripts/06-cat-of-cats.py
import os import photomosaic as pm import photomosaic.flickr import matplotlib.pyplot as plt # For these published examples we use os.environ to keep our API key private. # Just set your own Flickr API key here. FLICKR_API_KEY = os.environ['FLICKR_API_KEY'] # Get a pool of cat photos from Flickr. pm.set_options(flic...
Python
0
3aad37e287a6d0fdb037393d4fcc30817c9dece5
Create statanalyisi.py
statanalyisi.py
statanalyisi.py
import string #This line defines string so as to be able to get rid of punctuation. import re name = raw_input("Enter file:") if len(name) < 1 : name = "manqnohyphen.txt" print "Much Ado about Nothing statistics" handle = open(name) text = handle.read() print '' print 'There are', len(text), 'characters in the text.'...
Python
0.000008
65ac6b1281ff9cbd17bd0d8dd2f9c188d71215f9
Fix log capture on py3
test/service.py
test/service.py
import logging import re import select import subprocess import threading import time __all__ = [ 'ExternalService', 'SpawnedService', ] class ExternalService(object): def __init__(self, host, port): logging.info("Using already running service at %s:%d", host, port) self.host = host ...
import logging import re import select import subprocess import threading import time __all__ = [ 'ExternalService', 'SpawnedService', ] class ExternalService(object): def __init__(self, host, port): logging.info("Using already running service at %s:%d", host, port) self.host = host ...
Python
0
b66b02be95e7b0c36a9ced53b07d91298190ca4a
Add tests for mpi4py.dl module
test/test_dl.py
test/test_dl.py
from mpi4py import dl import mpiunittest as unittest import sys import os class TestDL(unittest.TestCase): def testDL1(self): if sys.platform == 'darwin': libm = 'libm.dylib' else: libm = 'libm.so' handle = dl.dlopen(libm, dl.RTLD_LOCAL|dl.RTLD_LAZY) self.a...
Python
0
63c4883c8bbcd9d1d2ef9417a776ea6134e8e48c
Add python file
gui.py
gui.py
################################################################################ # File name: gui.py # # Function: Display three data from stm32f4 using Python (matplotlib) # The three data is roll, pith, yall angle of quadcopter attitude. # # Reference:http://electronut.in/plotting-real-time-data-from-arduino-usin...
Python
0.000009
cf3cae6493a369173244e05d190cceae41b9abbd
Add some coverage for olog callback.
bluesky/tests/test_olog_cb.py
bluesky/tests/test_olog_cb.py
from bluesky import Msg from bluesky.callbacks.olog import logbook_cb_factory text = [] def f(**kwargs): text.append(kwargs['text']) def test_default_template(fresh_RE): text.clear() fresh_RE.subscribe('start', logbook_cb_factory(f)) fresh_RE([Msg('open_run', plan_args={}), Msg('close_run')]) a...
Python
0
57cfba649e3d7a441e7c10a25448ccb8413b964e
Put PageAdmin back
mangaki/mangaki/admin.py
mangaki/mangaki/admin.py
# coding=utf8 from mangaki.models import Anime, Track, OST, Artist, Rating, Page, Suggestion from django.forms import Textarea from django.db import models from django.contrib import admin, messages class AnimeAdmin(admin.ModelAdmin): search_fields = ('id', 'title') list_display = ('id', 'title', 'nsfw') l...
# coding=utf8 from mangaki.models import Anime, Track, OST, Artist, Rating, Page, Suggestion from django.forms import Textarea from django.db import models from django.contrib import admin, messages class AnimeAdmin(admin.ModelAdmin): search_fields = ('id', 'title') list_display = ('id', 'title', 'nsfw') l...
Python
0
e3d92ce2cd17a967ac19aecad2998c4094f2ae11
Add script to draw NACA foil
run.py
run.py
#!/usr/bin/env python """ This script generates a force and velocity vector diagram for a cross-flow turbine. """ import gizeh as gz import numpy as np import matplotlib.pyplot as plt def gen_naca_points(naca="0020", c=100, npoints=100): """Generate points for a NACA foil.""" x = np.linspace(0, 1, npoints)*c...
Python
0
4b8c5dd8ebc4261bcdb5e9f92e7936eba68fd5ad
Add BNB prediction script
bernoulli_nb/bnb_predict.py
bernoulli_nb/bnb_predict.py
import sys from sklearn.naive_bayes import BernoulliNB as BNB import matplotlib.pyplot as plt import numpy as np def read_variants(flname): fl = open(flname) markers = [] individuals = [] population_ids = [] population = -1 for ln in fl: if "Marker" in ln: if len(individuals) == 0: continue marker ...
Python
0.000001
2ccbed0e4d867652554dff208d7c1b7bdd1710f9
add bench/test_curry
bench/test_curry.py
bench/test_curry.py
from toolz.curried import get pairs = [(1, 2) for i in range(100000)] def test_get_curried(): first = get(0) for p in pairs: first(p)
Python
0.000014
3017396176491dae5bab3effda82a59e64a3591f
Add button_example
examples/pygobject/button_example.py
examples/pygobject/button_example.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2011 Sebastian Pölsterl # # Permission is granted to copy, distribute and/or modify this document # under the terms of the GNU Free Documentation License, Version 1.3 # or any later version published by the Free Software Foundation; # with no Invariant Sections, no ...
Python
0.000002
efc7097c0248394716144f552522daa1d44b74ce
add test python script
twython_test.py
twython_test.py
import datetime import sys from twython import Twython from gettokens import tokens tweet = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S') api = Twython(tokens['api_key'], tokens['api_secret'], tokens['access_token'], tokens['access_token_secret']) api.update_sta...
Python
0.000002
bb5457ab736b5f94b9efb9772da16c5ebf97fa06
Test for interpolation functions
tests/theanolm/probfunctions_test.py
tests/theanolm/probfunctions_test.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import math from theanolm.probfunctions import * class TestProbFunctions(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_interpolate_linear(self): self.assertAlmostEqual( interp...
Python
0
b8e27997000c448d191121ef0f8b08ebca877ed0
Add GNU Prolog package.
var/spack/repos/builtin/packages/gnu-prolog/package.py
var/spack/repos/builtin/packages/gnu-prolog/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
d57a1049b45614abfe393f80328a07d78c98b5b2
Add system tray support
main.py
main.py
#!/usr/bin/env python # -*-coding: utf8 -*- import wx import webbrowser TRAY_TOOLTIP = 'System Tray Demo' TRAY_ICON = 'icon/network.png' def create_menu_item(menu, label, func): item = wx.MenuItem(menu, -1, label) menu.Bind(wx.EVT_MENU, func, id=item.GetId()) menu.AppendItem(item) return item clas...
Python
0
a61bb392fd69c953d7d8c23155d1370bc145533d
Create TOA_Filtering.py
filtering-libstempo/TOA_Filtering.py
filtering-libstempo/TOA_Filtering.py
# TOA_Filtering.py # A script that takes in a .par file, .tim file, start time and end time, and an output directory # as a result, it creates a new file with TOAs in the time range, stored in output directory # sample input: # python TOA_Filtering.py /Users/fkeri/Desktop/B1855+09_NANOGrav_9yv0.par /Users/fkeri/Desktop...
Python
0
d6120537ec982f50d08fa188e91c68c023809db3
Send ERROR when the user disconnects
txircd/modules/rfc/response_error.py
txircd/modules/rfc/response_error.py
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from zope.interface import implements class ErrorResponse(ModuleData): implements(IPlugin, IModuleData) name = "errorResponse" core = True def actions(self): return [("quit", 10, self.sendEr...
Python
0.000001
12dda7a7473c094b4483789630e178fd60b0eba4
add routes.py
web/transit/routes.py
web/transit/routes.py
import transit import transit.views.basic from transit import app routes = ( ('/api/trains/', transit.views.basic.get_all_trains), ('/api/trains/line/<line>/', transit.views.basic.get_trains_on_line), ('/api/trains/station/<station>/', transit.views.basic.get_trains_at_station) ) for route, func in route...
Python
0.000002
2a590a11f92e03d923d66cfc6e8fe5837feb0f20
Add a snippet: 'matplotlib/gaussian_convolution'.
matplotlib/gaussian_convolution/gaussian_convolution_1d.py
matplotlib/gaussian_convolution/gaussian_convolution_1d.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Gaussian convolution 1D""" # Copyright (c) 2012 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 withou...
Python
0.999972
fac031300c81c31f5d6022a65d3637fd4e62fa91
add blink 3 script
raspberry-pi/led-blink3.py
raspberry-pi/led-blink3.py
import RPi.GPIO as GPIO import time def blink(ledPin, onTime, offTime): GPIO.output(ledPin, GPIO.HIGH) time.sleep(onTime) GPIO.output(ledPin, GPIO.LOW) time.sleep(offTime) return def blinkThree(redLedPin, blueLedPin, greenLedPin): blink(redLedPin, 1, 0) blink(blueLedPin, 1, 0) blin...
Python
0
ac44a041e3e7808305b025e1087f48b7d4a9234a
Add script to delete Bit.ly raw results from S3
tools/bitly/delete_bitly_blobs.py
tools/bitly/delete_bitly_blobs.py
#!/usr/bin/env python3 import argparse import boto3 import os from typing import List from mediawords.util.log import create_logger l = create_logger(__name__) def delete_bitly_blobs(story_ids: List[int]): session = boto3.Session(profile_name='mediacloud') s3 = session.resource('s3') bucket = s3.Bucket...
Python
0
37c0257fcc5e65b67fabfd17c2bf884ad8fe03e1
Add migration to reset signatures
recipe-server/normandy/recipes/migrations/0038_remove_invalid_signatures.py
recipe-server/normandy/recipes/migrations/0038_remove_invalid_signatures.py
""" Removes signatures, so they can be easily recreated during deployment. This migration is intended to be used between "eras" of signatures. As the serialization format of recipes changes, the signatures need to also change. This could be handled automatically, but it is easier to deploy if we just remove everything...
Python
0
2c60e8a6f419437a14a5f99855f9f5ffd8e4b499
use FlowNet for the whole dataset
FlowNet/flownet-release/models/flownet/opticalFlow_dataset.py
FlowNet/flownet-release/models/flownet/opticalFlow_dataset.py
# Simple optical flow algorithm # run for the whole UCF-101 dataset # python version: 3.4.3 # OpenCV version: 3.1.0 # Contact: # Min-Hung (Steve) Chen at <cmhungsteve@gatech.edu> # Chih-Yao Ma at <cyma@gatech.edu> # Last update: 05/16/2016 import numpy as np import cv2 import os from scripts.flownet import FlowNet ...
Python
0
c8371ac7c7d10473abf2086d28f3b1a4813800f4
Add menu.py
menu.py
menu.py
from __future__ import division, print_function import numpy as np import matplotlib import matplotlib.colors as colors import matplotlib.patches as patches import matplotlib.mathtext as mathtext import matplotlib.pyplot as plt import matplotlib.artist as artist import matplotlib.image as image import os class ItemPr...
Python
0.000002
8ff39701ce4549bf46f03342ee4ff6bdadddc2ff
Create Blob Upload script
blueprints/gcp_storage/management/upload_blob.py
blueprints/gcp_storage/management/upload_blob.py
from __future__ import unicode_literals import json import os from pathlib import Path from typing import Optional from common.methods import set_progress from google.oauth2.credentials import Credentials from googleapiclient.discovery import Resource as GCPResource from googleapiclient.discovery import build from go...
Python
0
f33ca28e7465a0b35d2419dd9016196f63a114d8
Add demo.py
demo.py
demo.py
#!/usr/bin/python3 # -*- encoding: utf-8 -*- from indexes import * import global_data def main(stock='000001', date=global_data.NEWEST_TRADE_DATE, p_MA=5, p_MACD=(12,26,9), p_RSI=6, p_KDJ=(9,3), p_MTM=(12,6)): """ Example date: str, '2017-08-18' p_MA: int, 5 p_MACD: tuple...
Python
0.000002
c19c1838802ef8b4429df605e085176aef3bb45f
Create 04_peery_beams.py
examples/01-advanced/04_peery_beams.py
examples/01-advanced/04_peery_beams.py
r""" .. _ref_ex_peery_beams: Symmetric and Unsymmetric Beams in Complex Bending -------------------------------------------------- Calculate section properties of two different beams given in examples from 'Aircraft Structures,' by Peery. These cases have known results, and the output from SectionProperties can be ...
Python
0
c29bf2b9a87fdeb58d78a3ef3219292742371314
test script for BEL2 stmt checks
bin/test_bel2_validation.py
bin/test_bel2_validation.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Usage: program.py <customer> """ import requests import json base_url = "http://localhost:9292" files = ['bel2.0-example-statements.bel', 'bel2_document_examples.bel'] def send_request(bel): # Issue #134 # GET http://localhost:9292/api/expressions/rxn(r...
Python
0
78cc6be2243e1e41000f4ff214fe8edea391780c
Create mixcolumns.py
research/aes/mixcolumns.py
research/aes/mixcolumns.py
# mixcolumns.py import sys sys.path.append("../..") import pyrtl from pyrtl import * def MixColumns(in_vector): """ MixColumns round of AES. Input: A single wirevector of bitwidth 128. Output: A single wirevector of bitwidth 128. """ a0 = in_vector[120:128] a1 = in_vector[112:120] a2 = in_vector[104:112] a3...
Python
0
cec17c0aaf794cdd108713642e0662c7eac7a020
Create cesarEncription.py
assigment1/cesarEncription.py
assigment1/cesarEncription.py
# Chechinput: returns false is the inputed text # has any numeric character def checkInput(userInput): return userInput.isalpha() # CheckNumber: returns false is the inputed text # has any numeric character def checkNumber(userInput): return userInput.isdigit() def readMessage(): valid = False; message = '...
Python
0.000005
fc35e902e4a41176e1860b5a42fb5ce51c3042f7
Add scaleioutil
scaleiopy/scaleioutil.py
scaleiopy/scaleioutil.py
import logging class ScaleIOLogger: instance = None @classmethod def get(cls): if cls.instance is None: cls.instance = cls() return cls.instance def __init__(self): # How to use: # loggerInstance = ScaleIOLogger.get() # logger = loggerInstance.get...
Python
0
606b00e7f09e45e57cf6872c67db2d2af8aeff27
Add augeas module
salt/modules/augeas_cfg.py
salt/modules/augeas_cfg.py
''' Manages configuration files via augeas ''' def __virtual__(): ''' Only run this module if the augeas python module is installed ''' try: from augeas import Augeas _ = Augeas except ImportError: return False else: return "augeas" def _recurmatch(path, aug): '''...
Python
0.000001
156d635653e1ec93fbaff7ee7c872a5f6035f9a8
Add new-command.py to standard_commands
extra/standard_commands/new-command.py
extra/standard_commands/new-command.py
"""Finds a directory or file inside the current project.""" from . import DodoCommand from dodo_commands.framework.config import CommandPath import os import sys script_src = """# noqa from dodo_commands.default_commands.standard_commands import DodoCommand class Command(DodoCommand): # noqa help = "" decor...
Python
0.000056
421bd355cb3d471ac61d608c9e39cc821b06089f
Create analyzefiles.py
bin/interpret/analyzefiles.py
bin/interpret/analyzefiles.py
#!/usr/bin/python
Python
0.000001
4ec3cb1ddb08e14ba3c2ba169b4c5c47c779740a
Add new package: unuran (#8397)
var/spack/repos/builtin/packages/unuran/package.py
var/spack/repos/builtin/packages/unuran/package.py
############################################################################## # Copyright (c) 2013-2018, 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
f111f106722afd3929073f78d9c52fd4e1d804e1
add androcov_report script
evaluation_scripts/androcov_report.py
evaluation_scripts/androcov_report.py
# analyze androcov result # giving the instrumentation.json generated by androcov and the logcat generated at runtime __author__ = 'yuanchun' import os import re import json from datetime import datetime # logcat regex, which will match the log message generated by `adb logcat -v threadtime` LOGCAT_THREADTIME_RE = re.c...
Python
0
ef62d0cca3f9f28cef6891b87da7b3d9e0ade953
Add stub file
2018/python/2018_02.py
2018/python/2018_02.py
"""Advent of Code 2018 Day 2: Inventory Management System""" import aoc_common import pytest DAY = 2 if __name__ == '__main__': puzzle_input = aoc_common.load_puzzle_input(DAY)
Python
0
d5b1dd851b87542ff215bc74f74e3b2e76fc5894
create traditional box score
nba_data/data/traditional_box_score.py
nba_data/data/traditional_box_score.py
class TraditionalBoxScore: def __init__(self, seconds_played, field_goals_made, field_goal_attempted, three_point_field_goals_made, three_point_field_goal_attempted, free_throws_made, free_throws_attempted, offensive_rebounds, defensive_rebounds, assists, steals, b...
Python
0.00048
c87f42579826cf236953bc955d15a9cc98c67d05
Add Migration File this time.
applications/migrations/0029_application_proposed_development_description.py
applications/migrations/0029_application_proposed_development_description.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-30 05:56 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('applications', '0028_auto_20170329_1445'), ] operations = [ migrations.AddF...
Python
0