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
02156d3e9140b7f8f61b79816891ede2fff2cc49
rename models to properties
properties.py
properties.py
import ConfigParser import os import sys subreddit = 'taigeilove' user_agent = 'Python:whalehelpbot:v1.0 (by /u/Noperative)' general_words = [] first_time_words = [] expedition_words = [] quest_words = []
Python
0.000005
e74c3273f840afbca25936083abdfb6577b4fdd0
Devuelve lista de etiquetas y atributos
smallsmilhandler.py
smallsmilhandler.py
#!/usr/bin/python # -*- coding: utf-8 -*- #CELIA GARCIA FERNANDEz from xml.sax import make_parser from xml.sax.handler import ContentHandler class SmallSMILHandler(ContentHandler): def __init__ (self): self.lista = [] self.etiquetas = ['root-layout', 'region', 'img', 'audio', 'textstream...
Python
0
024e7fe473a19a16b7e34203aef2841af7a3aad4
add markreads script
etc/markreads.py
etc/markreads.py
#!/usr/bin/env python import pysam import sys def markreads(bamfn, outfn): bam = pysam.AlignmentFile(bamfn, 'rb') out = pysam.AlignmentFile(outfn, 'wb', template=bam) for read in bam.fetch(until_eof=True): tags = read.tags tags.append(('BS',1)) read.tags = tags out.write(...
Python
0
b86ad075f690718e528364bedce891a3a4debdaf
Add a basic example API
examples/api.py
examples/api.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """Simple REST API for Imap-CLI.""" import copy import json import logging import re from wsgiref import simple_server from webob.dec import wsgify from webob.exc import status_map import imap_cli from imap_cli import config from imap_cli import const from imap_cli i...
Python
0.000129
0bd69e17d75cf1ecaa53153fd07abf2e139f57b7
add function0-input.py
input/function0-input.py
input/function0-input.py
# -*- coding: utf-8 -*- # Author Frank Hu # iDoulist Function 0 - input import urllib2 response = urllib2.urlopen("http://www.douban.com/doulist/38390646/") print response.read()
Python
0.000021
70d5b47a66d883187574c409ac08ece24277d292
Add the test.py example that is cited in the cytomine.org documentation
examples/test.py
examples/test.py
# -*- coding: utf-8 -*- # * Copyright (c) 2009-2020. Authors: see NOTICE file. # * # * 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...
Python
0
1c2bde23ffc6188fe839b36011775663f86c8919
Create config.py
config.py
config.py
# -*- coding: utf-8 -*- import configparser class Config: _cp = None def load(): Config._cp = configparser.ConfigParser() Config._cp.read("config.ini") for category in Config._cp.sections(): temp = {} for op in Config._cp.options(category): temp[op] = Config._cp[category][op] setattr(Config, cat...
Python
0.000002
0712d78cf76c1d3f699317fcc64db3fe60dc6266
Add utility functions for generating documentation
docs/utils.py
docs/utils.py
def cleanup_docstring(docstring): doc = "" stripped = [line.strip() for line in docstring.split("\n")] doc += '\n'.join(stripped) return doc
Python
0.000001
a36e013e9b1d7133ed98cb2f087f3cb3dc53de69
Add 5-2 to working dictionary.
models/tutorials/image/cifar10/5-2cnn_advance.py
models/tutorials/image/cifar10/5-2cnn_advance.py
import cifar10, cifar10_input import tensorflow as tf import numpy as np import time max_steps = 3000 batch_size = 128 data_dir = '/tmp/cifar10_data/cifar-10-batches-bin' def variable_with_weight_loss(shape, stddev, wl): var = tf.Variable(tf.truncated_normal(shape, stddev = stddev)) if wl is not None: ...
Python
0.000144
24bb92edc18ea65166873fa41cd8db3ed6d62b5d
Add tests for forms
td_biblio/tests/test_forms.py
td_biblio/tests/test_forms.py
from django.core.exceptions import ValidationError from django.test import TestCase from ..forms import text_to_list, EntryBatchImportForm def test_text_to_list(): """Test text_to_list utils""" inputs = [ 'foo,bar,lol', 'foo , bar, lol', 'foo\nbar\nlol', 'foo,\nbar,\nlol', ...
Python
0
1bf634bd24d94a7d7ff358cea3215bba5b59d014
Create power_of_two.py in bit manipulation
bit_manipulation/power_of_two/python/power_of_two.py
bit_manipulation/power_of_two/python/power_of_two.py
# Check if given number is power of 2 or not # Function to check if x is power of 2 def isPowerOfTwo (x): # First x in the below expression is for the case when x is 0 return (x and (not(x & (x - 1))) ) # Driver code x = int(input("Enter a no:")) if(isPowerOfTwo(x)): print('Yes') else: ...
Python
0.000011
00fa30068b36385c8b9b574074743af01aedff1f
find best parameters
mkTargeted/find_parameters.py
mkTargeted/find_parameters.py
def common_elements(list1, list2): return [element for element in list1 if element in list2] ngap_best = 0 glimit_best = 0 fit_best = -1 for ngap in range(5,50): for glimit in range(100,1500,100): data = t2 data = updateArray(data) #data = findClusterRedshift(data) data['CLU...
Python
0.999989
5124d27adbaac0304b2b9a318461257ed9d678fc
valid number
python/valid_num.py
python/valid_num.py
#! /usr/bin/python ''' Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one. ''' class Solution: # @param ...
Python
0.999385
8fddde260af6ea1e6de8491dd99dca671634327c
Add test for the matrix representation function.
test/operator/utility_test.py
test/operator/utility_test.py
# Copyright 2014, 2015 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. ...
Python
0
8b92e55fa202723f7859cd1ea22e835e5c693807
Add some time handling functions
Instanssi/kompomaatti/misc/awesometime.py
Instanssi/kompomaatti/misc/awesometime.py
# -*- coding: utf-8 -*- from datetime import datetime, timedelta def todayhelper(): today = datetime.today() return datetime(day=today.day, year=today.year, month=today.month) def format_single_helper(t): now = datetime.now() today = todayhelper() tomorrow = today + timedelta(days=1) the_day_...
Python
0.000015
bca4a0a0dda95306fe126191166e733c7ccea3ee
Add staff permissions for backup models
nodeconductor/backup/perms.py
nodeconductor/backup/perms.py
from nodeconductor.core.permissions import StaffPermissionLogic PERMISSION_LOGICS = ( ('backup.BackupSchedule', StaffPermissionLogic(any_permission=True)), ('backup.Backup', StaffPermissionLogic(any_permission=True)), )
Python
0
8f2d421242da11ab2b4fc3482ce6de5480b20070
Improve documentation
bears/c_languages/ClangComplexityBear.py
bears/c_languages/ClangComplexityBear.py
from clang.cindex import Index, CursorKind from coalib.bears.LocalBear import LocalBear from coalib.results.Result import Result from coalib.results.SourceRange import SourceRange from bears.c_languages.ClangBear import clang_available, ClangBear class ClangComplexityBear(LocalBear): """ Calculates cyclomati...
from clang.cindex import Index, CursorKind from coalib.bears.LocalBear import LocalBear from coalib.results.Result import Result from coalib.results.SourceRange import SourceRange from bears.c_languages.ClangBear import clang_available class ClangComplexityBear(LocalBear): """ Calculates cyclomatic complexit...
Python
0
54b66e132137eb6abea0a5ae6571dbc52e309b59
change all libraries to have module_main of 'index', and add an index.js if it doesn't have one
migrations/011-ensure_library_main_module.py
migrations/011-ensure_library_main_module.py
from jetpack.models import PackageRevision LIB_MODULE_MAIN = 'index' libs = PackageRevision.objects.filter(package__type='l', module_main='main') .select_related('package', 'modules') libs.update(module_main=LIB_MODULE_MAIN) main_per_package = {} for revision in libs: if revision.modules.filter(filenam...
Python
0.000001
2fda10a83aa5a4d3080a0ce8751e28a18fc9a3e0
Add two-point example to serve as a regression test for gridline/plot distinguishing
examples/two_point.py
examples/two_point.py
""" Demonstrates plotting multiple linear features with a single ``ax.pole`` call. The real purpose of this example is to serve as an implicit regression test for some oddities in the way axes grid lines are handled in matplotlib and mplstereonet. A 2-vertex line can sometimes be confused for an axes grid line, and t...
Python
0.000004
84b5464f67e60e35f28e0548a362ea68b13265bf
Create fullwaveform.py
fullwaveform.py
fullwaveform.py
# -*- coding: utf-8 -*- """ Created on Mon May 20 20:08:46 2013 Stuff to pull out stuff for full waveform @author: davstott davstott@gmail.com """ import os import numpy as np from scipy import interpolate from scipy import signal import matplotlib.pyplot as plt import fiona from shapely.geometry import shape from s...
Python
0.00001
ee85acb7f9f3af91db3bfb4bf766636883f07685
Add an extra test for the OpalSerializer
opal/tests/test_core_views.py
opal/tests/test_core_views.py
""" Unittests for opal.core.views """ from opal.core import test from opal.core import views class SerializerTestCase(test.OpalTestCase): def test_serializer_default_will_super(self): s = views.OpalSerializer() with self.assertRaises(TypeError): s.default(None)
Python
0.000001
1fdffc42c7ff7ea4339a58e8a19ffa07253e4149
Add script to resolve conflicts
resolveconflicts.py
resolveconflicts.py
# Copyright (C) 2014 Igor Tkach # # 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/. import argparse import couchdb from urlparse import urlparse def parse_args(): a...
Python
0.000001
a0a2017e05af986cd0a7207c429e7dc5e8b3fcd2
Add missing tests for Variable
tests/test_solver_variable.py
tests/test_solver_variable.py
from gaphas.solver import Variable def test_equality(): v = Variable(3) w = Variable(3) o = Variable(2) assert v == 3 assert 3 == v assert v == w assert not v == o assert v != 2 assert 2 != v assert not 3 != v assert v != o def test_add_to_variable(): v = Variable(3...
Python
0.000005
865356c5b7bbec2b9412ffd3d2a39fea19e4b01a
Create getcounts.py
usbcounter/getcounts.py
usbcounter/getcounts.py
import serial import json import os, sys import time
Python
0.000001
993b1af160e6ed7886c2c95770683fae72332aed
remove __debug__
direct/src/task/Task.py
direct/src/task/Task.py
""" This module exists temporarily as a gatekeeper between TaskOrig.py, the original Python implementation of the task system, and TaskNew.py, the new C++ implementation. """ from pandac.libpandaexpressModules import ConfigVariableBool wantNewTasks = ConfigVariableBool('want-new-tasks', False).getValue() if wantNewTa...
""" This module exists temporarily as a gatekeeper between TaskOrig.py, the original Python implementation of the task system, and TaskNew.py, the new C++ implementation. """ wantNewTasks = False if __debug__: from pandac.PandaModules import ConfigVariableBool wantNewTasks = ConfigVariableBool('want-new-tasks'...
Python
0.000105
85cbec4f398c49a4903c7370f74deeae3d5adabf
Create ShowData.py
ShowData.py
ShowData.py
""" The MIT License (MIT) Copyright (c) <2016> <Larry McCaig (aka: Larz60+ aka: Larz60p)> 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 rig...
Python
0
64130f988f2154870db540244a399a8297a103e9
move hardcoded URL from email script to model definition.
dj/scripts/email_url.py
dj/scripts/email_url.py
#!/usr/bin/python # email_url.py # emails the video URL to the presenters import itertools from pprint import pprint from email_ab import email_ab class email_url(email_ab): ready_state = 7 subject_template = "[{{ep.show.name}}] Video up: {{ep.name}}" body_body = """ The video is posted: {% for ur...
#!/usr/bin/python # email_url.py # emails the video URL to the presenters import itertools from pprint import pprint from email_ab import email_ab class email_url(email_ab): ready_state = 7 subject_template = "[{{ep.show.name}}] Video up: {{ep.name}}" body_body = """ The video is posted: {% for ur...
Python
0
ce47fec10ccda45550625221c64322d89622c707
Add libjpeg.gyp that wraps third_party/externals/libjpeg/libjpeg.gyp Review URL: https://codereview.appspot.com/5848046
gyp/libjpeg.gyp
gyp/libjpeg.gyp
# Copyright 2012 The Android Open Source Project # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Depend on this wrapper to pick up libjpeg from third_party { 'targets': [ { 'target_name': 'libjpeg', 'type': 'none', 'dependencies': [ ...
Python
0.000001
d4ff515df7e12d26c759adfafcacf82e47da71a1
Add util
snapchat_fs/util.py
snapchat_fs/util.py
#!/usr/bin/env python """ util.py provides a set of nice utility functions that support the snapchat_fs pkg """ __author__ = "Alex Clemmer, Chad Brubaker" __copyright__ = "Copyright 2013, Alex Clemmer and Chad Brubaker" __credits__ = ["Alex Clemmer", "Chad Brubaker"] __license__ = "MIT" __version__ = "0.1" __maintai...
Python
0.000051
7d9fd2eed72a2a65744259af1bd8580253f282d3
Create a.py
abc067/a.py
abc067/a.py
a, b = map(int, input().split()) if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0: print('Possible') else: print('Impossible')
Python
0.000489
c4d5d04a957fed09228995aa7f84ed19c64e3831
Add previously forgotten afterflight utilities module
af_utils.py
af_utils.py
#Copyright 2013 Aaron Curtis #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...
Python
0
d08f06f124dead14d47e241c81a0b6c819b15d0e
Add setup script
Setup/setup.py
Setup/setup.py
# -*- coding: utf-8 -*- import sys import os import shutil import glob import fnmatch import codecs import re from lxml import etree def get_buildtoolkit_path(): return os.path.abspath(os.path.join(os.path.split(__file__)[0], "..")) def show_usage(): print "[Usage] setup.py command" print "Command:" ...
Python
0.000001
229d5b93d6e5474dfcd125536c7744f6a7ec86d0
Create blender tool
waflib/Tools/blender.py
waflib/Tools/blender.py
#!/usr/bin/env python # encoding: utf-8 # Michal Proszek, 2014 (poxip) """ Detect the version of Blender, path and install the extension: def options(opt): opt.load('blender') def configure(cnf): cnf.load('blender') def build(bld): bld(name='io_mesh_raw', feature='blender', files=['file1.py', 'file2.py...
Python
0
f68b0bb1e1f10b10e58057f60e17377f027690f8
add a util function for ungzip.
web/my_util/compress.py
web/my_util/compress.py
import gzip from StringIO import StringIO def ungzip(resp): if resp.info().get('Content-Encoding') == 'gzip': buf = StringIO(resp.read()) f = gzip.GzipFile(fileobj=buf) data = f.read() return data else: return resp.read()
Python
0
eab925debf62d4ba180b1a114841b7a4f0fe8e76
add basic command line interface
basicInterface.py
basicInterface.py
import sys import requests import random passchars = map(chr,range(ord('a'),ord('z')+1) + range(ord('A'),ord('Z')+1) + range(ord('0'),ord('9')+1) ) class User(): def __init__(self,name,username,bracket): self.name = name self.username = username self.bracket = bracket self.password...
Python
0.000002
f66b799a22f2c74b88f867266c2e51eda1377b1c
Create find_the_mine.py
find_the_mine.py
find_the_mine.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Find the Mine! #Problem level: 6 kyu def mineLocation(field): for i in range(len(field)): for j in range(len(field)): if field[i][j]==1: return [i,j]
Python
0.00075
febc735e79f3cc1b5f2e5fe2882bf28c458f638a
Initialize init file
wikilink/db/__init__.py
wikilink/db/__init__.py
""" wikilink ~~~~~~~~ wiki-link is a web-scraping application to find minimum number of links between two given wiki pages. :copyright: (c) 2016 - 2018 by Tran Ly VU. All Rights Reserved. :license: Apache License 2.0. """ __all__ = ["db", "base", "page", "link"] __author__ = "Tran Ly Vu (vutransingapore...
Python
0
3fdb673977de57e5555eafb18e36544f3ea8c056
Solve the absurd problem with an absurd file
selection/absurd.py
selection/absurd.py
import kmeans import numpy as np kmeans = reload(kmeans) n_sample = 100 p_array = [] for i in range(n_sample): if i%10 == 0: print i, " / ", n_sample kmeans = reload(kmeans) p = kmeans.f(10) p_array.append(p) import matplotlib.pyplot as plt p_array = sorted(p_array) x = np.arange(...
Python
0.999963
c2bce27530f9997bffcb04f80a8d78db65ff98b2
Create GPS.py
home/kmcgerald/GPS.py
home/kmcgerald/GPS.py
from time import sleep # The geofence and measure distance methods should be available in MRL > 1.0.86 gps1 = Runtime.start("gps1", "GPS") gps1.connect("/dev/tty.palmOneGPS-GPSSerialOut") sleep(1) # define some points ... # Lets use Nova Labs 1.0 lat1 = 38.950829 lon1 = -77.339502 # and Nova Labs 2.0 lat2 = 38.9544...
Python
0.000007
ddc80392b17a3fadcbea09f82ea5f6936f0fd459
add fbcode_builder_config for mvfst build in oss
build/fbcode_builder/specs/mvfst.py
build/fbcode_builder/specs/mvfst.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import specs.folly as folly import specs.fizz as fizz def fbcode_builder_spec(builder): ret...
Python
0
84098985420d56d9db375531afb5083e7c7f0d08
Add an example using pygame (pygameLiveView.py). Connects to camera and show LiveView images via X or console (fbcon/svglib/etc).
src/example/pygameLiveView.py
src/example/pygameLiveView.py
from pysony import SonyAPI, common_header, payload_header import argparse import binascii import io import pygame import os # Global Variables options = None incoming_image = None frame_sequence = None frame_info = None frame_data = None done = False parser = argparse.ArgumentParser(prog="pygameLiveView") # Genera...
Python
0
20da50a3c6cee33caf2205562d0d05be6c6721fb
Create enforce_posting_limits.py
enforce_posting_limits.py
enforce_posting_limits.py
#!/usr/bin/python import sys import time import logging import praw def main(): # SET THESE - reddit application configuration user_agent = '' client_id = '' client_secret = '' username = '' password = '' # SET THESE - Customize these for your subreddit. subreddit_name = '' post_li...
Python
0.000014
82232f4c52b924c98e42bce0bd56ba604ca93555
Add 3D Helmholtz problem class
cg-static-condensation/helmholtz.py
cg-static-condensation/helmholtz.py
from firedrake import * from firedrake.utils import cached_property class HelmholtzProblem(object): name = "Helmholtz" parameter_names = ["scpc_hypre", "hypre"] def __init__(self, mesh_size=None, degree=None): super(object, self).__init__() self.degree = degree self.mesh_size =...
Python
0.000024
d8ff61b72c07a9f0b22e5cbaefe6277bf2697afc
Create project.py
project_surgery/project.py
project_surgery/project.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Gideoni Silva (Omnes) # Copyright 2013-2014 Omnes Tecnologia # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public Licen...
Python
0.000001
afb62cebced6bcbbbde2576be2d9b9d4b9ad3964
add chisquare test comparing random sample with cdf (first try of commit)
scipy/stats/tests/test_discrete_chisquare.py
scipy/stats/tests/test_discrete_chisquare.py
import numpy as np from scipy import stats debug = False def check_discrete_chisquare(distname, arg, alpha = 0.01): '''perform chisquare test for random sample of a discrete distribution Parameters ---------- distname : string name of distribution function arg : sequence ...
Python
0.000002
e87982d03edeb7c16d3c183309adfff4be50d168
Add Qt4 file to start on creating a Qt-based GUI
gui/qt.py
gui/qt.py
from lib.version import AMON_VERSION from lib.keybase import KeybaseUser from lib.gmail import GmailUser from lib.addresses import AddressBook import lib.gpg as gpg import sys import logging import json from PyQt4 import QtGui class Amon(QtGui.QMainWindow): def __init__(self): super(Amon, self).__init__(...
Python
0
3972c4a16894732db418a2d04f36b5104e0fac86
add rms code in own namespace
tkp/quality/rms.py
tkp/quality/rms.py
from tkp.utility import nice_format def rms_invalid(rms, noise, low_bound=1, high_bound=50): """ Is the RMS value of an image too high? :param rms: RMS value of an image, can be computed with tkp.quality.statistics.rms :param noise: Theoretical noise level of instrument, can be calcul...
Python
0.000001
5b34a265513381ec60def83885e754484f280c37
Create create_html.py
create_html.py
create_html.py
import os import webbrowser def create_html(): #p = subprocess.Popen('cat '+CurrPath+' | grep -B 1 -A 1 '+email, stdout=subprocess.PIPE, shell=True) #(output, err) = p.communicate() html_top=""" <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Breach Miner</title> <scrip...
Python
0.000011
5009b158f0c47ea885ba5fdcbd76dd1fc2bb6986
Use a script to post metrics to an ingest endpoint.
bfclient.py
bfclient.py
#!/usr/bin/env python import argparse from os import environ import datetime import requests import time def get_unix_time(dt): return int(time.mktime(dt.timetuple())) if __name__ == '__main__': parser = argparse.ArgumentParser() BF_URL = environ.get('BF_URL', None) BF_TOKEN = environ.get('BF_TOK...
Python
0
1613bde53cfda3d38d7e62c6c91f3d6c5407fb9c
Add script inspect_checkpoint.py to check if a model checkpoint is corrupted with NaN/inf values
inspect_checkpoint.py
inspect_checkpoint.py
""" Simple script that checks if a checkpoint is corrupted with any inf/NaN values. Run like this: python inspect_checkpoint.py model.12345 """ import tensorflow as tf import sys import numpy as np if __name__ == '__main__': if len(sys.argv) != 2: raise Exception("Usage: python inspect_checkpoint.py <file_na...
Python
0.000001
d5e16fdf73eb281da3541fa7a0e3f8792b83faeb
bump to 0.3.0
tproxy/__init__.py
tproxy/__init__.py
# -*- coding: utf-8 - # # This file is part of tproxy released under the MIT license. # See the NOTICE for more information. version_info = (0, 3, 0) __version__ = ".".join(map(str, version_info))
# -*- coding: utf-8 - # # This file is part of tproxy released under the MIT license. # See the NOTICE for more information. version_info = (0, 2, 4) __version__ = ".".join(map(str, version_info))
Python
0.000019
bb5a94208bb3a96995182b773998dbec4ebf7667
Test wrapper py script
py_scripts/EoSeval_test.py
py_scripts/EoSeval_test.py
# -*- coding: utf-8 -*- """ Code description goes in here """ import numpy import EoSeq from scipy.optimize import curve_fit # Prompt user for filename string # filename = raw_input("Please enter a file path for P and V data") # Load in data file # data = numpy.loadtxt(filename, delimiter = ',') data = numpy.loadtxt...
Python
0.000001
9a082b04973a9927014df496aa31f5c05e8be6ca
add 143
python/143_reorder_list.py
python/143_reorder_list.py
""" Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it to {1,4,2,3}. """ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self....
Python
0.999998
c91c8f56940ba60190f771ef7731169e68b2053e
Create functions.py
python/openCV/functions.py
python/openCV/functions.py
import numpy as np import cv2 def nothing(): pass def Rvalue(x): #print('R=',x) return x def Gvalue(x): #print('G=',x) return x def Bvalue(x): #print('B=',x) return x img = np.zeros((512, 512, 3), np.uint8) drawing = False # true if mouse is pressed mode = True # if True, draw rectangle. Pre...
Python
0.000006
38756d3fd7ac1d858d45f256e8d4ad118ecbf531
add basic admin file
emencia/django/socialaggregator/admin.py
emencia/django/socialaggregator/admin.py
"""Admin for parrot.gallery""" from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from emencia.django.socialaggregator.models import Feed from emencia.django.socialaggregator.models import Aggregator from emencia.django.socialaggregator.models import Ressource class FeedAdmin(ad...
Python
0
d53ec3fefddda14e6d7fad466f5e81d3ed369330
Add sfp_numverify module
modules/sfp_numverify.py
modules/sfp_numverify.py
#------------------------------------------------------------------------------- # Name: sfp_numverify # Purpose: SpiderFoot plug-in to search numverify.com API for a phone number # and retrieve location and carrier information. # # Author: <bcoles@gmail.com> # # Created: 2019-05-25 # C...
Python
0.000002
c2f96872e92c0cbe6f484e85a75ad32132473a13
Migrate in from rdfextras.
rdflib_jsonld/ldcontext.py
rdflib_jsonld/ldcontext.py
# -*- coding: utf-8 -*- """ Implementation of a Linked Data Context structure based on the JSON-LD definition of contexts. See: http://json-ld.org/ """ # from __future__ import with_statement from urlparse import urljoin try: import json except ImportError: import simplejson as json from rdflib.namespac...
Python
0
8b7db3fc9b90897c0e8da6d6b63d12e79754c625
Solve Knowit2019/19
knowit2019/19.py
knowit2019/19.py
def hidden_palindrome(n): n_s = str(n) if n_s == n_s[::-1]: return False s = str(n + int(n_s[::-1])) return s == s[::-1] def test_hidden_palindrome(): assert hidden_palindrome(38) assert not hidden_palindrome(49) if __name__ == '__main__': s = 0 for x in range(1, 12345432...
Python
0.999966
f5d4fa76c7ea97af5cd30a3840835e6b97dd0721
Add release script. (#162)
dev/release.py
dev/release.py
#!/usr/bin/env python import click from datetime import datetime from subprocess import call, check_call, check_output, PIPE import sys DATABRICKS_REMOTE = "git@github.com:databricks/tensorframes.git" PUBLISH_MODES = { "local": "tfs_testing/publishLocal", "m2": "tfs_testing/publishM2", "spark-package-publi...
Python
0
58d19ea654e0c8d250f46b0d72191e48b4bc8588
add tests for encryption/decryption in awx.main.utils.common
awx/main/tests/unit/common/test_common.py
awx/main/tests/unit/common/test_common.py
from awx.conf.models import Setting from awx.main.utils import common def test_encrypt_field(): field = Setting(pk=123, value='ANSIBLE') encrypted = common.encrypt_field(field, 'value') assert encrypted == '$encrypted$AES$Ey83gcmMuBBT1OEq2lepnw==' assert common.decrypt_field(field, 'value') == 'ANSIBL...
Python
0.000001
714c339d098bddf276df71c94ca62ab19fc45c2b
Add working LSTM tagger example
examples/lstm_tagger.py
examples/lstm_tagger.py
from __future__ import print_function, division import plac import numpy import time from timeit import default_timer as timer import dill as pickle import spacy from spacy.attrs import ORTH, LOWER, PREFIX, SUFFIX, SHAPE from spacy.tokens.doc import Doc from thinc.i2v import Embed, HashEmbed from thinc.v2v import Mod...
Python
0
0565270790e12318139d6231ab15102d52f9b2ba
Add example script to build a cooler
examples/make_cooler.py
examples/make_cooler.py
from __future__ import division, print_function from multiprocessing import Pool from collections import OrderedDict import numpy as np import pandas import h5py import Bio.Restriction as biorst import Bio.Seq as bioseq import pyfaidx import cooler def digest(fasta_records, enzyme): # http://biopython.org/DIST/...
Python
0
8ae3e44b0a43f382c98194b9caa097b62de899ef
Add script to save ner data to a csv file
nlpppln/save_ner_data.py
nlpppln/save_ner_data.py
#!/usr/bin/env python import click import os import codecs import json import pandas as pd @click.command() @click.argument('input_dir', type=click.Path(exists=True)) @click.argument('output_file', type=click.Path()) def nerstats(input_dir, output_file): output_dir = os.path.dirname(output_file) if not os.pat...
Python
0
46a40e7e8fc424cc7e7a601fc99ab2d852cd0980
Add example GCP CLI tool. (#69)
examples/gcp_cli.py
examples/gcp_cli.py
# -*- coding: utf-8 -*- # Copyright 2020 Google 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 ...
Python
0
9cc4067d581f6a97136e0f186dc8aa1dbc734e47
verify that the dynamic oracle for ArcEager can reach all projective parses
hals/transition_system/arc_eager_test.py
hals/transition_system/arc_eager_test.py
from copy import copy, deepcopy import numpy as np from unittest import TestCase from transition_system.arc_eager import ArcEager, ArcEagerDynamicOracle def generate_all_projective_parses(size): arc_eager = ArcEager(1) initial = arc_eager.state(size) stack = [] stack.append(initial) parses = set...
Python
0
db380d8e6a8dfa5444f82a0978fad3494d923278
Add tests of generate_matrix
tests/chainer_tests/testing_tests/test_matrix.py
tests/chainer_tests/testing_tests/test_matrix.py
import unittest import numpy from chainer import testing from chainer.testing import condition @testing.parameterize(*testing.product({ 'dtype': [ numpy.float16, numpy.float32, numpy.float64, numpy.complex64, numpy.complex128, ], 'x_s_shapes': [ ((2, 2), (2,)), ((2, 3), (...
Python
0.000003
3cad51e08ef4c1dcfb11cbb8c32272328b31015a
Prepare v1.2.306.dev
flexget/_version.py
flexget/_version.py
""" Current FlexGet version. This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by release scripts in continuous integration. Should (almost) never be set manually. The version should always be set to the <next release version>.dev The jenkins release job wi...
""" Current FlexGet version. This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by release scripts in continuous integration. Should (almost) never be set manually. The version should always be set to the <next release version>.dev The jenkins release job wi...
Python
0.000002
daa11c0f69412f57cc097ec188e7287a096de277
add Landsat 8 QA mask function
functions/Landsat8QA.py
functions/Landsat8QA.py
import numpy as np class Landsat8QA(): def __init__(self): self.name = "Landsat 8 Collection 2 QA Mask" self.description = "This function creates masks based on Landsat 8 Collection 2 QA band." self.bit_index = {'fill': 0, 'diluted': 1, 'cirrus': 2, 'cloud': 3, 'shadow': 4, 'snow': ...
Python
0
0ef5aa5abaf220579915e4068fd61513114b0be6
Fix evolver get_mif()
joommf/drivers/evolver.py
joommf/drivers/evolver.py
import textwrap class Minimiser(object): def __init__(self, m_init, Ms, name, d_mxHxm=0.1): self.m_init = m_init self.Ms = Ms self.name = name self.d_mxHxm = d_mxHxm def get_mif(self): mif = textwrap.dedent("""\ Specify Oxs_CGEvolve:evolver {{}} Speci...
import textwrap class Minimiser(object): def __init__(self, m_init, Ms, name, d_mxHxm=0.1): self.m_init = m_init self.Ms = Ms self.name = name self.d_mxHxm = d_mxHxm def get_mif(self): mif = textwrap.dedent("""\ Specify Oxs_CGEvolve:evolver {} Specify...
Python
0.000001
05e7db377b7f0224ec97d5f96c387d711e1e0f23
Add problem
src/SRM-144/time.py
src/SRM-144/time.py
class Time: def whatTime(self, seconds): hours = seconds / 3600 a = 3600 leftover = seconds - hours * 3600 minutes = leftover / 60 final_sec = seconds - hours * 3600 - minutes * 60 final = str(hours) + ":" + str(minutes)+ ":" + str(final_sec) return final
Python
0.03246
61f542c215c0b45bf8b4121bc4705c760c334aa9
Add a SetObjectExtruderOperation class
cura/Settings/SetObjectExtruderOperation.py
cura/Settings/SetObjectExtruderOperation.py
# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.Scene.SceneNode import SceneNode from UM.Operations.Operation import Operation from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator ## Simple operation to set the extruder a certain object ...
Python
0
cec802ac35cdc26912be882f53cb2f93aa67c022
Add clock tamer utility
greo/clock_tamer.py
greo/clock_tamer.py
#!/usr/bin/env python # Currently just a test to see if we can send data to the clock tamer. # Import things to know about clock tamer # It implements SPI with CPOL=1 and CPHA=0 # meaning we read on falling edge of SCK and change on rising edge # Here are our pinouts: # nSS = io_rx_08 = 0x0100 : active low # SCK =...
Python
0
57c29ec11b91505cade24670cc45726a8689bb9a
add needed util module
hera_mc/cm_utils.py
hera_mc/cm_utils.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD license. """Some dumb low-level configuration management utility functions. """ from __future__ import print_function import datetime def _get_datetime(_date,_time): if _date.lower() == 'now': ...
Python
0.000001
860b7b30f393622dac9badd15d65bf59679580e2
Create utils.py
image_gnip/utils.py
image_gnip/utils.py
import os import sys import time import logging.config import json class Utils: @staticmethod def insert_record(client, dataset_id, table_id, record): result = client.push_rows(dataset_id, table_id, [record], None) if result.get('insertErrors', None): prin...
Python
0.000001
7d7277b034fd8368d30cef3273514dedc9acae69
Create decode.py
decode.py
decode.py
#!/usr/bin/env python #Coding: UTF-8 from StringIO import StringIO import hmac from hashlib import sha1 import base64 from lxml import etree as ET import uuid def c14n(xml, exclusive=True): io_msg = StringIO(xml) et = ET.parse(io_msg) io_output = StringIO() et.write_c14n(io_output, exclusive=exclusive...
Python
0.00003
0080b6744b0ed9603ecf28b826e03aef01a58d2c
add editmate extension
editmate.py
editmate.py
""" Use TextMate as the editor Usage: %load_ext editmate Now when you %edit something, it opens in textmate. This is only necessary because the textmate command-line entrypoint doesn't support the +L format for linenumbers, it uses `-l L`. """ from subprocess import Popen, list2cmdline from IPython.core.error impo...
Python
0
2ecf595b29b3b45769ab0934be6d095a4f80ad56
Add mmtl unit teset
tests/metal/mmtl/test_mmtl.py
tests/metal/mmtl/test_mmtl.py
import unittest from metal.mmtl.BERT_tasks import create_tasks from metal.mmtl.metal_model import MetalModel from metal.mmtl.trainer import MultitaskTrainer class MMTLTest(unittest.TestCase): @classmethod def setUpClass(cls): task_names = [ "COLA", "SST2", "MNLI", ...
Python
0
34b1eb53ffbca24a36c103f2017b8780405c48f4
add prod wsgi to code
find.wsgi
find.wsgi
from openspending import core application = core.create_web_app()
Python
0
59de1a12d44245b69ade0d4703c98bf772681751
Add tests for User admin_forms
user_management/models/tests/test_admin_forms.py
user_management/models/tests/test_admin_forms.py
from django.core.exceptions import ValidationError from django.test import TestCase from .. import admin_forms from . factories import UserFactory class UserCreationFormTest(TestCase): def test_clean_email(self): email = 'test@example.com' form = admin_forms.UserCreationForm() form.clean...
Python
0
706e8a6318b50466ee00ae51f59ec7ab76f820d6
Create forecast.py
forecast.py
forecast.py
# -*- coding: utf-8 -*- # Weather Twitter Bot - AJBBB - 7/8/2015 v2.* import urllib2 import json from birdy.twitter import UserClient import tweepy #Twitter Keys CONSUMER_KEY = "YOUR CONSUMER KEY HERE" CONSUMER_SECRET = "YOUR CONSUMER SECRET HERE" ACCESS_TOKEN = "YOUR ACCESS TOKEN HERE" ACCESS_TOKEN_SECRET = "YOUR ...
Python
0
ae1aaaddb8adbbe4167e9b2a073493df90f6fd60
Remove unused CACHE_VERSION
subliminal/cache.py
subliminal/cache.py
# -*- coding: utf-8 -*- import datetime from dogpile.cache import make_region #: Expiration time for show caching SHOW_EXPIRATION_TIME = datetime.timedelta(weeks=3).total_seconds() #: Expiration time for episode caching EPISODE_EXPIRATION_TIME = datetime.timedelta(days=3).total_seconds() region = make_region()
# -*- coding: utf-8 -*- import datetime from dogpile.cache import make_region #: Subliminal's cache version CACHE_VERSION = 1 #: Expiration time for show caching SHOW_EXPIRATION_TIME = datetime.timedelta(weeks=3).total_seconds() #: Expiration time for episode caching EPISODE_EXPIRATION_TIME = datetime.timedelta(da...
Python
0.000065
1d5227941c4839ff781fb944f425865b8afdc01f
Add lc0732_my_calendar_iii.py
lc0732_my_calendar_iii.py
lc0732_my_calendar_iii.py
"""Leetcode 732. My Calendar III Hard URL: https://leetcode.com/problems/my-calendar-iii/ Implement a MyCalendarThree class to store your events. A new event can always be added. Your class will have one method, book(int start, int end). Formally, this represents a booking on the half open interval [start, end), the...
Python
0.000225
5dc8e70bc081646fdeb37e9af1090a78e016d91b
add script inserting initial datas in selected database
insert_initial_datas.py
insert_initial_datas.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import psycopg2 import sys import argparse POSTGRESQL_connection = u"host='localhost' port=5432 user='postgres' password='postgres'" def main(): parser = argparse.ArgumentParser(description="Script d'insertion des données initiales d'une base ENDIV.") parser.add_...
Python
0
2aa90b34951bde36696bbcb773940a6adc245f23
Add Authenticater plugin
plugins/Authenticater.py
plugins/Authenticater.py
from ts3observer.models import Plugin, Action import MySQLdb class Meta: author_name = 'Tim Fechner' author_email = 'tim.b.f@gmx.de' version = '1.0' class Config: enable = False interval = 5 yaml = { 'general': { 'servergroup_id': 0, 'remove_if_deleted': True,...
Python
0
571dbf74bfc9f893d25ad7d626de800b2b3d6c73
move load document functionality to deserializer. prepare for post/put methods
jsonapi/deserializer.py
jsonapi/deserializer.py
""" Deserializer definition.""" class DeserializerMeta(object): pass class Deserializer(object): Meta = DeserializerMeta @classmethod def load_document(cls, document): """ Given document get model. :param dict document: Document :return django.db.models.Model model: model ...
Python
0.000002
6537dc8853bb7f8d9fb93b0fb2b1c0241bb08b6b
Create client.py
python-scripts/client.py
python-scripts/client.py
import socket from datetime import datetime, time s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) # create a client socket port=9999 # get the current date-time time1=datetime.now() s.connect(("10.0.0.2", port)) # connect to server socket which is at address 10.0.0.2 and port 9999 tm=s.recv(1024) # this will rea...
Python
0
bae50495106ce5c9cb39143a58e0e73a4e823d29
Implement DispatchLoader (metapath import hook)
loader.py
loader.py
from __future__ import print_function, absolute_import, unicode_literals, division from stackable.stack import Stack from stackable.utils import StackablePickler from stackable.network import StackableSocket, StackablePacketAssembler from sys import modules from types import ModuleType class DispatchLoader(object): d...
Python
0
0f79cf1d15292476f2bead6d85d15e6f0db6ebbf
Revert "Remove manage.py in the root"
manage.py
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.sandbox.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure tha...
Python
0
77e13247b63af4dc2355bab2fdc64e2b38ec777a
Create manage.py
manage.py
manage.py
#!/usr/bin/python import argparse from json import dump, load from os import remove, rename, system parser = argparse.ArgumentParser(description='This tool is Chaincode Development Manager.') parser.add_argument("--init", action="store_true",help="Initialise the Chaincode environment") # parser.add_argument('integers...
Python
0.000001
540ab945736486ce78452750486ea73128b29d7b
Add parse_xml.py
parse_xml.py
parse_xml.py
import sys import os from bs4 import BeautifulSoup from zipfile import ZipFile def main(argv): root, ext = os.path.splitext(argv[1]) with ZipFile(argv[1]) as myzip: with myzip.open("content.xml") as f: soup = BeautifulSoup(f.read(), "lxml") # print(soup) notes = soup.findAll("draw:...
Python
0.000263
269b779fe560fb85ca527cdda2ebd4e5e9b3a89c
Add monkeyrunner script to common operations
monkey/common.py
monkey/common.py
from com.android.monkeyrunner import MonkeyDevice as mkd from com.android.monkeyrunner import MonkeyRunner as mkr _ddmm_pkg = 'br.ufpe.emilianofirmino.ddmm' def open_dev(): """Estabilish a MonkeyDevice connection to android""" return mkr.waitForConnection(1000) def open_app(device, package, activity = '.Main...
Python
0
e0d075661677b4b02fa29d108472e80b9fbcad02
Add quote fixture
SoftLayer/testing/fixtures/Billing_Order_Quote.py
SoftLayer/testing/fixtures/Billing_Order_Quote.py
getObject = { 'accountId': 1234, 'id': 1234, 'name': 'TestQuote1234', 'quoteKey': '1234test4321', } getRecalculatedOrderContainer = { 'orderContainers': [{ 'presetId': '', 'prices': [{ 'id': 1921 }], 'quantity': 1, 'packageId': 50, 'useHou...
Python
0
b517150810e3757ef5cd1aeb03088187efaa134f
Add unit tests for Mixture node
bayespy/inference/vmp/nodes/tests/test_mixture.py
bayespy/inference/vmp/nodes/tests/test_mixture.py
###################################################################### # Copyright (C) 2014 Jaakko Luttinen # # This file is licensed under Version 3.0 of the GNU General Public # License. See LICENSE for a text of the license. ###################################################################### ####################...
Python
0
07b6e59a5c7f581bd3e67f6ce254a8388e8b97e1
add test
minitds/test_minitds.py
minitds/test_minitds.py
#!/usr/bin/env python3 ############################################################################## # The MIT License (MIT) # # Copyright (c) 2016 Hajime Nakagami # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to...
Python
0.000002
9b7817e4c4583ddecf2586b595bce9e2e126f4f0
Add test for image.py
tests/image_test.py
tests/image_test.py
#!/usr/bin/env python # encoding: utf-8 from unittest import main from vimiv_testcase import VimivTestCase class ImageTest(VimivTestCase): """Image mode Test.""" @classmethod def setUpClass(cls): cls.init_test(cls, ["vimiv/testimages/arch_001.jpg"]) cls.image = cls.vimiv["image"] de...
Python
0.000002
a13ee62b02d3fe1958f2cbecd903c3e8b32562da
Add dummy test file #2
tests/test_dummy.py
tests/test_dummy.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2017 Jun-ya HASEBA # # 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
5d795253180ef11117ae27447fa597fa15b40734
Add testing for graphing code
tests/test_graph.py
tests/test_graph.py
import os from click.testing import CliRunner from cli.script import cli def get_graph_code(): return ''' from copy import deepcopy as dc class StringCopier(object): def __init__(self): self.copied_strings = set() def copy(self): string1 = 'this' string2 = dc(string1) s...
Python
0
66989005b6e9443c65c082ea1c2e4386ffae1330
Add a few basic pages tests ahead of #406
tests/test_pages.py
tests/test_pages.py
from gittip.testing import serve_request, load, setup_tips def test_homepage(): actual = serve_request('/').body expected = "Gittip happens every Thursday." assert expected in actual, actual def test_profile(): with load(*setup_tips(("cheese", "puffs", 0))): expected = "I&rsquo;m grateful for...
Python
0
7a5b46d5a9d0e45b928bcadfeb91a6285868d8f3
Create medium_RunLength.py
medium_RunLength.py
medium_RunLength.py
""" Determine the run length of a string ex: aaabbrerr > 3a2b1r1e2r """ def RunLength(string): val = string[0] count = 1 ret = "" for char in string[1:]: if char != val: ret += str(count) ret += val val = char count = 1 else: count += 1 ret += str(count) ret += val re...
Python
0.000004
f3c8117755537ca96c3c8c72d5f54b8c244c260b
add top-level class
mwdust/DustMap3D.py
mwdust/DustMap3D.py
############################################################################### # # DustMap3D: top-level class for a 3D dust map; all other dust maps inherit # from this # ############################################################################### class DustMap3D: """top-level class for a 3D dust...
Python
0.000566