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
458cf526a4ebb72b4fad84e8cd2b665e0f093c1b
Add functional test for cluster check recover
senlin/tests/functional/test_cluster_health.py
senlin/tests/functional/test_cluster_health.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 under t...
Python
0.000009
48c008b4ac08114e30f4bee7a208d5d3fb925296
Add partial simple greedy algorithm (baseline).
problem1/steiner-simplegreedy.py
problem1/steiner-simplegreedy.py
import networkx as nx from sys import argv def main(): # G = nx.read_gml(argv[1]) G = nx.read_gml("steiner-small.gml") T = [] # terminals for v,d in G.nodes_iter(data=True): if d['T'] == 1: T.append(v) U = T[:] # Steiner tree vertices F = [] # Steiner tree edges D = [] # cand...
Python
0.000001
fca390e7dd0d806cd87fa3570ce23ad132d8c852
add new example
examples/lineWithFocusChart.py
examples/lineWithFocusChart.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Examples for Python-nvd3 is a Python wrapper for NVD3 graph library. NVD3 is an attempt to build re-usable charts and chart components for d3.js without taking away the power that d3.js gives you. Project location : https://github.com/areski/python-nvd3 """ from nvd3 imp...
Python
0.000002
0114173d508298d6e9f72fd7f344d9123e4a7e59
Create wtospark.py
sparkgw/wtospark.py
sparkgw/wtospark.py
from flask import Flask, request, abort import json import urllib2 app = Flask(__name__) #Secret provided by # fbabottemp99 # MmQ3YTA0MGUtNGI1Zi00MTI3LTlmZTMtMjQxNGJhYmRjMTI0MzI2ZDFlYWYtYzhh # curl -X POST -H "X-Device-Secret: 12345" http://localhost:8080/report?temp=32 YOUR_DEVICE_SECRET = "12345" YOUR_BOT_TOKEN ...
Python
0
5432dd2ee2e1d20494d0b4cf8d816b298e70067c
Add test script.
protogeni/test/ma/lookup_keys.py
protogeni/test/ma/lookup_keys.py
#! /usr/bin/env python # # Copyright (c) 2012-2014 University of Utah and the Flux Group. # # {{{GENIPUBLIC-LICENSE # # GENI Public License # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and/or hardware specification (the "Work") to # deal in the Work without rest...
Python
0
d1edac38e3402ebe03f96597500c3d39e49f299d
add run_pylint.py
run_pylint.py
run_pylint.py
#!/usr/bin/python # # wrapper script for pylint which just shows the errors and changes the return value if there's problems # (enforcing a minscore and/or maxerrors - defaults to perfection) # import sys, re, subprocess, os MINSCORE = 10.0 MAXERRORS = 0 command = 'pylint --rcfile=pylintrc --disable=W0511,W9911,W...
Python
0.000011
a96c25cf46cd82716b397ba61c2b67acb8b7c2d7
Add code reading.
micro.py
micro.py
#!/usr/bin/env python from sys import argv def get_code(): return argv[1] if __name__ == '__main__': code = get_code() print(code)
Python
0
084ebff19703c42c50621eb94ac070c6a471e983
Solve the most wanted letter problem.
Home/mostWantedLetter.py
Home/mostWantedLetter.py
def checkio(word): word = word.lower() arr = dict() for i in range(len(word)): char = word[i] if not str.isalpha(char): continue if not arr.__contains__(char): arr[char] = 0 arr[char] = arr[char] + 1 result = "" counter = 0 for k, v in arr....
Python
0.999816
d437f494db827c69da7aaec00a5acf1d133e16b2
Add basic slash command example
examples/app_commands/basic.py
examples/app_commands/basic.py
from typing import Optional import discord from discord import app_commands MY_GUILD = discord.Object(id=0) # replace with your guild id class MyClient(discord.Client): def __init__(self, *, intents: discord.Intents, application_id: int): super().__init__(intents=intents, application_id=application_id)...
Python
0.009586
235a7107ca0c6d586edd9f224b9ee9132111a842
remove debug trace
toflib.py
toflib.py
import random from datetime import datetime, timedelta # those commands directly trigger cmd_* actions _simple_dispatch = set() # those commands directly trigger confcmd_* actions _simple_conf_dispatch = set() def cmd(expected_args): def deco(func): name = func.__name__[4:] _simple_dispatch.add(n...
import random from datetime import datetime # those commands directly trigger cmd_* actions _simple_dispatch = set() # those commands directly trigger confcmd_* actions _simple_conf_dispatch = set() def cmd(expected_args): def deco(func): name = func.__name__[4:] _simple_dispatch.add(name) ...
Python
0.000004
8fb4df5367b5c03d2851532063f6fa781fe2f980
Add Fibonacci Series Using Recursion
Maths/fibonacciSeries.py
Maths/fibonacciSeries.py
# Fibonacci Sequence Using Recursion def recur_fibo(n): if n <= 1: return n else: return(recur_fibo(n-1) + recur_fibo(n-2)) limit = int(input("How many terms to include in fionacci series:")) if limit <= 0: print("Plese enter a positive integer") else: print("Fibonacci series:") for ...
Python
0.000003
5f8e01f976d75eca651e29ebdd379c865aa5bda9
update merge_two_binary_trees_617
Python/merge_two_binary_trees_617.py
Python/merge_two_binary_trees_617.py
# Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. # You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. # Otherw...
Python
0.000004
8c6983656e550ebaf32ff714a3c22be276ba842b
Add ScribdDownloader.py
ScribdDownloader.py
ScribdDownloader.py
#Scribd Downloader #Adam Knuckey September 2015 print ("Starting Scribd Downloader") import os import re import urllib, urllib2 import threading from time import sleep def download(link,destination): #print link urllib.urlretrieve(link,destination) print("Enter textbook link:") website = raw_input(" > ") request =...
Python
0
97ae80b08958646e0c937f65a1b396171bf61e72
Add a proper unit test for xreload.py.
Lib/test/test_xreload.py
Lib/test/test_xreload.py
"""Doctests for module reloading. >>> from xreload import xreload >>> from test.test_xreload import make_mod >>> make_mod() >>> import x >>> C = x.C >>> Cfoo = C.foo >>> Cbar = C.bar >>> Cstomp = C.stomp >>> b = C() >>> bfoo = b.foo >>> b.foo() 42 >>> bfoo() 42 >>> Cfoo(b) 42 >>> Cbar() 42 42 >>> Cstomp() 42 42 42 >>>...
Python
0
53e851f68f106bff919a591a3516f26d5b07c375
add unit test case for FedMsgContext.send_message
fedmsg/tests/test_core.py
fedmsg/tests/test_core.py
import unittest import mock import warnings from fedmsg.core import FedMsgContext from common import load_config class TestCore(unittest.TestCase): def setUp(self): config = load_config() config['io_threads'] = 1 self.ctx = FedMsgContext(**config) def test_send_message(self): ...
Python
0.000002
aa38c6604476f1181903c688c0444ed87c9d75a1
Add engine tests.
simphony/engine/tests/test_engine_metadata.py
simphony/engine/tests/test_engine_metadata.py
"""Tests regarding loading engine's metadata.""" import sys import unittest import simphony.engine as engine_api from simphony.engine import ABCEngineExtension, EngineInterface from simphony.engine.extension import EngineManager, EngineManagerException from simphony.engine.extension import EngineFeatureMetadata, Engin...
Python
0
51d20a5e10e9cdfc38f8c18f8e98a03c5db99236
Create plot_daily_cycle.py
Python/plot_daily_cycle.py
Python/plot_daily_cycle.py
#plot_daily_cycle.py """plot the average daily cycle of your WRF output NOTE: we assume variables to have dimension [time,y,x] or [time,z,y,x] If this is not the case, adapt the dimensions where variable is read Author: Ingrid Super Last revisions: 3-6-2016""" import netCDF4 as nc import numpy as np import...
Python
0.001003
8483174f32801318d1cd8aa33abb04819b4a7810
Create usonic.py
usonic.py
usonic.py
#!/usr/bin/python # remember to change the GPIO values below to match your sensors # GPIO output = the pin that's connected to "Trig" on the sensor # GPIO input = the pin that's connected to "Echo" on the sensor def reading(sensor): import time import RPi.GPIO as GPIO # Disable any warning m...
Python
0
7a7d597c771ba8100957b5ca00156d7147c695c5
Add clear_db_es_contents tests
src/encoded/tests/test_clear_db_es_contents.py
src/encoded/tests/test_clear_db_es_contents.py
import pytest from encoded.commands.clear_db_es_contents import ( clear_db_tables, run_clear_db_es ) pytestmark = [pytest.mark.setone, pytest.mark.working] def test_clear_db_tables(app, testapp): # post an item and make sure it's there post_res = testapp.post_json('/testing-post-put-patch/', {'requir...
Python
0.000002
28677132dbcacd7d348262007256b3e2a9e44da2
add gate client module
server/Mars/Client/GateClient.py
server/Mars/Client/GateClient.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright (c) 2016 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.000003
36fdfa89230fd08b6c28501f3f277bff642e36e3
Create ipy_custom_action_button.py
pyside/pyside_basics/jamming/QAction/ipy_custom_action_button.py
pyside/pyside_basics/jamming/QAction/ipy_custom_action_button.py
from collections import OrderedDict from functools import partial from PySide import QtCore from PySide import QtGui ## class CustomAction(QtGui.QAction): def __init__(self, message, *args, **kwargs): super(CustomAction, self).__init__(*args, **kwargs) self.message = message self.triggere...
Python
0.000004
c4625a3ea98da282d9cd77acc13bba996e9fa676
Add refresh url param to dashboard page to allow on demand worker cache updates
flower/views/dashboard.py
flower/views/dashboard.py
from __future__ import absolute_import import logging from functools import partial try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict from tornado import web from tornado import gen from tornado import websocket from tornado.ioloop import PeriodicCallback from ...
from __future__ import absolute_import import logging from functools import partial try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict from tornado import web from tornado import websocket from tornado.ioloop import PeriodicCallback from ..views import BaseHandl...
Python
0
18f63b98bf7eefe3022dc4681e81ada9969d5228
Create guess-the-word.py
Python/guess-the-word.py
Python/guess-the-word.py
# Time: O(n^2) # Space: O(n) # This problem is an interactive problem new to the LeetCode platform. # # We are given a word list of unique words, each word is 6 letters long, # and one word in this list is chosen as secret. # # You may call master.guess(word) to guess a word. # The guessed word should have type strin...
Python
0.999864
803a2702a1330be1f51428f8d7533cfee27c3f90
Add facebook_test_user support.
facepy/test.py
facepy/test.py
import facepy class FacebookTestUser(object): def __init__(self, **kwargs): fields = ('id', 'access_token', 'login_url', 'email', 'password') for field in fields: setattr(self, field, kwargs[field]) self.graph = facepy.GraphAPI(self.access_token) class TestUserManager(object)...
Python
0
332f1fc67481432f6e8dd7cd9a35b02b12c9b6f6
Create numpy.py
numpy.py
numpy.py
# Best dimensions in each column of a matrix x. for i in range(x.shape[0]): dims = x[:,i].argsort()[-5:] vals = x[dims,i] print dims, vals
Python
0.000319
4d4904e69e030be3f2b0e30c957507626d58a50e
Teste nas listas
_Listas/sherlock.py
_Listas/sherlock.py
# Quem é o culpado perguntas = [] ct = 0 pt = 0 quest = input("Você telefonou a vitima: ") perguntas.append(quest) quest = input("Vocẽ esteve no local do crime: ") perguntas.append(quest) quest = input("Você mora perto da vitima? ") perguntas.append(quest) quest = input("Devia para a vitima? ") perguntas.append(ques...
Python
0.000002
f2d79da88bb84831e40cefc79fa3e1448a1bbaab
Add a Python script to help with various cleanups of 'properties'
fixup_trips.py
fixup_trips.py
""" // LineString // # Make sure at least 2 points """ import json def fixup(points, linestrings): return valid_linestrings(points, linestrings) def valid_linestrings(points, linestrings): """GeoJSON requires at least 2 sets of coordinates for a linestring.""" for line in linestrings: coords =...
Python
0
235bfc6db908b6701de77df11e00e89a307d738e
Create tinymongo.py
tinymongo/tinymongo.py
tinymongo/tinymongo.py
Python
0.000621
8ab8e8f5ca34cf524f76fe57f78d73546d2f6d09
Add make_otc_list.
tools/make_otc_list.py
tools/make_otc_list.py
# -*- coding: utf-8 -*- import csv import re import urllib2 from datetime import datetime NOW = datetime(2013, 12, 17) SAVEPATH = './otc_list.csv' TWSEURL = 'http://www.gretai.org.tw/ch/stock/aftertrading/otc_quotes_no1430/stk_wn1430_download.php?d=%(year)s/%(mon)s/%(day)s&se=%%s' % { 'year': NOW.year - 1911...
Python
0
b351e5106684b0af8b862bb6ba5375671c1f431d
include getcomments.py
getcomments.py
getcomments.py
import urllib2 import json import datetime import time import pytz import pandas as pd from pandas import DataFrame ts = str(int(time.time())) df = DataFrame() hitsPerPage = 1000 requested_keys = ["author", "comment_text", "created_at_i", "objectID", "points"] i = 0 while True: try: url = 'https://hn.algolia.com/...
Python
0.000001
74ecac2dbca41d737f62325955fd4d0dc393ac16
Rename flots.py to plots.py
plots.py
plots.py
import json import re class plot(object): def get_data(self,fn,col1,col2): y = '' for line in open(fn, 'rU'): # don't parse comments if re.search(r'#',line): continue x = line.split() if not re.search(r'[A-Za-z]{2,}\s+[A-Za-z]{2,}',line): ...
Python
0.999997
8136a1a584fe23b57f416e663f479142aafb7c89
implement expect column values valid ISBN13 code (#4668)
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_isbn13.py
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_isbn13.py
from typing import Optional from isbnlib import is_isbn13 from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.execution_engine import PandasExecutionEngine from great_expectations.expectations.expectation import ColumnMapExpectation from great_expectat...
Python
0.000004
f13da24b8fb4cf6d8fff91e88afb1507528c2c2a
Add `.ycm_extra_conf.py` for https://github.com/Valloric/ycmd
android/.ycm_extra_conf.py
android/.ycm_extra_conf.py
import os basePath = os.path.dirname(os.path.realpath(__file__)) def FlagsForFile(filename, **kwargs): return { 'flags': [ '-std=c++11', '-DFOLLY_NO_CONFIG=1', '-DFOLLY_USE_LIBCPP', '-I' + basePath + '/ReactAndroid/../ReactCommon/cxxreact/..', '-I' + basePath + '/ReactAndroid/../Re...
Python
0.000002
654f21b39a68aa461b6457199403e7d89781cc79
add migration
students/migrations/0010_auto_20161010_1345.py
students/migrations/0010_auto_20161010_1345.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-10 11:45 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('students', '0009_auto_20161005_1820'), ] operations = [ migrations.AlterFie...
Python
0.000001
b90b43ceefb78e1a94ba898ed23443567786cf25
Add /monitoring/status handler
app/monitoring/handlers.py
app/monitoring/handlers.py
from __future__ import unicode_literals, absolute_import, division import json from structlog import get_logger class StatusHandler: def __init__(self): self.logger = get_logger() def on_get(self, req, res): """ @type req: falcon.request.Request @type res: falcon.response.Res...
Python
0.000002
95c71727bf340f55e17a15d475aba54438eb0b8e
add solution for Partition List
src/partitionList.py
src/partitionList.py
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @param x, an integer # @return a ListNode def partition(self, head, x): head1, head2 = ListNode(0), ListNode(0) ...
Python
0
5bff284204a1397dbc63e83363d865213a35efe6
add a new test file test_begin_end.py
tests/unit/selection/modules/test_begin_end.py
tests/unit/selection/modules/test_begin_end.py
# Tai Sakuma <tai.sakuma@gmail.com> import pytest try: import unittest.mock as mock except ImportError: import mock from alphatwirl.selection.modules import Not, NotwCount ##__________________________________________________________________|| not_classes = [Not, NotwCount] not_classe_ids = [c.__name__ for c ...
Python
0.000016
7655fe94decf2fc9c3a07104f8fa76cf39442ddb
implement rectified drive
rectifieddrive.py
rectifieddrive.py
import navx import subsystems class RectifiedDrive: """ This class implemented the rectifiedDrive function, which sets the motor outputs given a desired power and angular velocity using the NavX and a PID controller. """ def __init__(self, kp, ki, kd, period=0.05): self.kp = kp se...
Python
0.000001
dd1d0893823561efec203cdfbb927b8edac7a72a
Add a coupld tests to create exception classes from error code names
tests/unit/beanstalk/test_exception.py
tests/unit/beanstalk/test_exception.py
# Copyright (c) 2014 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 limitation the rights...
Python
0
de38b3e7b3d8458920b913316b06bb10b886df9f
Implement ArgumentSelector for overload disambiguation
thinglang/symbols/argument_selector.py
thinglang/symbols/argument_selector.py
import collections import copy from thinglang.compiler.errors import NoMatchingOverload from thinglang.lexer.values.identifier import Identifier SymbolOption = collections.namedtuple('SymbolOption', ['symbol', 'remaining_arguments']) class ArgumentSelector(object): """ Aids in disambiguating overloaded meth...
Python
0
609bd2a0712ee488dd76bb3619aef70343adb304
add test__doctests.py
greentest/test__doctests.py
greentest/test__doctests.py
import os import re import doctest import unittest import eventlet base = os.path.dirname(eventlet.__file__) modules = set() for path, dirs, files in os.walk(base): package = 'eventlet' + path.replace(base, '').replace('/', '.') modules.add((package, os.path.join(path, '__init__.py'))) for f in files: ...
Python
0.000009
2885adb781ba5179e0dcc7645644bcb182e7bfe7
Create hacks/eKoomerce/__init__.py
hacks/eKoomerce/__init__.py
hacks/eKoomerce/__init__.py
import bs4
Python
0.000004
d9cce6f06503f1527d56d40d3037f46344c517d4
Add PerUserData utility.
src/librement/utils/user_data.py
src/librement/utils/user_data.py
from django.db import models from django.db.models.signals import post_save, pre_delete from django.contrib.auth.models import User def PerUserData(related_name=None): """ Class factory that returns an abstract model attached to a ``User`` object that creates and destroys concrete child instances where req...
Python
0
e58d30a64ae2ce2962dbaaf119e5e4c4ee33e4e7
Create pub.py
cloud/mqtt_server/pub.py
cloud/mqtt_server/pub.py
#!/usr/bin/env python import asyncio from hbmqtt.client import MQTTClient from hbmqtt.mqtt.constants import QOS_0, QOS_1, QOS_2 async def publish_test(): try: C = MQTTClient() ret = await C.connect('mqtt://192.168.0.4:1883/') message = await C.publish('server', 'MESSAGE-QOS_0'.encode(), qos=QOS_0) m...
Python
0.000001
8551c56a9fea5d21ea9dc6761eff8e93d451f6b3
Add pip setup.py
setup.py
setup.py
"""Setup script for gin-config. See: https://github.com/google/gin-config """ import codecs from os import path from setuptools import find_packages from setuptools import setup here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with codecs.open(path.join(here, 'README.md'...
Python
0.000002
379c5e73d767753142a62ba57f5928acf754b508
Add simple setup.py for ease of system-installing
setup.py
setup.py
from setuptools import setup, find_packages setup( name="crow2", version="0.1.dev0", packages=find_packages(), scripts=["bin/crow2"], install_requires=["twisted", "zope.interface"] )
Python
0
c2d14b8c3beaee3cff498fc02106751fce8e8e1c
Add setup.py
setup.py
setup.py
import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand import pb2df class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] def initialize_options(self): TestCommand.initialize_options(self) sel...
Python
0.000001
a7bf54f417576bfc355e1851258e711dadd73ad3
Add python trove classifiers
setup.py
setup.py
from setuptools import setup, find_packages from taggit import VERSION f = open('README.rst') readme = f.read() f.close() setup( name='django-taggit', version=".".join(map(str, VERSION)), description='django-taggit is a reusable Django application for simple tagging.', long_description=readme, a...
from setuptools import setup, find_packages from taggit import VERSION f = open('README.rst') readme = f.read() f.close() setup( name='django-taggit', version=".".join(map(str, VERSION)), description='django-taggit is a reusable Django application for simple tagging.', long_description=readme, a...
Python
0.000327
2b1146a1741262a9c5acec9a56dfa3e45202f1df
set version 1.0
setup.py
setup.py
from setuptools import setup, find_packages setup( name='aleph', version='1.0', description="Document sifting web frontend", long_description="", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Operating System :: OS Independent", ...
from setuptools import setup, find_packages setup( name='aleph', version='0.2', description="Document sifting web frontend", long_description="", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Operating System :: OS Independent", ...
Python
0.000002
733289636661f3c0034a66eaa8763058ef43796d
update setup.py
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup from codecs import open setup(name='Open-Tamil', version='0.1-dev', description='Tamil language text processing tools', author='Muthiah Annamalai', author_email='ezhillang@gmail.com', url='https://github.com/arcturusannamalai/open-ta...
#!/usr/bin/env python from distutils.core import setup from codecs import open setup(name='Open Tamil', version='0.1-dev', description='Tamil language text processing tools', author='Muthiah Annamalai', author_email='ezhillang@gmail.com', url='https://github.com/arcturusannamalai/open-ta...
Python
0.000001
231d050fe611adb201cd7ae55f52212d0b84caa1
Check for pandoc. add pyandoc to setup_requires
setup.py
setup.py
from setuptools import setup, find_packages, Command from setuptools.command.build_py import build_py as _build_py from distutils.spawn import find_executable import os.path import imp import pandoc.core pandoc.core.PANDOC_PATH = find_executable('pandoc') assert pandoc.core.PANDOC_PATH is not None, \ "'pandoc' is...
from setuptools import setup, find_packages, Command from setuptools.command.build_py import build_py as _build_py from distutils.spawn import find_executable import os.path import imp import pandoc.core pandoc.core.PANDOC_PATH = find_executable('pandoc') ROOT = os.path.abspath(os.path.dirname(__file__)) def read(fn...
Python
0
5a16ada916d719a0499d75bc5c82aaa5228dec15
Split off IP/hostname munging to addr_util
libnamebench/addr_util.py
libnamebench/addr_util.py
# Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
0.000005
e458733b0aa1cbb142fc6818ae1f7cf84bef6518
Add setup
setup.py
setup.py
import setuptools if __name__ == "__main__": setuptools.setup( name='friendly_computing_machine', version="0.1.1", description='A starting template for Python programs', author='CHENXI CAI', author_email='ccai28@emory.edu', url="https://github.com/xiaohaiguicc/friend...
Python
0.000001
bc17ea522b0120ec7308ba0309d87b18ba9163d9
Add setup.py
setup.py
setup.py
import sys from setuptools import setup setup( name='pingdombackup', version="0.1.0", description='Backup Pingdom logs', long_description='Backup Pingdom result logs to a SQLite database.', author='Joel Verhagen', author_email='joel.verhagen@gmail.com', install_requires=['requests>=2.1.0'],...
Python
0.000001
1dd8a34cba565f70a30a6c8ab4604a489377e752
Add template remove script
src/utils/remove_templates.py
src/utils/remove_templates.py
def remove_templates(text): """Remove all text contained between '{{' and '}}', even in the case of nested templates. Args: text (str): Full text of a Wikipedia article as a single string. Returns: str: The full text with all templates removed. """ start_char = 0 while '{{...
Python
0
ad714cbf92d2984c9cc855e99e31bf622c38a220
add setup file
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup( name = 's7n-menu', version = "1a1", packages = ['s7n', 's7n.menu'], )
Python
0.000001
ff147838ce320c97c34e00be4dafb63b6d0603fc
Add setup.py
setup.py
setup.py
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path import sys here...
Python
0.000001
e9832b7b3bb028170562cacde3dbb52f13adba85
Set version number
setup.py
setup.py
#!/usr/bin/env python # # Copyright (C) 2007 SIOS Technology, Inc. # Copyright (C) 2011 Umea Universitet, Sweden # # 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...
#!/usr/bin/env python # # Copyright (C) 2007 SIOS Technology, Inc. # Copyright (C) 2011 Umea Universitet, Sweden # # 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...
Python
0.000032
73d9b80d6fa1cf75dba73e396d1f5d3bd4963df6
Create setup.py
setup.py
setup.py
from distutils.core import setup setup( name = 'wthen', packages = ['wthen'], # this must be the same as the name above version = '0.1', description = 'A simple rule engine with YAML format', author = 'Alex Yu', author_email = 'mltest2000@aliyun.com', url = 'https://github.com/sevenbigcat/wthen', # use th...
Python
0.000001
62e126908e08544f8595be368d300b0abaca82d3
support old setuptools versions
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys try: from setuptools import setup except ImportError: from distutils.core import setup # Get the version version_regex = r'__version__ = ["\']([^"\']*)["\']' with open('h2/__init__.py', 'r') as f: text = f.read() match = re.s...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys try: from setuptools import setup except ImportError: from distutils.core import setup # Get the version version_regex = r'__version__ = ["\']([^"\']*)["\']' with open('h2/__init__.py', 'r') as f: text = f.read() match = re.s...
Python
0
1e038b40cfb61f15fb69cdf4207a739e2ebe0060
add tests for scylla-sstable's dump commands
test/cql-pytest/test_tools.py
test/cql-pytest/test_tools.py
# Copyright 2022-present ScyllaDB # # SPDX-License-Identifier: AGPL-3.0-or-later ############################################################################# # Tests for the tools hosted by scylla ############################################################################# import glob import json import nodetool im...
Python
0.00038
4d16ae6d1ad8b308c14c23e802349001b81ae461
Add Python-based opcode enum parser
thinglang/compiler/opcodes.py
thinglang/compiler/opcodes.py
import os import re BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ENUM_PARSER = re.compile(r'(.*)\s*?=\s*?(\d+)') def read_opcodes(): with open(os.path.join(BASE_DIR, '..', '..', 'thingc', 'execution', 'Opcode.h')) as f: for line in f: if 'enum class Opcode' in line: b...
Python
0.001332
ac823e61fd214f9818bb7a893a8ed52a3bfa3af4
Add utils for graph visualization.
neurokernel/conn_utils.py
neurokernel/conn_utils.py
#!/usr/bin/env python import itertools import os import tempfile import conn import matplotlib.pyplot as plt import networkx as nx def imdisp(f): """ Display the specified image file using matplotlib. """ im = plt.imread(f) plt.imshow(im) plt.axis('off') plt.draw() return im def...
Python
0
e663394d1dc4de7b8e3a877f0c9870a804e804f2
Make tests runnable from lifelines.tests
lifelines/tests/__main__.py
lifelines/tests/__main__.py
import unittest from . import test_suite if __name__ == '__main__': unittest.main(module=test_suite)
Python
0.00001
525a8438bd601592c4f878ca5d42d3dab8943be0
Test that specific Failures are caught before parent Failures
ooni/tests/test_errors.py
ooni/tests/test_errors.py
from twisted.trial import unittest import ooni.errors class TestErrors(unittest.TestCase): def test_catch_child_failures_before_parent_failures(self): """ Verify that more specific Failures are caught first by handleAllFailures() and failureToString(). Fails if a subclass is list...
Python
0.000001
90d079928eaf48e370d21417e4d6e649ec0f5f6f
Update tasks and evaluate viewports on saving
taskwiki/taskwiki.py
taskwiki/taskwiki.py
import sys import re import vim from tasklib.task import TaskWarrior, Task # Insert the taskwiki on the python path sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki') from regexp import * from task import VimwikiTask from cache import TaskCache """ How this plugin works: 1.) On startup, it reads all t...
import sys import re import vim from tasklib.task import TaskWarrior, Task # Insert the taskwiki on the python path sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki') from regexp import * from task import VimwikiTask from cache import TaskCache """ How this plugin works: 1.) On startup, it reads all t...
Python
0
f2e9f2adbc81a37847bbe27401dd852317243486
add a test for the session tables
test/sessionstest.py
test/sessionstest.py
#!/usr/bin/python2.4 # # Copyright (c) 2004-2005 rpath, Inc. # import time import testsuite testsuite.setup() import sqlite3 import rephelp from mint_rephelp import MintRepositoryHelper from mint import dbversion from mint import sessiondb class SessionTest(MintRepositoryHelper): def testSessions(self): ...
Python
0
ddbfc403034c1ed98590088889687ff23f222aab
add package
var/spack/packages/paraview/package.py
var/spack/packages/paraview/package.py
from spack import * class Paraview(Package): homepage = 'http://www.paraview.org' url = 'http://www.paraview.org/files/v4.4/ParaView-v4.4.0-source.tar.gz' version('4.4.0', 'fa1569857dd680ebb4d7ff89c2227378', url='http://www.paraview.org/files/v4.4/ParaView-v4.4.0-source.tar.gz') variant('python'...
Python
0
eb71a3d3319480b3f99cb44f934a51bfb1b5bd67
Add abstract class for HAP channels
pyatv/auth/hap_channel.py
pyatv/auth/hap_channel.py
"""Base class for HAP based channels (connections).""" from abc import ABC, abstractmethod import asyncio import logging from typing import Callable, Tuple, cast from pyatv.auth.hap_pairing import PairVerifyProcedure from pyatv.auth.hap_session import HAPSession from pyatv.support import log_binary _LOGGER = logging....
Python
0
079ff9e471c4ad60f03e87929f0c7c44e239ddf2
Add timer class and checkpoint class
pycqed/utilities/timer.py
pycqed/utilities/timer.py
import numpy as np import datetime as dt import logging from collections import OrderedDict from pycqed.measurement.hdf5_data import write_dict_to_hdf5 log = logging.getLogger(__name__) import functools class Timer(OrderedDict): HDF_GRP_NAME = "Timers" NAME_CKPT_START = "start" NAME_CKPT_END = "end" ...
Python
0
5fa7514d9cf6bed319adb5f63b07c29feb5e29ea
add hex.cmdline.py3.py
python/hex.cmdline.py3.py
python/hex.cmdline.py3.py
#!/usr/bin/env python3 # Copyright (c) 2014 Tristan Cavelier <t.cavelier@free.fr> # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as p...
Python
0.000004
0089de0eccae27bf4cd5a2f9166e8418d64171c3
Create XOR.py
XOR.py
XOR.py
''' Implement XOR operation ''' def XOR(a,b): result = 0 power = 1 while a>0 or b>0: m = a%2 n = b%2 if m+n==1: result = result+power power *=2 a = a/2 b = b/2 return result if __name__=='__main__': a = 123 b = 230 p...
Python
0.000027
bd01797f18012927202b87872dc33caf685306c0
Add GDB plugin for printing ABC values
gdb.py
gdb.py
deadbeef = 0xdeadbeefdeadbeef abc_any = gdb.lookup_type("union any") def color(s, c): return "\x1b[" + str(c) + "m" + s + "\x1b[0m" def gray(s): return color(s, 90) def red(s): return color(s, "1;31") def p(indent, tag, value): print(" " * indent + tag + ": " + str(value)) def print_abc(i, v): ...
Python
0
2d320058c96f88348d8226fa4a827a6c2c973237
Add Classical multidimensional scaling algorithm.
mds.py
mds.py
""" Simple implementation of classical MDS. See http://www.stat.cmu.edu/~ryantibs/datamining/lectures/09-dim3-marked.pdf for more details. """ import numpy as np import numpy.linalg as linalg import matplotlib.pyplot as plt def square_points(size): nsensors = size**2 return np.array([(i/size, i%size) for i in range...
Python
0.000001
fe128c1172070476ba09536bbbbe81c69a46ef57
fix bgp reggression
ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py
ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py
import six class RouteFormatterMixin(object): fmtstr = ' {0:<3s} {1:<32s} {2:<8s} {3:<20s} {4:<15s} '\ '{5:<6s} {6:<6s} {7:<}\n' @classmethod def _format_family_header(cls): ret = '' ret += ('Status codes: * valid, > best\n') ret += ('Origin codes: i - IGP, e - EGP, ? - i...
import io class RouteFormatterMixin(object): fmtstr = ' {0:<3s} {1:<32s} {2:<8s} {3:<20s} {4:<15s} '\ '{5:<6s} {6:<6s} {7:<}\n' @classmethod def _format_family_header(cls): ret = '' ret += ('Status codes: * valid, > best\n') ret += ('Origin codes: i - IGP, e - EGP, ? - in...
Python
0
a78d879c9c097c32c58f5246d46a4a188b17d99c
Add workup vebose name change migration.
workup/migrations/0002_add_verbose_names.py
workup/migrations/0002_add_verbose_names.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('workup', '0001_initial'), ] operations = [ migrations.AlterField( model_name='historicalworkup', nam...
Python
0
d4a87c2131c02b3638743167ce32c779ece14fd5
Create crawlerino.py
crawlerino.py
crawlerino.py
"""Simple web crawler, to be extended for various uses. Written in Python 3, uses requests and BeautifulSoup modules. """ def crawler(startpage, maxpages=100, singledomain=True): """Crawl the web starting from specified page. 1st parameter = starting page url maxpages = maximum number of pages to crawl ...
Python
0.000005
91facfcc42e001e2a598d6d06e55270ef9239b1d
add migration
actstream/migrations/0006_auto_20170329_2048.py
actstream/migrations/0006_auto_20170329_2048.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-29 20:48 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('actstream', '0005_auto_20161119_2211'), ] operations = [ migrations.AddFiel...
Python
0.000001
1e050f30e8307a75976a52b8f1258a5b14e43733
Add middleware for static serving
wsgi_static.py
wsgi_static.py
import wsgi_server import os from werkzeug.wsgi import SharedDataMiddleware application = SharedDataMiddleware(wsgi_server.application, { '/static': os.path.join(os.path.dirname(__file__), 'static') })
Python
0.000001
a086307e6aac341ed8a6596d0a05b7a8d198c7ec
Add command to dump and restore user pointers.
zephyr/management/commands/dump_pointers.py
zephyr/management/commands/dump_pointers.py
from optparse import make_option from django.core.management.base import BaseCommand from zephyr.models import Realm, UserProfile import simplejson def dump(): pointers = [] for u in UserProfile.objects.select_related("user__email").all(): pointers.append((u.user.email, u.pointer)) file("dumped-poi...
Python
0
769abf579f7bd082f7c6f4295edb49b41b252bce
Add empty alembic revision
alembic/versions/4784a128a6dd_empty_revision.py
alembic/versions/4784a128a6dd_empty_revision.py
"""Empty revision This is the empty revision that can be used as the base for future migrations. Initial database creation shall be done via `metadata.create_all()` and `alembic stamp head`. Revision ID: 4784a128a6dd Revises: Create Date: 2017-12-13 00:48:12.079431 """ from alembic import op import sqlalchemy as s...
Python
0.000003
4bf84b05b183916fd211f77ab8099ef14c9cec06
Update migrations
app/timetables/migrations/0003_auto_20171107_1103.py
app/timetables/migrations/0003_auto_20171107_1103.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-11-07 11:03 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timetables', '0002_auto_20171005_2209'), ] operations = [ migrations.AlterFie...
Python
0.000001
74135b8289fa4b6684c54d8c9e37671c75b92447
add admin for area settings
adhocracy4/maps/admin.py
adhocracy4/maps/admin.py
from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from . import models @admin.register(models.AreaSettings) class AreaSettingsAdmin(admin.ModelAdmin): list_filter = ('module__project__organisation', 'module__project') list_display = ('module',) fieldsets = ( ...
Python
0
2dce9ed68463b536f246f01b2ac5cb275df2453b
add polynomial
regression.py
regression.py
# coding: utf8 from datetime import datetime import itertools import matplotlib.pyplot as plt import numpy as np from sklearn.preprocessing import PolynomialFeatures, Imputer from sklearn.pipeline import make_pipeline from sklearn.linear_model import Ridge, BayesianRidge from utils import * data_accidents = load_data_...
Python
0.999999
5982e1c875827569a02e9ecbe20d2a59392baf0c
move client to amcat repo for now
amcat/nlp/vunlpclient.py
amcat/nlp/vunlpclient.py
########################################################################### # (C) Vrije Universiteit, Amsterdam (the Netherlands) # # # # This file is part of vunlp, the VU University NLP e-lab # # ...
Python
0
eb91b11930319369bc9cfc3b1b15c0b92fb4d85c
Add `OrganizationOption` tests based on `ProjectOption`.
tests/sentry/models/test_organizationoption.py
tests/sentry/models/test_organizationoption.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from sentry.models import OrganizationOption from sentry.testutils import TestCase class OrganizationOptionManagerTest(TestCase): def test_set_value(self): OrganizationOption.objects.set_value(self.organization, 'foo', 'bar') assert ...
Python
0
f264f8804c208f2b55471f27f92a9e8c1ab5d778
Test our new happenings-by-year view.
tests/correlations/test_views.py
tests/correlations/test_views.py
# -*- coding: utf-8 -*- import datetime import pytest from django.core.urlresolvers import reverse from components.people.factories import GroupFactory, IdolFactory @pytest.mark.django_db def test_happenings_by_year_view(client): [GroupFactory(started=datetime.date(2013, 1, 1)) for i in xrange(5)] response ...
Python
0
43c4595ae26a7663538e712af37553c7a64fade7
Add a couple unit tests for teuthology.parallel
teuthology/test/test_parallel.py
teuthology/test/test_parallel.py
from ..parallel import parallel def identity(item, input_set=None, remove=False): if input_set is not None: assert item in input_set if remove: input_set.remove(item) return item class TestParallel(object): def test_basic(self): in_set = set(range(10)) with pa...
Python
0
f370ee48c8aec312f9ea8a9ce1737214e51e2eaf
Disable repaint.key_mobile_sites_repaint.
tools/perf/benchmarks/repaint.py
tools/perf/benchmarks/repaint.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from core import perf_benchmark from benchmarks import silk_flags from measurements import smoothness from telemetry import benchmark import page_sets cla...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from core import perf_benchmark from benchmarks import silk_flags from measurements import smoothness from telemetry import benchmark import page_sets cla...
Python
0.000002
3d523bca7377c0f4c80a4f697b0c41d340eb8200
add a command to clear the celery queue
crate_project/apps/crate/management/clear_celery.py
crate_project/apps/crate/management/clear_celery.py
import redis from django.conf import settings from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): r = redis.StrictRedis(host=settings.GONDOR_REDIS_HOST, port=settings.GONDOR_REDIS_PORT, password=settings.GONDOR_REDIS_PASSWORD) r.del...
Python
0.000001
33e7216ae9b367c509b5075496fce08d346743e2
Implement channel limit
txircd/modules/rfc/cmode_l.py
txircd/modules/rfc/cmode_l.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType from zope.interface import implements class LimitMode(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "Lim...
Python
0.000001
fc03641455ce005c340bdd0baf2463a7db41ba8f
test with captured packet from chrome
test/b.py
test/b.py
from spdy.connection import Connection, SERVER b = b'\x80\x02\x00\x01\x01\x00\x01\x0e\x00\x00\x00\x01\x00\x00\x00\x00\x00\x008\xea\xdf\xa2Q\xb2b\xe0b`\x83\xa4\x17\x06{\xb8\x0bu0,\xd6\xae@\x17\xcd\xcd\xb1.\xb45\xd0\xb3\xd4\xd1\xd2\xd7\x02\xb3,\x18\xf8Ps,\x83\x9cg\xb0?\xd4=:`\x07\x81\xd5\x99\xeb@\xd4\x1b3\xf0\xa3\xe5i\x...
Python
0
ddc9a02ba64c24f8243bc299cd898bd337e5ce9a
isscalar predicate
datashape/predicates.py
datashape/predicates.py
from .util import collect, dshape from .internal_utils import remove from .coretypes import * # https://github.com/ContinuumIO/datashape/blob/master/docs/source/types.rst __all__ = ['isdimension', 'ishomogeneous', 'istabular', 'isfixed'] dimension_types = (Fixed, Var, Ellipsis) isunit = lambda x: isinstance(x, Unit...
from .util import collect, dshape from .internal_utils import remove from .coretypes import * # https://github.com/ContinuumIO/datashape/blob/master/docs/source/types.rst __all__ = ['isdimension', 'ishomogeneous', 'istabular', 'isfixed'] dimension_types = (Fixed, Var, Ellipsis) isunit = lambda x: isinstance(x, Unit...
Python
0.999798
7c24ffe52fe96339d14f522dc7c67122d01cead6
add istabular predicate
datashape/predicates.py
datashape/predicates.py
from .util import collect, remove, dshape from .coretypes import * # https://github.com/ContinuumIO/datashape/blob/master/docs/source/types.rst dimension_types = (Fixed, Var, Ellipsis) isunit = lambda x: isinstance(x, Unit) def isdimension(ds): """ Is a component a dimension? >>> isdimension(Fixed(10)) ...
from .util import collect, remove, dshape from .coretypes import * # https://github.com/ContinuumIO/datashape/blob/master/docs/source/types.rst dimension_types = (Fixed, Var, Ellipsis) isunit = lambda x: isinstance(x, Unit) def isdimension(ds): """ Is a component a dimension? >>> isdimension(Fixed(10)) ...
Python
0.999995
3406467f3d17621d436fc05d8820e21b7399a241
add simple depth frame network benchmark
scripts/depth_client.py
scripts/depth_client.py
#!/usr/bin/env python """ Simple benchmark of how fast depth frames are delivered. """ import logging import threading import time from tornado.ioloop import IOLoop, PeriodicCallback from streamkinect2.server import ServerBrowser from streamkinect2.client import Client # Install the zmq ioloop from zmq.eventloop imp...
Python
0
9dd20f8361cff99329a5ab4b526e29edddac9a61
add session.py
session.py
session.py
#!/usr/bin/python #A quick and dirty interface to end a session # This assumes systemd and xinitrc (for logout) #By Charles Bos from tkinter import * import os import sys def getWm() : args = sys.argv if len(args) == 1 : return "-u $USER" else : return args[1] def runAction() : if option.get() == 1 ...
Python
0.000001
c43d929f9ee2f21a7e93986171307cd0f17fa96c
add unittests of helpers
tests/test_helper.py
tests/test_helper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from types import BuiltinFunctionType from clime.helper import * class TestClimeHelper(unittest.TestCase): def test_autotype(self): cases = ('string', '100', '100.0', None) answers = ('string', 100 , 100.0 , None) for case,...
Python
0
dd8496c61543b3e39c5ee3ccb8bc7b9f69e9487f
add tests for packet
tests/test_packet.py
tests/test_packet.py
from zope.interface.verify import verifyClass, verifyObject from ironman.packet import IPBusPacket from ironman.interfaces import IIPbusPacket def test_ipbus_packet_create(): obj = IPBusPacket() assert obj is not None def test_ipbus_packet_class_iface(): # Assure the class implements the declared interfac...
Python
0.000001
a6e4516f4cae0d42e1b7ccf30b34d25837a5123a
add tableTemplateClass (for IE)
src/ObjectModel/tableTemplateClass.py
src/ObjectModel/tableTemplateClass.py
# -*- coding: utf-8 -*- """ Table Template Hervé Déjean cpy Xerox 2017 READ project """ from templateClass import templateClass import numpy as np from ObjectModel.XMLDSTABLEClass import XMLDSTABLEClass class tableTemplateClass(templateClass): """ ...
Python
0
b2aace3212f51ac7db83281903e6282849a58adb
add portmanteau finder
portmanteau.py
portmanteau.py
""" Let's find pairs of words that blend nicely, like book + hookup --> bookup Strategy: given a wordlist, first remove generative affixes like un- and -ly. Find all reasonably-long substrings of every word. Match suffixes of candidate first words with midparts of candidate second words. TODO: get better at stripping...
Python
0.000679