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
ad777af05d2995ee43b3d64ce435cc96379fa9a2
add iostat template
graph_templates/iostat.py
graph_templates/iostat.py
from . import GraphTemplate class IostatTemplate(GraphTemplate): ''' corresponds to diamond diskusage plugin ''' target_types = { 'gauge': { 'match': '^servers\.(?P<server>[^\.]+)\.iostat\.(?P<device>[^\.]+)\.(?P<type>.*)$', 'default_group_by': 'server', 'de...
Python
0
5a47b4f3b13c2d66a9e226eeb90dfddef048279f
Implement the host and address options in runserver
djangae/management/commands/runserver.py
djangae/management/commands/runserver.py
import os from django.core.management.commands.runserver import BaseRunserverCommand from datetime import datetime class Command(BaseRunserverCommand): """ Overrides the default Django runserver command. Instead of starting the default Django development server this command fires up a copy of the f...
import os from django.core.management.commands.runserver import BaseRunserverCommand from datetime import datetime class Command(BaseRunserverCommand): """ Overrides the default Django runserver command. Instead of starting the default Django development server this command fires up a copy of the f...
Python
0.000001
1637b53727f81c9528c47effab172f86a58e8b9a
Add script register_ph_migrate.py to mass register and migrate placeholders remotely
ereuse_devicehub/scripts/register_ph_migrate.py
ereuse_devicehub/scripts/register_ph_migrate.py
import argparse import requests from ereuse_devicehub.security.request_auth import Auth def create_placeholders_and_migrate(base_url, email, password, n_placeholders, origin_db, dest_db, label=None, comment=None): """ Remotely connects to a devicehub, creates n_placehol...
Python
0
417e8d1b63b4b343de3a81366d2d2ce433f089dd
Add paf (#294)
jcvi/formats/paf.py
jcvi/formats/paf.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # paf.py # formats # # Created by Haibao Tang on 09/03/20 # Copyright © 2020 Haibao Tang. All rights reserved. # import sys import logging from jcvi.formats.base import must_open from jcvi.apps.base import OptionParser, ActionDispatcher class PAFLine: """ PAF ...
Python
0
54641126cd8d662c6443aff1e6fe238c4bb09932
Add PowerAnalysers Voltech PMn000
engineering_project/Instrument/PowerAnalyser.py
engineering_project/Instrument/PowerAnalyser.py
# import time # import logging # from scipy.interpolate import UnivariateSpline # import numpy as np try: from Instrument.GenericInstrument import GenericInstrument from Instrument.IEEE488 import IEEE488 from Instrument.SCPI import SCPI except ImportError: from GenericInstrument import GenericInstrumen...
Python
0
d4a5e1bf3e44a8cfe4bd3a9d1900803613e6da67
Add C_O_L_R_test.py to check basic compile/decompile of otTables.COLR
Tests/ttLib/tables/C_O_L_R_test.py
Tests/ttLib/tables/C_O_L_R_test.py
from fontTools import ttLib from fontTools.misc.testTools import getXML, parseXML from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import OTTableReader, OTTableWriter import pytest COLR_DATA = ( b"\x00\x00" # Version b"\x00\x01" # BaseGlyphRecordCount b"\x00\x00\x00\...
Python
0
884861de58ddfb12f2f5d15ce35349c74eab0c4e
Create 5009-set_bio_gripper.py
example/wrapper/common/5009-set_bio_gripper.py
example/wrapper/common/5009-set_bio_gripper.py
#!/usr/bin/env python3 # Software License Agreement (BSD License) # # Copyright (c) 2020, UFACTORY, Inc. # All rights reserved. # # Author: Hutton <geweipan@ufactory.cc> """ Example: Bio Gripper Control Please make sure that the gripper is attached to the end. """ import os import sys import time sys.path.append(os.pa...
Python
0.000012
3ebe9ccebede38cc0638ef4adefe54fca306f2e6
fix path
doc/conf.py
doc/conf.py
__license__ = """ Copyright 2012 DISQUS 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, so...
__license__ = """ Copyright 2012 DISQUS 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, so...
Python
0.000017
965cd743ab1310455fe1ee24c5fa0ae0ae97bd7a
Create MyTestProgram.py
MyTestProgram.py
MyTestProgram.py
#!/usr/bin/python import RPIO, time # John Scuteri's Button Board tester program # This program is for John Jay's Button board # This program was inspired by programs from the following website # http://www.savagehomeautomation.com/projects/raspberry-pi-john-jays-8-led-button-breakout-board.html # This program uses Py...
Python
0
3cfd37f81708e1f3a1b69d6c310c7f93d32eb8ed
add script to generate artificial data
django_db_meter/generate_data.py
django_db_meter/generate_data.py
import random import threading from django.contrib.auth.models import User from models import TestModel def generate_queries(): u1 = User.objects.filter() new_name = str(random.randint(0, 2000000)) if u1: u1.update(first_name=new_name) else: u1 = User(username=new_name) u1.sa...
Python
0.000002
af88a37ed87b18941232a98f52fec001bd63b453
Fix bug in CookieJar where QSettings expected str, but got QByteArray instead (#10)
python/pyphantomjs/cookiejar.py
python/pyphantomjs/cookiejar.py
''' This file is part of the PyPhantomJS project. Copyright (C) 2011 James Roe <roejames12@hotmail.com> This program 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 ...
''' This file is part of the PyPhantomJS project. Copyright (C) 2011 James Roe <roejames12@hotmail.com> This program 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 ...
Python
0
eb34dd310cac0106070554c440b134d0baad6c8e
add a way to sequence animations into a new animation
vectortween/SequentialAnimation.py
vectortween/SequentialAnimation.py
from vectortween.Animation import Animation from vectortween.Tween import Tween from vectortween.Mapping import Mapping from copy import deepcopy from itertools import tee import numpy as np def pairwise(iterable): "s -> (s0,s1), (s1,s2), (s2, s3), ..." a, b = tee(iterable) next(b, None) return zip(a,...
Python
0.000001
d5b622e9fb855753630cd3a6fae1a315b4be1a08
Add example using new pytorch backend
examples/dominant_eigenvector_pytorch.py
examples/dominant_eigenvector_pytorch.py
import numpy as np import numpy.random as rnd import numpy.linalg as la import torch from pymanopt import Problem from pymanopt.tools import decorators from pymanopt.manifolds import Sphere from pymanopt.solvers import TrustRegions def dominant_eigenvector(A): """ Returns the dominant eigenvector of the symm...
Python
0
7a9cb703e776d91d4fc3c632b190bd7d318a12a6
Create primary directions module
flatlib/predictives/primarydirections.py
flatlib/predictives/primarydirections.py
""" This file is part of flatlib - (C) FlatAngle Author: João Ventura (flatangleweb@gmail.com) This module implements the Primary Directions method. """ from flatlib import angle from flatlib import utils # === Base functions === # def arc(pRA, pDecl, sRA, sDecl, mcRA, lat): """ Retu...
Python
0.000001
9fbde5b8dd4d2555e03bc0b7915fc4e55f8333d9
Add test to help module
numba/tests/test_help.py
numba/tests/test_help.py
from __future__ import print_function import builtins import types as pytypes import numpy as np from numba import types from .support import TestCase from numba.help.inspector import inspect_function, inspect_module class TestInspector(TestCase): def check_function_descriptor(self, info, must_be_defined=False...
Python
0
e8607fce01bfe17c08de0702c4041d98504bc159
Add migration for changing CONTACTED_CHOICES
reunition/apps/alumni/migrations/0006_auto_20150823_2030.py
reunition/apps/alumni/migrations/0006_auto_20150823_2030.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('alumni', '0005_note'), ] operations = [ migrations.AlterField( model_name='note', name='contacted', ...
Python
0
e280b3d270395fd39ae0164265fdf5960b16a822
add new example for wexplore2 with gpu mapper
examples/sEH_TPPU/sEH_TPPU_WExplore2_GPU/we.py
examples/sEH_TPPU/sEH_TPPU_WExplore2_GPU/we.py
import pickle import h5py import numpy as np import pandas as pd import simtk.openmm.app as omma import simtk.openmm as omm import simtk.unit as unit import scoop.futures import mdtraj as mdj from wepy.sim_manager import Manager from wepy.resampling.wexplore2 import WExplore2Resampler from wepy.openmm import OpenM...
Python
0
5db1a4c8c721a0acffa6e903c5eef9b84ebfd0d3
rename example to avoid namespace problem
examples/tutorials/scipy2008/traits_example.py
examples/tutorials/scipy2008/traits_example.py
from numpy import linspace, sin from enable.api import ColorTrait from chaco.api import ArrayPlotData, Plot, marker_trait from enable.component_editor import ComponentEditor from traits.api import HasTraits, Instance, Int from traitsui.api import Group, Item, View class ScatterPlotTraits(HasTraits): plot = Inst...
Python
0
212d19c29a42bd6966965b166cdbb4dd642e5eb4
Add test-cases for `get_user_membership`
wqflask/tests/unit/wqflask/test_resource_manager.py
wqflask/tests/unit/wqflask/test_resource_manager.py
"""Test cases for wqflask/resource_manager.py""" import unittest from unittest import mock from wqflask.resource_manager import get_user_membership class TestGetUserMembership(unittest.TestCase): """Test cases for `get_user_membership`""" def setUp(self): conn = mock.MagicMock() conn.hgetall...
Python
0.000002
3bdbc33e94a601f5d903bd32caf5ad7698fc025e
Fix zulip.com hardcoding.
zerver/management/commands/initialize_voyager_db.py
zerver/management/commands/initialize_voyager_db.py
from __future__ import absolute_import from typing import Any, Iterable, Tuple from django.core.management.base import BaseCommand from django.contrib.sites.models import Site from zerver.models import UserProfile, Stream, Recipient, \ Subscription, Realm, get_client, email_to_username from django.conf import se...
from __future__ import absolute_import from typing import Any, Iterable, Tuple from django.core.management.base import BaseCommand from django.contrib.sites.models import Site from zerver.models import UserProfile, Stream, Recipient, \ Subscription, Realm, get_client, email_to_username from django.conf import se...
Python
0
b2febfd4b52c1e50be4d8ba614adcbe4d59251d8
Add blank init file
SDK/__init__.py
SDK/__init__.py
Python
0
fc58a85131675672ccef2302038cc55c9e4b0460
Migrate products
c2corg_api/scripts/migration/documents/products.py
c2corg_api/scripts/migration/documents/products.py
from c2corg_api.models.document import DocumentGeometry, \ ArchiveDocumentGeometry from c2corg_api.models.waypoint import Waypoint, ArchiveWaypoint, \ WaypointLocale, ArchiveWaypointLocale from c2corg_api.scripts.migration.documents.document import MigrateDocuments class MigrateProducts(MigrateDocuments): ...
Python
0.000002
9719189501f8b0fcff186b1bc2130fcef8d21e8d
add movie scraper
scrape_rotten/scrape_rotten/spiders/movie_spider.py
scrape_rotten/scrape_rotten/spiders/movie_spider.py
import scrapy def get_urls(): # load from file with open('movie_urls.json') as f: return [line.rstrip() for line in f] class MovieSpider(scrapy.Spider): name = 'movies' start_urls = get_urls() def meta_property(self, response, prop): return response.xpath("//meta[@property='...
Python
0.000009
052832a766e296a3444cb7afd5b5a930013d18d6
Create z04-convolutional-neural-network.py
skflow-examples/z04-convolutional-neural-network.py
skflow-examples/z04-convolutional-neural-network.py
# http://terrytangyuan.github.io/2016/03/14/scikit-flow-intro/ # Loading MNIST data mnist = input_data.read_data_sets('MNIST_data') def max_pool_2x2(tensor_in): return tf.nn.max_pool(tensor_in, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME') def conv_model(X, y): # reshape X to 4d tensor w...
Python
0.000003
d76572b47d6b7657274617b129abc6890c503e1e
Add RIP packet type
pox/lib/packet/rip.py
pox/lib/packet/rip.py
# Copyright 2012 James McCauley # Copyright 2008 (C) Nicira, Inc. # # This file is part of POX. # # POX 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) an...
Python
0.000002
b9ff8fc06f9bd55721332831d4ce23589d93fafb
Create 3Sum.py
leetcode/15.-3Sum/3Sum.py
leetcode/15.-3Sum/3Sum.py
class Solution(object): def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ res = [] sortnum = sorted(nums) length = len(sortnum) # make sure a < b < c for i in xrange(length-2): a = sortnum[i] ...
Python
0.000002
80bf107b29f51456f778da718ef438fd62545b1b
Add server test file
pi_approach/UI/server.py
pi_approach/UI/server.py
import socket HOST = socket.gethostname() + '.local' # Server IP or Hostname PORT = 12345 # Pick an open Port (1000+ recommended), must match the client sport s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print 'Socket created' #managing error exception try: s.bind((HOST, PORT)) print "Opened" ...
Python
0.000001
64577b7eb445a62f4e8348d687fa6ed7ed5401ed
Add migrations to user_profile app.
localtv/user_profile/migrations/0001_initial.py
localtv/user_profile/migrations/0001_initial.py
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): depends_on = ( ('localtv', '0008_add_profile'), ) def forwards(self, orm): pass # this is handled by 0008_add_profile def bac...
Python
0
691b27a4d97d5c2966f1627ed6cc5870024537c0
add bouncy example
06-animation/bouncy.py
06-animation/bouncy.py
def setup(): size(300,300) # ball properties global rad, d, pos, vel, grav rad = 25 # radius of the ball pos = PVector( 150, 50 ) # initial position of the ball vel = PVector( random(-3,3), random(-3,3) ) # velocity of the balll grav = PVector( 0, 0.9 ) # force on the ball (gravity) d = 0.97 # how much...
Python
0.000007
1f6e225a1b01e8eb4cd9f1d5da05455d85326064
Validate ck_user_has_mobile_or_other_auth constraint
migrations/versions/0357_validate_constraint.py
migrations/versions/0357_validate_constraint.py
""" Revision ID: 0357_validate_constraint Revises: 0356_add_webautn_auth_type Create Date: 2021-05-13 14:15:25.259991 """ from alembic import op revision = '0357_validate_constraint' down_revision = '0356_add_webautn_auth_type' def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op...
Python
0
8387b0289e84ededdd9ba3db5ba47f149b918530
clean up batch submit script
dnanexus/dx_batch.py
dnanexus/dx_batch.py
#!/usr/bin/env python import argparse import os import sys import subprocess import dxpy import requests from dxencode import dxencode as dxencode SERVER = 'https://www.encodeproject.org' ASSAY_TYPE = 'whole genome bisulfite sequencing' ASSAY_TERM_ID = 'OBI:0001863' HEADERS = {'content-type': 'application/json'} de...
Python
0
9e217f0641328e1dfce91cdffdb8b5d77e4fe8fa
Add segcnn
examples/human_sar/segcnn.py
examples/human_sar/segcnn.py
import os import sys import cPickle import theano.tensor as T homepath = os.path.join('..', '..') if not homepath in sys.path: sys.path.insert(0, homepath) from dlearn.models.layer import FullConnLayer, ConvPoolLayer from dlearn.models.nnet import NeuralNet from dlearn.utils import actfuncs, costfuncs from dlear...
Python
0.000084
218df31e0f808aae75310b98dfe2c5cb7d87e7ed
introduce image slicer
postcards/slice_image.py
postcards/slice_image.py
from PIL import Image import os from time import gmtime, strftime import math import sys import logging """slice_image.py: Slice images into tiles.""" __author__ = "Andrin Bertschi. www.abertschi.ch" LOGGER_NAME = 'slice_image' logger = logging.getLogger(LOGGER_NAME) def make_tiles(image, tile_width, tile_height):...
Python
0.000003
ef627493f87d60e404008b26fe13e816d492a333
add a bluetooth test component that simply displays when a device move on the network
python/test_bluetooth.py
python/test_bluetooth.py
#!/usr/bin/python # -- Content-Encoding: UTF-8 -- """ Test bluetooth module that displays informations from bluetooth and print a message when a bluetooth device appears or disappears. :author: Luc Libralesso :copyright: Copyright 2014, isandlaTech :license: Apache License 2.0 :version: 0.0.3 :status: Alpha .. C...
Python
0
a1e3e275a81ff073fed226619bde23361230cfce
Add tests for packaging.tests.support (#12659).
Lib/packaging/tests/test_support.py
Lib/packaging/tests/test_support.py
import os import tempfile from packaging.dist import Distribution from packaging.tests import support, unittest class TestingSupportTestCase(unittest.TestCase): def test_fake_dec(self): @support.fake_dec(1, 2, k=3) def func(arg0, *args, **kargs): return arg0, args, kargs self...
Python
0
5a59b5b96e223da782cf683aabbf4e8371c883e1
Add DHKE protocol
cryptos/dhke.py
cryptos/dhke.py
""" Implementation of the Diffie-Hellman Key Exchange Protocol Usage: # Setup invoker = DHKEInvoker() other = DHKEParty(invoker.get_param()) # Key exchange phase other.receive_partial_key(invoker.get_partial_key()) invoker.receive_partial_key(other.get_partial_key()) # Check consistency ...
Python
0.000001
088cd2ddb79bdd2a8dd68e2d7169484eea90fd1a
Add problem79.py
euler_python/problem79.py
euler_python/problem79.py
""" problem79.py A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317. The text file, keylog.txt, contains fifty successful login att...
Python
0.000088
a0e9ac222091619f41a4eed0cfb25c1653b8034d
add simple update script
cvxpy/utilities/cvxpy_upgrade.py
cvxpy/utilities/cvxpy_upgrade.py
import argparse import re # Captures row and column parameters; note the captured object should # not be a keyword argument other than "cols" (hence the requirement that # the captured group is followed by a comma, whitespace, or parentheses) P_ROW_COL = r"(?:rows=)?(\w+),\s*(?:cols=)?(\w+)[\s,)]" # A list of substi...
Python
0
5a99f676a5b0b55d0490c955cb9af42d9121192d
Initialize database transactions
app/database.py
app/database.py
"""This module initialises .""" from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base from config.config import Config engine = create_engine(Config.DATABASE_URI, convert_unicode=True) db_session = scoped_session(sessionmake...
Python
0
0ee023d29f613f718f5b88c158b120adb8b2fe2e
add new package (#16289)
var/spack/repos/builtin/packages/py-murmurhash/package.py
var/spack/repos/builtin/packages/py-murmurhash/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyMurmurhash(PythonPackage): """Cython bindings for MurmurHash.""" homepage = "https://github.com/explosio...
Python
0
ab1c64e4af25920b31868a9a9f168e76bdf386c6
Move object collection code to own module.
pytest_wish/collection.py
pytest_wish/collection.py
# -*- coding: utf-8 -*- # # Copyright (c) 2015-2016 Alessandro Amici # # 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, c...
Python
0
e4bc3edf4180ac1385e125a11d01f222747b13f7
send File Over FTP using ftplib
python/sendFileOverFTP.py
python/sendFileOverFTP.py
#---License--- #This is free and unencumbered software released into the public domain. #Anyone is free to copy, modify, publish, use, compile, sell, or #distribute this software, either in source code form or as a compiled #binary, for any purpose, commercial or non-commercial, and by any #means. #by frainfreeze #-...
Python
0
b33725e2a3153b27312e820797bbc8375dbe8970
Create beta_interweaving_strings_and_removing_digits.py
Solutions/beta_interweaving_strings_and_removing_digits.py
Solutions/beta_interweaving_strings_and_removing_digits.py
from itertools import zip_longest as zlo from string import digits interweave = lambda a,b: ''.join((i if i not in digits else '')+(j if j not in digits else '') for i,j in zlo(a, b, fillvalue = ''))
Python
0.000066
6b53e890958251bd34c29b09f597c8221f4bc98b
Add sublime text utils module
modules/st_utils.py
modules/st_utils.py
import sublime def open_window(): sublime.run_command("new_window") return sublime.active_window()
Python
0
ff2fba1c09cff57c9fb01ff3c12f076aff23d56a
Create __init__.py
__init__.py
__init__.py
#!/usr/bin/python #-------------------------------IMPORT--------------------------------# from lib import * #-------------------------------EXPORT--------------------------------# __all__ = ['<#PREFIX#>_app','<#PREFIX#>_index']
Python
0.000429
1641de48deab3e6cc18de7eb40e1d02ab28dd88c
Create StarTrek.py
StarTrek.py
StarTrek.py
# Star Treck
Python
0
ae93eaf84487339c5fba696c7900485f2918546e
Add __init__.py
__init__.py
__init__.py
from .pytypecheck import tc, tc_opts from . import predicates
Python
0.006636
59e9281d94acf529113697057d80bb6a1eac6191
Add global init file
__init__.py
__init__.py
# -*- coding: utf-8 -*- """Marble: analyse social stratification in cities""" __author__ = "Rémi Louf" __email__ = "remilouf@sciti.es" __website__ = "www.sciti.es" __copyright__ = "2015, Rémi Louf"
Python
0.000001
f06ebc1da601de961311c4b753e966227eadb911
Create __init__.py
__init__.py
__init__.py
""Backport of importlib.import_module from 3.x.""" # While not critical (and in no way guaranteed!), it would be nice to keep this # code compatible with Python 2.3. import sys def _resolve_name(name, package, level): """Return the absolute name of the module to be imported.""" if not hasattr(package, 'rindex'...
Python
0.000429
a09fa218a918fbde70ea99a67fa1d964b17c5e2c
add init
__init__.py
__init__.py
__all__ = ['bust'] from .detector import bust
Python
0.998609
7b8136d77f2968ac02d17991eca30862bdf9e104
add __init__ file
__init__.py
__init__.py
from resnet import *
Python
0.000128
da874ace234dbac4f0fc8f428cf43d3f415cc596
Create __init__.py
__init__.py
__init__.py
# __init__.py
Python
0.000429
1e716efd7e275068a18d309f42ec8e955309b4b7
Create __init__.py
__init__.py
__init__.py
Python
0.000429
f7cc1a858ae88ac14ac18548d70d00c932359b7f
finish question 1060
p1060_Missing_Element_In_Sorted_Array.py
p1060_Missing_Element_In_Sorted_Array.py
''' - Leetcode problem: 1060 - Difficulty: Medium - Brief problem description: Given a sorted array A of unique numbers, find the K-th missing number starting from the leftmost number of the array. Example 1: Input: A = [4,7,9,10], K = 1 Output: 5 Explanation: The first missing number is 5. Example 2: Input: ...
Python
0.999999
0a5710cae8597faf111486600fd90278bfc000f9
reset head due to large file issue
dataForShaopeng/generate_data.py
dataForShaopeng/generate_data.py
import numpy as np from CMash import MinHash as MH import seaborn import matplotlib.pyplot as plt # Data prep # In bash: #mkdir dataForShaopeng #cd dataForShaopeng/ #mkdir data #cd data #wget https://ucla.box.com/shared/static/c1g8xjc9glh68oje9e549fjqj0y8nc17.gz && tar -zxvf c1g8xjc9glh68oje9e549fjqj0y8nc17.gz && rm c...
Python
0
d72f11fbfc23de44af8a2600a7310adafe3e2ffe
Create a.py
agc015/a.py
agc015/a.py
def main(): n, a, b = map(int, input().split()) if a > b or (n == 1 and a != b): print(0) else: print((n - 1) * (b - a) - (b - a - 1)) if __name__ == '__main__': main()
Python
0.000489
47ba8815c7a0de0191fb363c22c42732781a8e38
Fix blank index_for
daiquiri/metadata/migrations/0020_blank_index_for.py
daiquiri/metadata/migrations/0020_blank_index_for.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2018-04-05 15:25 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('daiquiri_metadata', '0019_column_index_for'), ] operations = [ migrations.A...
Python
0.999194
a9d5c1dcb059f02f6c3ec5dbff6b07f54c20194d
Add an example directory
example/main.py
example/main.py
from beckett import clients, resources class PersonResource(resources.BaseResource): class Meta: name = 'Person' resource_name = 'people' identifier = 'url' attributes = ( 'name', 'birth_year', 'eye_color', 'gender', 'heig...
Python
0.000002
3367f9d1e394bf686bc6bbd6316265c9feef4f03
Add basic tests for config usb
test/on_yubikey/test_cli_config.py
test/on_yubikey/test_cli_config.py
from .util import (DestructiveYubikeyTestCase, ykman_cli) class TestConfigUSB(DestructiveYubikeyTestCase): def setUp(self): ykman_cli('config', 'usb', '--enable-all', '-f') def tearDown(self): ykman_cli('config', 'usb', '--enable-all', '-f') def test_disable_otp(self): ykman_cli...
Python
0
b8e466a8671be716397d136e16814790b7ed594a
Create Scaffold
SteinerTree.py
SteinerTree.py
import random import numpy import matplotlib.pyplot as plt from deap import base, creator, tools, algorithms ''' SteinerTree Code scaffold for solving the SteinerTree problem using the DEAP framework https://github.com/deap/deap (currently OneMax problem) you can find more information about DEAP in the noteb...
Python
0.000001
4dbe1b21ab0f82eeba82be7db2e141260942b998
add num_states to mixture convenience wrapper
basic/models.py
basic/models.py
# These classes make aliases of class members and properties so as to make # pybasicbayes mixture models look more like pyhsmm models. When comparing # H(S)MM model fits to pybasicbayes mixture model fits, it's easier to write one # code path by using these models. import pybasicbayes from ..util.general import rle c...
# These classes make aliases of class members and properties so as to make # pybasicbayes mixture models look more like pyhsmm models. When comparing # H(S)MM model fits to pybasicbayes mixture model fits, it's easier to write one # code path by using these models. import pybasicbayes from ..util.general import rle c...
Python
0.000001
fb7a5b279da36b9dbd6338867168a79011edd0d6
Create new package (#7208)
var/spack/repos/builtin/packages/glimmer/package.py
var/spack/repos/builtin/packages/glimmer/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
ec54ae0e59058cadecec38fb70be2947d0907d6a
Hello World
pyexamples/conditions.py
pyexamples/conditions.py
print('Hello World')
Python
0.99998
921244353f75292fc26f521ad081fd587c2b2b25
Create pyramid_mongo_session.py
pyramid_mongo_session.py
pyramid_mongo_session.py
# encoding: utf-8 from pyramid.interfaces import ISession from pyramid.compat import PY3, pickle from pyramid.session import manage_accessed, manage_changed from zope.interface import implementer from hashlib import md5 import time import os import re def get_random(): return md5(os.urandom(32)).hexdigest() # ...
Python
0.000238
fe1af6449ec4feeaf75a248422e806ad9c818749
remove doc
python/qidoc/__init__.py
python/qidoc/__init__.py
## Copyright (c) 2012 Aldebaran Robotics. All rights reserved. ## Use of this source code is governed by a BSD-style license that can be ## found in the COPYING file. """ qidoc : handle generating sphinx and doxygen documentation of qibuild projects """
## Copyright (c) 2012 Aldebaran Robotics. All rights reserved. ## Use of this source code is governed by a BSD-style license that can be ## found in the COPYING file. """ qidoc : handle generating sphinx and doxygen documentation of qibuild projects qiDoc: documentation generator ============================== qi...
Python
0.00001
ceb8ec420e5e894644aecce8b96463cc3769ce1d
Add process_alerts management command
cityhallmonitor/management/commands/process_alerts.py
cityhallmonitor/management/commands/process_alerts.py
from django.conf import settings from django.core.mail import send_mail from django.core.management.base import BaseCommand, CommandError from django.utils import timezone from cityhallmonitor.models import Subscription from documentcloud import DocumentCloud DEFAULT_PROJECT = 'Chicago City Hall Monitor' EMAIL_SUBJE...
Python
0.000003
59a0996644115bef57de6e15dc572a6227e45b3a
Add script for downloading weekly price data from India
data_crunching/download_india_prices.py
data_crunching/download_india_prices.py
#!/usr/bin/env python2 import urllib import urllib2 import shutil import re import sys import datetime usage_str = ''' This scripts downloads weekly food prices from http://rpms.dacnet.nic.in/Bulletin.aspx in XLS format. ''' def download_spreadsheet(date_string): main_url = 'http://rpms.dacnet.nic.in/Bulletin.a...
Python
0
44597a9b9f5e2ef2eb391b096d3240b81960ce68
fix doc generation on plot_lasso_coordinate_descent_path.py example (pb on my box)
examples/glm/plot_lasso_coordinate_descent_path.py
examples/glm/plot_lasso_coordinate_descent_path.py
""" ===================== Lasso and Elastic Net ===================== Lasso and elastic net (L1 and L2 penalisation) implemented using a coordinate descent. """ print __doc__ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD Style. from itertools import cycle import numpy as np import pylab a...
""" ===================== Lasso and Elastic Net ===================== Lasso and elastic net (L1 and L2 penalisation) implemented using a coordinate descent. """ print __doc__ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD Style. from itertools import cycle import numpy as np import pylab a...
Python
0
c12305c59f9c95149e95094179768ac627d7faf9
Add test file for upload client class
tests/client/test_upload_client.py
tests/client/test_upload_client.py
import os import mock import unittest from qingstor.sdk.config import Config from qingstor.sdk.service.qingstor import Bucket from qingstor.sdk.service.qingstor import QingStor from qingstor.sdk.client.upload_client import UploadClient from qingstor.sdk.error import ( BadRequestError, InvalidObjectNameError ) ...
Python
0
305ab2ede27fde9097c7a69804189a529c868140
add missing filter plugins
filter_plugins/customs.py
filter_plugins/customs.py
class FilterModule(object): def filters(self): return { 'filename_without_extension': self.filename_without_extension } def filename_without_extension(self, path, extension): return path[:-len(extension)]
Python
0.000001
9296c11a013fc03c7f299707a12b74a4ef85abf7
update cStringIO counter
gdb_StringIO.py
gdb_StringIO.py
import gdb """ SPECS /* Entries related to the type of user set breakpoints. */ static struct pybp_code pybp_codes[] = { { "BP_NONE", bp_none}, { "BP_BREAKPOINT", bp_breakpoint}, { "BP_WATCHPOINT", bp_watchpoint}, { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint}, { "BP_READ_WATCHPOINT", bp_read_watchpoin...
Python
0
96a94b6901ebca0930a2509ccadfd603f8558b8d
Add test case for event items
tests/test_event.py
tests/test_event.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json from lxml import html from utils.summary_downloader import SummaryDownloader from utils.data_handler import DataHandler from parsers.team_parser import TeamParser from parsers.game_parser import GameParser from parsers.roster_parser import Ros...
Python
0.000002
bc581b1ac7a12fd3026667663a4812fe0bd3869b
add dict.py
dict.py
dict.py
#! /usr/bin/env python2 # -*- coding: utf-8 -*- import sys import json import urllib import subprocess def main(): word = subprocess.check_output('xsel') params = urllib.urlencode({'from': 'auto', 'to': 'auto', 'client_id':'WGCxN9fzvCxPo0nqlzGLCPUc', 'q': word}) f = urllib.urlopen("http://openapi.baidu.co...
Python
0.000002
28b5fef57580640cd78775d6c0544bc633e5958a
Add helper script to generate API keys.
generate-key.py
generate-key.py
#!/usr/bin/python import os import sqlite3 import sys import time if len(sys.argv) < 3: raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0]) db = sqlite3.connect('/var/lib/zon-api/data.db') api_key = str(os.urandom(26).encode('hex')) tier = 'free' name = sys.argv[1] email = sys.argv[...
Python
0
a314da2415e661ed6cbc9929095a0f34610d9c21
FIX _get_search_domain in partner
transindar_personalization/res_partner.py
transindar_personalization/res_partner.py
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import models, api, fields class re...
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import models, api, fields class re...
Python
0
6807ce92c5d0a26a43db8cb25ef5ffd8b8ff6277
Add skeleton cryptdev module
salt/modules/cryptdev.py
salt/modules/cryptdev.py
# -*- coding: utf-8 -*- ''' Salt module to manage Unix cryptsetup jobs and the crypttab file ''' # Import python libraries from __future__ import absolute_import import logging # Import salt libraries import salt # Set up logger log = logging.getLogger(__name__) # Define the module's virtual name __virtualname__ = ...
Python
0
9b457a08ce433b574f186bb1b32da666edee485a
Complete sol by recursion
lc0108_convert_sorted_array_to_binary_search_tree.py
lc0108_convert_sorted_array_to_binary_search_tree.py
"""Leetcode 108. Convert Sorted Array to Binary Search Tree Easy URL: https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree...
Python
0.006524
26cb7ea15886f78d781018e0fb9398f5a61acadd
Create time_keeper.py
fx_collect/time_keeper.py
fx_collect/time_keeper.py
from datetime import datetime, timedelta import numpy as np import pytz class TimeKeeper(object): """ The TimeKeeper class controls all date time logic. """ def __init__(self, init_dt): # init_dt is the current daily bar # init_dt = datetime(2018,1,29,22,0) self._create_current...
Python
0.000012
e36df0c827de666fa00d9b806759cde0f0cb1697
Test code
game.py
game.py
class Room: def __init__(self, configuration={}): self.doors = configuration class Merchant: def __init__(self, markup=1.2, markdown=0.8): self.inventory = [] self.markup = markup self.markdown = markdown def add_item(self, item): # Adds an item to the merch...
Python
0.000001
8afc0186fa35a25692ee8f895873d888c5f0540e
Create helm.py
helm.py
helm.py
""" Provides some helper functions for helm. (C) Oliver Schoenborn License: modified MIT, ie MIT plus the following restriction: This code can be included in your code base only as the complete file, and this license comment cannot be removed or changed. This code was taken from https://github.com/schollii/sandals...
Python
0.000001
e9eed6b6e99e948ed2863fcc45a037b0e2b1e80f
fix import in tornado worker
gunicorn/workers/gtornado.py
gunicorn/workers/gtornado.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import os from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop, PeriodicCallback from gunicorn.workers.base import Worker class TornadoWorker(Worker): def w...
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop, PeriodicCallback from gunicorn.workers.base import Worker class TornadoWorker(Worker): def watchdog(sel...
Python
0.000001
96451643294003992e6d73ec34876badae177ed8
Add PULSE support
libpebble2/communication/transports/pulse.py
libpebble2/communication/transports/pulse.py
from __future__ import absolute_import __author__ = 'Liam McLoughlin' import struct try: import pulse2 except ImportError: pass from . import BaseTransport, MessageTargetWatch from libpebble2.exceptions import ConnectionError, PebbleError class PULSETransport(BaseTransport): """ Represents a direct...
Python
0
4fd03b93f7c2ff31b6a7ab6bf6d404cc579a6bf8
Rewrite download_hash in Python (#5995)
scripts/download_hash.py
scripts/download_hash.py
#!/usr/bin/env python3 # After a new version of Kubernetes has been released, # run this script to update roles/download/defaults/main.yml # with new hashes. import hashlib import sys import requests from ruamel.yaml import YAML MAIN_YML = "../roles/download/defaults/main.yml" def open_main_yaml(): yaml = YAML...
Python
0
41e115305a4de332689199ecf6a52a37c0d72e55
Fix #108
src/collectors/memory/memory.py
src/collectors/memory/memory.py
# coding=utf-8 """ This class collects data on memory utilization Note that MemFree may report no memory free. This may not actually be the case, as memory is allocated to Buffers and Cache as well. See [this link](http://www.linuxatemyram.com/) for more details. #### Dependencies * /proc/meminfo or psutil """ im...
# coding=utf-8 """ This class collects data on memory utilization Note that MemFree may report no memory free. This may not actually be the case, as memory is allocated to Buffers and Cache as well. See [this link](http://www.linuxatemyram.com/) for more details. #### Dependencies * /proc/meminfo or psutil """ im...
Python
0.000001
3b27b1d6b1c4739b8d456703542ec8182ce12277
Add a Wordpress+MySQL composed instance functional test case
heat/tests/functional/test_WordPress_Composed_Instances.py
heat/tests/functional/test_WordPress_Composed_Instances.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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 applicabl...
Python
0.000002
1172287e38f623994b039cea0dab36ea68d18471
add RabbitService
ics_demo/remote_services/demo.py
ics_demo/remote_services/demo.py
from base import Service from ics_demo.helpers.base import uuidgen class RabbitService(Service): def it_is_my_warren(self, name): cmd = 'mkdir -p /tmp/%s' % name self.remote_cmd_quiet(cmd) def put_carrot_bucket_in_my_warren(self, rabbit): cmd = 'mkdir /tmp/%s/carrots' % rabbit.name ...
Python
0
8de10ac1bf133c41cc1d0e330714e1659e42b092
add script to write consul-manager ip to a text file
consul/get_consul_manager_ip.py
consul/get_consul_manager_ip.py
import os import digitalocean TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.token" with open(TOKEN_FILE) as f: token = f.read().strip() os.environ['DO_API_TOKEN'] = token manager = digitalocean.Manager(token=token) my_droplets = manager.get_all_droplets() consul_manager_droplet = [d for d in my_dro...
Python
0
8f362afc34c79a90f2b1ca332a82e9901a150d64
add the ability to start program without network connection
lib/ansible/modules/extras/cloud/vmware/vmware_vm_shell.py
lib/ansible/modules/extras/cloud/vmware/vmware_vm_shell.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Ritesh Khadgaray <khadgaray () gmail.com> # # This file is part of Ansible # # Ansible 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...
Python
0.000001
32f4055b52c8768c80cf82451f6ace74af600d0c
test new analyze rewrite
lib/neuroimaging/refactoring/tests/test_analyze.py
lib/neuroimaging/refactoring/tests/test_analyze.py
import unittest from neuroimaging.refactoring.analyze import AnalyzeImage from neuroimaging.tests.data import repository from neuroimaging.visualization.arrayview import arrayview class AnalyzeImageTest(unittest.TestCase): def setUp(self): self.image = AnalyzeImage("rho", datasource=repository) def t...
Python
0.000002
6feae8e14b4e690cb0d5c71880b9d6c167ac978b
add stub for a csv scraping script
ipeds_reporter/scripts/scrape.py
ipeds_reporter/scripts/scrape.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ WIP thing to scrape ipeds for me. """ from selenium import webdriver def main(): driver = webdriver.Firefox() driver.close() if __name__ == '__main__': main()
Python
0
4241d67149887f8edc0636f7cb4fdbcb22e8e98b
Create repeatings.py
job_interview_algs/repeatings.py
job_interview_algs/repeatings.py
TEXT = """abba com mother bill mother com abba dog abba mother com""" def secuenced_words(txt): """ Function identifies and displays the three words most often repeated as a group, regardless of the words order in the group """ word_list = txt.split() collector = dict() fo...
Python
0.000006
3bd95d8789871246fb90c6eb0487d9746ef5cb27
Migrate all project contents blocks to activity contents blocks
bluebottle/cms/migrations/0056_auto_20191106_1041.py
bluebottle/cms/migrations/0056_auto_20191106_1041.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-11-06 09:41 from __future__ import unicode_literals from django.db import migrations def migrate_project_blocks(apps, schema_editor): ProjectsContent = apps.get_model('cms', 'ProjectsContent') ActivitiesContent = apps.get_model('cms', 'ActivitiesC...
Python
0
d64ab6f099caf90941fdb6eb99d89fbacc9e2378
add deepbench
wa/workloads/deepbench/__init__.py
wa/workloads/deepbench/__init__.py
# Copyright 2018 ARM Limited # # 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 writin...
Python
0.000001
06570a926bde2ea10730062b05a2348c3020745c
Add example: filtered ensemble average.
examples/filter_ensemble_average.py
examples/filter_ensemble_average.py
import numpy as np import matplotlib.pyplot as plt import atomic from ensemble_average import time_dependent_power if __name__ == '__main__': times = np.logspace(-7, 0, 50) temperature = np.logspace(0, 3, 50) density = 1e19 from atomic.pec import TransitionPool ad = atomic.element('argon') t...
Python
0
d9985ec4fa37cf99e0e541c7affadd5ec9288a0c
Create multithread.py
APIs/multithread.py
APIs/multithread.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 15 22:59:02 2018 @author: zhurundong """ import time import requests import asyncio import aiohttp from concurrent.futures import ThreadPoolExecutor NUMBERS = range(12) URL = 'http://httpbin.org/get?a={}' # Get http requests results def fetch(a):...
Python
0.000001
93f6ebde39ef0538624ad3eb94316bf8bdf69fd9
Create N_QueensII.py
Array/N_QueensII.py
Array/N_QueensII.py
Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. class Solution: # @param {integer} n # @return {integer} def totalNQueens(self, n): if n == 0: return 0 self.result = 0 # Here we should use the global variable, o...
Python
0.000011
38b4ec7164f07af7135c41c401c4f403c1061d66
Add skeleton for parsing commands
app/main.py
app/main.py
"""lazy Usage: lazy (new|n) lazy (show|s) [<id>] lazy (delete|d) [<id>] lazy (import|i) <path> lazy (export|e) <path> [<id>] Options: -h, --help: Show this help message. """ from docopt import docopt def main(): # Parse commandline arguments. args = docop...
Python
0.000002
b0f4a0abb74bc9f1cf97a49d4501c48d666b6dfe
add qt3
autoconf/qt3.py
autoconf/qt3.py
from _external import * import os def unique(list): return dict.fromkeys(list).keys() def subdirs(files): dirs = unique(map(os.path.dirname, files)) dirs.sort() return dirs def locateQt3Command(env, command, bindir): #print 'locateQt3Command:', command suffixes = [ '-qt3', '3', '', ] progs = [command+s...
Python
0.010732
b394b9846823b29e9f625b34b820dbbd485b47c9
"nested sets" example. needs work.
examples/nested_sets/nested_sets.py
examples/nested_sets/nested_sets.py
"""Celko's "Nested Sets" Tree Structure. http://www.intelligententerprise.com/001020/celko.jhtml """ from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.orm import attributes from sqlalchemy.ext.declarative import declarative_base engine = create_engine('sqlite://', echo=True) Base = declarative_b...
Python
0.999923
3ed9dd0ca03216311771cda5f9cd3eb954a14d4f
Add boilerplate with simple test sounds
telemeta/management/commands/telemeta-test-boilerplate.py
telemeta/management/commands/telemeta-test-boilerplate.py
from optparse import make_option from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from django.template.defaultfilters import slugify import os from telemeta.models import * from timeside.core.tools.test_samples import generat...
Python
0