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
29aa26f553633fbe4a5ae37721e1da0ecca4139c
Create MyaiBot-Pictures.py
home/moz4r/MyaiBot-Pictures.py
home/moz4r/MyaiBot-Pictures.py
#PICTURE FIND AND DISPLAY BOT #LONK AT http://www.myai.cloud/ #FOR SERVER NAME AND BOT STATUS #IT S A SMALL COMPUTER FOR NOW SORRY IF PROBLEMS from java.lang import String import random import threading import itertools http = Runtime.createAndStart("http","HttpClient") Runtime.createAndStart("chatBot", "ProgramAB") R...
Python
0
147374971ad21406d61beb1512b5a702298fc3dc
add a generic seach module (relies on sqlalchemy)
cartoweb/plugins/search.py
cartoweb/plugins/search.py
from sqlalchemy.sql import select from sqlalchemy.sql import and_ from sqlalchemy.sql import func from shapely.geometry.point import Point from shapely.geometry.polygon import Polygon class Search: EPSG = 4326 UNITS = 'degrees' def __init__(self, idColumn, geomColumn, epsg=EPSG, units=UNITS): sel...
Python
0.000001
97ee2cd748c73196099adc888ea9c5575451f0ed
Add skeleton for JunebugBackend
casepro/backend/junebug.py
casepro/backend/junebug.py
from . import BaseBackend class JunebugBackend(BaseBackend): ''' Junebug instance as a backend. ''' def pull_contacts( self, org, modified_after, modified_before, progress_callback=None): """ Pulls contacts modified in the given time window :param org:...
Python
0.000001
6078617684edbc7f264cfe08d60f7c3d24d2898f
add test for handle_conversation_before_save
plugin/test/test_handle_conversation_before_save.py
plugin/test/test_handle_conversation_before_save.py
import unittest import copy from unittest.mock import Mock import chat_plugin from chat_plugin import handle_conversation_before_save class TestHandleConversationBeforeSave(unittest.TestCase): def setUp(self): self.conn = None chat_plugin.current_user_id = Mock(return_value="user1") def rec...
Python
0.000001
943e162eee203f05b5a2d5b19bcb4a9c371cc93b
Add new script to get comet velocity from kymograph
plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py
plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py
# @Float(label="Time Interval (s)", value=1) dt # @Float(label="Pixel Length (um)", value=1) pixel_length # @Boolean(label="Do you want to save results files ?", required=False) save_results # @Boolean(label="Do you want to save ROI files ?", required=False) save_roi # @ImageJ ij # @ImagePlus img # @Dataset data # @Sta...
Python
0
9934db8d079cf283f177daa55cb9e21e3f12dae2
add sunburst graph python module
sbgraph.py
sbgraph.py
#!/usr/bin/python import sys import re stack_traces = [] stack_trace = [] stack_samples = [] def stack_sample_to_dict(sample): ret = {} if len(sample['stack_trace']) == 1: ret['name'] = sample['stack_trace'][0] ret['size'] = sample['count'] return ret ret['name'] = sample['stac...
Python
0.000001
c426c773ee36d2872f79ff01d3bed615245e61b3
add nbconvert.utils.pandoc
IPython/nbconvert/utils/pandoc.py
IPython/nbconvert/utils/pandoc.py
"""Utility for calling pandoc""" #----------------------------------------------------------------------------- # Copyright (c) 2013 the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #--------------...
Python
0
5b951c91a7d054958d819bf19f97a5b33e21ff2d
add in some forms
lib/buyers/forms.py
lib/buyers/forms.py
from django import forms from .models import Buyer class BuyerValidation(forms.ModelForm): class Meta: model = Buyer class PreapprovalValidation(forms.Form): start = forms.DateField() end = forms.DateField() return_url = forms.URLField() cancel_url = forms.URLField()
Python
0.000001
4d47d14e2f630652c36765abf5907d6800a8012d
Revert "Revert "Initial python to find public APIs in Hadoop and compare them to outp…"" (#73) (cherry picked from commit a24236206b35744835781d42ff1dededbc685721)
bigtop-tests/spec-tests/runtime/src/test/python/find-public-apis.py
bigtop-tests/spec-tests/runtime/src/test/python/find-public-apis.py
#!/usr/bin/python ''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); yo...
Python
0
e63d18f9ef70e7a42344cf13322676efa2226fa2
Create largest_rectangle_in_histogram.py
largest_rectangle_in_histogram.py
largest_rectangle_in_histogram.py
""" https://www.youtube.com/watch?v=VNbkzsnllsU """ def largest_rectangle_in_histogram(histogram): "Return area of largest rectangle under histogram." assert all(height >= 0 for height in histogram) # Use stacks to keep track of how long a rectangle of height h # extends to the right. largest = ...
Python
0.001693
f2854aff3dde6439d990f8fd7d69e70dd4664b93
Add tags app admin
opps/core/tags/admin.py
opps/core/tags/admin.py
# -*- encoding: utf-8 -*- from django.contrib import admin from .models import Tag class TagAdmin(admin.ModelAdmin): list_display = ('name', 'date_insert') search_fields = ('name',) prepopulated_fields = {"slug": ["name"]} fieldsets = [(None, {'fields': ('name', 'slug',)})] class Meta: ...
Python
0.000001
c3d37914777ee9e2356bfa691361351423b0615a
make a nova server instance return it's host's hostname
heat/network_aware_resources.py
heat/network_aware_resources.py
from heat.engine.resources.openstack.nova.server import Server as NovaServer from oslo_log import log as logging import traceback LOG = logging.getLogger(__name__) class NetworkAwareServer(NovaServer): OS_EXT_HOST_KEY = 'OS-EXT-SRV-ATTR:host' def get_attribute(self, key, *path): if key == "host": ...
Python
0.000015
425363751244d5ff75e61126fd1481094c941129
Create luhn.py for pypi package
luhn/luhn.py
luhn/luhn.py
#!/usr/bin/env python3 # Python 3.4 Implementation of the Luhn Algorithm # Checks to see if 14, 15 or 16 digit account number is Luhn Compliant. # See https://en.wikipedia.org/wiki/Luhn_algorithm for formula details. # This file is suitable for unittest testing # CardNumber is an account number (for example) recei...
Python
0
be271f41103efdc26aadbc2cf3e39446bf2a05bc
Define Application class.
taxe/__init__.py
taxe/__init__.py
# -*- coding: utf-8 -*- from functools import wraps from werkzeug.wrappers import Request, Response class Application(object): def route(self, url): def deco(function): @wraps(function) def _(*args, **kwargs): print self, url return function(*args, ...
Python
0
70f8a7d9d38814039ec548141829afe6f9470fa0
Copy from https://github.com/agaricusb/MinecraftRemapping/blob/606a37541b91bfbf0705b1592df17fafffb60f27/mapbranch.py
python/mapbranch.py
python/mapbranch.py
#!/usr/bin/python # Remap each CraftBukkit commit import subprocess import os import shutil import xml.dom.minidom srcRoot = "../CraftBukkit" # original source scriptDir = "../Srg2Source/python" # relative to srcRoot outDir = "/tmp/MCPBukkit" # remapped source output srcComponent = "src" ...
Python
0
d0c7dfad3e7769b6f89828733414a4a68677696a
Create UnorderedList.py
Python/GenPythonProblems/UnorderedList.py
Python/GenPythonProblems/UnorderedList.py
## http://interactivepython.org/runestone/static/pythonds/BasicDS/ImplementinganUnorderedListLinkedLists.html class Node: def __init__(self,initdata): self.data = initdata self.next = None def getData(self): return self.data def getNext(self): return self.next def setD...
Python
0
5a3521fa547c46b0d7592b054dbb1bdb301d7257
Create phjCalculateBinomialProportions.py
epydemiology/phjCalculateBinomialProportions.py
epydemiology/phjCalculateBinomialProportions.py
""" This function calculates the binomial proportions of a series of binomial variables for each level of a given group variable. The dataframe has the following format: group A B C 0 g1 yes no yes 1 g1 yes NaN yes 2 g2 no NaN yes 3 g1 no yes NaN...
Python
0.000001
6ac4db0b9bfc638d708fd7341b0f3e1437ce8f97
add dir cmmbbo to hold code for docker scheduler
cmbbo/main.py
cmbbo/main.py
#coding: utf-8
Python
0
4f06672cb18673941f625987b51b9fabe57ea8ac
find kth smallest
Python/search/find_kthsmallest.py
Python/search/find_kthsmallest.py
''' Find the kth smallest element in an unsorted array ''' import heapq def kth_smallest(arr, k): # O(n) complexity heapq.heapify(arr) # k*log(n) for _ in range(k-1): # log(n) heapq.heappop(arr) return heapq.heappop(arr) assert kth_smallest([5, 4, 3, 1, 10], 1) == 1 assert kth_sm...
Python
0.999975
4ab45fc2dee8676566467706c0a433315c8fe3c8
Add test
skbio/util/tests/test_testing.py
skbio/util/tests/test_testing.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
Python
0
81032ffdae2d4bd02f3e9a6460b022079bf3cee8
Create about.py
home/hairygael/GESTURES/about.py
home/hairygael/GESTURES/about.py
def about(): sleep(2) ear.pauseListening() sleep(2) i01.setArmSpeed("right", 0.1, 0.1, 0.2, 0.2); i01.setArmSpeed("left", 0.1, 0.1, 0.2, 0.2); i01.setHeadSpeed(0.2,0.2) i01.moveArm("right", 64, 94, 10, 10); i01.mouth.speakBlocking("I am the first life si...
Python
0
ce3a5186c8522cb0e8a2f3aa5e843846bb7f4e27
Remove whitespace from the beginning and the end of the string
techgig_strip.py
techgig_strip.py
def main(): a=raw_input() print a.strip() main()
Python
0.999807
ac85219bec0eea5619ebec802e74382399b0f87c
Add a VERY simple redis returner
salt/returners/redis.py
salt/returners/redis.py
''' Return data to a redis server This is a VERY simple example for pushing data to a redis server and is not nessisarily intended as a usable interface. ''' import redis __opts__ = { 'redis.host': 'mcp', 'redis.port': 6379, 'redis.db': '0', } def returner(ret): '''...
Python
0.00003
dfdaac63df7e4d8b381215fafd1f88c2af4781f2
Update __openerp__.py
sale_product_variants_types/__openerp__.py
sale_product_variants_types/__openerp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # 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...
# -*- encoding: utf-8 -*- ############################################################################## # # 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...
Python
0.000024
8275a7ccecfcb100b1575737944bde35f64949e9
Add test for search in varaints query
saleor/graphql/product/tests/test_variant_with_filtering.py
saleor/graphql/product/tests/test_variant_with_filtering.py
from decimal import Decimal import pytest from ....product.models import Product, ProductVariant from ...tests.utils import get_graphql_content QUERY_VARIANTS_FILTER = """ query variants($filter: ProductVariantFilterInput){ productVariants(first:10, filter: $filter){ edges{ node{ ...
Python
0.000001
96bbf25be25482a7edfd92ec9b956b0bbeab39c4
Add a basic summary query implementation
src/traffic/__init__.py
src/traffic/__init__.py
from datetime import datetime import zmq from messages import common_pb2, replies_pb2, requests_pb2 class Connection(object): def __init__(self, uri, context=None): self._uri = uri if context is None: context = zmq.Context() self._context = context self._socket = self....
Python
0.003632
e9f88f1c43189fe429730c488f4514bf78edea4e
Add python -m mistune cli
mistune/__main__.py
mistune/__main__.py
import sys import argparse from . import ( create_markdown, __version__ as version ) def _md(args): if args.plugin: plugins = args.plugin else: # default plugins plugins = ['strikethrough', 'footnotes', 'table', 'speedup'] return create_markdown( escape=args.escape,...
Python
0.000003
4af4d5d293d057bd12454200e7a1a72679c218a5
Create zipatoconnection.py
src/zipatoconnection.py
src/zipatoconnection.py
import requests class ZipatoConnection(Settings): __init__(self, serial): """ Initializes a ZipatoConnection. :param str serial: Zipato Box serial. """ self.serial = serial def set_sensor_status(self, ep, apikey, status): """ Set status of a...
Python
0.000004
d0e2daf892de6b35ba90926f446c70ec3079f468
Update version.
__init__.py
__init__.py
# -*- coding: utf-8 -*- """Kernel of Pyslvs. This kernel can work without GUI. Modules: + Solver: + parser + tinycadlib + Sketch Solve solver + triangulation + Number synthesis: + number + Structure Synthesis: + atlas + Dimensional synthesis: + planarlinkage + rga + firefly ...
# -*- coding: utf-8 -*- """Kernel of Pyslvs. This kernel can work without GUI. Modules: + Solver: + parser + tinycadlib + Sketch Solve solver + triangulation + Number synthesis: + number + Structure Synthesis: + atlas + Dimensional synthesis: + planarlinkage + rga + firefly ...
Python
0
3e345bc4a17cf53c40ef51cd2ae1732744be7e60
Add custom form for editing and updating of decks
cardbox/deck_forms.py
cardbox/deck_forms.py
from django.forms import ModelForm from django.forms.widgets import Textarea, TextInput from deck_model import Deck class DeckForm(ModelForm): """The basic form for updating or editing decks""" class Meta: model = Deck fields = ('title', 'description') widgets = { 'title': ...
Python
0
95d93518d664c9d8b095061bc854907c29f05623
Add dummy keygen
tests/__init__.py
tests/__init__.py
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa, padding from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, PublicFormat, BestAvailableEncryption import os f4 = 65537 os.environ['EQ_PUBLIC_KEY'] = './jwt-test-keys/sr-pub...
Python
0.000001
fa8b40b8ebc088f087ff76c36068fea67dae0824
Add management command for updating genome coordinate names using Ensembl-INSDC mapping
rnacentral/portal/management/commands/update_coordinate_names.py
rnacentral/portal/management/commands/update_coordinate_names.py
""" Copyright [2009-2017] EMBL-European Bioinformatics Institute 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 a...
Python
0
6418807dbba9fb946ffeb05aee525c51c2e71f75
Fix fixture, add doc string
tests/fixtures.py
tests/fixtures.py
"""Defines fixtures that can be used to streamline tests and / or define dependencies""" from random import randint import pytest import hug @pytest.fixture def hug_api(): """Defines a dependency for and then includes a uniquely identified hug API for a single test case""" return hug.API('fake_api_{}'.forma...
Python
0
6f9d04b3d894b4dc3178285f665342a249bbc17c
support script in python for bootstrapping erlang on a new erts
support/build.py
support/build.py
#! /bin/python """Support for building sinan, bootstraping it on a new version of erlang""" import sys import os import commands from optparse import OptionParser class BuildError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) ERTS_VERSI...
Python
0
47c1dfd602281c56973de0d8afe64b923eb29592
Add unit tests for env module.
test/test_env.py
test/test_env.py
from _ebcf_alexa import env from unittest.mock import patch, call import pytest @pytest.yield_fixture def mock_now(): with patch.object(env, 'now') as now: yield now @patch('datetime.datetime') def test_now_is_utc(fake_datetime): assert env.now() assert fake_datetime.now.call_args == call(tz=env...
Python
0
c727cee4dc579f5fe09b54877118a681a2597c47
add tests for log module
test/test_log.py
test/test_log.py
"""Test for custom logging functions.""" import logging from mapchete.log import user_process_logger, driver_logger def test_user_process_logger(): logger = user_process_logger(__name__) assert isinstance(logger, logging.Logger) assert logger.name == "mapchete.user_process.test_log" def test_driver_lo...
Python
0.000001
fc9e9b4b9bdee1bd1f6b112c90772702cf60ad2d
Add a unittest-based test suite for scenarios
test_converge.py
test_converge.py
#!/usr/bin/env python import functools import logging import unittest import converge import converge.processes from converge.framework import datastore from converge.framework import scenario def with_scenarios(TestCase): loader = unittest.defaultTestLoader def create_test_func(generic_test, params): ...
Python
0.999868
f65c6f3939c50326eea14bd0dadc77b7c9364dd2
Add a module to deal with credentials
gssapi/creds.py
gssapi/creds.py
from __future__ import absolute_import from ctypes import cast, byref, c_char_p, c_void_p, string_at from .gssapi_h import ( GSS_C_NO_CREDENTIAL, GSS_C_NO_NAME, GSS_C_INDEFINITE, GSS_C_NO_OID_SET, GSS_C_BOTH, GSS_S_COMPLETE, OM_uint32, gss_cred_id_t, gss_init_sec_context, gss_accept_sec_context, gss_d...
Python
0
0c64ad7f93fc1183ac51be7f1e311659fa070594
Add som tests for the DB module
tests/test_db.py
tests/test_db.py
# -*- coding: utf-8 -*- # vim: set ts=4 # Copyright 2016 Rémi Duraffort # This file is part of ReactOBus. # # ReactOBus 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, ...
Python
0
c88b95bd28b1ece65fc4631f73e95dac5b48f038
Add new py-fixtures package (#14026)
var/spack/repos/builtin/packages/py-fixtures/package.py
var/spack/repos/builtin/packages/py-fixtures/package.py
# Copyright 2013-2019 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) from spack import * class PyFixtures(PythonPackage): """Fixtures, reusable state for writing clean tests and more.""...
Python
0
9692c1494e52238fdbc388ef5aba4ae551b46a88
Create ohmycoins.py
ohmycoins.py
ohmycoins.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import requests from bs4 import BeautifulSoup #Put your Ether addresses here in the list addresses = [] #Etherscan def get_ether(address): url = 'https://etherscan.io/address/' + address r = requests.get(url) soup = BeautifulSoup(r.text, 'html.parser') ...
Python
0.000003
2ad504a1a40e08aea3105642821190f9b928fab7
create tags package
tags/__init__.py
tags/__init__.py
VERSION = (0, 1, 0, 'dev', 1)
Python
0.000001
a317e86e0faab308421588f649f6dd7ba65cd03b
Add rscommon/pickle_.py
rscommon/pickle_.py
rscommon/pickle_.py
########################################## # File: pickle_.py # # Copyright Richard Stebbing 2014. # # Distributed under the MIT License. # # (See accompany file LICENSE or copy at # # http://opensource.org/licenses/MIT) # ########################################## # Imports ...
Python
0.000001
2a832e8a9a0881200756db5aa99650745c0ecc16
rename to
tools/packing.py
tools/packing.py
#!/usr/bin/env python import os import shutil import subprocess from contextlib import contextmanager @contextmanager def pushd(path): currentDir = os.getcwd() os.chdir(path) yield os.chdir(currentDir) def printInfo(message): print os.path.basename(__file__) + ' >> ' + message def installDependencies(): ...
#!/usr/bin/env python import os import shutil import subprocess from contextlib import contextmanager @contextmanager def pushd(path): currentDir = os.getcwd() os.chdir(path) yield os.chdir(currentDir) def printInfo(message): print os.path.basename(__file__) + ' >> ' + message def installDependencies(): ...
Python
0.999995
5bea29f6590adad3479a994dd141dd459350063c
add draft cryptogram analysis tool
cryptogram.py
cryptogram.py
#!/usr/bin/env python """Cryptogram. Description: This script statistically analyses a line of text to help solve a cryptogram Author: Andrew Mattheisen Usage: cryptogram.py <cyphertext>... cryptogram.py (-h | --help) cryptogram.py --version Options: -h --help Show this screen. --version Show...
Python
0
0590adbbd9325c0d9a9595dfac62caae05dd43e0
Add leetcode 061 solution
leetcode/061_rotate_list.py
leetcode/061_rotate_list.py
""" Rotate List Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Input: 1 -> 2 -> 3 -> 4 -> 5 -> NULL, k = 2 Output: 4 -> 5 -> 1 -> 2 -> 3 -> NULL Explation: rotate 1 steps to the right: 5 -> 1 -> 2 -> 3 -> 4 -> NULL rotate 2 steps to the right: ...
Python
0.000003
8e8c14446a0089ee7fa57cfd5520c7d6d6e2711e
Add Python user customization file.
usercustomize.py
usercustomize.py
""" Customize Python Interpreter. Link your user customizing file to this file. For more info see: https://docs.python.org/3/library/site.html "Default value is ~/.local/lib/pythonX.Y/site-packages for UNIX and non-framework Mac OS X builds, ~/Library/Python/X.Y/lib/python/site-packages for Mac framework builds, and...
Python
0
13be4749aef2415ab84ffbd090c5b24d8ed98af5
Add test case of BloArticle class
tests/TestBloArticle.py
tests/TestBloArticle.py
import unittest from blo.BloArticle import BloArticle class TestBloArticle(unittest.TestCase): def setUp(self): self.blo_article = BloArticle() def test_failed_load_from_file(self): file_path = "" with self.assertRaises(FileNotFoundError): self.blo_article.load_from_file(f...
Python
0
4442fabf9292efa44a82f420e2d3e807d7d15b04
Add more tests to cli
tests/test_cli.py
tests/test_cli.py
from click.testing import CliRunner from tinydb import TinyDB, where from tinydb.storages import MemoryStorage import pytest try: import mock except ImportError: from unittest import mock from passpie import cli @pytest.fixture def mock_db(mocker): credentials = [ {'login': 'foo', 'name': 'bar', ...
Python
0
b2e10a344a940ae2cce9656c435c7a6f4919a53b
add cli invoke tests
tests/test_cli.py
tests/test_cli.py
import pytest from click.testing import CliRunner import bgpfu.cli def test_cli_invoke(): runner = CliRunner() res = runner.invoke(bgpfu.cli.cli, ['as_set']) res = runner.invoke(bgpfu.cli.cli, ['prefixlist']) res = runner.invoke(bgpfu.cli.cli, ['raw'])
Python
0.000001
c659f31cfb3eadd66838036ea285070f564fdced
Add rendering test
tests/test_rendering.py
tests/test_rendering.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import pytest from PIL.Image import Image from psd_tools.user_api.psd_image import PSDImage, merge_layers from tests.utils import decode_psd, full_name CLIP_FILES = [ ('clipping-mask.psd',), ('clipping-mask2.psd',) ] @pytest.m...
Python
0.000001
436719050ada475d840004a49c693d08c3f92034
Add a widget for line editors.
greatbigcrane/project/widgets.py
greatbigcrane/project/widgets.py
from django.forms.widgets import Textarea from django.utils.safestring import mark_safe class LineEditorWidget(Textarea): class Media: js = ('js/jquery-1.4.2.min.js' ,'js/jquery.lineeditor.js') def render(self, name, value, attrs=None): if isinstance(value,list): value = "\n".join(...
Python
0
52d03e19bd61dcba56d1d7fc3944afcc6d9b6a8d
make nautilus use backspace for back
.local/share/nautilus-python/extensions/BackspaceBack.py
.local/share/nautilus-python/extensions/BackspaceBack.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # by Ricardo Lenz, 2016-jun # riclc@hotmail.com # import os, gi gi.require_version('Nautilus', '3.0') from gi.repository import GObject, Nautilus, Gtk, Gio, GLib def ok(): app = Gtk.Application.get_default() app.set_accels_for_action( "win.up", ["BackSpace"] ) ...
Python
0.00001
e778f67101a9ba8e38e249263d49738d3239f557
test select prefix cursor
test_p_cursor.py
test_p_cursor.py
import sys sys.path.append('./build/lib.linux-x86_64-2.7/') from voidptr import VoidPtr as vp import spapi as sp env = vp("env") ctl = vp("ctl") db = vp("db") o = vp("o") t = vp("t") print "env", sp.env(env) print "env,ctl", sp.ctl(env,ctl) print "ctl_set", sp.ctl_set(ctl,"sophia.path","./test_data") print "ctl_s...
Python
0.000001
2a1777a74d6f2cba61485f281f0c048cbbdca727
Add valgrind tests file.
test_valgrind.py
test_valgrind.py
from __future__ import print_function import shutil import os from model_test_helper import ModelTestHelper tests = {'om_360x300-valgrind' : ('om'), 'cm_360x300-valgrind' : ('cm')} class TestValgrind(ModelTestHelper): """ Run the model in valgrind. """ def __init__(self): super(Te...
Python
0
f9273e7b905bdc94f3e161b17225a11120810b26
handle core serice by self-defined-class
google_service.py
google_service.py
import httplib2 import os import oauth2client from apiclient import discovery from oauth2client import client, tools try: import argparse flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args() except ImportError: flags = None class Gooooogle(): def __init__(self): self.crede...
Python
0
556530f4933b1323ef8e4414c324a0aa2d0b81bd
Add the example bundles.
tests/example.py
tests/example.py
# This file is part of the Juju GUI, which lets users view and manage Juju # environments within a graphical interface (https://launchpad.net/juju-gui). # Copyright (C) 2013 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public Lice...
Python
0
1dec974693222864537b20b31ac33656bea92912
add LogFactory
py3utils/_log.py
py3utils/_log.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # date: 2018/4/15 # author: he.zhiming # from __future__ import unicode_literals, absolute_import import logging import logging.config from logging import handlers class LogFactory: _LOG_CONFIG_DICT = { } logging.config.dictConfig(_LOG_CONFIG...
Python
0.000001
6f9d02510ad861bf8ae5ad8f1ae335a4e565756d
Add initial unit tests for io module
tests/test_io.py
tests/test_io.py
from unittest.mock import MagicMock, patch import pytest from isort import io class TestFile: def test_read(self, tmpdir): test_file_content = """# -*- encoding: ascii -*- import ☺ """ test_file = tmpdir.join("file.py") test_file.write(test_file_content) # able to read file eve...
Python
0
d94260f0be472d2c163e9ae57aacc25a8e9f2519
Package contrib
t5x/contrib/__init__.py
t5x/contrib/__init__.py
# Copyright 2022 The T5X Authors. # # 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 writ...
Python
0
b0470bbde7c477e8f176fa0529a1d90eca85caba
Add survey support and use it for IPP.
openfisca_france/surveys.py
openfisca_france/surveys.py
# -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team # https://github.com/openfisca # # This file is part of OpenFisca. # # OpenFisca is free software; you can redistribute it and/or modify # it ...
Python
0
0f32a1e193a0064e5d5313cdc205d15cea71f1e7
Test for a long hippo scrolling view.
tests/graphics/hipposcalability.py
tests/graphics/hipposcalability.py
import hippo import gtk import gobject from sugar.graphics.icon import CanvasIcon from sugar.graphics.roundbox import CanvasRoundBox import common test = common.Test() canvas = hippo.Canvas() test.pack_start(canvas) canvas.show() scrollbars = hippo.CanvasScrollbars() canvas.set_root(scrollbars) box = hippo.Canvas...
Python
0
f0204e3061b110028fde5312fdb7b613e361b16e
Create output.py
trendpy/output.py
trendpy/output.py
# -*- coding: utf-8 -*- # output.py # MIT License # Copyright (c) 2017 Rene Jean Corneille # 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 limitatio...
Python
0.000295
277b12fdd5af885466fd3ff6f8ccfd47555fbabe
Fix `RedisQuotaTest.test_uses_defined_quotas`.
tests/sentry/quotas/redis/tests.py
tests/sentry/quotas/redis/tests.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import mock from redis.client import ( Script, StrictRedis, ) from exam import fixture, patcher from sentry.quotas.redis import ( IS_RATE_LIMITED_SCRIPT, RedisQuota, ) from sentry.testutils import TestCase def test_is_rate_limited_scri...
# -*- coding: utf-8 -*- from __future__ import absolute_import import mock from redis.client import ( Script, StrictRedis, ) from exam import fixture, patcher from sentry.quotas.redis import ( IS_RATE_LIMITED_SCRIPT, RedisQuota, ) from sentry.testutils import TestCase def test_is_rate_limited_scri...
Python
0
a78fe01101de6143885f2559a519024a86d97315
Add new command dev_guess_downloader.
allmychanges/management/commands/dev_guess_downloader.py
allmychanges/management/commands/dev_guess_downloader.py
# coding: utf-8 from django.core.management.base import BaseCommand from twiggy_goodies.django import LogMixin from allmychanges.downloader import guess_downloader class Command(LogMixin, BaseCommand): help = u"""Command to test how downloader guesser workds for given url.""" def handle(self, *args, **optio...
Python
0
c5dbebe13e2c1c7018a1701e3c8e37ae29f9a387
add solution for Reverse Integer
src/reverseInteger.py
src/reverseInteger.py
class Solution: # @return an integer def reverse(self, x): int_max = 2147483647 limit = int_max/10 if x > 0: sig = 1 elif x < 0: sig = -1 x = -x else: return x y = 0 while x: if y > limit: ...
Python
0.000018
6f3ae8a9e8a400b8882cf57fa0753c1c44b85c2a
Create pdf_all.py
pdf_all.py
pdf_all.py
#!/usr/bin/env python # encoding:UTF-8 """ This script runs a file through all of the PDF tools """ import sys import pdf_js import pdf_links import pdf_strings import pdf_openaction def run_all(fpath): print "*"*20 + "PDF OpenAction" + "*"*20 pdf_openaction.extract_openactions(fpath) print "*"*20 + "...
Python
0
288a59cfeade739260a1f76cf632d735677022be
Add the start of some test for the scoring stuff.
src/test_scores_db.py
src/test_scores_db.py
import scores_db import mock import redis_client import control from twisted.internet import defer def test_set_scores(): fake_connection = mock.Mock() fake_connection.set = mock.Mock() with mock.patch('redis_client.connection', fake_connection): scores_db.scores.set_match_score(1, 'ABC', 12) ...
Python
0.999996
a0e4ba8dbdd14f51d17d2fb1c4e0829894d7cd10
Add utility file for playbook
src/utils/playbook.py
src/utils/playbook.py
from django.conf import settings from ansible.models import Playbook import os def content_loader(pk, slug): playbook = Playbook.query_set.get(pk=pk) playbook_dir = playbook.directory # TODO: for now assume without validation playbook_file = os.path.join(playbook_dir, slug + '.yml') return playboo...
Python
0.000001
c517e0cb2de9cd813e4b49b6786a07e01005f0b5
Add fully functional code, prints field and sprinkler coordinates.
Max_Crop.py
Max_Crop.py
#Find optimal position for a sprinkler in a field with randomly places crops.Takes in h,w,r, where h is height, w is width, r is the sprinker radius #http://www.reddit.com/r/dailyprogrammer/comments/2zezvf/20150318_challenge_206_intermediate_maximizing/ import random import math #Creates field with random crop placem...
Python
0
41bed7865c9002086f5599059700ed8599c8c7ef
Copy of existing (manual) https debug tool
Sketches/MPS/ProxyHTTP/https.py
Sketches/MPS/ProxyHTTP/https.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1) # # (1) Kamaelia Contributors are listed in the AUTHORS file and at # http://www.kamaelia.org/AUTHORS - please extend this file, # not this notice. # # Licensed under the Apache License, Ver...
Python
0
4fd051fd6d048e64f574097a3ca314111087ee45
Fix up conv models to match current master.
theanets/convolution.py
theanets/convolution.py
# -*- coding: utf-8 -*- '''This module contains convolution network structures.''' from . import feedforward class Regressor(feedforward.Regressor): '''A regressor attempts to produce a target output.''' INPUT_NDIM = 4 '''Number of dimensions for holding input data arrays.''' class Classifier(feedfor...
# -*- coding: utf-8 -*- '''This module contains convolution network structures.''' from . import feedforward class Regressor(feedforward.Regressor): '''A regressor attempts to produce a target output. A convolutional regression model takes the following inputs during training: - ``x``: A three-dimensi...
Python
0
1dc795fcf3e6c09a9a77fb008ee3b5fe5c7c3719
fix bug 1035957 - correct received_at column
alembic/versions/391e42da94dd_bug_1035957_use_literal_now_for_.py
alembic/versions/391e42da94dd_bug_1035957_use_literal_now_for_.py
"""bug 1035957 - use literal NOW() for received_at, do not evaluate at migration time Revision ID: 391e42da94dd Revises: 495bf3fcdb63 Create Date: 2014-07-08 10:55:04.115932 """ # revision identifiers, used by Alembic. revision = '391e42da94dd' down_revision = '495bf3fcdb63' from alembic import op from socorro.lib...
Python
0
05ce8407af2075ebcc002583b4224659d19dc9db
Add unit tests for spack help command (#6779)
lib/spack/spack/test/cmd/help.py
lib/spack/spack/test/cmd/help.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
3590a162363ff62859eccf9f7f46c74f2c5cadc4
Create PAKvsIND.py
PAKvsIND.py
PAKvsIND.py
# -*- coding: utf-8 -*- """ Created on Tue Jun 20 01:56:57 2017 @author: Muhammad Salek Ali """ # 1- Importing libraries for twitter and NLP #-------------------------------------------- import numpy as np import tweepy from textblob import TextBlob # 2- Authentication #------------------- consumerKey= 'enter_yours...
Python
0
3b82f7ada9e80eb581cf924dbf7b0490f864b264
break at 500
012_highly_divisible_triangular_number.py
012_highly_divisible_triangular_number.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # A Solution to "Highly divisible triangular number" – Project Euler Problem No. 12 # by Florian Buetow # # Sourcecode: https://github.com/fbcom/project-euler # Problem statement: https://projecteuler.net/problem=12 # i = n = 0 while True: i = i + 1 n = i*(i+1)/2...
Python
0.000005
a3b8fe98d82e6e82267599fdd9f8ecea684fb603
Add import script
mdb/__init__.py
mdb/__init__.py
import sys import click import types import bibtexparser from girder_client import GirderClient class MDBCli(GirderClient): def __init__(self, username, password, api_url=None, api_key=None): def _progress_bar(*args, **kwargs): bar = click.progressbar(*args, **kwargs) bar.bar_tem...
Python
0.000001
f31dd0c7f23273207eab5e30a3ea42b5edf30f2b
work in progress, script to balance PTR records
mnm-balance-reversezones.py
mnm-balance-reversezones.py
#!/usr/bin/env python3 # Copyright (C) 2013 Men & Mice # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND MEN & ...
Python
0
2187ae0b6303ae1745749b270c5c46937d8dde33
Create mexican_wave.py
mexican_wave.py
mexican_wave.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Mexican Wave #Problem level: 6 kyu def wave(str): li=[] for i in range(len(str)): x=list(str) x[i]=x[i].upper() li.append(''.join(x)) return [x for x in li if x!=str]
Python
0.998674
fdc40675eabaeee191fa3a047705b677d431f58c
Create a small form class to facilitate easy use of Djangos CSRF functionality
src/whitelist/util/apply_whitelist_form.py
src/whitelist/util/apply_whitelist_form.py
from django import forms class ApplyWhitelistForm(forms.Form): """A small placeholder form class to allow Django's form magic to take hold of the "apply whitelist" button. """ pass
Python
0
b17a0d30c02795a87d0ab5f691416ddddf5fb0bd
Add exoplayer workload
wa/workloads/exoplayer/__init__.py
wa/workloads/exoplayer/__init__.py
# SPDX-License-Identifier: Apache-2.0 # # Copyright (C) 2017, Arm Limited and contributors. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
Python
0
73a9945fae1527e62d2076c87b77fa63b8da7e7b
Add MultiForm views
meinberlin/apps/contrib/forms.py
meinberlin/apps/contrib/forms.py
# flake8: noqa from django.core.exceptions import ImproperlyConfigured from django.db import transaction from django.forms import models as model_forms from django.forms.formsets import all_valid from django.http import HttpResponseRedirect from django.utils.encoding import force_text from django.views import generic ...
Python
0
252c0916e4db033c3aee81e232a64e649f6bc926
add a command to trigger a bulk sync
crate_project/apps/crate/management/commands/trigger_bulk_sync.py
crate_project/apps/crate/management/commands/trigger_bulk_sync.py
from django.core.management.base import BaseCommand from pypi.tasks import bulk_synchronize class Command(BaseCommand): def handle(self, *args, **options): bulk_synchronize.delay() print "Bulk Synchronize Triggered"
Python
0.000001
457ba730a6541ab27ce8cbe06cbb6bfe246bba74
Add a simple HTTP Basic Authentication decorator for the API
towel/api/decorators.py
towel/api/decorators.py
from functools import wraps import httplib from django.contrib.auth import authenticate from django.utils.cache import patch_vary_headers def http_basic_auth(func): @wraps(func) @vary_on_headers('Authorization') def _decorator(request, *args, **kwargs): if 'HTTP_AUTHORIZATION' in request.META: ...
Python
0
457937561f6a581edd495d7f9559f57b94108c24
add really basic game implementation
haive/game.py
haive/game.py
# An interactive wrapper for the model from haive import model from collections import namedtuple def tuple_from_string(string): return tuple(int(item) for item in string.split(',')) human = 'human' ai = 'ai' player_types = (human, ai) Move = namedtuple('Move', ('token','source','destination')) class Game(obj...
Python
0
c8d441fbee372abc61867d594f0645d9d79a36f0
add raw data parser script
parseRawData/parseRawXML.py
parseRawData/parseRawXML.py
#!/usr/bin/python import sys import json from bs4 import BeautifulSoup import logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def extract_xml(markup): """ Extract `url`, `title`, 'description`, ...
Python
0.000001
e83dd0bfa4f601ed3c5ea9687d2781e83a2e6bf4
Add logger
cpnest/logger.py
cpnest/logger.py
import logging def start_logger(output=None, verbose=0): """ Start an instance of Logger for logging output : `str` output directory (./) verbose: `int` Verbosity, 0=CRITICAL, 1=WARNING, 2=INFO, 3=DEBUG fmt: `str` format for logger (None) See logging documentation for det...
Python
0.00002
5fe88aa7d814bb630c29a7afcf511caba8c03ece
add placeholder
htdocs/c/c.py
htdocs/c/c.py
import os import sys tilecachepath, wsgi_file = os.path.split(__file__) sys.path.insert(0, "/opt/iem/include/python/") sys.path.insert(0, "/opt/iem/include/python/TileCache/") from TileCache.Service import Service, wsgiHandler cfgfiles = os.path.join(tilecachepath, "tilecache.cfg") theService = {} def wsgiApp(env...
Python
0
4a1b7c7e1c6bd1df2d31e37a0cf97853faafb8e5
Add BrowserScraper class
BrowserScraper.py
BrowserScraper.py
import time from selenium import webdriver from selenium.common.exceptions import StaleElementReferenceException class BrowserScraper(): def __init__(self, username, level, driver=None): if driver is None: self.driver = webdriver.Chrome('./chromedriver') pass def wait(self): ...
Python
0
c313a21274f4e77d0c4baad13c5c0f5781ac13ef
Create special-binary-string.py
Python/special-binary-string.py
Python/special-binary-string.py
# Time: f(n) = kf(n/k) + n/k * klogk <= O(logn * nlogk) <= O(n^2) # n is the length of S, k is the max number of special strings in each depth # Space: O(n) class Solution(object): def makeLargestSpecial(self, S): """ :type S: str :rtype: str """ result = [] ...
Python
0.999098
63f3e2027948d98781bdd66a0341501facb4b46c
Add test file
image_test.py
image_test.py
import unittest class TestStringMethods(unittest.TestCase): def test_upper(self): self.assertEqual('foo'.upper(), 'FOO') def test_isupper(self): self.assertTrue('FOO'.isupper()) self.assertFalse('Foo'.isupper()) def test_split(self): s = 'hello world' self.assertEqual(s.split(), ...
Python
0.000001
70ba6d35682c4cad67ed3950542505557e97b86a
Create selenium-auth.py
selenium-auth.py
selenium-auth.py
# The sendingRequest and responseReceived functions will be called for all requests/responses sent/received by ZAP, # including automated tools (e.g. active scanner, fuzzer, ...) # Note that new HttpSender scripts will initially be disabled # Right click the script in the Scripts tree and select "enable" # 'initia...
Python
0.000002
a4ca12fb7f3525206a9a921ab64e31bc145cc9d3
Create __init__.py
__init__.py
__init__.py
Python
0.000429
102ad365089794d337820714ab281f99af0797b0
update make_base_url
qiniu/auth_token.py
qiniu/auth_token.py
# -*- coding: utf-8 -*- import json import base64 import time import rpc import config import urllib import auth_digest class PutPolicy(object): scope = None # 可以是 bucketName 或者 bucketName:key expires = 3600 # 默认是 3600 秒 callbackUrl = None callbackBody = None returnUrl = None returnBody = N...
# -*- coding: utf-8 -*- import json import base64 import time import rpc import config import urllib import auth_digest class PutPolicy(object): scope = None # 可以是 bucketName 或者 bucketName:key expires = 3600 # 默认是 3600 秒 callbackUrl = None callbackBody = None returnUrl = None returnBody = N...
Python
0.000001
647e3b463d1b71ea1a3bd34d11e6a5855b4ea70d
Create __init__.py
__init__.py
__init__.py
Python
0.000429
988598d0385ce63d951b3cc0817392cf2271575c
change encoding to utf8
__init__.py
__init__.py
import sys if not sys.getdefaultencoding()=='utf8': reload(sys) sys.setdefaultencoding('utf8')
Python
0.999791
04530dd3def6f8ff158df7b607c367f5f273fd1b
add pythainlp.tools
pythainlp/tools/__init__.py
pythainlp/tools/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import,unicode_literals def test_segmenter(segmenter, test): words = test result = segmenter correct = (result == words) if not correct: print ('expected', words) print('got ', result) return correct if __name__ == "__main__...
Python
0.000356
879032d31d8cf89df14489107015b7f29ace1490
Solve designer door mat
python/designer-door-mat.py
python/designer-door-mat.py
# Size: 7 x 21 # ---------.|.--------- # ------.|..|..|.------ # ---.|..|..|..|..|.--- # -------WELCOME------- # ---.|..|..|..|..|.--- # ------.|..|..|.------ # ---------.|.--------- class DoorMat: DASH = "-" DOT = "." PIPE = "|" WELCOME = "WELCOME" def __init__(self, N, M): self.N = N ...
Python
0.999927
0b9926313831b8fd5c2e72cfc2559f7bdd1c2855
Add class utils
nisl/_utils/class_helper.py
nisl/_utils/class_helper.py
from sets import Set import inspect def get_params(_class, _object, ignore=None): _ignore = Set(['memory', 'memory_level', 'verbose', 'copy']) if ignore is not None: _ignore.update(ignore) # params is a dictionary params = _class.get_params(_object) for i in _ignore: if i in par...
Python
0.000001
f71d6b2fe05290ab976e3ba433185ec649a35c20
Move get_context_from_function_and_args() to context.py
openstack/common/context.py
openstack/common/context.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # 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/...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # 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/...
Python
0.000663