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
4f2cd5d857c00c5b2f4d4aed5fff42a00a003cac
add directory
MellPlayer/directory.py
MellPlayer/directory.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Netease Music Player Created on 2017-02-23 @author: Mellcap ''' import os DIRECTORY = '~/.MellPlayer' def create_directory(directory): if not os.path.exists(directory): os.makedirs(directory)
Python
0.000001
6bf066dff1cd88a56d228e73b5eabcaee55e534f
Add unit tests for deterministic annealing gradients
bayespy/inference/vmp/tests/test_annealing.py
bayespy/inference/vmp/tests/test_annealing.py
###################################################################### # Copyright (C) 2015 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
2d9122adc0e12b00f29bca321979dc2ecc428ddc
Create proxy_scan.py
proxy_scan.py
proxy_scan.py
from burp import IBurpExtender from burp import IHttpListener from burp import IScannerListener from java.net import URL from java.io import File import datetime import time class BurpExtender(IBurpExtender, IHttpListener, IScannerListener): def registerExtenderCallbacks(self, callbacks): self._callbacks =...
Python
0.000002
19c0183e6e23195aef479553c018718565925585
Add new regex based features
nala/features/regex.py
nala/features/regex.py
import re from nala.features import FeatureGenerator class RegexNLFeatureGenerator(FeatureGenerator): def __init__(self): self.patterns = [ re.compile('[g]\.[0-9]+_[0-9]+(del)[0-9]+'), re.compile('deletion of( (the|a))?.* region'), re.compile('deletion of( (the|a))?( \...
Python
0
0259d9a361fa49966977f958b8222f977616713f
Add SRIM energy histogram vacancy analysis script (#31)
analysis/SRIMVacEnergyCount.py
analysis/SRIMVacEnergyCount.py
#!/usr/bin/python # # Tool to parse a SRIM COLLISION.txt file and produce an output comparable # to TrimVacEnergyCount (output.type = 'vaccount') # import fileinput import math import re recoil = re.compile('^\xdb') # read file header header = [''] * 4 for i in range(4) : header[i] = fileinput.input() # parse re...
Python
0
620e568b59d8e811a6457be251dfa7d5bf0f8a3d
implement stack using the linked list
utils/stack.py
utils/stack.py
try: from .linkedlist import LinkedList, Element except ModuleNotFoundError as e: from linkedlist import LinkedList, Element class Stack(object): def __init__(self, top=None): self.ll = LinkedList(top) def push(self, new_element): """Push (add) a new element onto the top of the stack"...
Python
0.000001
a94964156d1bfbcab1fd711514d375d8fba0eaf5
sum plus one
problems/sum-of-array-plus-one/sum-of-array-plus-one.py
problems/sum-of-array-plus-one/sum-of-array-plus-one.py
def sum_plus_one(arr): return sum(arr) + len(arr) print sum_plus_one([1, 2, 3, 4]) # 14
Python
0.99844
fd2cc81feab4b24b276c8f4a0a8efc16cacef60b
Add template for lab 09 class A
Lab/09/Template_09_A.py
Lab/09/Template_09_A.py
class Bangunan: def __init__(self, nama, lama_sewa, harga_sewa): self.nama = nama self.lama_sewa = lama_sewa self.harga_sewa = harga_sewa def getHargaSewa(self): return self.harga_sewa class Restoran(Object): def __init__(self, nama, lama_sewa): Bangunan.__init__(s...
Python
0.000001
5bf67ac445da7b69dd4f883b8d4ed89bd17f8274
add urlinfo with basic youtube parsing
modules/urlinfo.py
modules/urlinfo.py
from twisted.web.client import getPage from twisted.internet.defer import inlineCallbacks from core.Uusipuu import UusipuuModule import re import lxml.html class Module(UusipuuModule): def startup(self): self.log('urlinfo.py loaded') def privmsg(self, user, target, msg): if target != sel...
Python
0
e70ec3a60d36a6d525230b6864a516ac9bf9c255
importing __init__ in counting
theshitfolder/Jake/__init__.py_misconfigure/src/counting.py
theshitfolder/Jake/__init__.py_misconfigure/src/counting.py
import __init__ #Log Here logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) #import timeit #TODO add a shit ton more threads #just counts files were indexing def counting(): root=os.path.expanduser('~')#change this before development #print "start" i=1 #start = timeit.default_timer() f...
Python
0.999645
fdb2dc8b54c5d7194639457444c32c20d5e2bfca
Create launch.py
launch.py
launch.py
#!/usr/bin/env python from __future__ import print_function from __future__ import division import pygecko import opencvutils as cvu def run(): pass if __name__ == '__main__': run()
Python
0.000001
cee5313906b2ee7e4fb01fc772e2afc6c4de1072
Add simple lauch script without configuration options
launch.py
launch.py
from twisted.application import internet, service from twisted.names import dns from twisted.names import server from openvpnzone import OpenVpnStatusAuthority, extract_status_file_path def createOpenvpn2DnsService(): zones = [OpenVpnStatusAuthority(extract_status_file_path('server.conf'))] f = server.DNSSer...
Python
0
281e328711b9724027eb6b64939bf9795fe86ac4
Create linter.py
linter.py
linter.py
#!/usr/bin/python import yaml, sys, getopt, os.path def main(argv): try: opts, args = getopt.getopt(argv,"hi:") except getopt.GetoptError: print 'linter.py -i <inputfile.yml>' sys.exit(2) for opt, arg in opts: if opt == '-h': print 'linter.py -i <inputfile.yml>'...
Python
0.000002
5d7574728290fd1afba39769bb933b12b6044ee9
Create massinvandring_streamer.py
massinvandring_streamer.py
massinvandring_streamer.py
# the MassinvandringStreamer is a subclass of TwythonStreamer from twython import TwythonStreamer # the MassinvandringStreamer class will use the streaming api to find tweets containing the word 'massinvandring' # This class could technically be used to reply to all kinds of tweets. class MassinvandringStreamer(Twytho...
Python
0.000001
ced30f90907909090c0da0e468c855f400d9da92
Add shallow tests for spin-1/2 general drudge
tests/spin_one_half_gen_test.py
tests/spin_one_half_gen_test.py
"""Tests for the general model with explicit one-half spin.""" import pytest from drudge import UP, DOWN, SpinOneHalfGenDrudge @pytest.fixture(scope='module') def dr(spark_ctx): """The fixture with a general spin one-half drudge.""" return SpinOneHalfGenDrudge(spark_ctx) def test_spin_one_half_general_dru...
Python
0
251e88398541124555b0c87edf83a59c4ea0347a
add testing framework for new announcer
tests/test_announcer_2_chair.py
tests/test_announcer_2_chair.py
import unittest from source.announcer_2_chair import * class AnnouncerTestCase(unittest.TestCase): def setUp(self): pass def test_announcer_is_a_class(self): pass def test_announcer_has_a_show_method(self): pass def test_announcer_has_an_ask_human_method(self): pass
Python
0
733dc300dff354312fdfa7588bcd7636117ac0c7
Create SpatialFieldRetrieve.py
SpatialFieldRetrieve.py
SpatialFieldRetrieve.py
#------------------------------------------------------------------------------- # Name: Spatial Field Retrieval # Purpose: Retrieve a field from the source dataset and use it to populate # the target field. Honors selections. # Author: Andy Bradford # # Created: 25/02/2016 # Copyrigh...
Python
0
69ca53841e830c582dde304578ba40d3833ab920
add script to performance of trace processor ingestion am: c893b17841
tools/measure_tp_performance.py
tools/measure_tp_performance.py
#!/usr/bin/env python3 # Copyright (C) 2021 The Android Open Source Project # # 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 requ...
Python
0
4791122d34cbf4eaf6bc118c5e7e78346dee7010
add cost_ensemble
costcla/models/cost_ensemble.py
costcla/models/cost_ensemble.py
__author__ = 'al'
Python
0.001376
d099466e604c77b3f16676aec9dd1a04fa22ba98
Set point settimanali
cgi-bin/writedayssetpoints.py
cgi-bin/writedayssetpoints.py
#!/usr/bin/env python3 import os import json import cgi import cgitb cgitb.enable() # Mi serve il file dei setpoins # Se il file esiste lo apro, se no, genero entrambi SetPoints e file with open("dayssetpointarray.json") as JsonFileDays: DaysSetPoints = json.load(JsonFileDays) # Intestazione HTML print("<!DOCTYP...
Python
0.000005
abd6fab2000d8af016a0251ab9fb912c359a77ed
add atom for eLisp
compiler/eLisp2/eLisp/atom.py
compiler/eLisp2/eLisp/atom.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright (c) 2015 ASMlover. 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 above copyrig...
Python
0.000021
59f9e552d16e7d4dca73b1232c0804d4ef3154a7
Add functioning code for training sequence
training_sequence_classifier.py
training_sequence_classifier.py
import tensorflow as tf import numpy as np tf.set_random_seed(5) n_steps = 28 n_inputs = 28 n_neurons = 150 n_outputs = 10 learning_rate = 0.001 X = tf.placeholder(tf.float32, [None, n_steps, n_inputs]) y = tf.placeholder(tf.int32, [None]) with tf.variable_scope('rnn', initializer=tf.contrib.layers.variance_scalin...
Python
0.000011
6ea0d957a49f734151605c952768d15183d3a285
Create __init__.py
CyberGuard_v2/secrets/__init__.py
CyberGuard_v2/secrets/__init__.py
Python
0.000429
9e38386947ba01effcf5908adad264aa77a688e5
Add basic auth module
modernrpc/auth.py
modernrpc/auth.py
# coding: utf-8 def user_pass_test(func=None, test_function=None, params=None): def decorated(function): function.modernrpc_auth_check_function = test_function function.modernrpc_auth_check_params = params return function # If @rpc_method is used without any argument nor parenthesis...
Python
0.000001
2a44794af558563d9cdfc1d0ea9bf072fad41ffa
test soma_workflow working directory
epac/tests/test_swf_wd.py
epac/tests/test_swf_wd.py
# -*- coding: utf-8 -*- """ Created on Tue Sep 17 17:07:47 2013 @author: jinpeng.li@cea.fr """ import tempfile import os from soma_workflow.client import Job, Workflow from soma_workflow.client import Helper, FileTransfer from soma_workflow.client import WorkflowController import socket import os.path if __name__ =...
Python
0
231029d867171ad5ee708c61d8a0aed60127aa9a
Add test for Link object.
cybox/test/objects/link_test.py
cybox/test/objects/link_test.py
# Copyright (c) 2015, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import unittest from mixbox.vendor.six import u from cybox.objects.link_object import Link from cybox.objects.uri_object import URI from cybox.test.objects import ObjectTestCase class TestLink(ObjectTestCase, un...
Python
0
07b198463951753535217ff1612c2789045c4046
add manage.py
manage.py
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seed_staged_based_messaging.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
0.000001
2cad12729048dd5dc52b5d612656fe60bb3bd256
Use '/usr/bin/env python' instead of '/usr/bin/python' in manage.py to support running manage.py as an executable in virtualenvs.
manage.py
manage.py
#!/usr/bin/env python import os import sys if not os.path.exists('mysite/manage.py'): print "Eek, where is the real manage.py? Quitting." sys.exit(1) execfile('mysite/manage.py', globals(), locals())
#!/usr/bin/python import os import sys if not os.path.exists('mysite/manage.py'): print "Eek, where is the real manage.py? Quitting." sys.exit(1) execfile('mysite/manage.py', globals(), locals())
Python
0
be3c5b7f73025a88055fcc22cbfdafbd5829a1b7
Add listCycle solution
hackerrank/listCycle/solution.py
hackerrank/listCycle/solution.py
""" A linked list is said to contain a cycle if any node is visited more than once while traversing the list. Complete the function provided for you in your editor. It has one parameter: a pointer to a Node object named that points to the head of a linked list. Your function must return a boolean denoting whether ...
Python
0
979dbd0ff0fba03847ca96beaf4d68a0f4e5c9eb
Add beam information to 850um file
data/b5_scuba2_850um_addbeam.py
data/b5_scuba2_850um_addbeam.py
import os from astropy.io import fits file_scuba2_raw='B5_850um_ext_v2_regrid.fits' file_scuba2_out='B5_850um_ext_v2_regrid_beam.fits' hdu = fits.open(file_scuba2_raw) hdr =hdu[0].header data=hdu[0].data hdu.close() hdr.append(('BMAJ', 14.6/3600.)) hdr.append(('BMIN', 14.6/3600.)) hdr.append(('BPA', 0.0)) os.system(...
Python
0
d87311d349b3a7a25b23bd03804a27fd29e90b52
add missing file
moban/data_loaders/manager.py
moban/data_loaders/manager.py
import os from lml.plugin import PluginManager from moban import constants class AnyDataLoader(PluginManager): def __init__(self): super(AnyDataLoader, self).__init__(constants.DATA_LOADER_EXTENSION) def get_data(self, file_name): file_extension = os.path.splitext(file_name)[1] file_t...
Python
0.000001
5346b024ffc3e4eca25794214a4539cb8a20f08c
add monk file
monk_eproperty.py
monk_eproperty.py
#!/usr/bin/python import monkModule import monkTools as tools import os def get_desc(): return "E-property simple property interface" def create(): # module name is 'ewol' and type binary. myModule = monkModule.Module(__file__, 'eproperty', 'LIBRARY') # enable doculentation : myModule.set_website("http://atria-s...
Python
0
911787ff1c8d0fb03c522e42dcb5f8bacd7fcde6
Create netstat_parser.py
netstat_parser.py
netstat_parser.py
#The MIT License (MIT) # #Copyright (c) 2015 Robert Abela # #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 use, copy, modify, me...
Python
0
3aa165d9527266d978d943437cb03816c30b8608
add a fit_nh3 test
examples/ammonia_fit_example_wrapper.py
examples/ammonia_fit_example_wrapper.py
from __future__ import print_function import pyspeckit import numpy as np from astropy import units as u from pyspeckit.spectrum.models import ammonia xarr = np.linspace(-40, 40, 300) * u.km/u.s oneonemod = ammonia.ammonia(xarr.to(u.GHz, u.doppler_radio(ammonia.freq_dict['oneone']*u.Hz)),) twotwomod = ammonia.ammonia...
Python
0.00001
29d8e20e41ab599030cd1027069ba01f569c1627
add terminal highlight utils
highlight.py
highlight.py
class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def highlight( s, **term_color ): """return ANSI color rendered string This will work on unixes including OS...
Python
0.000001
23607247006f36034ba29eba0fddbc35c9f407b4
add script for automatic dependency updates
bin/update-web-dependencies.py
bin/update-web-dependencies.py
#!/usr/bin/env python import sys,re,urllib.request,json,fileinput from prettytable import PrettyTable def replaceAll(file,searchExp,replaceExp): for line in fileinput.input(file, inplace=1): if searchExp in line: line = line.replace(searchExp,replaceExp) sys.stdout.write(line) filenam...
Python
0
b3b3c347a1e23cd4cd5a2e4490b05e8786686a8e
add josemagicword module
ext/josemagicword.py
ext/josemagicword.py
#!/usr/bin/env python3 import discord import asyncio import sys import hashlib sys.path.append("..") import jauxiliar as jaux import joseerror as je import joseconfig as jconfig DEFAULT_MAGICWORD_DATABASE = ''' {} ''' def parse(string, message): res = [] i = 0 while i < len(string): char = strin...
Python
0.000001
f2f2f8833628058052fae0c5c814e42411f681d2
Add migrations
python/ecep/portal/migrations/0021_auto_20170625_1454.py
python/ecep/portal/migrations/0021_auto_20170625_1454.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('portal', '0020_auto_20170525_1921'), ] operations = [ migrations.AlterField( model_name='contact', n...
Python
0.000001
4feb6d987f92981542eea2a9501e363277ce4109
Create Tcheck2_clear.py
Tcheck2_clear.py
Tcheck2_clear.py
import sys from itertools import combinations F_dict = dict() M_dict = dict() counter = 0 fileIn1 = sys.argv[1] #feb_less_april_clear fileIn2 = sys.argv[2] #mar_clear.txt fileOut1 = sys.argv[3] #t_pairs_clear.feb fileOut2 = sys.argv[4] #t_uniq_pairs_clear.mar fi = open(fileIn1, 'r') num_lines = sum(1 for line in fi...
Python
0.000001
64c21a3e01d50cdc6a719f0e4e48f925d5dd9e03
Add tests for very big AST trees
src/testers/unittests/test_ast_deep.py
src/testers/unittests/test_ast_deep.py
import unittest from triton import * DEPTH = 10000 class TestDeep(unittest.TestCase): def setUp(self): """Define the arch.""" self.triton = TritonContext() self.triton.setArchitecture(ARCH.X86_64) self.ctx = self.triton.getAstContext() sym_var = self.ctx.variable(self.tr...
Python
0
c2f79200689171a49c5bd72e6354ba56ee09a6b6
Upgrade libchromiumcontent to contain printing headers.
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python import platform import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '432720d4613e3aac939f127fe55b9d44fea349e5' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[...
#!/usr/bin/env python import platform import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'bb664e4665851fe923ce904e620ba43d8d010ba5' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[...
Python
0
ddf0a5a4438531e4bfa29d8709c1c76d8ca17f59
Add helper module for keyword-only arguments.
volttron/platform/kwonlyargs.py
volttron/platform/kwonlyargs.py
'''Support functions for implementing keyword-only arguments. This module is designed to make it easy to support keyword-only arguments in Python 2.7 while providing the same kind of exceptions one would see with Python 3.x. Basic usage: def foo(arg1, *args, **kwargs): # Use required context manager to c...
Python
0
99d95d6ed14e912701b1f6ae26779612694590f5
add gdw2 django task tutorial
examples/djangotasks/tasks.py
examples/djangotasks/tasks.py
from pyjamas.ui.Label import Label from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.VerticalPanel import VerticalPanel from pyjamas.ui.TextBox import TextBox from pyjamas.ui.ListBox import ListBox from pyjamas.ui import KeyboardListener from pyjamas.JSONService import JSONProxy class TodoApp: def onModu...
Python
0.000241
cbfb38e904c7bc75c0635d36e896feef6c44fde2
add modbus_thread example
examples/modbus_thread.py
examples/modbus_thread.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # modbus_thread # start a thread for polling a set of registers, display result on console import time from threading import Thread, Lock from pyModbusTCP.client import ModbusClient SERVER_HOST = "localhost" SERVER_PORT = 502 # set global regs = [] # init a thread lock...
Python
0
9121e61cf0ae86b14ee26b454016a4678275dd84
Create Order.py
demo/openmrs/openmrs/Order.py
demo/openmrs/openmrs/Order.py
from BaseClasses import * class Enum(set): def __getattr__(self, name): if name in self: return name raise AttributeError class Order(BaseOpenmrsData): #serializable has to be implemented serialVersionUID = 1L OrderAction = Enum(['ORDER', 'DISCONTINUE']) #is this equivalent...
Python
0
3b50369b089a94eb961dcc170bee7b97c0345805
Add script to mass-comment Jenkins triggers on PR
release/src/main/scripts/mass_comment.py
release/src/main/scripts/mass_comment.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
Python
0
081297b75fdcc9415be20e84b8db19a8eae483c9
Create match_smiley_to_cvr.py
examples/match_smiley_to_cvr.py
examples/match_smiley_to_cvr.py
"""Print match and missing match between smiley and CVR.""" from __future__ import print_function from cvrminer.cvrmongo import CvrMongo from cvrminer.smiley import Smiley cvr_mongo = CvrMongo() smiley = Smiley() cvrs = smiley.all_cvrs() n_missing = 0 n_ok = 0 for cvr in sorted(cvrs): company = cvr_mongo.get...
Python
0.000035
29080fb1764f4eb75ebe1dd79460cce00527bc91
Add example of using tractography from another pipeline.
examples/plot_other_tracking.py
examples/plot_other_tracking.py
""" ============================================= Segmenting tractography from another pipeline ============================================= The AFQ API provides facilities to segment tractography results obtained using other software. For example, we often use `qsiprep <https://qsiprep.readthedocs.io/en/latest/>`_ t...
Python
0
1f2917dd4146c2ddb6c0f5532e4aaa63f19f1a44
Create 1.py
python/problems/1/1.py
python/problems/1/1.py
sum = 0 for number in range(1000): if not (number % 3 or number % 5): sum = sum + number print(sum)
Python
0.000001
9641234ac5897ec3f1a5f6cf0b5a822e7b103ae8
Update consecutive-numbers-sum.py
Python/consecutive-numbers-sum.py
Python/consecutive-numbers-sum.py
# Time: O(sqrt(n)) # Space: O(1) # Given a positive integer N, # how many ways can we write it as a sum of # consecutive positive integers? # # Example 1: # # Input: 5 # Output: 2 # Explanation: 5 = 5 = 2 + 3 # Example 2: # # Input: 9 # Output: 3 # Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4 # Example 3: # # Input: 15 # O...
# Time: O(sqrt(n)) # Space: O(1) # Given a positive integer N, # how many ways can we write it as a sum of # consecutive positive integers? # # Example 1: # # Input: 5 # Output: 2 # Explanation: 5 = 5 = 2 + 3 # Example 2: # # Input: 9 # Output: 3 # Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4 # Example 3: # # Input: 15 # O...
Python
0.003216
5c084bf10cb8feda62ac46939b3508a8c0e6a080
load csv files generic
parsers/data_parser.py
parsers/data_parser.py
import numpy as np from tflearn.data_utils import load_csv def parse_csv(csv_file): features, labels = load_csv(csv_file, target_column=4, columns_to_ignore=None, has_header=True) feature_tensor = np.array(features).reshape(len(features[0]), len(features)) label_tensor = np.array(labels).reshape(len(labels), 1) re...
Python
0.000001
8be9ab8de9558efa6ded7d184a3cdc8dad43e4ff
Add an ajax_aware_render utility.
jsonit/utils.py
jsonit/utils.py
import os from django.http import HttpResponse from django.template import RequestContext, loader def ajax_aware_render(request, template_list, extra_context=None, **kwargs): if isinstance(template_list, basestring): template_list = [template_list] if request.is_ajax(): new_template_list = []...
Python
0
a21add52424d81a36f5a34d067f70cfb2066636f
Add process module
androtoolbox/process.py
androtoolbox/process.py
import attr import re from .adb import adb @attr.s class Process(object): name = attr.ib() user = attr.ib() pid = attr.ib(convert=int) parent_pid = attr.ib(convert=int) vsize = attr.ib(convert=int) rss = attr.ib(convert=int) wchan = attr.ib() pc = attr.ib() state = attr.ib() ...
Python
0.000001
add720894d1d29eb80ee99986c7e8473ef4f3067
upgrade script for translations works for published items (#1431)
superdesk/data_updates/00015_20181127-105425_archive.py
superdesk/data_updates/00015_20181127-105425_archive.py
# -*- coding: utf-8; -*- # This file is part of Superdesk. # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license # # Author : tomas # Creation: 2018-11-27 10:54 from superdesk.commands.data...
Python
0
56c955b5700eb9e133024c9f51e39af9b065dfb1
Add neopixel rainbow demo.
demos/rainbow.py
demos/rainbow.py
# Add your Python code here. E.g. from microbit import * import neopixel np = neopixel.NeoPixel(pin13, 12) rainbow_raw = [ (255, 0, 0), (255, 127, 0), (255, 255, 0), (127, 255, 0), (0, 255, 0), (0, 255, 127), (0, 255, 255), (0, 127, 255), (0, 0, 255), (127, 0, 255), (255, ...
Python
0
255d9b002b820d1c475d2434858fd5ab3c6847cf
add SeriesStim
pliers/stimuli/misc.py
pliers/stimuli/misc.py
"""Miscellaneous Stim classes.""" import numpy as np import pandas as pd from .base import Stim class SeriesStim(Stim): '''Represents a pandas Series as a pliers Stim. Args: data (dict, pd.Series, array-like): A dictionary, pandas Series, or any other iterable (e.g., list or 1-D numpy a...
Python
0
d270330375060d0bd8694bc8a2ea8bdbb3762586
add show_single_event for debugging
show_single_event.py
show_single_event.py
from deepjets.generate import get_generator_input, generate gen_input = get_generator_input('pythia', 'w.config', random_state=1) for event in generate(gen_input, 1): print event.jets print event.subjets print event.subjets.shape print event.trimmed_constit print event.trimmed_constit.shape
Python
0.000001
3d916f56427edb88fb71acd15974bf827aebd867
compute accuracy of a random choice of matching neighborhood
significance_test.py
significance_test.py
from approx_emd import point_inside_poly from scipy.spatial import ConvexHull, cKDTree from shapely.geometry import Polygon, mapping import bisect import itertools import math as m import numpy as np import random import json import cities as c import ClosestNeighbor as cn import persistent as p import report_metrics_r...
Python
0.998169
974ebd337c00a8b4a07991983eea0b9b60e1af08
Add example binary sink
sinks/binary_sink.py
sinks/binary_sink.py
import struct import sys # Line format. We have: # 8 byte unsigned timestamp # 1 byte metric type # 1 byte value type # 2 byte key length # 8 byte value LINE = struct.Struct("<QBBHd") PREFIX_SIZE = 20 TYPE_MAP = { 1: "kv", 2: "counter", 3: "timer" } VAL_TYPE_MAP = { 0: "kv", 1: "sum", 2: "sum ...
Python
0.000001
420ebb50cfb5a366b35d058ad6018857b899a19e
Add function approximator to deal with off-switch
hiora_cartpole/offswitch_hfa.py
hiora_cartpole/offswitch_hfa.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals # HO … higher-order class SliceHOFeatureVec(object): def __init__(self, slice_i, entries_per_slice, feature_vec): self.feature_vec = feature_vec self.slice = slice(slice_i * entries_per_slice, (s...
Python
0
e150f6bc2401d396d9baed52d1cee747ee906141
extract all sentence from BCCWJ/SUW"
Script/get_sent_from_BCCWJ_SUW.py
Script/get_sent_from_BCCWJ_SUW.py
#!usr/bin/python #coding:utf-8 import glob import pickle import sys if __name__ == "__main__": dir_name = '../Orig_Data/' #sys.args[1] fnames = sorted(glob.glob(dir_name + '*.txt') ) for fname in fnames: sentences = '' print fname file_name = fname.split('/')[-1][:-4] ...
Python
0.999999
cfe103b4edc5e8366cccb7e34e1a890fe8ad9bfc
unify quotes
letsencrypt/tests/configuration_test.py
letsencrypt/tests/configuration_test.py
"""Tests for letsencrypt.configuration.""" import os import unittest import mock class NamespaceConfigTest(unittest.TestCase): """Tests for letsencrypt.configuration.NamespaceConfig.""" def setUp(self): self.namespace = mock.MagicMock( config_dir='/tmp/config', work_dir='/tmp/foo', foo='...
"""Tests for letsencrypt.configuration.""" import os import unittest import mock class NamespaceConfigTest(unittest.TestCase): """Tests for letsencrypt.configuration.NamespaceConfig.""" def setUp(self): self.namespace = mock.MagicMock( config_dir='/tmp/config', work_dir='/tmp/foo', foo='...
Python
0.029793
2db2727dcccf81c3dca2e86efabd8e40afb223d1
Automate Transfers: Add another pre-transfer script
transfers/pre-transfer/add_metadata.py
transfers/pre-transfer/add_metadata.py
#!/usr/bin/env python2 import json import os import sys def main(transfer_path): basename = os.path.basename(transfer_path) try: _, dc_id, _ = basename.split('---') except ValueError: return 1 metadata = [ { 'parts': 'objects', 'dc.identifier': dc_id, ...
Python
0
649860778dd61bdcf8d2863222a98c97cef425c6
Add tool for parsing desired capabilities from a file
seleniumbase/core/capabilities_parser.py
seleniumbase/core/capabilities_parser.py
import re def get_desired_capabilities(cap_file): if not cap_file.endswith('.py'): raise Exception("\n\n`%s` is not a Python file!\n\n" % cap_file) f = open(cap_file, 'r') all_code = f.read() f.close() desired_capabilities = {} num_capabilities = 0 code_lines = all_code.split('\...
Python
0
29555289b28e63655e5bb6fa89d163b5e3022827
add supervised loss as separate term
hypergan/losses/supervised.py
hypergan/losses/supervised.py
import tensorflow as tf from hypergan.util.ops import * from hypergan.util.hc_tf import * import hyperchamber as hc def config(): selector = hc.Selector() selector.set("reduce", [tf.reduce_mean])#reduce_sum, reduce_logexp work selector.set('create', create) selector.set('batch_norm', layer_norm_1) ...
Python
0
e1478f694d6ad422a87e03f71a79a8c1b5e77c5c
build for the entire framework
Sketches/AM/KPIFramework/setup.py
Sketches/AM/KPIFramework/setup.py
#!/usr/bin/env python # # (C) 2004 British Broadcasting Corporation and Kamaelia Contributors(1) # All Rights Reserved. # # You may only modify and redistribute this under the terms of any of the # following licenses(2): Mozilla Public License, V1.1, GNU General # Public License, V2.0, GNU Lesser General Pub...
Python
0
53306793268cb31944d42caf95c275afcbe97e6d
Add migration for creating the Professional Certificate program type
course_discovery/apps/edx_catalog_extensions/migrations/0002_create_professional_certificate_program_type.py
course_discovery/apps/edx_catalog_extensions/migrations/0002_create_professional_certificate_program_type.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.11 on 2016-12-19 19:51 from __future__ import unicode_literals from django.db import migrations PAID_SEAT_TYPES = ('credit', 'professional', 'verified',) PROGRAM_TYPE = 'Professional Certificate' def add_program_type(apps, schema_editor): SeatType = apps.get_mod...
Python
0
3c515ddc2f7fee12f82f3db6dc4869b25bec8c7a
implement importFBAModelUtil
lib/kb_uploadmethods/Utils/ImportFBAModelUtil.py
lib/kb_uploadmethods/Utils/ImportFBAModelUtil.py
import time import json import sys import uuid from fba_tools.fba_toolsClient import fba_tools from DataFileUtil.DataFileUtilClient import DataFileUtil from KBaseReport.KBaseReportClient import KBaseReport def log(message, prefix_newline=False): """Logging function, provides a hook to suppress or redirect log m...
Python
0.000145
8b894a02cf1d271b7df65e1c3efcac499100ed51
Add submission form tests
reddit/tests/test_submission.py
reddit/tests/test_submission.py
from django.test import TestCase, Client from reddit.forms import SubmissionForm class TestSubmissionForm(TestCase): def test_full_valid_submission(self): test_data = { 'title': 'submission_title', 'url': 'http://example.com', 'text': 'submission text' } ...
Python
0
d2802eebe9311243aabc5954f26719fa5544b378
Create matchingBrackets.py
GeneralPython/PyDataStructure/matchingBrackets.py
GeneralPython/PyDataStructure/matchingBrackets.py
# https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/ def areParanthesisBalanced(expr): stack = list() for i,chr in enumerate(expr): #print(i, chr) if chr in ['(','{','[']: stack.append(chr) continue # IF current current char...
Python
0.000001
323e37e52170914b4ecc7abc52f619ffe67b138b
add droidbotApp connection
droidbot/adapter/droidbotApp.py
droidbot/adapter/droidbotApp.py
import logging import socket import subprocess import json DROIDBOT_APP_REMOTE_PORT = 7336 class DroidBotAppConnException(Exception): """ Exception in telnet connection """ pass class DroidBotAppConn(object): """ a connection with droidbot app. """ def __init__(self, device=None): ...
Python
0.000001
6e9a789aa3113403d6d60ca662605506ce70c4d1
Add empty Resources module.
app/api_v1/resources.py
app/api_v1/resources.py
"""This module contains the resources to be served on the endpoints."""
Python
0
b223bc7023cd959c95171fc69466153a744f035a
Add note saying where code was lifted from.
src/new/util/util.py
src/new/util/util.py
#################### import functools import gzip import io import random import time try: import socks NO_SOCKS = False except ImportError: NO_SOCKS = True import socket ################### try: import urllib2 except ImportError: import urllib.request as urllib2 #################### class Util...
#################### import functools import gzip import io import random import time try: import socks NO_SOCKS = False except ImportError: NO_SOCKS = True import socket ################### try: import urllib2 except ImportError: import urllib.request as urllib2 #################### class Util...
Python
0
faa1c167e6551da738f2039ef9e9373bde50ab41
Add unittest utils.
app/tests/test_utils.py
app/tests/test_utils.py
import unittest import re from app.util.utils import * class utilsTest(unittest.TestCase): """Docstring for decorationsTest. """ def setUp(self): """ decorators: setup """ pass def tearDown(self): pass def test_is_empty(self): """utils, is_empty: Check if an ...
Python
0
d9486bc6180a2dfe38a953eb84184e0410e1cb66
Add a Quartz backend for the null toolkit
enthought/enable/null/quartz.py
enthought/enable/null/quartz.py
#------------------------------------------------------------------------------ # Copyright (c) 2011, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions describe...
Python
0.000001
5f9a2fe783891dd5a1f926060fcfa2561150d840
add cleese pipeline runner
reduction/run_pipeline_cleese.py
reduction/run_pipeline_cleese.py
import make_apex_cubes from os.path import join root = '/scratch/aginsbur/apex/' rawpath = join(root,'raw/') reducedpath = join(root,'reduced/') make_apex_cubes.june2013datapath = rawpath make_apex_cubes.june2013path = join(reducedpath,'june2013/') make_apex_cubes.h2copath = join(reducedpath, 'h2co_cubes/') make_apex_...
Python
0.000001
a659f0f8f4672933fc36cecfe62c65366c496f07
Add a package for VarDictJava@1.5.1 (#5626)
var/spack/repos/builtin/packages/vardictjava/package.py
var/spack/repos/builtin/packages/vardictjava/package.py
############################################################################## # Copyright (c) 2013-2017, 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
e7b40a6f10cd70c73134829403a87068df4665ff
Add 101-symmetric-tree.py, solve it both recursively and iteratively
101-symmetric-tree.py
101-symmetric-tree.py
""" Question: Symmetric Tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following is not: 1 / \ 2 2 \ \ ...
Python
0.000288
6757535a7bb212a9ce1f569fd8864dcc72c455cf
add plugin to send message to AWS SQS queue, closes #196
rest/plugins/fxaCustomsServer.py
rest/plugins/fxaCustomsServer.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Copyright (c) 2014 Mozilla Corporation # # Contributors: # Jeff Bryner jbryner@mozilla.com import os import sys from c...
Python
0
cc582dd4b435ba06dc140b1ca96b688871e36abb
Add mock python package.
var/spack/repos/builtin.mock/packages/python/package.py
var/spack/repos/builtin.mock/packages/python/package.py
############################################################################## # Copyright (c) 2013-2015, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
dcb8a4f25b64bad4279ba68dcb0770d13d0d7ebb
Add basic ignore add/removal command.
joku/cogs/configuration.py
joku/cogs/configuration.py
""" Configuration cog. """ import argparse import shlex import rethinkdb as r from discord.ext import commands from discord.ext.commands import Context, MemberConverter, BadArgument, ChannelConverter from joku.bot import Jokusoramame class ArgumentParser(argparse.ArgumentParser): def error(self, message): ...
Python
0
a8dba4568e43740f85bedfa70c61dc94cdb8ba9d
add ALMA query tool [WIP]
astroquery/alma/core.py
astroquery/alma/core.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import print_function import time import sys import os.path import webbrowser import getpass import warnings import keyring import numpy as np import re from bs4 import BeautifulSoup from astropy.extern.six import BytesIO from astropy.exte...
Python
0
f718f852bcc9be7d7ff57b8a0188499d5b1c9f99
Create pyglatin.py
pyglatin.py
pyglatin.py
print "Welcome to the Pig Latin Translator! \n" pyg = "ay" original = raw_input("Enter a word: ") if len(original) > 0 and original.isalpha(): word = original.lower() first = word[0] if word[0] != "a" or "e" or "i" or "o" or "u": new_word = word + first + pyg new_word = new_word[1:] else: new_word = word +...
Python
0.000012
a5edbf04345653b18bdb63ed9bd63625689b0f4c
add some simple unit tests for ADMM
odl/test/solvers/nonsmooth/admm_test.py
odl/test/solvers/nonsmooth/admm_test.py
# Copyright 2014-2017 The ODL contributors # # This file is part of ODL. # # 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 https://mozilla.org/MPL/2.0/. """Unit tests for ADMM.""" from __future__ ...
Python
0
a0bd114b8caf75d28bc52a3aba10494660e6735a
Add lc0138_copy_list_with_random_pointer.py
lc0138_copy_list_with_random_pointer.py
lc0138_copy_list_with_random_pointer.py
"""Leetcode 138. Copy List with Random Pointer Medium URL: https://leetcode.com/problems/copy-list-with-random-pointer/ A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. Example 1: Input: {"$id":"1","...
Python
0.000001
f8bde0dd523a46d81a64f9b3bd8633be0bf6676d
Create an exception to throw when a user tries to tag a bad commit
webserver/codemanagement/exceptions.py
webserver/codemanagement/exceptions.py
class CodeManagementException(Exception): pass
Python
0.000001
1120f16569e1bc9c9675a9cefd782b09266cd82c
Add initial k-means algo
avocado/stats/kmeans.py
avocado/stats/kmeans.py
import math from random import random from collections import namedtuple Point = namedtuple('Point', ('coords', 'n', 'ct')) Cluster = namedtuple('Cluster', ('points', 'center', 'n')) def euclidean(p1, p2): return math.sqrt(sum([ (p1.coords[i] - p2.coords[i]) ** 2 for i in range(p1.n) ])) def calcula...
Python
0.999978
f1cfe335dce4c57778d28f0cbf0be48447b60805
normalize pressure and radius, according to python-for-android / API doc
kivy/input/providers/androidjoystick.py
kivy/input/providers/androidjoystick.py
# pylint: disable=W0611 __all__ = ('AndroidMotionEventProvider', ) import os try: import android except ImportError: if 'KIVY_DOC' not in os.environ: raise Exception('android lib not found.') from kivy.logger import Logger from kivy.input.provider import MotionEventProvider from kivy.input.factory im...
# pylint: disable=W0611 __all__ = ('AndroidMotionEventProvider', ) import os try: import android except ImportError: if 'KIVY_DOC' not in os.environ: raise Exception('android lib not found.') from kivy.logger import Logger from kivy.input.provider import MotionEventProvider from kivy.input.factory im...
Python
0
1de5cfe8714c140a79358e4287645f21095abad7
Create sarafu.py
sarafu.py
sarafu.py
def (sarafu) print ("sarafu")
Python
0.000002
d8878fdfae5e4ca61de8b980bbc753f9e86ac655
Add botaddnitf plugin
hangupsbot/plugins/botaddnotif.py
hangupsbot/plugins/botaddnotif.py
""" Plugin for monitoring if bot is added to a HO and report it to the bot admins. Add a "botaddnotif_enable": true parameter in the config.json file. Author: @cd334 """ import asyncio import logging import hangups import plugins logger = logging.getLogger(__name__) def _initialise(bot): plugins.register_hand...
Python
0.000001
c2207ed347ab4d804cb7ea966eace6ea93a41326
Create sensor.py
sensor.py
sensor.py
import RPi.GPIO as gpio import time def distance(measure='cm'): try: gpio.setmode(gpio.BOARD) gpio.setup(12, gpio.OUT) gpio.setup(16, gpio.IN) gpio.output(12, False) while gpio.input(16) == 0: nosig = time.time() while gpio.input(16) == 1: ...
Python
0.000002
b009531fe397fd9d1dfc67b0cdfca082a413161b
Add module that was missing in git
senlin/api/openstack/v1/nodes.py
senlin/api/openstack/v1/nodes.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...
Python
0.000001
5ac2e849fbf4857f7b449cdd39608ba053bddf6e
add main func
ExtractLevelDomain.py
ExtractLevelDomain.py
#coding=utf-8 import re from urlparse import urlparse class ExtractLevelDomain(): def __init__(self): self.topHostPostfix = ( '.com','.la','.io', '.co', '.cn','.info', '.net', '.org','.me', '.mobi', '.us', '.biz', '.xxx', '.ca', '.co.jp', ...
Python
0.001334
9ad83570d31469758aeec3c80f45ba8b012cef82
Create genDataFixedSize.py
bin/genDataFixedSize.py
bin/genDataFixedSize.py
#!/usr/bin python import time import random import base64 import os import sys start = time.time() # pwd = os.path.dirname(__file__) # outputpath = os.path.normpath(pwd + '/../sample_data/' + sys.argv[1]) outputpath = os.path.normpath(sys.argv[1]) # print outputpath #run for five m:inutes # while time.time() < s...
Python
0.000001
fd0e09e11d41d1d7b64f7bf592b788fda8b86e3e
Create archive_identifier.py
identifiers/archive_identifier.py
identifiers/archive_identifier.py
from identifier import Result CAB_PATTERNS = [ '4D 53 43 46' ] class CabResolver: def identify(self, stream): return Result('CAB') def load(hound): hound.add_matches(CAB_PATTERNS, CabResolver())
Python
0.000001
d68379703f502ed7c7945ec4040ab35413f968b4
Create numbertheory.py
numbertheory.py
numbertheory.py
# -*- coding: utf-8 -*- """ Created on Tue Oct 4 22:53:41 2016 @author: midhununnikrishnan """ import numpy as np import combinatorics as cb def sumofdigits(G,k=1)->int: """find + of digits """ su = 0 while G > 0: if k == 1: su += (G%10) else: su += (G%...
Python
0.000017
bb619aa09132dbd970d2b78e23fecbd78ee774de
Create new package. (#6191)
var/spack/repos/builtin/packages/r-aneufinder/package.py
var/spack/repos/builtin/packages/r-aneufinder/package.py
############################################################################## # Copyright (c) 2013-2017, 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
4091f699d0d75a9a506190ec04e2bfc9fc10f9f5
add Invoke-WCMDump credentials current user
lib/modules/powershell/credentials/Invoke-WCMDump.py
lib/modules/powershell/credentials/Invoke-WCMDump.py
from lib.common import helpers class Module: def __init__(self, mainMenu, params=[]): # metadata info about the module, not modified during runtime self.info = { # name for the module that will appear in module menus 'Name': 'Invoke-WCMDump', # list of one or ...
Python
0
d604429f1d27f8753b8d9665a55111a3b90f0699
Add homebrew version of fluentd logger
scrapi/util/logging.py
scrapi/util/logging.py
import logging from datetime import datetime from fluent import sender class FluentHandler(logging.Handler): ''' Logging Handler for fluent. ''' def __init__(self, tag, host='localhost', port=24224, timeout=3.0, verb...
Python
0
cfeb4fbfa44b597772f1eb63d828e605f9e39396
Add server
server.py
server.py
import argparse import os import signal import subprocess def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('operation', choices=['start', 'stop', 'restart'], help='start/stop/restart the server') return parser.parse_args() def find_s...
Python
0.000001