commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
27bf3bf0292e4168a372c75533080e4e42b73336 | Test reproducing problem | evernym/zeno,evernym/plenum | plenum/test/primary_selection/test_promotion_leads_to_primary_inconsistency.py | plenum/test/primary_selection/test_promotion_leads_to_primary_inconsistency.py | import json
from indy.did import create_and_store_my_did
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
from plenum.test.node_catchup.test_config_ledger import start_stopped_node
from plenum.test.helper import sdk_send_random_and_check, checkViewNoForNodes
from plenum.test.pool_transacti... | apache-2.0 | Python | |
29ea1f1a15b087e63ce137b5a3f637b40eadafb3 | add import script for mid sussex | andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_mid_sussex.py | polling_stations/apps/data_collection/management/commands/import_mid_sussex.py | """
Imports Mid Sussex
"""
import sys
from django.contrib.gis.geos import Point, GEOSGeometry
from data_collection.management.commands import BaseKamlImporter
class Command(BaseKamlImporter):
"""
Imports the Polling Station data from Mid Sussex
"""
council_id = 'E07000228'
districts_name = 'm... | bsd-3-clause | Python | |
0731f672cbecd6db4cc15316affef65bc3d55117 | add script to compare DFAs. | Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client | src/trusted/validator_ragel/unreviewed/compare_dfa.py | src/trusted/validator_ragel/unreviewed/compare_dfa.py | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import dfa_parser
visited_pairs = set()
de... | bsd-3-clause | Python | |
76414d61408814b26d972db6dbc462c41d415bd8 | test modes | tlevine/vlermv | vlermv/test/test_vlermv/test_serializers.py | vlermv/test/test_vlermv/test_serializers.py | from tempfile import mkdtemp
import pytest
from ...vlermv import Vlermv
class _mode_checker:
def dump(self, obj, fp):
assert ('b' in fp.mode) == self.vlermv_binary_mode
def load(self, fp):
assert ('b' in fp.mode) == self.vlermv_binary_mode
def __init__(self, binary_mode):
self.v... | agpl-3.0 | Python | |
4a5647d9061239ac9a6b8e78b133ef4aca616f51 | add test suite | ddbeck/oraide | oraide/tests.py | oraide/tests.py | import logging
import subprocess
import time
import unittest
from oraide import send_keys, ConnectionFailedError, SessionNotFoundError
class TestSendKeys(unittest.TestCase):
session_name = 'oraide_test_session'
verification_string = '7hh50zxnxj'
def start_tmux_session(self):
logging.info('Starti... | bsd-3-clause | Python | |
8a4f814630ffd106f9711a2fb339c12c4df3efb0 | Solve 328 wtf so easy | HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode | 328-Odd_Even_Linked_List.py | 328-Odd_Even_Linked_List.py | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def oddEvenList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None:
retu... | apache-2.0 | Python | |
abab62f2a772ab46ff8ef9ef5163865e132974dc | Add Samplesheet_converter | sylvinite/standalone_scripts,jgruselius/standalone_scripts,SciLifeLab/standalone_scripts,SciLifeLab/standalone_scripts,vezzi/standalone_scripts,sylvinite/standalone_scripts,vezzi/standalone_scripts,jgruselius/standalone_scripts | Samplesheet_converter_v1.0.py | Samplesheet_converter_v1.0.py | # These scripts are for the purpose of converting Illumina samplesheet that contains Chromium 10X indexes for demultiplexing.
# Headers and lines with ordinary indexes will be passed without any change. Lines with Chromium 10X indexes will be expanded into 4 lines, with 1 index in each line, and suffix 'Sx' will be add... | mit | Python | |
bcc3b2a04b982bfce84899170eb73418d5985d9d | add eayun-userdata to v2 API extension | eayunstack/nova,eayunstack/nova | nova/api/openstack/compute/contrib/eayun_user_data.py | nova/api/openstack/compute/contrib/eayun_user_data.py | # Copyright 2012 OpenStack Foundation
#
# 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 ... | apache-2.0 | Python | |
145e9125cbd79c5cf69e4ca21d50a7f2a5130ce4 | Test for tigris bug 2944. DFLAGS changes not causing rebuild | andrewyoung1991/scons,andrewyoung1991/scons,andrewyoung1991/scons,timj/scons,andrewyoung1991/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,andrewyoung1991/scons,timj/scons,timj/scons,andrewyoung1991/scons,andrewyoung1991/scons,timj/scons,andrewyoung1991/scons,andrewyoung1991/scons | test/D/Issues/2944/D_changed_DFLAGS_not_rebuilding.py | test/D/Issues/2944/D_changed_DFLAGS_not_rebuilding.py | # Test to check for issue reported in tigris bug 2994
# http://scons.tigris.org/issues/show_bug.cgi?id=2994
#
import TestSCons
test = TestSCons.TestSCons()
dmd_present = test.detect_tool('dmd', prog='dmd')
ldc_present = test.detect_tool('ldc',prog='ldc2')
gdc_present = test.detect_tool('gdc',prog='gdc')
if not (dmd... | mit | Python | |
d3da5ffd25e6d8c164c0b42afb84a0a7605400ed | test program | cboling/xos,open-cloud/xos,cboling/xos,open-cloud/xos,opencord/xos,opencord/xos,opencord/xos,cboling/xos,zdw/xos,zdw/xos,cboling/xos,zdw/xos,cboling/xos,zdw/xos,open-cloud/xos | xos/observers/vcpe/observer_ansible_test.py | xos/observers/vcpe/observer_ansible_test.py | #!/usr/bin/env python
import os
import sys
sys.path.append("../..")
import observer.ansible
print sys.argv
private_key="""-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAtJiuarud5S4Y2quDeWyaS0UCQGQtfuSzzNhplFwujYnJGL65
e14REtv+UuHGymyr/SfkTrBd8vH5NI2UZ/4sZW13ieI/1d97OeVe2+ct0Y4BaFEI
3Hja6DIpsY3Q2cBQsWUwcQzbMIF9jIq... | apache-2.0 | Python | |
fb4406231511b327c8d01af96202d766bc7ec17e | fix behaviour of ctrl-w to behave more sensible | paretje/dotfiles,paretje/dotfiles,paretje/dotfiles,paretje/dotfiles,paretje/dotfiles | .ipython/profile_default/startup/01-ctrlw.py | .ipython/profile_default/startup/01-ctrlw.py | from IPython import get_ipython
from prompt_toolkit.keys import Keys
from prompt_toolkit.key_binding.bindings.named_commands import get_by_name
from prompt_toolkit.filters import ViInsertMode, EmacsInsertMode
insert_mode = ViInsertMode() | EmacsInsertMode()
ip = get_ipython()
registry = ip.pt_cli.application.key_bind... | mit | Python | |
0e97ef9522e5be883cb055c0183c9a44fe440b6b | add unit test | sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper | _unittests/ut_documentation/test_get_flog.py | _unittests/ut_documentation/test_get_flog.py | #-*- coding: utf-8 -*-
"""
@brief test log(time=33s)
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if p... | mit | Python | |
e09bcbeaf7a857fb6db22a77f1e6452a67918273 | Add HEK tests. | mjm159/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,mjm159/sunpy | sunpy/tests/net/test_hek.py | sunpy/tests/net/test_hek.py | # -*- coding: utf-8 -*-
# Author: Florian Mayer <florian.mayer@bitsrc.org>
#pylint: disable=W0613
from __future__ import absolute_import
import pytest
from sunpy.net import hek
def test_eventtype_collide():
with pytest.raises(TypeError):
hek.attrs.AR & hek.attrs.CE
with pytest.raises(TypeError):
... | bsd-2-clause | Python | |
32b7d87eeed5748306269f5eb1eaaf55e06bba3c | implement basic lockfile functions | parazyd/amprolla,parazyd/amprolla | lib/lock.py | lib/lock.py | # See LICENSE file for copyright and license details.
"""
Lockfile functions
"""
from time import time
from os import remove
from os.path import isfile
import sys
from lib.log import info
def check_lock():
"""
Checks if a lockfile is active, and creates one if not.
"""
if isfile('/tmp/amprolla.lock'... | agpl-3.0 | Python | |
1b57a7263b4a3a5f0f124cac27d9b1324ccfe4a6 | Add test (work on progress) | LeBarbouze/tunacell | tunacell/tests/test_simu.py | tunacell/tests/test_simu.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import print_function
import pytest
import numpy as np
import itertools
from tunacell.simu.main import SimuParams, DivisionParams, SampleInitialSize
#from tunacell.simu.ou import OUSimulation, run_ou_simulation
@pytest.fixture
def simu_params():... | mit | Python | |
df2fc25ddfeef564ae10bc8dc7f8c394591eed0c | Add a py-theano version from git repo (#4871) | tmerrick1/spack,tmerrick1/spack,TheTimmy/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,EmreAtes/spack,TheTimmy/spack,krafczyk/spack,krafczyk/spack,EmreAtes/spack,LLNL/spack,EmreAtes/spack,skosukhin/spack,EmreAtes/spack,krafczyk/spack,lgarren/spack,LLNL/spack,iulian787/spack,lgarren/spack,iulian787/spack,LLNL... | var/spack/repos/builtin/packages/py-theano/package.py | var/spack/repos/builtin/packages/py-theano/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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... | ##############################################################################
# Copyright (c) 2013-2016, 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... | lgpl-2.1 | Python |
508daaf2fed07c4fb858484290f75d387407af02 | Add python/utils.py | ngnrsaa/qflex,ngnrsaa/qflex,ngnrsaa/qflex,ngnrsaa/qflex | python/utils.py | python/utils.py | # Lint as: python3
"""
Provides utils for qFlex.
"""
import numpy as np
import cirq
import re
def ComputeSchmidtRank(gate):
if len(gate.qubits) == 1:
return 1
if len(gate.qubits) > 2:
raise AssertionError("Not yet implemented.")
V, S, W = np.linalg.svd(
np.reshape(
n... | apache-2.0 | Python | |
422c1f79fd603f390414c68662981f4c46d6065b | Add model classes | racker/python-raxcli | raxcli/model.py | raxcli/model.py | # Copyright 2013 Rackspace
#
# 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... | apache-2.0 | Python | |
839fad791c3c0c13fdde54c8ed9711637d4662f6 | add missing polybench-mod projects | PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild | benchbuild/projects/polybench/polybench-mod.py | benchbuild/projects/polybench/polybench-mod.py | from os import path
from benchbuild.projects.polybench.polybench import PolyBenchGroup
from benchbuild.utils.compiler import lt_clang
from benchbuild.utils.downloader import Git
class PolybenchModGroup(PolyBenchGroup):
DOMAIN = 'polybench'
GROUP = 'polybench-mod'
DOMAIN = 'polybench'
VERSION = '4.2-1... | mit | Python | |
7660765749f079decf12a1fd79330f1c1745e081 | add 016 | ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln | python/016_3sum_closest.py | python/016_3sum_closest.py | """
Given an array S of n integers, find three integers in S such that the sum is
closest to a given number, target. Return the sum of the three integers. You
may assume that each input would have exactly one solution.
For example, given array S = {-1 2 1 -4}, and target = 1.
The sum that is closest to the target is ... | mit | Python | |
1db1ebe35e36c26c1e6a45b1e12397b8c84af4b5 | Add transforming_title | softwaresaved/international-survey | analysis/include/transforming_title.py | analysis/include/transforming_title.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
In case of several questions representing items (such as for likert) or questions that needs to be grouped
(such as the questions with severla y/n) it is impossible to have a proper title. Here it is the corresponding dictionary to match the code of the question with t... | bsd-3-clause | Python | |
18804c381e40df6802ae10aca20e4e40c6d549d3 | add the data faker for csv format data (#54) | bytedance/fedlearner,bytedance/fedlearner,bytedance/fedlearner,bytedance/fedlearner,bytedance/fedlearner,bytedance/fedlearner,bytedance/fedlearner | test/data_join/generate_csv_raw_data.py | test/data_join/generate_csv_raw_data.py | # Copyright 2020 The FedLearner Authors. 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 applica... | apache-2.0 | Python | |
913c713f24be481299c658c305c65b260d59f930 | Implement script to import ES data to PG [WAL-2397] | opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur | src/waldur_core/logging/management/commands/import_elasticsearch_dump.py | src/waldur_core/logging/management/commands/import_elasticsearch_dump.py | from argparse import FileType
import operator
import json
from sys import stdin
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from waldur_auth_openid.log import OpenIDEventLogger
from waldur_auth_saml2.log import Saml2AuthEventLogger
from waldur_auth_social.... | mit | Python | |
81bf3ee8338975ea54458142920e951e64dc6161 | add json compare tools to repo | SivagnanamCiena/cosc-learning-labs,tbarrongh/cosc-learning-labs,SivagnanamCiena/cosc-learning-labs,tbarrongh/cosc-learning-labs | src/utils/json_compare.py | src/utils/json_compare.py | # Copyright 2015 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 | Python | |
b0bfe960c614ae633333e7930de438a219694395 | Add urls to user_profile | DeWaster/Tviserrys,DeWaster/Tviserrys | user_profile/urls.py | user_profile/urls.py | from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^', views.ViewView.as_view(), name='profile_own_view'),
url(r'^edit/', views.EditView.as_view(), name='profile_edit'),
url(r'^view/', views.ViewView.as_view(), name='profile_own_view'),
... | mit | Python | |
e8c5d862b9bf5804031b60b59068b881db7f8169 | add pacman-astar | zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlg... | ai/astar-search/pacman-astar/pacman-astar.py | ai/astar-search/pacman-astar/pacman-astar.py | import copy
pacman_x, pacman_y = list(map(int, input().split()))
food_x, food_y = list(map(int, input().split()))
n, m = list(map(int, input().split()))
grid = []
queue = []
answer_routes = None
for i in range(0, n):
grid.append(list(map(str, input())))
directions = [[-1, 0], [0, -1], [0, 1], [1, 0]]
queue.appe... | mit | Python | |
afc5d901e2ebade04a8d4ed8bdc83075bbd22d63 | Add stem leaf plot | altair-viz/altair,ellisonbg/altair,jakevdp/altair | altair/vegalite/v2/examples/stem_and_leaf.py | altair/vegalite/v2/examples/stem_and_leaf.py | """
Steam and Leaf Plot
-------------------
This example shows how to make a steam and leaf plot.
"""
import altair as alt
import pandas as pd
import numpy as np
np.random.seed(42)
# Generating Random Data
original_data = pd.DataFrame({'samples':np.array(np.random.normal(50, 15, 100), dtype=np.int)})
# Splitting St... | bsd-3-clause | Python | |
697f1061c5eb874ce2cb30dae501c1ed80a89342 | Create new package (#6849) | matthiasdiener/spack,tmerrick1/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,iulian787/spack,EmreAtes/spack,LLNL/spack,mfherbst/spack,EmreAtes/spack,LLNL/spack,mfherbst/spack,EmreAtes/spack,iulian787/spack,tmerrick1/spack,mfherbst/spack,tmerrick1/spack,iulian787/spack,LLNL/spack,EmreAtes/spack,tmerrick1/spac... | var/spack/repos/builtin/packages/perl-xml-simple/package.py | var/spack/repos/builtin/packages/perl-xml-simple/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... | lgpl-2.1 | Python | |
058501df098b71040422bcdb49efaabeb9e5f2f1 | add map object persistent | Compjeff/PokemonGo-Bot,Compjeff/PokemonGo-Bot | pokemongo_bot/cell_workers/map_object_persistent.py | pokemongo_bot/cell_workers/map_object_persistent.py | from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.worker_result import WorkerResult
class MapObjectPersistent(BaseTask):
SUPPORTED_TASK_API_VERSION = 1
def initialize(self):
print self.config
def work(self):
print "dsdsds ddss"
| mit | Python | |
79724ffb33766eb2b71ab6571564cc7dd77c401f | Add a test for paramter sharing | toslunar/chainerrl,toslunar/chainerrl | test_async.py | test_async.py | import unittest
import chainer
import chainer.links as L
import numpy as np
import async
class TestAsync(unittest.TestCase):
def setUp(self):
pass
def test_shared_link(self):
"""Check interprocess parameter sharing works if models share links
"""
head = L.Linear(2, 2)
... | mit | Python | |
07e3159f421ee783c96d4b46e1de9567dd053d0c | Add dummy test to make CI happy | Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet | test_truth.py | test_truth.py | def test_the_truth():
assert True
| mit | Python | |
8c400038b02bb6d57ef27617962823023710c40a | Fix FK issue in distributions table for alembic migrations | tkiethanom/splice,mostlygeek/splice,oyiptong/splice,ncloudioj/splice,mostlygeek/splice,rlr/splice,mozilla/splice,oyiptong/splice,mostlygeek/splice,mozilla/splice,tkiethanom/splice,ncloudioj/splice,mozilla/splice,tkiethanom/splice,ncloudioj/splice,tkiethanom/splice,mostlygeek/splice,rlr/splice,rlr/splice,ncloudioj/splic... | migrations/versions/1e529bad1e38_.py | migrations/versions/1e529bad1e38_.py | """empty message
Revision ID: 1e529bad1e38
Revises: 3364d1466fac
Create Date: 2015-05-20 17:42:07.580213
"""
# revision identifiers, used by Alembic.
revision = '1e529bad1e38'
down_revision = '3364d1466fac'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | mpl-2.0 | Python | |
22673cb0f00d6a5bbc36c76f1c50e8591cd2598b | apply migrations | gitgik/flask-rest-api,gitgik/flask-rest-api | migrations/versions/34158b4aafb9_.py | migrations/versions/34158b4aafb9_.py | """empty message
Revision ID: 34158b4aafb9
Revises: 536e84635828
Create Date: 2017-04-21 17:13:19.080838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '34158b4aafb9'
down_revision = '536e84635828'
branch_labels = None
depends_on = None
def upgrade():
# ... | mit | Python | |
839413e76f4d432e17d0f2c6c458e4c5846bb5ce | Add SylviaEpcServer.py | bgutter/sylvia | sylvia/SylviaEpcServer.py | sylvia/SylviaEpcServer.py | #
# SylviaEpcServer.py
#
# RPC Server for Emacs-Lisp
#
from Poem import *
def startEpcServer( pd, pi ):
"""
Start the Emacs RPC Server.
"""
from epc.server import EPCServer
server = EPCServer(('localhost', 0))
poem = Poem( pd, "" )
# TODO!!!
# Merge all of this with SylviaConsole in ... | mit | Python | |
baef1894cbb401cb8f134591cce61fbdafa7f81d | Add linger rate plugin | thecarebot/carebot,thecarebot/carebot,thecarebot/carebot | tests/test_plugin_linger.py | tests/test_plugin_linger.py | #!/usr/bin/env python
import app_config
app_config.DATABASE_NAME = 'carebot_test.db'
app_config.DEFAULT_CONFIG_PATH = 'tests/config_test.yml'
import datetime
try:
import unittest2 as unittest
except ImportError:
import unittest
from mock import patch
from mock import ANY
from plugins.npr.linger import NPRLin... | mit | Python | |
9e7aa9ca8b4301be8c219f4ce37edb271e6cb1ba | Add helper module with humanize_time function | howard/p1tr-tng,howard/p1tr-tng | p1tr/helpers.py | p1tr/helpers.py | """Generally useful helper functions, possibly for use in plugins."""
def humanize_time(delta):
"""
Converts a timespan provided as a datetime object into a human-readable
format.
"Inspired" by the time_ago_in_words function in P1tr Legacy.
"""
days = delta.days
minutes = delta.seconds // 6... | mit | Python | |
089207cd1bcf9125ff9404c5293ff824642ea5b4 | Test distarray.world.WORLD exists. | RaoUmer/distarray,RaoUmer/distarray,enthought/distarray,enthought/distarray | distarray/tests/test_world.py | distarray/tests/test_world.py | # encoding: utf-8
#----------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
#----------------------------------------------------------------------------
"""... | bsd-3-clause | Python | |
47977d281a590bd4bfbe97f4584932ad9dfebc1c | make shortestpath work with nx 2.0 and add tests | wuhaochen/multinet,wuhaochen/multinet | multinet/tests/test_shortest_path.py | multinet/tests/test_shortest_path.py | from __future__ import division
import multinet as mn
import networkx as nx
g1 = nx.Graph()
dg1 = nx.DiGraph()
nodes = ['A', 'B', 'C', 'D', 'E']
edges = [('A', 'B'), ('C', 'D')]
g1.add_nodes_from(nodes)
g1.add_edges_from(edges)
dg1.add_nodes_from(nodes)
dg1.add_edges_from(edges)
g2 = nx.Graph()
dg2 = nx.DiGraph()
no... | mit | Python | |
c4cdcc981d275135cdba076866ccc5f5e554f6b9 | Add CLI module | wbolster/whip-neustar | whip_neustar/cli.py | whip_neustar/cli.py | """
Command line interface module.
"""
import logging
import sys
import aaargh
import ujson
from .reader import iter_records
app = aaargh.App(
description="Neustar (formerly Quova) data set utilities.")
@app.cmd(description="foobar")
@app.cmd_arg('filename')
def convert(filename):
out_fp = sys.stdout
... | bsd-3-clause | Python | |
09e13841ec100669c1e2f371bfceecd69bf5b793 | add scikit-learn/pyannote conversion mixin | pyannote/pyannote-algorithms | pyannote/algorithms/utils/sklearn_io.py | pyannote/algorithms/utils/sklearn_io.py | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014 CNRS
# 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 ... | mit | Python | |
4ddbff25d17432aca076cf57e7221adf04f04746 | Create toto_get.py | falgon/toto_getter,falgon/toto_getter | src/csv/toto_get.py | src/csv/toto_get.py | #!/usr/local/bin/python3
#coding:utf-8
import sys,string,re,unicodedata,csv,urllib.request
from bs4 import BeautifulSoup,NavigableString,Declaration,Comment
from progressbar import ProgressBar
min_value=198
max_value=898
url_='http://www.toto-dream.com/dci/I/IPB/IPB01.do?op=lnkHoldCntLotResultLsttoto&holdCntId=0'
d... | mit | Python | |
fa08499661cbc92a87ff7c91c76d6227fd882617 | Remove empty orphans while migrating | UrLab/DocHub,UrLab/DocHub,UrLab/beta402,UrLab/beta402,UrLab/DocHub,UrLab/DocHub,UrLab/beta402 | catalog/migrations/0017_remove_empty_orphan_courses.py | catalog/migrations/0017_remove_empty_orphan_courses.py | from django.db import migrations, models
from django.db.models import Count
def forwards(apps, schema_editor):
Course = apps.get_model("catalog", "Course")
empty_orphans = Course.objects.annotate(
docs=Count("document", distinct=True), cats=Count("categories", distinct=True)
).filter(docs=0, cats=... | agpl-3.0 | Python | |
bbec06d330d0ee380949a5b9ea4e2a8ec0bc1fe2 | Create Linked_List_CycleII.py | UmassJin/Leetcode | Array/Linked_List_CycleII.py | Array/Linked_List_CycleII.py | '''
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
Follow up:
Can you solve it without using extra space?
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @p... | mit | Python | |
508aac5c591134c4d6f77e27d9c0906c153d55ac | Add boto script to add go-agent ingress into apps. | eltoncarr/tubular,eltoncarr/tubular | admin/boto_to_add_ingress.py | admin/boto_to_add_ingress.py | #!/usr/bin/env python
import sys
from os import path
import click
import logging
import boto.ec2
from boto.ec2.autoscale import AutoScaleConnection
LOG_FILENAME = 'security_group_change.txt'
logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
# Info for the security group used by the go-agents.
GO_AGENT_SE... | agpl-3.0 | Python | |
b678341eb77867fd95401811a99119c97771f3f6 | Create led_button.py | TommyR22/RaspberryPi-gettingStarted | tutorials/LED/led_button.py | tutorials/LED/led_button.py | # @author TommasoRuscica
#
# LED
#
# ----------------------
# import libraries
import RPi.GPIO as GPIO
import time
# set pin mode
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# configure channels as input or output
# button connected on pin 4.
# led connected on pin 17.
GPIO.setup(4,GPIO.IN)
GPIO.setup(17... | mit | Python | |
8c1429c42bfa4330153c182442bfa81971aa358f | Create leetcode-49.py | jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm | python_practice/leetCode/leetcode-49.py | python_practice/leetCode/leetcode-49.py | class Solution:
def groupAnagrams(self, strs: 'List[str]') -> 'List[List[str]]':
dic = {}
for anagram in strs:
key = ''.join(sorted(anagram))
if key in dic.keys():
dic[key].append(anagram)
else:
dic[key] = [anagram]
result =... | mit | Python | |
fa3b19000db9ed6f3d6cf31895aeee4ac0d4e633 | update tau tarball | matthiasdiener/spack,krafczyk/spack,skosukhin/spack,lgarren/spack,matthiasdiener/spack,TheTimmy/spack,mfherbst/spack,matthiasdiener/spack,LLNL/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,iulian787/spack,LLNL/spack,LLNL/spack,TheTimmy/spack,skosukhin/spack,TheTimmy/spack,tmerrick1/spack,krafczyk/spack,LLNL/... | var/spack/packages/tau/package.py | var/spack/packages/tau/package.py | from spack import *
import os
from llnl.util.filesystem import join_path
class Tau(Package):
"""A portable profiling and tracing toolkit for performance
analysis of parallel programs written in Fortran, C, C++, UPC,
Java, Python."""
homepage = "http://www.cs.uoregon.edu/research/tau"
url ... | from spack import *
import os
from llnl.util.filesystem import join_path
class Tau(Package):
"""A portable profiling and tracing toolkit for performance
analysis of parallel programs written in Fortran, C, C++, UPC,
Java, Python."""
homepage = "http://www.cs.uoregon.edu/research/tau"
url ... | lgpl-2.1 | Python |
bede8309d81c36e55f3288246a058c89a02a6fd6 | Create SimpleHTTPServer1.py | ahhh/SPSE,thedarkcoder/SPSE | SimpleHTTPServer1.py | SimpleHTTPServer1.py | #/bin/python
import SocketServer
import SimpleHTTPServer
PORT = 8888
class HTTPRequestHandler (SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/test' :
self.wfile.write('You have found the test page!')
self.wfile.write(self.headers)
else:
SimpleHTTPServer.S... | mit | Python | |
0df1672a5dca66af3c35113bc37f5847af5c8a9c | Make this a module. Indentify where the code comes from | uogbuji/akara | akara/thirdparty/__init__.py | akara/thirdparty/__init__.py | # 'preforkserver.py' comes from flup
# 'httpserver.py' comes from paste
| apache-2.0 | Python | |
cebb99ca378bd9048351bc8f1aa25b282b21186f | Create sample for new functions | mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb | client/python/samples/basic/LoggingSample.py | client/python/samples/basic/LoggingSample.py | from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from modeldb.thrift.modeldb import ModelDBService
# create connection to thrift client
host = "localhost"
port = 6543
transport = TSocket.TSocket(host, port)
# Buffering is critical. Raw sockets are... | mit | Python | |
a9a723c07df1b3938a65c0db3cef47cdeb1eeb13 | add tags; highlight alternate files/tags | johntellsall/shotglass,johntellsall/shotglass,johntellsall/shotglass | shotglass/app/migrations/0006_sourceline_tags_json.py | shotglass/app/migrations/0006_sourceline_tags_json.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0005_sourceline_length'),
]
operations = [
migrations.AddField(
model_name='sourceline',
name... | mit | Python | |
1989f0201fc7e166383e10ed00981653b4bad4b1 | add log.py | benformosa/Toolbox,benformosa/Toolbox | log.py | log.py | #!/usr/bin/env python
"""Demonstrates configurable logging output"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import logging
def main():
"""Main function
Set arguments, configure logging, run test"""
parser = argparse.... | unlicense | Python | |
0adcde55347138bf08284565a4c123f2664f92b2 | Add test_post_invoice | PressLabs/silver,PressLabs/silver,PressLabs/silver | silver/tests/spec/test_invoice.py | silver/tests/spec/test_invoice.py | from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
from silver.tests.factories import (AdminUserFactory, CustomerFactory,
ProviderFactory)
class TestInvoiceEndpoints(APITestCase):
def setUp(self):
ad... | apache-2.0 | Python | |
859b455c25100c220e0e9a70b790ab2a38341f19 | add a ansible dynamic inventory example | yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn | ansible/dynamic_inventory.py | ansible/dynamic_inventory.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import json
"""
ansible -i dynamic_inventory all --list-host
ansible -i dynamic_inventory test --list-host
"""
if __name__ == '__main__':
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument('--ho... | bsd-3-clause | Python | |
756402e5acb86ce5741e1a2c6f6b6f4b50adcffa | Add TransformSystem class | sbtlaarzc/vispy,bollu/vispy,Eric89GXL/vispy,sh4wn/vispy,kkuunnddaannkk/vispy,QuLogic/vispy,kkuunnddaannkk/vispy,drufat/vispy,bollu/vispy,drufat/vispy,sbtlaarzc/vispy,inclement/vispy,michaelaye/vispy,hronoses/vispy,srinathv/vispy,sh4wn/vispy,QuLogic/vispy,ghisvail/vispy,RebeccaWPerry/vispy,inclement/vispy,dchilds7/Deysh... | vispy/visuals/transform_system.py | vispy/visuals/transform_system.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division
from .transforms import NullTransform, STTransform
class TransformSystem(object):
""" TransformSystem encapsulates information about the... | bsd-3-clause | Python | |
ca1f17126c9fe5597760e64b0dddf0764ccbb5b9 | remove unused import and cleanup | tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable | kiva/agg/__init__.py | kiva/agg/__init__.py | from agg import *
pix_format_string_map = {}
pix_format_string_map["gray8"] = pix_format_gray8
pix_format_string_map["rgb555"] = pix_format_rgb555
pix_format_string_map["rgb565"] = pix_format_rgb565
pix_format_string_map["rgb24"] = pix_format_rgb24
pix_format_string_map["bgr24"] = pix_format_bgr24
pix_format_string_ma... |
import sys
from agg import *
pix_format_string_map = {}
pix_format_string_map["gray8"] = pix_format_gray8
pix_format_string_map["rgb555"] = pix_format_rgb555
pix_format_string_map["rgb565"] = pix_format_rgb565
pix_format_string_map["rgb24"] = pix_format_rgb24
pix_format_string_map["bgr24"] = pix_format_bgr24
pix_for... | bsd-3-clause | Python |
7c8dac37d4e9cfced65e1c7ec5655c3e78c8de2a | Remove migrations that arenot relevant to the work | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0074_update_url_to_community.py | accelerator/migrations/0074_update_url_to_community.py | # Generated by Django 2.2.10 on 2021-11-05 12:29
from django.db import migrations
def update_url_to_community(apps, schema_editor):
people_url = "/people"
mentor_url = "/directory"
community_url = "/community"
SiteRedirectPage = apps.get_model('accelerator', 'SiteRedirectPage')
for siteredirectpage in Site... | mit | Python | |
055e99c8e70e237f9b206ad583c6d1818e551f01 | add solution-292. | wings27/leetcode-solution | com/github/wings27/leetcode_solution/s-292-nim-game.py | com/github/wings27/leetcode_solution/s-292-nim-game.py | class Solution(object):
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
return not (n % 4 == 0)
| apache-2.0 | Python | |
07b6e44da09f87dbe191b34368e9e095d1ae4786 | add util to display an object inhertance structure | skellykiernan/pylearn,skellykiernan/pylearn | VI/ch29/classtree.py | VI/ch29/classtree.py | """
climbs the inhertance tree using namespace links
"""
def classtree(cls, indent):
print('.' * indent, cls.__name__)
for supercls in cls.__bases__:
classtree(supercls, indent + 2)
def instancetree(inst):
print("Tree of {0}".format(inst))
classtree(inst.__class__, 2)
def selftest():
clas... | bsd-3-clause | Python | |
d0f26e952adc631f717e10bdbce1f959db9a2a74 | add nasp convert script | FofanovLab/VaST | VaST/nasp_convert.py | VaST/nasp_convert.py | import argparse
import os
import pandas as pd
from utils import path_type, file_type
def get_outpath(path, infile, ext="csv"):
return os.path.join(path,
"{0}.{1}".format(
os.path.splitext(
os.path.basename(infile))[0],
ext))
def parse_index(index):
return "{0}::{1}"... | mit | Python | |
f224a029a1e4909ff89fc1da0f95efedc8e3bf56 | Add main propulsion resistance propulsion script | MaritimeRenewable/PyResis | PyResis/propulsion_power.py | PyResis/propulsion_power.py | import numpy as np
from scipy import interpolate
def frictional_resistance_coef(length, speed, **kwargs):
Cf = 0.075 / (np.log10(reynolds_number(length, speed, **kwargs)) - 2) ** 2
return Cf
def reynolds_number(length, speed, temperature=25):
kinematic_viscosity = interpolate.interp1d([0, 10, 20, 25, 30... | mit | Python | |
67f82f569dbf75ee5555862e21bd1bafbaa5464b | Add command to find datasource mismatches | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/management/commands/find_datasource_mismatches.py | corehq/apps/userreports/management/commands/find_datasource_mismatches.py | from __future__ import absolute_import
from __future__ import print_function
import csv
from datetime import datetime
from django.core.management.base import BaseCommand
from corehq.apps.userreports.document_stores import get_document_store
from corehq.apps.userreports.models import get_datasource_config
from corehq... | bsd-3-clause | Python | |
a1f51eb9ae53a2361eefd5a83c1063adce573bb2 | add management command | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/management/commands/copy_web_permissions_to_all_apps.py | corehq/apps/users/management/commands/copy_web_permissions_to_all_apps.py | from django.core.management.base import BaseCommand
from corehq.apps.users.models import UserRole
from corehq.util.couch import DocUpdate, iter_update
from corehq.util.log import with_progress_bar
def _copy_permissions(role_doc):
role = UserRole.wrap(role_doc)
changed = False
permissions = role_doc['perm... | bsd-3-clause | Python | |
7b73da577fae31b35d416c30bfd0a2baf2abd8ed | Create rabbits-in-forest.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/rabbits-in-forest.py | Python/rabbits-in-forest.py | # Time: O(n)
# Space: O(n)
# In a forest, each rabbit has some color.
# Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them.
# Those answers are placed in an array.
#
# Return the minimum number of rabbits that could be in the forest.
#
# Examples:
# Input: answer... | mit | Python | |
84f824495793eaa780b6681be691fe4d5a10fc28 | Add py solution for 412. Fizz Buzz | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/fizz-buzz.py | py/fizz-buzz.py | import sys
class Solution(object):
def fizzBuzz(self, n):
"""
:type n: int
:rtype: List[str]
"""
ret = []
for i in xrange(1, n + 1):
s = ''
if i % 3 == 0:
s += 'Fizz'
if i % 5 == 0:
s += 'Buzz'
... | apache-2.0 | Python | |
bc3b9ab2c7979fc170e2e69f92cae0f778a3889c | Add post generate hook | Empiria/matador-cookiecutter | hooks/post_gen_project.py | hooks/post_gen_project.py | import os
src = '{{cookiecutter.repo_name}}/src/utils/prepare-commit-msg.py'
dst = '{{cookiecutter.repo_name}}/.git/hooks/prepare-commit-msg'
os.mkdir('{{cookiecutter.repo_name}}/.git/hooks')
os.symlink(src, dst)
| mit | Python | |
d9330450854e5fd7b7e9d038283c8fb80058cc2e | Add script to ensure the correct tile size of a file | htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID | scripts/ensure_tilesize.py | scripts/ensure_tilesize.py | #!/usr/bin/python
#
# This is a helper script to ensure an image has the correct tile size.
# It uses pgmagick[1] to read and (if needed) correct the image. To use
# it on a number of files one could use e.g. the find command:
#
# find <data-folder> -name *.jpg -exec scripts/ensure_tilesize.py {} 256 \;
#
# [1] http:... | agpl-3.0 | Python | |
3136b1ca4e33a8b6c1c2066abe1262f8a25631ab | work in progress | StanfordPL/strata,StanfordPL/strata | scripts/graphs/progress.py | scripts/graphs/progress.py | #!/usr/bin/env python
"""
Plot the progress over time
"""
import csv
import config
import matplotlib.pyplot as plt
config.setup()
# load data
x = []
y = []
with open(config.data_path + '/progress.csv', 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in spamreader:
x.... | apache-2.0 | Python | |
2410325ddd2cff5fe6ab89002635f49eacb721f9 | Add schtex | mph-/lcapy | devel/schtex.py | devel/schtex.py | #!/usr/bin/python
"""schtex V0.1
Copyright (c) 2014 Michael P. Hayes, UC ECE, NZ
Usage: schtex file.sch
"""
from optparse import OptionParser
import sys
from schematic import Schematic
def main (argv=None):
if argv is None:
argv = sys.argv
version = __doc__.split('\n')[0]
parser = OptionParse... | lgpl-2.1 | Python | |
16c9303ecc06c282eb15082b99f8eefa76fd4f18 | Add test to exercise code snippet known to cause segfault | neuroidss/nupic.core,scottpurdy/nupic.core,breznak/nupic.core,rhyolight/nupic.core,subutai/nupic.core,breznak/nupic.core,subutai/nupic.core,neuroidss/nupic.core,breznak/nupic.core,numenta/nupic.core,numenta/htmresearch-core,ywcui1990/nupic.core,utensil/nupic.core,neuroidss/nupic.core,subutai/nupic.core,numenta/htmresea... | bindings/py/tests/temporal_memory_test.py | bindings/py/tests/temporal_memory_test.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | agpl-3.0 | Python | |
e7d60f59e5bedc3a0893185303746c1cbb0d15af | Create weekday node and createweekday class | teamtaverna/core | app/api/cruds/weekday_crud.py | app/api/cruds/weekday_crud.py | from django.core.exceptions import ValidationError
import graphene
from graphene_django import DjangoObjectType
from app.timetables.models import Weekday
from .utils import get_errors
class WeekdayNode(DjangoObjectType):
original_id = graphene.Int()
class Meta:
model = Weekday
filter_fields... | mit | Python | |
7429df088ad52187be81d8cedc990b0ff1539918 | use DatetimeColumn. | dimagi/rapidsms-contrib-apps-dev,rapidsms/rapidsms-contrib-apps-dev,rapidsms/rapidsms-contrib-apps-dev,dimagi/rapidsms-contrib-apps-dev | messagelog/tables.py | messagelog/tables.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.utils.tables import Table, Column, DatetimeColumn
from .models import Message
class MessagelogTable(Table):
text = Column("Text")
who = Column("To/From", sortable=False)
direction = Column("Direction", attr="get_direction_displa... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.utils.tables import Table, Column
from .models import Message
class MessagelogTable(Table):
text = Column("Text")
who = Column("To/From", sortable=False)
date = Column("Date", template="{{ row.date|date:'d/m/Y H:i' }}")
... | bsd-3-clause | Python |
e28184e2ec2cdd4b2048f2211a874f761f71346e | Add a moksha.widgets module | mokshaproject/moksha,ralphbean/moksha,ralphbean/moksha,pombredanne/moksha,pombredanne/moksha,pombredanne/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,lmacken/moksha,mokshaproject/moksha,lmacken/moksha,pombredanne/moksha | moksha/widgets/__init__.py | moksha/widgets/__init__.py | from live import LiveWidget
from feed import Feed, LiveFeedWidget
from chat import LiveChatWidget
from flot import LiveFlotWidget
from stomp import StompWidget
from layout import LayoutWidget
| apache-2.0 | Python | |
ec04fb92ed9afdddc1d47c18b528107c2ba342f1 | add xycut in util | Transkribus/TranskribusDU,Transkribus/TranskribusDU,Transkribus/TranskribusDU | TranskribusDU/util/XYcut.py | TranskribusDU/util/XYcut.py | # -*- coding: utf-8 -*-
"""
XYcut.py
vertical/ horizontal cuts for page elements:
copyright Naver Labs Europe 2018
READ project
"""
def mergeSegments(lSegment, iMin):
"""Take as input a list of interval on some axis,
together with the object that contributed to this interval.
In... | bsd-3-clause | Python | |
941ae5a5206ffde5fdc4bed146bc68c26048a33c | fix previous (stupid) commit. | moutai/scikit-learn,potash/scikit-learn,wazeerzulfikar/scikit-learn,ssaeger/scikit-learn,Sentient07/scikit-learn,hitszxp/scikit-learn,walterreade/scikit-learn,jseabold/scikit-learn,rsivapr/scikit-learn,amueller/scikit-learn,massmutual/scikit-learn,mhue/scikit-learn,khkaminska/scikit-learn,r-mart/scikit-learn,mlyundin/s... | scikits/learn/utils/tests/test_fixes.py | scikits/learn/utils/tests/test_fixes.py | # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD
import numpy as np
from nose.tools import assert_equal
from numpy.testing import assert_array_equal
from ..fixes import _in1d, _copysign
def test_in1d():
a = np.arange(1... | # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD
import numpy as np
from nose.tools import assert_equal
from numpy.testing import assert_array_equal
from ..fixes import _in1d, _copysign
def test_in1d():
a = np.arange(1... | bsd-3-clause | Python |
c32d173fd87db9ff0a56267eea86f94603e36a02 | Add 1D kriging example (#55) | bsmurphy/PyKrige,rth/PyKrige | examples/kriging_1D.py | examples/kriging_1D.py | """
1D Kriging
An example of 1D kriging with PyKrige
"""
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
# Data taken from https://blog.dominodatalab.com/fitting-gaussian-process-models-python/
X, y = np.array([[-5.01, 1.06], [-4.90, 0.92], [-4.82, 0.35], [-4.69, 0.49], [-4.56, 0.52],
... | bsd-3-clause | Python | |
8ba9c328ffabf1f99e654679d81ded49cd329d18 | Add simple_fzf.py | frostidaho/dynmen | examples/simple_fzf.py | examples/simple_fzf.py | #!/usr/bin/env python
import dynmen
from collections import OrderedDict
from pprint import pprint
some_dict = OrderedDict((str(x), x**2) for x in range(20))
pprint(some_dict)
out_fzf = dynmen.fzf(some_dict)
pprint(out_fzf)
print('The return code from fzf was {}'.format(out_fzf.returncode))
| mit | Python | |
4e29832d5a6ace0bc0adc44a2525872f47dc9b03 | ADD a prototype for a plotting script of the learned model | mlindauer/AutoFolio | scripts/plot_config.py | scripts/plot_config.py | #!/usr/bin/env python
import logging
import sys
import os
import inspect
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
cmd_folder = os.path.realpath(os.path.join(cmd_folder, ".."))
if cmd_folder not in sys.path:
sys.path.insert(0,cmd_folder)
import pic... | bsd-2-clause | Python | |
fbc523a1ebacc72df83b519ea2025873777c0765 | Add ACL migration util | DirkHoffmann/indico,pferreir/indico,pferreir/indico,OmeGak/indico,indico/indico,indico/indico,pferreir/indico,mvidalgarcia/indico,OmeGak/indico,OmeGak/indico,ThiefMaster/indico,mic4ael/indico,indico/indico,ThiefMaster/indico,mic4ael/indico,mvidalgarcia/indico,mvidalgarcia/indico,ThiefMaster/indico,DirkHoffmann/indico,m... | indico/core/db/sqlalchemy/util/convert_acl_settings.py | indico/core/db/sqlalchemy/util/convert_acl_settings.py | # This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | mit | Python | |
6ca162237842c43ab055cd963f838374663d132f | update 1x engine | asciimoo/searx,jcherqui/searx,dalf/searx,dalf/searx,dalf/searx,asciimoo/searx,jcherqui/searx,asciimoo/searx,jcherqui/searx,asciimoo/searx,jcherqui/searx,dalf/searx | searx/engines/www1x.py | searx/engines/www1x.py | """
1x (Images)
@website http://1x.com/
@provide-api no
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, thumbnail, img_src, content
"""
from lxml import html
from searx.url_utils import urlencode, urljoin
from searx.engines.xpath import extract_text
# engine d... | """
1x (Images)
@website http://1x.com/
@provide-api no
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, thumbnail, img_src, content
"""
from lxml import html
import re
from searx.url_utils import urlencode, urljoin
# engine dependent config
categories = ['imag... | agpl-3.0 | Python |
06fd7f80952dcbd60507f6a8e6059d81dd23a41c | Create sequence_classifier.py | Kunalpod/codewars,Kunalpod/codewars | sequence_classifier.py | sequence_classifier.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Sequence classifier
#Problem level: 7 kyu
from itertools import groupby
def sequence_classifier(arr):
if len([k for k,_ in groupby(arr)]) == 1: return 5
elif sorted(arr) == arr:
if len([k for k,_ in groupby(arr)]) != len(arr): return 2
return 1... | mit | Python | |
e65855a46019b90298f137d98b8d12acc797d38e | update migration | vinta/django-email-confirm-la,vinta/django-email-confirm-la | email_confirm_la/migrations/0002_auto_20170713_1447.py | email_confirm_la/migrations/0002_auto_20170713_1447.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('email_confirm_la', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='emailconfirmation',
... | mit | Python | |
1b0e6966d6bd73598e3f9ec49a73a78b0478da10 | Document from the reality that while breaking apps down is a good idea, even then you often have a sufficient number of topic areas to cover that can't be easily split into more apps, i.e. TestCase classes are insufficient to group the relevant tests together, and a 5k tests.py file is almost certainly a bad idea. | pzrq/discover-road-runner | discover_road_runner/famishius/tests/test_vulgaris.py | discover_road_runner/famishius/tests/test_vulgaris.py | from django.test import SimpleTestCase
class OtherTest(SimpleTestCase):
"""
In reality, apps often can have so many tests this is a more practical
organising pattern.
"""
def test_success(self):
self.assertEqual(1 + 1, 2)
| mit | Python | |
4459a35fc14b09478a9b97a80c591abb4410236b | Add 242-valid-anagram.py | mvj3/leetcode | 242-valid-anagram.py | 242-valid-anagram.py | """
Question:
Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.
For example,
s = "anagram", t = "nagaram", return true.
s = "rat", t = "car", return false.
Note:
You may assume the string contains only lowercase alphabets.
Performance:
1.... | mit | Python | |
a41205d0019b584682f9a3642cc94b3a17b88c44 | Create monopoly.py | game-probability-simulator/monopoly | monopoly.py | monopoly.py | import probability
| mit | Python | |
aedf1819edd0bf1668e530cbdb7f6998410e5ada | Add some tests for url. | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/tests_urls.py | fellowms/tests_urls.py | import unittest
from django.test import Client
from django.contrib.auth.models import User
ADMIN_PASSWORD = '123456'
class SimpleTest(unittest.TestCase):
@classmethod
def setUpClass(self):
User.objects.create_superuser('admin',
'admin@fake.software.ac.uk',
... | bsd-3-clause | Python | |
923cf7266546b2e52af74be1533f276d7c441e2c | add public veyepar site to list of trusted sites to view file://s from | EricSchles/veyepar,xfxf/veyepar,EricSchles/veyepar,yoe/veyepar,CarlFK/veyepar,EricSchles/veyepar,xfxf/veyepar,yoe/veyepar,EricSchles/veyepar,xfxf/veyepar,CarlFK/veyepar,yoe/veyepar,yoe/veyepar,EricSchles/veyepar,xfxf/veyepar,CarlFK/veyepar,xfxf/veyepar,CarlFK/veyepar,yoe/veyepar,CarlFK/veyepar | set_ff_prefs.py | set_ff_prefs.py | #!/usr/bin/python
import os
import ConfigParser
home_dir = os.path.expanduser('~')
print "home dir:", home_dir
profiles_path= os.path.join(home_dir, ".mozilla","firefox","profiles.ini")
print "profiles_path:", profiles_path
# read ini file
config = ConfigParser.RawConfigParser()
config.read([profiles_path])
profile... | #!/usr/bin/python
import os
import ConfigParser
home_dir = os.path.expanduser('~')
print "home dir:", home_dir
profiles_path= os.path.join(home_dir, ".mozilla","firefox","profiles.ini")
print "profiles_path:", profiles_path
# read ini file
config = ConfigParser.RawConfigParser()
config.read([profiles_path])
profile... | mit | Python |
9adecb1bc31c40e6173927342bf3209d164b0fa6 | Add setup.py | dylanaraps/pywal,dylanaraps/pywal,dylanaraps/pywal | setup.py | setup.py | """wal - setup.py"""
from setuptools import setup
setup(
name="wal",
version="0.1",
author="Dylan Araps",
author_email="dylan.araps@gmail.com",
description="🎨 Generate and change colorschemes on the fly",
license="MIT",
url="https://github.com/dylanaraps/wal.py",
scripts=["wal"]
)
| mit | Python | |
ef7f3ef8ea9b5d6697a32abbd86e15d424ad8705 | add setup for readthedocs | blanton144/kcorrect,blanton144/kcorrect,blanton144/kcorrect,blanton144/kcorrect,blanton144/kcorrect | setup.py | setup.py | # encoding: utf-8
#
# setup.py
#
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from setuptools import setup, find_packages
import os
import argparse
import sys
NAME = 'kcorrect'
VERSION = 'dev'
RELEASE = 'dev' i... | bsd-3-clause | Python | |
ce4270ccb79a14af24475151dd55fad2a8f3d61a | Clean up setup.py | innolitics/natural-neighbor-interpolation,innolitics/natural-neighbor-interpolation,innolitics/natural-neighbor-interpolation | setup.py | setup.py | from distutils.core import setup, Extension
import numpy.distutils.misc_util
module = Extension(
'naturalneighbor',
include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs(),
library_dirs=['/usr/local/lib'],
extra_compile_args=['--std=c++11'],
sources=['_naturalneighbor.cpp', 'nn.cpp']
)
s... | from distutils.core import setup, Extension
import numpy.distutils.misc_util
module = Extension('naturalneighbor',
# include_dirs = ['/usr/local/include'],
include_dirs = numpy.distutils.misc_util.get_numpy_include_dirs(),
# libraries = ['boost'],
... | mit | Python |
8280ae8d681a805ce2a65ad2daf8617b3cd26aad | Revert "Version bump" | xeroc/python-bitshares | setup.py | setup.py | #!/usr/bin/env python3
from setuptools import setup
# Work around mbcs bug in distutils.
# http://bugs.python.org/issue10945
import codecs
try:
codecs.lookup('mbcs')
except LookupError:
ascii = codecs.lookup('ascii')
codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs'))
VERSION = '0.1.... | #!/usr/bin/env python3
from setuptools import setup
# Work around mbcs bug in distutils.
# http://bugs.python.org/issue10945
import codecs
try:
codecs.lookup('mbcs')
except LookupError:
ascii = codecs.lookup('ascii')
codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs'))
VERSION = '0.1.... | mit | Python |
c40bc3d53d135ac7d2a9ad3fe249c1b36ca66a75 | Increase version to 0.3.3 | MatteusDeloge/opengrid,MatteusDeloge/opengrid,WolfBerwouts/opengrid,JrtPec/opengrid,MatteusDeloge/opengrid,JrtPec/opengrid,WolfBerwouts/opengrid | setup.py | setup.py | # -*- coding: utf-8 -*-
"""
A setuptools based setup module for opengrid.
Adapted from
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 i... | # -*- coding: utf-8 -*-
"""
A setuptools based setup module for opengrid.
Adapted from
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 i... | apache-2.0 | Python |
6dcbcdd3405770c8f7c27a067a9bdf0ec3a4cb43 | Complete setup.py | ddsc/ddsc-logging | setup.py | setup.py | from setuptools import setup
version = '0.2.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'pika',
'setuptools',
],
tests_require = [
'coverage',
'nose',
]
setup(name='ddsc-log... | from setuptools import setup
version = '0.2.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'pika',
'setuptools',
],
tests_require = [
'coverage',
'nose',
]
setup(name='ddsc-log... | mit | Python |
df09d1722909ee92b5c4c617aeaeaccc5cbcde82 | change email for receipt | neurodata/ndio,neurodata/ndio,jhuapl-boss/intern,openconnectome/ndio,neurodata/ndio | setup.py | setup.py | from distutils.core import setup
setup(
name = 'ndio',
packages = [
'ndio',
'ndio.convert',
'ndio.ramon',
'ndio.remote',
'ndio.utils'
],
version = '0.0.1',
description = 'A Python library for neuroscience data access and manipulation.',
author = 'Jordan Ma... | from distutils.core import setup
setup(
name = 'ndio',
packages = [
'ndio',
'ndio.convert',
'ndio.ramon',
'ndio.remote',
'ndio.utils'
],
version = '0.0.1',
description = 'A Python library for neuroscience data access and manipulation.',
author = 'Jordan Ma... | apache-2.0 | Python |
36a1dd7fa4be8f93013bb14654d641a24d25e4fc | increment version to 2.0.2 | srob650/pytvmaze | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name = 'pytvmaze',
version = '2.0.2',
description = 'Python interface to the TV Maze API (www.tvmaze.com)',
url = 'https://github.com/srob650/pytvmaze',
author = 'Spencer Roberts',
author_email = 'pytvmaze@gmail.com',
license='MIT',
cl... | from setuptools import setup, find_packages
setup(
name = 'pytvmaze',
version = '2.0.1',
description = 'Python interface to the TV Maze API (www.tvmaze.com)',
url = 'https://github.com/srob650/pytvmaze',
author = 'Spencer Roberts',
author_email = 'pytvmaze@gmail.com',
license='MIT',
cl... | mit | Python |
1c1d23cda63aa1a6787dca872832be59684b6d24 | Use newer version. | PyBossa/pbs,PyBossa/pbs,PyBossa/pbs | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
try:
from pypandoc import convert
long_description = convert('README.md', 'rst')
except IOError:
print("warning: README.md not found")
long_description = ""
except ImportError:
print("warning: pypandoc module not found, cou... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
try:
from pypandoc import convert
long_description = convert('README.md', 'rst')
except IOError:
print("warning: README.md not found")
long_description = ""
except ImportError:
print("warning: pypandoc module not found, cou... | agpl-3.0 | Python |
e971e1323296051bb0ed2cead1bf58dadf183b7c | Update license classifier | wdecoster/NanoPlot,wdecoster/NanoPlot | setup.py | setup.py | # Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
exec(open('nanoplot/version.py').read())
setup(
name='NanoPlot',
version=__version__,
description='Pl... | # Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
exec(open('nanoplot/version.py').read())
setup(
name='NanoPlot',
version=__version__,
description='Pl... | mit | Python |
33207f29dc52eb9c93e960685bc7718b42d55d41 | Add joint_graph | Hashi4/vmdgadgets | vmdgadgets/joint_graph.py | vmdgadgets/joint_graph.py | ''' Make a Graphviz dot file of (rigid_body_a)->[joint]->(rigid_body_b) graph.
'''
import sys
import argparse
from collections import defaultdict
from vmdutil import pmxutil
BODY_STYLE = {0: 'solid', 1: 'dashed', 2: 'dotted'}
FONT = 'meiryo'
def make_argumentparser():
parser = argparse.ArgumentParser()
pars... | apache-2.0 | Python | |
27e0a0d9d9ca395c2456751b3428163a37b06793 | Fix typo | mortonjt/american-gut-web,mortonjt/american-gut-web,mortonjt/american-gut-web,josenavas/american-gut-web,josenavas/american-gut-web,biocore/american-gut-web,squirrelo/american-gut-web,squirrelo/american-gut-web,biocore/american-gut-web,adamrp/american-gut-web,adamrp/american-gut-web,ElDeveloper/american-gut-web,Persona... | setup.py | setup.py | #!/usr/bin/env python
# -----------------------------------------------------------------------------
# Copyright (c) 2013, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ---------------------------... | #!/usr/bin/env python
# -----------------------------------------------------------------------------
# Copyright (c) 2013, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ---------------------------... | bsd-3-clause | Python |
094e96a3eff0cdcb7f1dedb1a29ed31081882148 | Bump faker from 4.5.0 to 4.9.0 | marshmallow-code/marshmallow-jsonapi | setup.py | setup.py | import re
from setuptools import setup, find_packages
INSTALL_REQUIRES = ("marshmallow>=2.15.2",)
EXTRAS_REQUIRE = {
"tests": ["pytest", "mock", "faker==4.9.0", "Flask==1.1.2"],
"lint": ["flake8==3.8.4", "flake8-bugbear==20.1.4", "pre-commit~=2.0"],
}
EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_RE... | import re
from setuptools import setup, find_packages
INSTALL_REQUIRES = ("marshmallow>=2.15.2",)
EXTRAS_REQUIRE = {
"tests": ["pytest", "mock", "faker==4.5.0", "Flask==1.1.2"],
"lint": ["flake8==3.8.4", "flake8-bugbear==20.1.4", "pre-commit~=2.0"],
}
EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_RE... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.