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
f6d3c63a0131a7532a091c1cc492ef7d7c84263e
Access realm alias objects in lower-case.
zerver/management/commands/realm_alias.py
zerver/management/commands/realm_alias.py
from __future__ import absolute_import from __future__ import print_function from typing import Any from argparse import ArgumentParser from django.core.management.base import BaseCommand from zerver.models import Realm, RealmAlias, get_realm, can_add_alias from zerver.lib.actions import realm_aliases import sys cla...
from __future__ import absolute_import from __future__ import print_function from typing import Any from argparse import ArgumentParser from django.core.management.base import BaseCommand from zerver.models import Realm, RealmAlias, get_realm, can_add_alias from zerver.lib.actions import realm_aliases import sys cla...
Python
0
a6d958b7c29f11014ed322b9f153e8ad0c1a2cda
Add local server.
runserver.py
runserver.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask_rest_service import app app.run(debug=True)
Python
0
40b0f0cb42b14d79fc0cd4451b592a6933b436e4
Add Python script to generate AOM CTC-formatted CSV files.
csv_export.py
csv_export.py
#!/usr/bin/env python import argparse import json import os import csv import sys from numpy import * #offset by 3 met_index = {'PSNR': 0, 'PSNRHVS': 1, 'SSIM': 2, 'FASTSSIM': 3, 'CIEDE2000': 4, 'PSNR Cb': 5, 'PSNR Cr': 6, 'APSNR': 7, 'APSNR Cb': 8, 'APSNR Cr':9, 'MSSSIM':10, 'Encoding Time'...
Python
0
a00dc9b0b1779ee8218917bca4c75823081b7854
Add migration file for new database model
InvenTree/part/migrations/0072_bomitemsubstitute.py
InvenTree/part/migrations/0072_bomitemsubstitute.py
# Generated by Django 3.2.5 on 2021-10-12 23:24 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('part', '0071_alter_partparametertemplate_name'), ] operations = [ migrations.CreateModel( name=...
Python
0
88087c9416103ae7f56749f59cdfabcd19fb14ab
Add a snippet.
python/notion_api/update_a_page_and_its_icon.py
python/notion_api/update_a_page_and_its_icon.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ################################################################# # Install the Python requests library: pip install requests # http://docs.python-requests.org/en/master/user/quickstart/ ################################################################# # Src: https://dev...
Python
0.000002
a962de79938c73b5c0e0459be7b82265bde76b40
Test case for LSPI on gridworld.
cases/gridworld/lspi.py
cases/gridworld/lspi.py
#!/usr/bin/env python __author__ = "William Dabney" from Domains import GridWorld from Tools import Logger from Agents import LSPI from Representations import Tabular from Policies import eGreedy from Experiments import Experiment def make_experiment(id=1, path="./Results/Temp"): """ Each file specifying an...
Python
0
72559b02424b933322b2e5c6c9873a8a6b63ef78
Add eclipse update script
environments/auto/macos/bin/eclipse-update.py
environments/auto/macos/bin/eclipse-update.py
#!/usr/bin/python import os import subprocess import sys p2repositoryLocations = [ "http://download.eclipse.org/eclipse/updates/4.7", "http://download.eclipse.org/releases/oxygen", "http://dist.springsource.com/release/TOOLS/update/e4.7/", "http://jeeeyul.github.io/update/", "http://andrei.gmxhome....
Python
0
b514cf783d53a5c713911729422239c9b0f0ff99
Add automatic leak detection python script in examples
client/python/examples/edleak_autodetect.py
client/python/examples/edleak_autodetect.py
import sys import rpc.ws import edleak.api import edleak.slice_runner def usage(): print('autodetect [period] [duration]') def print_leaker(leaker): print('-------------------------------') print('class : ' + leaker['leak_factor']['class']) print('leak size : ' + str(leaker['leak_factor']['leak'])) ...
Python
0
c7b756c69f3fce63208d1378ccee8d76e8574f3f
Add basic_bond_seed_file for 5 bonds.
bond_analytics_project/basic_bond_seed_file.py
bond_analytics_project/basic_bond_seed_file.py
import datetime import os import django os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bond_analytics_project.settings') django.setup() from bondapi.models import Bond test_bond_list = [ dict(name='test_bond_1', face_value=1000, annual_interest=27.5 * 2, annual_coupon_rate=5.50, market_interest_rate=...
Python
0
04da8d531267972554c6300c24a5a7b2c7def59d
add basic unit testing for appliance instances (incomplete)
tests/test_appliance_instance.py
tests/test_appliance_instance.py
import sys sys.path.append('..') import disaggregator as da import unittest import pandas as pd import numpy as np class ApplianceInstanceTestCase(unittest.TestCase): def setUp(self): indices = [pd.date_range('1/1/2013', periods=96, freq='15T'), pd.date_range('1/2/2013', periods=96, fre...
Python
0.000012
879744e19cab5cc7357912ba670d200adfd58be6
add aur-update
bumblebee_status/modules/contrib/aur-update.py
bumblebee_status/modules/contrib/aur-update.py
"""Check updates for AUR. Requires the following packages: * yay (used as default) Note - You can replace yay by changing the "yay -Qum" command for your preferred AUR helper. Few examples: paru -Qum pikaur -Qua rua upgrade --printonly trizen -Su --aur --quiet yay -Qum contributed by `ishaanbhimwal <https://git...
Python
0.000001
c6a0abe4f5cf3d1f54a10636b4c8882a2a1c9663
hamster tracks, the beginnings. not usable without a running hamster applet
hamster_tracks.py
hamster_tracks.py
#!/usr/bin/env python # - coding: utf-8 - # Copyright (C) 2010 Toms Bauģis <toms.baugis at gmail.com> """An attempt to make an overview visualization. Consumes hamster d-bus API""" import gtk from lib import graphics import dbus import time, datetime as dt from collections import defaultdict HAMSTER_DBUS_PATH = "...
Python
0.998979
4175f27a03be52baa8b4245df96a03e6bbd22310
Add test for pygame sound play hook
modulation_test.py
modulation_test.py
import pygame import random from demodulate.cfg import * from gen_tone import * if __name__ == "__main__": pygame.mixer.pre_init(frequency = int(SAMPLE_FREQ), channels = 1) pygame.mixer.init() WPM = random.uniform(2,20) pattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A' #gen_test_data() data = gen_tone(pattern...
Python
0
af1f087affef7a30729a85fbde9c8157ce3bfbed
Add to be completed to notes in rule note load
show_term.py
show_term.py
import argparse from app.core import create_app from app.config import config application = create_app('production').app_context().push() from app.main.models import Term, Rule, Note from openpyxl import Workbook ######################################################################################### ## ...
Python
0
cfeab0e8f704a4681e1ec887b3ce116839557af9
update tests to changes in graph_lasso
sklearn/covariance/tests/test_graph_lasso.py
sklearn/covariance/tests/test_graph_lasso.py
""" Test the graph_lasso module. """ import sys from StringIO import StringIO import numpy as np from scipy import linalg from sklearn.covariance import graph_lasso, GraphLasso, GraphLassoCV, \ empirical_covariance from sklearn.datasets.samples_generator import make_sparse_spd_matrix from sklearn.utils im...
""" Test the graph_lasso module. """ import sys from StringIO import StringIO import numpy as np from scipy import linalg from sklearn.covariance import graph_lasso, GraphLasso, GraphLassoCV from sklearn.datasets.samples_generator import make_sparse_spd_matrix from sklearn.utils import check_random_state def test_g...
Python
0
dd9893eec00c16f55b77944509bafe4864319b72
create main function
JobManager.py
JobManager.py
import filelib.parser.ma import filelib.parser.mb import os.path import sys if __name__ == "__main__": addFilePath = "/root/test_maya_2015.mb" if(len(sys.argv) > 1): addFilePath = sys.argv[1] (dir,jobExt) = os.path.splitext(addFilePath) jobExt = jobExt.lower() if jobExt == ".ma": ...
Python
0.004115
c65731de77f88380f2c816fa9667d153140bfbe1
Add LDA script
lda/lda_analysis.py
lda/lda_analysis.py
import sys from sklearn.lda import LDA 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 = dict() marker["ind...
Python
0.000001
cf97c95ab9dcb3b1dba6608639471375a1cbef42
Create afUdimLayout.py
scripts/afUdimLayout.py
scripts/afUdimLayout.py
import pymel.core as pm import maya.mel as mel allSets = pm.ls(sl=1,type="objectSet") for i in range(0,len(allSets)): if i<10: pm.select(allSets[i],r=1,ne=1) pm.select(hierarchy=1) mel.eval("ConvertSelectionToUVs;") pm.polyEditUV(u=i,v=0) elif i>=10<20: pm.select(allSet...
Python
0.000001
49f557228a6c826598c48a08f6a0de4ee176d888
add python script to send ogg audio stream over LCM messages
software/tools/tools/scripts/oggStreamLCM.py
software/tools/tools/scripts/oggStreamLCM.py
import bot_core import lcm import urllib2 import time import sys import os import select import subprocess import threading # VLC command: # cvlc <input> --sout '#transcode{acodec=vorb,ab=10,channels=1,samplerate=8000}:std{access=http,mux=ogg,url=localhost:8080}' # where <input> is a file or a url serverChannel = '...
Python
0.000001
76be22f3d1aa86616ecd06a326344f24ff03adbe
Add function to generate uniform addresses
DataGeneration/GenerateUniformAddresses.py
DataGeneration/GenerateUniformAddresses.py
# The purpose of this script is to generate a uniformly distributed series of # lat/long coordinates given max/min latitude, max/min longitude, latitude # resolution, and longitude resolution, where resolution is the desired number # of degrees between output coordinates # Outputs a pandas dataframe of lat/long coor...
Python
0.018119
05f87be4c85036c69abc9404acb824c58d71f101
Add border operation... Damn that was easy
slice_ops.py
slice_ops.py
import slicer import shapely.ops import shapely.geometry def border(sli, amount): cuts = [cut.polygon(True) for cut in sli.cuts] cut_outline = shapely.ops.cascaded_union(cuts) \ .buffer(amount / 2) shape_outline = sli.poly.boundary.buffer(amount) outlines = cut_outline.unio...
Python
0
a3089dd3d9c31d0d705fe54858fdc0ebee76f488
write a Python client for Sift Science's REST API
server/sift_client.py
server/sift_client.py
"""Python client for Sift Science's REST API (https://siftscience.com/docs/rest-api). """ import json import logging import traceback import requests API_URL = 'https://api.siftscience.com/v202/events' sift_logger = logging.getLogger('sift_client') class Client(object): def __init__(self, api_key, api_url=API...
Python
0
f3f5249c0ac7d41ebf2115fb0b5c7576012bcb38
Add production settings
src/biocloud/settings/production.py
src/biocloud/settings/production.py
# In production set the environment variable like this: # DJANGO_SETTINGS_MODULE=my_proj.settings.production from .base import * # NOQA import logging.config # For security and performance reasons, DEBUG is turned off DEBUG = False # Must mention ALLOWED_HOSTS in production! # ALLOWED_HOSTS = [] # Ca...
Python
0.000001
cda1efa55242641accf78162493c3ebb3582399e
Create AM_example.py
Effects/Amplitude_Modulation/AM_example.py
Effects/Amplitude_Modulation/AM_example.py
# Play a wave file with amplitude modulation. # Assumes wave file is mono. # This implementation reads and plays a one frame (sample) at a time (no blocking) """ Read a signal from a wave file, do amplitude modulation, play to output Original: pyrecplay_modulation.py by Gerald Schuller, Octtober 2013 Modified to read ...
Python
0.000005
2387d8f269cbe1943db1b1e6304603ccb6901e43
Add flashcards for powers of two estimation
flashcards.py
flashcards.py
import random import time DELAY = 10 while 1: time.sleep(DELAY) useful_powers_of_2 = {7, 8, 10, 16, 20, 30, 32, 40} random_power_of_2 = random.sample(useful_powers_of_2, 1)[0] print '\nWhat\'s the largest %s bit integer?' % random_power_of_2 time.sleep(DELAY) print 'Answer: %s' % '{:,}'.format(2 ** rando...
Python
0
7a79c163144b242be57ed8cf45ae4fb5097f11fa
Create defaultlog.py
defaultlog.py
defaultlog.py
# -*- coding: utf-8 -*- """Console and file logging configuration. This module automatically configures the logging to use a colored console format, and a timed rotating log file that rolls over at midnight. The log formats results in the following outputs: Console: [INFO ] This is some info (root) ...
Python
0.000001
2acf089d00426d8b61317c6d031aee7696d42b03
Create script to import Wicklow data
import_wicklow.py
import_wicklow.py
import psycopg2 import re import sys ORG_ID = 10 conn = psycopg2.connect("dbname=school_crm user=postgres host=localhost port=5432") cur = conn.cursor() # cur.execute("set client_encoding to 'latin1'") def import_names(): cur.execute("DELETE FROM person_tag WHERE person_id in (SELECT person_id from person where ...
Python
0
f8b9e697f4d49f35dda322817ac8ac63d96b6732
Add failing wait tests
nclxd/tests/test_container_utils.py
nclxd/tests/test_container_utils.py
# Copyright 2015 Canonical Ltd # 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...
# Copyright 2015 Canonical Ltd # 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...
Python
0.000005
04979d5536a9787cac0024dd6e767f0baec280fd
Update __init__.py
tendrl/node_agent/objects/definition/__init__.py
tendrl/node_agent/objects/definition/__init__.py
import importlib import namespaces as ns import yaml from tendrl.commons import objects from tendrl.commons import etcdobj from tendrl.node_agent.objects.definition import master # Definitions need there own special init and have to be present in the NS # before anything else, Hence subclassing BaseObject class ...
import importlib import namespaces as ns import yaml from tendrl.commons import objects from tendrl.commons import etcdobj from tendrl.node_agent.objects.definition import master # Definitions need there own special init and have to be present in the NS # before anything else, Hence subclassing BaseObject class ...
Python
0.000072
51ee19f41e6fc48d4791bde97c5d28d55d76cdf4
Add brute force inplementation
solvers/BruteForce.py
solvers/BruteForce.py
#!/usr/bin/env python # encoding: utf-8 from itertools import permutations from base_solver import BaseSolver class BruteForceSolver(BaseSolver): def run_search(self): # get list of mid nodes names mid_nodes = [] for node in self.task.mid_nodes: mid_nodes.append(node.name) ...
Python
0.999725
46496d8761ae94a349ed3b592ec7ee7e0c7e1a15
Remove unused import; add missing import
gitc_utils.py
gitc_utils.py
# # Copyright (C) 2015 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 required by applicable la...
# # Copyright (C) 2015 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 required by applicable la...
Python
0.000007
4dfc0c49cec86f3c03b90fa66e1fc9de2ac665e6
Add migration file (fix fields)
samples/migrations/0012_auto_20170512_1138.py
samples/migrations/0012_auto_20170512_1138.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-12 14:38 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('samples', '0011_fluvaccine_date_applied'), ] operations = [ migrations.AlterF...
Python
0
947551083798e3125cf0782df44cc18728c6bca4
test messages
src/eduid_webapp/security/tests/test_msgs.py
src/eduid_webapp/security/tests/test_msgs.py
# -*- coding: utf-8 -*- import unittest from eduid_webapp.security.helpers import SecurityMsg class MessagesTests(unittest.TestCase): def test_messages(self): """""" self.assertEqual(str(SecurityMsg.out_of_sync.value), 'user-out-of-sync') self.assertEqual(str(SecurityMsg.stale_reauthn.v...
Python
0.000004
fcfb84838c7bb111fb9710f4984767b2233caed3
test commit
test.py
test.py
print("Content-Type: text/plain") print("") print("Fuck you")
Python
0.000002
f4f3429d157988d4823f20d5155b951f8471fb1b
Fix test app
test.py
test.py
def app(environ, start_response): """Simplest possible application object""" data = 'Hello, World!\n' status = '200 OK' response_headers = [ ('Content-type','text/plain'), ('Content-Length', len(data)) ] start_response(status, response_headers) return [data]
from gunicorn.httpserver import WSGIServer def app(environ, start_response): """Simplest possible application object""" data = 'Hello, World!\n' status = '200 OK' response_headers = [ ('Content-type','text/plain'), ('Content-Length', len(data)) ] start_response(status, respo...
Python
0.000013
bc0aa69adc5b1e290941c221ddd498d3fb92244e
Add simple recipe tagger experiment
test.py
test.py
import nltk from nltk.classify import MaxentClassifier # Set up our training material in a nice dictionary. training = { 'ingredients': [ 'Pastry for 9-inch tart pan', 'Apple cider vinegar', '3 eggs', '1/4 cup sugar', ], 'steps': [ 'Sift the powdered sugar and cocoa ...
Python
0.000039
5d9200298ab660bee79d7958f8e155023893be08
Change author
l10n_cr_account_banking_cr_bcr/__openerp__.py
l10n_cr_account_banking_cr_bcr/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute...
Python
0.000003
ab458e10742897c692e3d4e4066ed193e141e258
add filterfuncs module
filterfuncs.py
filterfuncs.py
from tools import pipeline_helpers import pandas as pd def run1(infile, features_label, output_label): """ Handle variant data by only keeping rows where 10-90% of samples have variants. For CNV data, don't do any filtering. Otherwise, simply remove rows with zero variance. """ if (featur...
Python
0.000001
b9d5e015b291f27becc682f05a12ec5c6a0cf467
Implement module to create new pads on collabedit.com.
gygax/modules/pad.py
gygax/modules/pad.py
# -*- coding: utf-8 -*- """ :mod:`gygax.modules.pad` --- Module for creating pads on collabedit.com ======================================================================= """ from http import client from gygax.modules import admin def pad(bot, sender, text): if not admin.is_admin(sender): bot.reply("un...
Python
0
7cc86a96427cc35824960c01d84fbe8d45364670
Add admin page for User
helios_auth/admin.py
helios_auth/admin.py
from django.contrib import admin from helios.models import User class UserAdmin(admin.ModelAdmin): exclude = ('info', 'token') admin.site.register(User, UserAdmin)
Python
0.000143
e99700ff985e9821faf390ca6070a0c879eafc20
Add perkeyavg python example
src/python/PerKeyAvg.py
src/python/PerKeyAvg.py
""" >>> from pyspark.context import SparkContext >>> sc = SparkContext('local', 'test') >>> b = sc.parallelize([("coffee", 1), ("pandas", 2), ("coffee", 3), ("very", 4)]) >>> perKeyAvg(b) """ import sys from pyspark import SparkContext def perKeyAvg(nums): """Compute the avg""" sumCount = nums.combineByKey(...
Python
0.000001
a640bf45c4fb8829888f664e48058d6647473449
Fix migrations
lowfat/migrations/0113_merge_20171103_0948.py
lowfat/migrations/0113_merge_20171103_0948.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-11-03 09:48 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('lowfat', '0112_auto_20171031_1133'), ('lowfat', '0111_auto_20171009_0933'), ] opera...
Python
0.000006
8d2c141ac6c2d1772561d36c38cbbf8140abd9db
Add day 12.
day_12.py
day_12.py
""" http://adventofcode.com/day/11 --- Day 12: JSAbacusFramework.io --- Santa's Accounting-Elves need help balancing the books after a recent order. Unfortunately, their accounting software uses a peculiar storage format. That's where you come in. They have a JSON document which contains a variety of things: arrays ...
Python
0.000572
946c5b14ec95af2e4dde406e94a50e7d5cdc1502
Create BalanceData.py
BalanceData.py
BalanceData.py
#Copyright (c) 2016 Vidhya, Nandini import os import numpy as np import operator from constants import * FIX_DEV = 0.00000001 rootdir = os.getcwd() newdir = os.path.join(rootdir,'featurefiles') def LoadData(): data_file = open(os.path.join(newdir,'out_2.txt'),'r') unprocessed_data = data_file.readlines() ...
Python
0.000001
3811bf52733bfbac7e5720f860cced216b530963
Add a Theme object
src/theme.py
src/theme.py
# This module is part of the GeoTag-X project builder. # Copyright (C) 2015 UNITAR. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option...
Python
0.000001
7bace5ca301124f03d7ff98669ac08c0c32da55f
Add example OOP python script
labs/lab-5/oop.py
labs/lab-5/oop.py
#!/usr/bin/python # # Copyright 2016 BMC Software, 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 la...
Python
0.000005
5f2533e090e181d84c3e5567131447aa4326773a
Add libx11 package
libx11/conanfile.py
libx11/conanfile.py
from conans import ConanFile, AutoToolsBuildEnvironment, tools import os class Libx11Conan(ConanFile): name = "libx11" version = "1.6.5" license = "Custom https://cgit.freedesktop.org/xorg/lib/libX11/tree/COPYING" url = "https://github.com/trigger-happy/conan-packages" description = "X11 client-si...
Python
0.000001
e972bb5127b231bfbdf021597f5c9a32bb6e21c8
Create gametesting.py
gametesting.py
gametesting.py
Python
0
a83a48f6c9276b86c3cc13aeb000611036a6e3c4
Make all end-points accepting post
jedihttp/handlers.py
jedihttp/handlers.py
import bottle from bottle import response, request import json import jedi import logging app = bottle.Bottle( __name__ ) logger = logging.getLogger( __name__ ) @app.post( '/healthy' ) def healthy(): return _Json({}) @app.post( '/ready' ) def ready(): return _Json({}) @app.post( '/completions' ) def complet...
import bottle from bottle import response, request import json import jedi import logging app = bottle.Bottle( __name__ ) logger = logging.getLogger( __name__ ) @app.get( '/healthy' ) def healthy(): return _Json({}) @app.get( '/ready' ) def ready(): return _Json({}) @app.post( '/completions' ) def completio...
Python
0.000318
64e91bf4a7fb8dae8ae49db64396bdfed12bec63
Add deploy script for pypi.
deploy.py
deploy.py
""" Deploy this package to PyPi. If the package is already uploaded (by --version) then this will do nothing. Reqires Python3. """ import http.client import json import subprocess def setup(*args): o = subprocess.check_output('python3 ./setup.py %s' % ' '.join(args), shell=True) ...
Python
0
2dfa0dd815061497f89f9ca5e09fa62ea4dc23bf
fix issue #956
launcher/start.py
launcher/start.py
#!/usr/bin/env python # coding:utf-8 import os, sys import time import atexit import webbrowser import launcher_log current_path = os.path.dirname(os.path.abspath(__file__)) python_path = os.path.abspath( os.path.join(current_path, os.pardir, 'python27', '1.0')) noarch_lib = os.path.abspath( os.path.join(python_path...
#!/usr/bin/env python # coding:utf-8 import os, sys import time import atexit import webbrowser import launcher_log current_path = os.path.dirname(os.path.abspath(__file__)) python_path = os.path.abspath( os.path.join(current_path, os.pardir, 'python27', '1.0')) noarch_lib = os.path.abspath( os.path.join(python_path...
Python
0
03137f65202f5423ea705db601aaea7f18c590f9
add the main file
lexos/__main__.py
lexos/__main__.py
"""Module allowing for ``python -m lexos ...``.""" from lexos import application application.run()
Python
0.000001
370f5a87ac8d26245b5919fc98b24019861f4dde
Add missing test
tests/test_fetch_site_logs_from_ftp_sites.py
tests/test_fetch_site_logs_from_ftp_sites.py
import pytest import os from fetch_site_logs_from_ftp_sites import gws_list_site_logs def test_get_gws_site_logs(): os.environ['gws_url'] = 'https://testgeodesy-webservices.geodesy.ga.gov.au' assert len(gws_list_site_logs()) > 1000
Python
0.000383
0774413ae3623c28a8aaf77727d0c355f6a5bd7c
Add deezer_complete core plugin #146
timeside/plugins/provider/deezer_complete.py
timeside/plugins/provider/deezer_complete.py
from timeside.core import implements, interfacedoc from timeside.core.provider import Provider from timeside.core.api import IProvider from timeside.core.tools.utils import slugify import os from requests import get class DeezerComplete(Provider): """ Represents Deezer Provider while loading results comp...
Python
0
fa8032792f208e2693f8f6a4693ba9af084de935
use path
src/robotide/spec/librarymanager.py
src/robotide/spec/librarymanager.py
# Copyright 2008-2012 Nokia Siemens Networks Oyj # # 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...
# Copyright 2008-2012 Nokia Siemens Networks Oyj # # 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.000005
02c06a544b1b6e4230a9b658540b360cc60c0bb5
add cmstat.py
gist/cmstat.py
gist/cmstat.py
from __future__ import print_function import sh from collections import namedtuple import os import itertools git = sh.git.bake() NumStat = namedtuple('NumStat', ['insert', 'delete', 'filename']) def getCommit(commit): """get commit message --no-pager: stop pager which block stdout -n 1: only show one c...
Python
0.000101
e29a2107cd08e6b40b99e3682d783887107a5e77
Add a loader to load several yaml files
populous/loader.py
populous/loader.py
import collections import yaml def load_yaml(*filenames): """ Parse the given files as if they were a single YAML file. """ with ChainedFileObject(*filenames) as f: return yaml.load(f) class ChainedFileObject(object): """ A file-like object behaving like if all the given filenames w...
Python
0
555cedf76d5f569b8a99691ed7dba672e578bb42
Add admin integration for positions
positions/admin.py
positions/admin.py
from django.contrib import admin from .models import Position class PositionAdminIndex(admin.ModelAdmin): list_display = ['title', 'date'] list_filter = ['date'] search_fields = ['title', 'content'] admin.site.register(Position, PositionAdminIndex)
Python
0
9dc39f6492d9ece3964d5cb733cc146acee7cf66
Create w3_1.py
w3_1.py
w3_1.py
print("hello")
Python
0.000482
31fcd83585905ca28245e42163c77af38f0c83cf
Create w3_1.py
w3_1.py
w3_1.py
print("test")
Python
0.000482
d35f2d7310c277625ea6e2e15b887ac9620696a7
Add unit test for glacier vault
tests/unit/glacier/test_vault.py
tests/unit/glacier/test_vault.py
#!/usr/bin/env python # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved # # 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 ...
Python
0
d44f12ca4395c0001bbaf0cf0d5436a84484569c
Create fasta2nexus.py
biokit/converters/fasta2nexus.py
biokit/converters/fasta2nexus.py
from Bio import AlignIO class Fasta2Nexus(object): """ """ def __init__(self, infile, outfile, *args, **kwargs): """ """ self.infile = infile self.outfile = outfile def __call__(self): input_handle = open(self.infile, "rU") output_handle = open(self.ou...
Python
0.000001
e8cd41a2151e5907aeaac685f5c78300a010ce7e
add sensu plugin to check eventanomaly
plugins/bongo/check-eventanomaly.py
plugins/bongo/check-eventanomaly.py
#!/usr/bin/env python from optparse import OptionParser import socket import sys import httplib import json PASS = 0 FAIL = 1 def get_bongo_host(server, app): try: con = httplib.HTTPConnection(server, timeout=45) con.request("GET","/v2/apps/" + app) data = con.getresponse() if dat...
Python
0
6a95f7aa987994cdd173dc52d5de2754e449ebbb
Add a Python script that controls the user list in my own Twitter lists.
listmanager.py
listmanager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """This script manages your own Twitter lists. Examples: You can add users to a list by the "add" command:: $ python listmanager.py add your_screen_name your_list_name user1 [user2 ...] Likewise, you can also remove users by the "remove" command. """ from secret...
Python
0
489c77d3bbd3a9e0e14578f4371870042e2d04d1
Add another debug script
debug1.py
debug1.py
import logging import threading from cornbread.xorg import * if __name__ == '__main__': logging.warning('Creating FW') w = FocusedWindow() logging.warning('Creating FW thread') t = threading.Thread(target=FocusedWindowWatcher, args=(w,)) logging.warning('Starting thread') t.start() try: ...
Python
0.000001
28d409eea4fbcd3846d0146f878529ed3b1c2145
Create update.py
app/update.py
app/update.py
''' Update functions for Classes in Models - Update SCTR - updatingSCTR() in: array (Adj Close) out: float (Average SCTR over SCTR_AVERAGE days, EMA50) - Update Money wave - updatingMoneyWave() in: array (High, Low, Adj Close, nextMWPrice = False, MW) out: float (Money Wave) - Sub func Update next stock price for a...
Python
0.000001
b6b65f0ca7253af5325eafc6b19e7cfecda231b3
Add solution for exercise 2b of hw3
hw3/hw3_2b.py
hw3/hw3_2b.py
import sympy x1, x2 = sympy.symbols('x1 x2') f = 8*x1 + 12*x2 + x1**2 -2*x2**2 df_dx1 = sympy.diff(f,x1) df_dx2 = sympy.diff(f,x2) H = sympy.hessian(f, (x1, x2)) xs = sympy.solve([df_dx1, df_dx2], [x1, x2]) H_xs = H.subs([(x1,xs[x1]), (x2,xs[x2])]) lambda_xs = H_xs.eigenvals() count = 0 for i in lambda_xs.keys(): ...
Python
0.000071
6daa90f89ec563f2d5b6eaa57c46bc4b06ad1cc0
Generate shapes using a pca model
detect.py
detect.py
from functools import partial import numpy as np import menpo.io as mio def bbox_overlap_area(a, b): max_overlap = np.min([a.max(axis=0), b.max(axis=0)], axis=0) min_overlap = np.max([a.min(axis=0), b.min(axis=0)], axis=0) overlap_size = max_overlap - min_overlap if np.any(overlap_size < 0): re...
Python
0.999996
8649fef1ddea18525fd0f6c5f8aa42e18b0726f8
rename plot to visualizer
lib/visualizer.py
lib/visualizer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas import datetime import time from utils import slugify from scipy.cluster.hierarchy import dendrogram def create_bar_graph(_x,_y,_title,_disp): print "Creating ...
Python
0.000874
813e1c44340fae6cb41144878d7afabfcd564f2b
Create matrix.py
src/mathematics/matrix.py
src/mathematics/matrix.py
import random import time from functools import reduce class Matrix(object): def __init__(self, mat=None): if mat is None: self.matrix = [] else: self.matrix = mat self.shape = self.get_shape() def __add__(self, other): result = [] if self.get_s...
Python
0.000006
71b0af732e6d151a22cc0d0b28b55020780af8b6
Add memoize function for python 2.x
ftools.py
ftools.py
from functools import wraps def memoize(obj): # This is taken from the Python Decorator Library on the official Python # wiki. https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize # Unfortunately we're using Python 2.x here and lru_cache isn't available cache = obj.cache = {} @wraps(obj)...
Python
0.000018
1967db2a9b6e3b4420a1ebc5fe5fe157d61c6314
Initialise entry and do a proper 404 if it could not be found.
kindlefeed.py
kindlefeed.py
# KindleFeed Controller # ===================== # # This file is part of KindleFeed. # # KindleFeed is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option)...
# KindleFeed Controller # ===================== # # This file is part of KindleFeed. # # KindleFeed is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option)...
Python
0
4bc2c46e605b7bffb6e7e8206fdb6bb168864c45
test random user fulfilling the specifications
listRandomUser.py
listRandomUser.py
import random class list_random: def __init__(self, n): self.n=n self.count=n/2 self.l_tuple=[] for i in range(n): for j in range(i+1,n): self.l_tuple.append([i,j,0]) # 0 no usado # 1 invalido # 2 usado ...
Python
0
c2f1717c53042f8ff3a7ba169a2db365aa8bc8ba
ADd gff2togff3.py
gff2togff3.py
gff2togff3.py
"""Change attribute string from GFF2 format GGF3 format.""" import csv import sys for row in csv.reader(open(sys.argv[1]), delimiter="\t"): if not row[0].startswith("#"): row[8] = ";".join( ["%s=%s" % (attribute.split()[0], " ".join(attribute.split()[1:])) for attribute in row[8]....
Python
0.001224
ac89ec64ab619bfa778d0961aeaefc8967d971a3
Add errors.py to move away from Python errors
errors.py
errors.py
# Kimi language interpreter in Python 3 # Anjana Vakil # http://www.github.com/vakila/kimi def complain_and_die(message): print(message) quit() def assert_or_complain(assertion, message): try: assert assertion except AssertionError: complain_and_die(message)
Python
0.000001
5cb726d5139537cbe7c03bc5ed540b9cdb7c7e21
Add bzero simprocedure I have had lying around forever
angr/procedures/posix/bzero.py
angr/procedures/posix/bzero.py
from ..libc import memset class bzero(memset.memset): def run(self, addr, size): return super().run(addr, self.state.solver.BVV(0, self.arch.byte_width), size)
Python
0
551f78f32665b1397120ada10036c1d9c09daddc
Create flip-bits.py
lulu/flip-bits.py
lulu/flip-bits.py
class Solution: """ @param a, b: Two integer return: An integer """ def bitSwapRequired(self, a, b): # write your code here return self.countOnes(a^b) def countOnes(self, num): # write your code here counter = 0 a = 1 for i in range(0, 32)...
Python
0.000004
75437fc5607b41763f8c81813ba12dbe1c414c5f
combine the sequence names from various headers and then concatonate the sam entries
iron/utilities/combine_sam.py
iron/utilities/combine_sam.py
#!/usr/bin/python import sys, argparse, re def main(): parser = argparse.ArgumentParser(description = 'Combine sam files') parser.add_argument('sam_files',nargs='+',help='FILENAME for sam files') args = parser.parse_args() header = False seqs = set() tagorder = [] tagseen = {} for file in args.sam_file...
Python
0.000001
e3c493847ead7352ecad1e92a739a1b79549a70c
Add dodo tape command
dodo_commands/extra/webdev_commands/tape.py
dodo_commands/extra/webdev_commands/tape.py
# noqa import argparse from dodo_commands.extra.standard_commands import DodoCommand class Command(DodoCommand): # noqa help = "" decorators = ["docker"] docker_options = [ '--name=tape', ] def add_arguments_imp(self, parser): # noqa parser.add_argument( 'tape_args',...
Python
0.000004
0f13cc95eeeed58c770e60b74a37f99ca24a28f0
add tests for views
api/tests/test_views.py
api/tests/test_views.py
from django.test import TestCase from rest_framework.test import APIClient from rest_framework import status from django.core.urlresolvers import reverse class ViewsTestCase(TestCase): """Test suite for views.""" def setUp(self): """setup variables""" self.client = APIClient() def create_...
Python
0
aba613ddef5e25e057ca515bb017c4a21095936f
Add example to use CRF1d with automatically sorting sequences
examples/pos/postagging_with_auto_transpose.py
examples/pos/postagging_with_auto_transpose.py
import argparse import collections import nltk import numpy import six import chainer from chainer import datasets import chainer.links as L from chainer import reporter from chainer import training from chainer.training import extensions class CRF(chainer.Chain): def __init__(self, n_vocab, n_pos): su...
Python
0
27788308891d9cd82da7782d62b5920ea7a54f80
Add custom command to daily check scores
employees/management/commands/dailycheck.py
employees/management/commands/dailycheck.py
from constance import config from datetime import datetime from django.core.management.base import BaseCommand from django.core.mail import EmailMessage from django.shortcuts import get_list_or_404 from employees.models import Employee class Command(BaseCommand): help = "Update scores daily." def change_day(...
Python
0
8aac73fdc26fd838c3f91ffa9bc58e25777a5179
Add tests for mach angle
properties/tests/test_mach_angle.py
properties/tests/test_mach_angle.py
#!/usr/bin/env python """Test Mach angle functions. Test data is obtained from http://www.grc.nasa.gov/WWW/k-12/airplane/machang.html. """ import nose import nose.tools as nt from properties.prandtl_meyer_function import mu_in_deg @nt.raises(ValueError) def test_mach_lesser_than_one(): m = 0.1 mu_in_deg(...
Python
0
49dfd690abe794e3b393b8bcac3e0ab1427c41b3
Define riot_open.
riot/app.py
riot/app.py
# -*- coding: utf-8 -*- import urwid def run_tag(tag, *args, **kwargs): loop = urwid.MainLoop(tag, *args, **kwargs) loop.run() def quit_app(): raise urwid.ExitMainLoop()
Python
0.000913
04021db907109a5291833eb5ae96c45fb8d1802c
Add flask app mocking the EC API
ckanext/glasgow/tests/mock_ec.py
ckanext/glasgow/tests/mock_ec.py
import uuid import flask from werkzeug.exceptions import default_exceptions from werkzeug.exceptions import HTTPException def make_json_app(import_name, **kwargs): """ Creates a JSON-oriented Flask app. All error responses that you don't specifically manage yourself will have application/json conten...
Python
0
f1cc40c716f1e4f598e0a9230cd188fc897ac117
add config
moon/config.py
moon/config.py
# -*- coding: utf-8 -*- """ 这里是一些工具, 用来实现简单的项目配置系统 """ import logging _confdata = {} def setconf(prjname, confile, confdict={}): _confdata[prjname] = (confile, confdict) def exportconf(prjname, globals): """ 从文件和字典中导出配置 >>> open("/tmp/testmoonconf.py", "w").write("OSOS = 10") >>> setconf("hongbo", ...
Python
0.000002
106a339561f5b79e0cd9508246d2f8da227c4fdc
move file to folder
move_hmdb51.py
move_hmdb51.py
import argparse import os import sys import math import cv2 import numpy as np import multiprocessing import re import shutil parser = argparse.ArgumentParser() parser.add_argument('--data_dir', type=str, help="video image list", default='/media/llj/storage/tvcj/hmdbcnn3_test') parser.add_argument('--origin_fil...
Python
0.000003
6349d8acfd76fc893dfdb6a7c12aebfe9ec1bac9
add plexpy/Plex.tv
Contents/Libraries/Shared/subzero/lib/auth.py
Contents/Libraries/Shared/subzero/lib/auth.py
# coding=utf-8 # thanks, https://github.com/drzoidberg33/plexpy/blob/master/plexpy/plextv.py class PlexTV(object): """ Plex.tv authentication """ def __init__(self, username=None, password=None): self.protocol = 'HTTPS' self.username = username self.password = password ...
Python
0
d0c2ee2e0d848a586cc03ba5ac5da697b333ef32
Create list of random num
Misc/listOfRandomNum.py
Misc/listOfRandomNum.py
#List of randoms import random import math numList = [] for i in range(10): numList.append(random.randrange(1, 20)) for i in numList: print("Rand num = " + str(i))
Python
0.00002
9f508a429949d59f9969cc1e17a9094fa7c2441d
Create routines.py
routines.py
routines.py
Python
0.000003
85abbe29c7c764deac75b6e7b95e1ccec645d84b
Add icmp_ping ansible module
ansible-tests/validations/library/icmp_ping.py
ansible-tests/validations/library/icmp_ping.py
#!/usr/bin/env python DOCUMENTATION = ''' --- module: icmp_ping short_description: ICMP ping remote hosts requirements: [ ping ] description: - Check host connectivity with ICMP ping. options: host: required: true description: - IP address or hostname of host to ping type: s...
Python
0
24cf3ca775e8f42fa73217e29d3662a32627f9ea
Use a more reliable method to get the commit SHA for a tag.
buedafab/notify.py
buedafab/notify.py
"""Deploy notification hooks for third party services like Campfire and Hoptoad. """ from fabric.api import env, require, local from fabric.decorators import runs_once import os from buedafab import utils @runs_once def hoptoad_deploy(deployed=False): """Notify Hoptoad of the time and commit SHA of an app deploy....
"""Deploy notification hooks for third party services like Campfire and Hoptoad. """ from fabric.api import env, require, local from fabric.decorators import runs_once import os from buedafab import utils @runs_once def hoptoad_deploy(deployed=False): """Notify Hoptoad of the time and commit SHA of an app deploy....
Python
0
d3937b803baf036d5bd96dfcb1e10e51b29bab1e
Create migration
fellowms/migrations/0023_event_ad_status.py
fellowms/migrations/0023_event_ad_status.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-06-06 13:00 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fellowms', '0022_fellow_user'), ] operations = [ migrations.AddField( ...
Python
0.000001
db465ffe58a425b651930eaf1778ef179ed42d2a
Rename res_dict to result and add comment.
redash/query_runner/dynamodb_sql.py
redash/query_runner/dynamodb_sql.py
import json import logging import sys from redash.query_runner import * from redash.utils import JSONEncoder logger = logging.getLogger(__name__) try: from dql import Engine, FragmentEngine from pyparsing import ParseException enabled = True except ImportError, e: enabled = False types_map = { '...
import json import logging import sys from redash.query_runner import * from redash.utils import JSONEncoder logger = logging.getLogger(__name__) try: from dql import Engine, FragmentEngine from pyparsing import ParseException enabled = True except ImportError, e: enabled = False types_map = { ...
Python
0
101d6bc6d62e7e08d7c6867a77e58b0b168afc17
Add migrations to remove all the models
pinax/stripe/migrations/0015_auto_20190120_1239.py
pinax/stripe/migrations/0015_auto_20190120_1239.py
# Generated by Django 2.1.5 on 2019-01-20 18:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pinax_stripe', '0014_auto_20180413_1959'), ] operations = [ migrations.RemoveField( model_name='account', name='user...
Python
0
0781070ee0c17a34a3cc9521e8a6b67c401aa692
Add WGAN Tests
models/wgan_test.py
models/wgan_test.py
# Lint as: python3 """Tests for WGAN model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np import os import wgan class SpectralTest(tf.test.TestCase): def test_interpolation_2d(self): x1 = np.ra...
Python
0
e90d12802ff62738cbe4094e8db079f6519f47a5
Create BDayGift.py
Probability/BDayGift.py
Probability/BDayGift.py
import sys; n = int(sys.stdin.readline()); S = 0 for i in range(n): S += int(sys.stdin.readline()); print(S/2.0);
Python
0
45f91a92fd3ae08dd7403707f3981f306122eb6c
test task creation
freelancefinder/remotes/tests/test_tasks.py
freelancefinder/remotes/tests/test_tasks.py
"""Tests related to the remotes.tasks functions.""" from django_celery_beat.models import IntervalSchedule, PeriodicTask from ..tasks import setup_periodic_tasks def test_make_tasks(): """Ensure that setup makes some tasks/schedules.""" setup_periodic_tasks(None) intervals = IntervalSchedule.objects.all...
Python
0.000322
9edce7cb1704aa1d06b74b661725d54b465e54da
Add SQLALCHEMY_ECHO support in heroku.py (when debugging)
heroku.py
heroku.py
#!/usr/bin/env python from evesrp import create_app from evesrp.killmail import CRESTMail, ZKillmail from evesrp.transformers import ShipTransformer, PilotTransformer from evesrp.auth.testauth import TestAuth from evesrp.auth.bravecore import BraveCore from os import environ as env from binascii import unhexlify from e...
#!/usr/bin/env python from evesrp import create_app from evesrp.killmail import CRESTMail, ZKillmail from evesrp.transformers import ShipTransformer, PilotTransformer from evesrp.auth.testauth import TestAuth from evesrp.auth.bravecore import BraveCore from os import environ as env from binascii import unhexlify from e...
Python
0
cd3f59026b9026d62537b38d4e9d70a740e88018
Add tests for java mode
tests/test_java_mode.py
tests/test_java_mode.py
import editor_manager import editor_common import curses import curses.ascii import keytab from ped_test_util import read_str,validate_screen,editor_test_suite,play_macro,screen_size,match_attr def test_java_mode(testdir,capsys): with capsys.disabled(): def main(stdscr): lines_to_test = [ ...
Python
0.000001