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 |
|---|---|---|---|---|---|---|---|---|
faee76e0cf0093ab5ec74714683da996327c8b8d | add a script to clear the forever logs | sagemathinc/smc,tscholl2/smc,tscholl2/smc,sagemathinc/smc,sagemathinc/smc,sagemathinc/smc,DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc | salvus/scripts/clear_forever_logs.py | salvus/scripts/clear_forever_logs.py | #!/usr/bin/env python
import os
home = os.environ['HOME']
for a in os.listdir("%s/.forever"%home):
print a
open(os.path.join(home,a),'w').close()
| agpl-3.0 | Python | |
5134bc80c28d7e3b5395c1bc699b7d04c04e2398 | Create __init__.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | cloud/platform/sips/sips/__init__.py | cloud/platform/sips/sips/__init__.py | mit | Python | ||
e68214f4eb5181a61709269fcd9c0088a502c6b1 | include tests folder. Add your local tests in the future. | yousong/yappi,yousong/yappi,nirs/yappi,nirs/yappi | tests/issue21.py | tests/issue21.py | import yappi
import time
import threading
import sys
class MyThread(threading.Thread):
def run(self):
time.sleep(1)
n = 25
yappi.start()
for i in range(0,n):
c = MyThread()
c.start()
time.sleep(1)
yappi.print_stats()
yappi.stop() | mit | Python | |
432756ebb653f14bd33517668c62e9a800dcfded | add SVT-AV1 | DeadSix27/python_cross_compile_script | packages/dependencies/svt_av1.py | packages/dependencies/svt_av1.py | {
'repo_type' : 'git',
'url' : 'https://github.com/OpenVisualCloud/SVT-AV1.git',
'conf_system' : 'cmake',
'source_subfolder' : '_build',
'custom_cflag' : '-D_FORTIFY_SOURCE=0',
'configure_options' : '.. {cmake_prefix_options} -DCMAKE_INSTALL_PREFIX={target_prefix} -DBUILD_SHARED_LIBS=OFF -DCPPAN_BUILD=OFF -DCMAKE... | mpl-2.0 | Python | |
c9c7dd18ec6fd9a221013ec7bd236a88ea36f3ec | Create ttl-discovery.py | noahpowers/nlzr,noahpowers/nlzr | ttl-discovery.py | ttl-discovery.py | import re
import subprocess
ipList = []
count = 0
while count <= <number>:
ipAddr = ipList[count]
p = subprocess.Popen(["ping","-c 1",ipAddr], stdout = subprocess.PIPE)
s = p.communicate()[0]
pingback = re.compile('(.*)ttl=12(.*)\n')
matchResult = pingback.search(s)
if matchResult:
fh = open("windows-445hosts... | mit | Python | |
64135c180c68b6d413baadcd4ad5b646faad4beb | Create minimum-number-of-refueling-stops.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/minimum-number-of-refueling-stops.py | Python/minimum-number-of-refueling-stops.py | # Time: O(nlogn)
# Space: O(n)
# A car travels from a starting position to a destination
# which is target miles east of the starting position.
#
# Along the way, there are gas stations.
# Each station[i] represents a gas station that is station[i][0] miles
# east of the starting position, and has station[i][1] liter... | mit | Python | |
1e1d7291ccfd27f7cf3748a0d8cb1dd7ef131b3a | add multiprocessing01.py | devlights/try-python | trypython/stdlib/multiprocessing01.py | trypython/stdlib/multiprocessing01.py | # coding: utf-8
"""
multiprocessingモジュールについてのサンプルです。
"""
import multiprocessing
import os
import time
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# multiprocessingモジュール
# threadingと似た構成を持つモジュール。t... | mit | Python | |
3c4d2fc6f2cdeba074511fb591134014cf77032d | Add tests for ansible.module_utils.known_hosts | thaim/ansible,thaim/ansible | test/units/module_utils/basic/test_known_hosts.py | test/units/module_utils/basic/test_known_hosts.py | # -*- coding: utf-8 -*-
# (c) 2015, Michael Scherer <mscherer@redhat.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at ... | mit | Python | |
dc8c8311c6d1c2f8989b0bac89176d48dcb59a41 | Create new package. (#7674) | LLNL/spack,LLNL/spack,EmreAtes/spack,tmerrick1/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,krafczyk/spack,tmerrick1/spack,mfherbst/spack,krafczyk/spack,mfherbst/spack,matthiasdiener/spack,krafczyk/spack,iulian787/spack,EmreAtes/spack,iulian787/spack,matthiasdiener/spack,EmreAtes/spack,tmerrick1/spack,mfherbst... | var/spack/repos/builtin/packages/wgsim/package.py | var/spack/repos/builtin/packages/wgsim/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 | |
26154a7f21bf2eaa8af9293d0dff6c6b94f32ecf | add some admin blankage migration | MadeInHaus/django-social,MadeInHaus/django-social,MadeInHaus/django-social,MadeInHaus/django-social | social/migrations/0010_make_blank.py | social/migrations/0010_make_blank.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('social', '0009_auto_20141215_2239'),
]
operations = [
migrations.AlterField(
model_name='twittermessage',
... | mit | Python | |
1263bf8dd374afe04735948e767bb31813d99077 | Add test of PIV read/write object cycle | Yubico/yubikey-manager,Yubico/yubikey-manager | test/on_yubikey/cli_piv/test_read_write_object.py | test/on_yubikey/cli_piv/test_read_write_object.py | import os
import unittest
from ..framework import cli_test_suite
from ykman.piv import OBJ
from .util import DEFAULT_MANAGEMENT_KEY
@cli_test_suite
def additional_tests(ykman_cli):
class ReadWriteObject(unittest.TestCase):
def setUp(cls):
ykman_cli('piv', 'reset', '-f')
pass
... | bsd-2-clause | Python | |
a7d8733c1d357f0c2da8f373dd3b3be08faa559c | Test partitioning, all OK | benvermaercke/klustakwik2,kwikteam/klustakwik2 | klustakwik2/tests/test_partitioning.py | klustakwik2/tests/test_partitioning.py | from numpy import *
from klustakwik2 import *
from numpy.testing import assert_raises, assert_array_almost_equal, assert_array_equal
from nose import with_setup
from nose.tools import nottest
from numpy.random import randint, rand
from test_mask_starts import generate_multimask_test_data
def test_partitioning():
... | bsd-3-clause | Python | |
6506f185b3dd69e2502a0f4676235b300dfebc91 | add simple benchmark script for mock kinect | rjw57/streamkinect2 | scripts/benchmark_mock_kinect.py | scripts/benchmark_mock_kinect.py | from logging import getLogger
import time
from streamkinect2.mock import MockKinect
from streamkinect2.compress import DepthFrameCompresser
def main():
wait_time = 5
print('Running mock kinect for {0} seconds...'.format(wait_time))
state = { 'n_frames': 0 }
with MockKinect() as kinect:
then =... | bsd-2-clause | Python | |
5182a8939f1d305b34205b0a627a7ead6aeb6fbe | fix setup.py | lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview | pr_inversion/src/setup.py | pr_inversion/src/setup.py | """
Setup script for the P(r) inversion module
"""
import sys
import os
# Then build and install the modules
from distutils.core import setup, Extension
from numpy.distutils.misc_util import get_numpy_include_dirs
numpy_incl_path = os.path.join(get_numpy_include_dirs()[0], "numpy")
#numpy_incl = "Lib\sit... | bsd-3-clause | Python | |
bb0df32c45be4fbeac925dfa012eff51cc75d757 | Add migration | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fat/migrations/0063_auto_20160809_1545.py | fat/migrations/0063_auto_20160809_1545.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-09 15:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fat', '0062_auto_20160809_1541'),
]
operations = [
migrations.RenameModel(
... | bsd-3-clause | Python | |
df8f5fbd90ddc283d188e41cc1eabe2657406bbe | Create Numberof1Bits.py | lingcheng99/LeetCode | Numberof1Bits.py | Numberof1Bits.py | """
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return 3.
"""
class Solution(object):
def hammingWeight(self, n):... | mit | Python | |
547f22e688c0b3d1c493753d76c75fb44d1b6fdf | Remove test_importers from plumbing/tests/units/__init__.py (close #23). | scottlittle/solar_radiation_model,ahMarrone/solar_radiation_model,gersolar/solar_radiation_model | imagedownloader/plumbing/tests/units/__init__.py | imagedownloader/plumbing/tests/units/__init__.py | from test_collectorschannel import *
from test_collectorstimed import *
from test_files import * | from test_collectorschannel import *
from test_collectorstimed import *
from test_files import *
from test_importers import * | mit | Python |
76040eef4d314f5f4a2bcafed064ef5aa6bc7dc1 | add files to zip or list files in folder. | LairdStreak/MyPyPlayGround,LairdStreak/MyPyPlayGround,LairdStreak/MyPyPlayGround | pyZipper/dozipfiles.py | pyZipper/dozipfiles.py | import zipfile
import os
working_folder = 'C:\\dev\\Testing\\'
for subdir, dirs, files in os.walk(working_folder):
for file in files:
print(os.path.join(subdir, file))
files = os.listdir(working_folder)
files_py = []
for f in files:
if f.endswith('py'):
fff = os.path.join(working_folder, f... | mit | Python | |
5b0139a9aeb7f652b22966f310d181a0c9e289f7 | Add NumPy benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/stats/base/dsum/benchmark/python/numpy/benchmark.py | lib/node_modules/@stdlib/stats/base/dsum/benchmark/python/numpy/benchmark.py | #!/usr/bin/env python
#
# @license Apache-2.0
#
# Copyright (c) 2020 The Stdlib 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
#
# ... | apache-2.0 | Python | |
977e9ef8d6e23a2221cfb6697edf8698b8849ef6 | Add class LivingSpace | EdwinKato/Space-Allocator,EdwinKato/Space-Allocator | src/living_space.py | src/living_space.py | from .room import Room
class LivingSpace(Room):
def __init__(self, room_type, room_name):
super(LivingSpace, self).__init__(room_type, room_name)
| mit | Python | |
cee22ec7d8fc36df823bd56e6f23ab365e5bd0da | fix compound interactions. | jaruba/chromium.src,Chilledheart/chromium,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk,mogoweb/chromium-crosswalk,nacl-webkit/chrome_deps,axinging/chromium-crosswalk,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crossw... | tools/telemetry/telemetry/compound_interaction.py | tools/telemetry/telemetry/compound_interaction.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import page_interaction
class CompoundInteraction(page_interaction.PageInteraction):
def __init__(self, attributes=None):
super(Comp... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import page_interaction
class CompoundInteraction(page_interaction.PageInteraction):
def __init__(self, attributes=None):
super(Comp... | bsd-3-clause | Python |
87fa7c15fc1f529debf7b010a5e3cd8ee4fb3f04 | Add adiak package, version 0.1.1 | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/adiak/package.py | var/spack/repos/builtin/packages/adiak/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 Adiak(CMakePackage):
"""Adiak collects metadata about HPC application runs and provides it... | lgpl-2.1 | Python | |
34cf796b54de4465ff329d52b9b5bf2b43b41e4f | Create new package. (#6700) | mfherbst/spack,iulian787/spack,iulian787/spack,tmerrick1/spack,matthiasdiener/spack,krafczyk/spack,krafczyk/spack,mfherbst/spack,tmerrick1/spack,LLNL/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,mfherbst/spack,LLNL/spack,EmreAtes/spack,krafczyk/spack,iulian787/spack,LLNL/spack,krafczyk/spack,matthiasdiener/spa... | var/spack/repos/builtin/packages/mefit/package.py | var/spack/repos/builtin/packages/mefit/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 | |
64f728b55fad1221c10e7a39bb8cdb5dd9ec2ac8 | Create pytest.py | dreamsxin/icomet,dreamsxin/icomet,ideawu/icomet,dreamsxin/icomet,dreamsxin/icomet,ideawu/icomet,ideawu/icomet,dreamsxin/icomet,dreamsxin/icomet | demo/pytest.py | demo/pytest.py | import pycurl
class Test:
def body_callback(self, buf):
if buf!="" :
print buf#此处为接受到数据后的逻辑处理 略。。
if __name__ == "__main__":
url = 'http://127.0.0.1:8100/stream?cname=12'#stream不能变 cname可变
t = Test()
c = pycurl.Curl()
c.setopt(c.URL, url... | bsd-3-clause | Python | |
4aabc0aa265ab71bf1b65d98fc4b0fbf1114ff84 | prepare FrameLog class skeleton | CaptainDesAstres/Blender-Render-Manager,CaptainDesAstres/Simple-Blender-Render-Manager | TaskList/TaskLog/FrameLog.py | TaskList/TaskLog/FrameLog.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage task Frame log'''
import xml.etree.ElementTree as xmlMod
class TaskLog:
'''class to manage task frame log'''
def __init__(self, xml = None):
'''initialize task frame object'''
if xml is None:
self.defaultInit()
else:
self.fromXml(xml)
... | mit | Python | |
e419ae979fc59af758c5fe93bde7add47dcf21df | Add base class for profile writer plugins | onitake/Uranium,onitake/Uranium | UM/Settings/ProfileWriter.py | UM/Settings/ProfileWriter.py | # Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.PluginObject import PluginObject
## Base class for profile writer plugins.
#
# This class defines a write() function to write profiles to files with.
class ProfileWriter(PluginObject):
## Initialises the... | agpl-3.0 | Python | |
a61d86d235d3968898911596df594f93fe96d7e5 | Test suite used for testing the Component level API for fixed box sizes | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | Sketches/MPS/Synchronous.py | Sketches/MPS/Synchronous.py | #!/usr/bin/python
import Axon
import time
from Kamaelia.Chassis.Pipeline import Pipeline
class MySender(Axon.Component.component):
def main(self):
while 1:
yield 1
sent = False
print "-----------------------------------------------------------------------"
w... | apache-2.0 | Python | |
1663cb8557de85b1f3ccf5822fa01758e679ccd7 | Test script for the stress test | zrma/EasyGameServer,zeliard/EasyGameServer,zeliard/EasyGameServer,zrma/EasyGameServer,Lt-Red/EasyGameServer,Lt-Red/EasyGameServer | TestScript/multi_client.py | TestScript/multi_client.py | # -*- coding: utf-8 -*-
__author__ = 'sm9'
import asyncore, socket
import string, random
import struct, time
HOST = '192.168.0.11'
PORT = 9001
PKT_CS_LOGIN = 1
PKT_SC_LOGIN = 2
PKT_CS_CHAT = 3
PKT_SC_CHAT = 4
def str_generator(size=128, chars=string.ascii_uppercase + string.digits):
return... | mit | Python | |
3a3f529498522dada5e6af6765cd537f47d368d8 | Test utility to look for bad stacksize calculations. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Tools/compiler/stacktest.py | Tools/compiler/stacktest.py | import compiler
import dis
import types
def extract_code_objects(co):
l = [co]
for const in co.co_consts:
if type(const) == types.CodeType:
l.append(const)
return l
def compare(a, b):
if not (a.co_name == "?" or a.co_name.startswith('<lambda')):
assert a.co_name == b.co_nam... | mit | Python | |
4e548cb4115131bcad1ebab5ea24cde325af9861 | add tests/olpc-buddy-search.py | community-ssu/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,mlundblad/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,community-ssu/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,j... | tests/olpc-buddy-search.py | tests/olpc-buddy-search.py | """test OLPC search buddy"""
import base64
import errno
import os
import dbus
# must come before the twisted imports due to side-effects
from gabbletest import go, make_result_iq
from servicetest import call_async, lazy, match, tp_name_prefix, unwrap, Event
from twisted.internet.protocol import Factory, Protocol
fro... | lgpl-2.1 | Python | |
275f15844433fde67b2e5f6126e313e1e3b5769b | Create count-different-palindromic-subsequences.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/count-different-palindromic-subsequences.py | Python/count-different-palindromic-subsequences.py | # Time: O(n^2)
# Space: O(n)
class Solution(object):
def countPalindromicSubsequences(self, S):
"""
:type S: str
:rtype: int
"""
def dp(i, j, prv, nxt, lookup):
if lookup[i][j] is not None:
return lookup[i][j]
result = 1
i... | mit | Python | |
4b040d8d55c427e0ab0855da9a49a9460811b46e | add test_roi_max_pooling_2d.py | chainer/chainer,ktnyt/chainer,tkerola/chainer,keisuke-umezawa/chainer,niboshi/chainer,ktnyt/chainer,hvy/chainer,jnishi/chainer,chainer/chainer,okuta/chainer,keisuke-umezawa/chainer,hvy/chainer,keisuke-umezawa/chainer,chainer/chainer,niboshi/chainer,niboshi/chainer,okuta/chainer,ktnyt/chainer,jnishi/chainer,chainer/chai... | tests/chainer_tests/functions_tests/pooling_tests/test_roi_max_pooling_2d.py | tests/chainer_tests/functions_tests/pooling_tests/test_roi_max_pooling_2d.py | import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'dtype': [numpy.float16, numpy.float32, numpy.float64]
}))
class Te... | mit | Python | |
268a21beb8528eb66e9ea2d46815653c9c1812fc | Add initial version for goals-per-game analysis | leaffan/pynhldb | analysis/_goals_per_game.py | analysis/_goals_per_game.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from collections import defaultdict
import requests
from lxml import html
URL_TEMPLATE = "http://www.hockey-reference.com/leagues/NHL_%d.html"
overall_sum_games_played = 0
overall_sum_goals_scored = 0
games_goals_per_year = defaultdict(dict)
goal_leaders =... | mit | Python | |
63709e388ed86892e9771b86daad4a9ec3c0bd44 | Remove import of specific models | jrsmith3/ibei | ibei/__init__.py | ibei/__init__.py | # -*- coding: utf-8 -*-
"""
Base Library (:mod:`ibei`)
==========================
.. currentmodule:: ibei
"""
from .version import __version__
from .uibei import uibei
| # -*- coding: utf-8 -*-
"""
Base Library (:mod:`ibei`)
==========================
.. currentmodule:: ibei
"""
from .version import __version__
from .uibei import uibei
from .sqsolarcell import SQSolarcell
from .devossolarcell import DeVosSolarcell
| mit | Python |
3ef6a9d7d40dd66c89fd3e5c309ad76b5d4e836c | Add unittests for faultwrap middleware | miguelgrinberg/heat,JioCloud/heat,takeshineshiro/heat,pshchelo/heat,jasondunsmore/heat,dragorosson/heat,rh-s/heat,maestro-hybrid-cloud/heat,pratikmallya/heat,miguelgrinberg/heat,rickerc/heat_audit,NeCTAR-RC/heat,cwolferh/heat-scratch,cryptickp/heat,openstack/heat,steveb/heat,gonzolino/heat,rh-s/heat,citrix-openstack-bu... | heat/tests/test_fault_middleware.py | heat/tests/test_fault_middleware.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python | |
1ccb86512d6e6486456dc3c92be0dce96edf463b | add safe version of hypot | minghuascode/pyj,minghuascode/pyj,gpitel/pyjs,pyjs/pyjs,pombredanne/pyjs,pombredanne/pyjs,spaceone/pyjs,lancezlin/pyjs,spaceone/pyjs,pyjs/pyjs,minghuascode/pyj,spaceone/pyjs,spaceone/pyjs,pombredanne/pyjs,pombredanne/pyjs,lancezlin/pyjs,gpitel/pyjs,gpitel/pyjs,Hasimir/pyjs,minghuascode/pyj,Hasimir/pyjs,pyjs/pyjs,gpitel... | pyjs/src/pyjs/lib/math.py | pyjs/src/pyjs/lib/math.py | from __pyjamas__ import JS
def ceil(x): return float(JS("Math.ceil(@{{x}}.valueOf())"))
def fabs(x): return float(JS("Math.abs(@{{x}}.valueOf())"))
def floor(x): return float(JS("Math.floor(@{{x}}.valueOf())"))
def exp(x): return float(JS("Math.exp(@{{x}}.valueOf())"))
def log(x, base=None):
if base is None:
... | from __pyjamas__ import JS
def ceil(x): return float(JS("Math.ceil(@{{x}}.valueOf())"))
def fabs(x): return float(JS("Math.abs(@{{x}}.valueOf())"))
def floor(x): return float(JS("Math.floor(@{{x}}.valueOf())"))
def exp(x): return float(JS("Math.exp(@{{x}}.valueOf())"))
def log(x, base=None):
if base is None:
... | apache-2.0 | Python |
9fd4574e6ef02626a61915d8143d93c27b4b4580 | add migration | joshpelkey/cfbets,joshpelkey/cfbets,joshpelkey/cfbets | cfbets/bets/migrations/0004_auto_20170618_2001.py | cfbets/bets/migrations/0004_auto_20170618_2001.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-06-19 00:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bets', '0003_auto_20170115_1704'),
]
operations = [
migrations.AlterModelOptions(
... | apache-2.0 | Python | |
a5b1c82467cc1093b6d4c61da0766dd54038109b | Create 06.Sums3Numbers.py | stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity | .ProgramingBasics/SampleCoding101Exam-Jan2016/06.Sums3Numbers.py | .ProgramingBasics/SampleCoding101Exam-Jan2016/06.Sums3Numbers.py | num1 = int(input())
num2 = int(input())
num3 = int(input())
minimum = min(num1, num2, num3)
maximum = max(num1, num2, num3)
sum = num1 + num2 + num3
mid = sum - minimum - maximum
if minimum + mid == maximum:
print("%d + %d = %d" % (minimum, mid, maximum))
else:
print("No")
| mit | Python | |
3cd167e94b402dbfdeb2520a0b17ffafe0d0292c | Create janebob.py | JaneBob/Demo-Video | janebob.py | janebob.py | import jimbobimport unittestdef three_times_x_plus_two(x): y = jimbob.threetimes(x) if y is None: return None else: return y + 2class MyTest(unittest.TestCase): def test(self): self.assertEqual(three_times_x_plus_two(3), 11) self.assertEqual(three_times_x_plus_two(3.1), 11.3) ... | mit | Python | |
5a2e3da28fa2471d97b5d0e1b3cae76602dc9c79 | Create small script to compute distance to some US holidays | davidgasquez/kaggle-airbnb | snippets/list_holidays.py | snippets/list_holidays.py | import pandas as pd
from datetime import date
import holidays
def process_holidays(df):
year = df['year']
user_date = date(year, df['month'], df['day'])
hd = holidays.US(years=year)
for holiday_date, name in hd.iteritems():
days = (holiday_date - user_date).days
# Get the real data for... | mit | Python | |
235c83047f36f26b4b27c592ccc3656a98785508 | add scope extractor processor | SUNET/SATOSA,irtnog/SATOSA,SUNET/SATOSA,its-dirg/SATOSA,irtnog/SATOSA | src/satosa/micro_services/processors/scope_extractor_processor.py | src/satosa/micro_services/processors/scope_extractor_processor.py | from ..attribute_processor import AttributeProcessorError
from .base_processor import BaseProcessor
CONFIG_KEY_MAPPEDATTRIBUTE = 'mapped_attribute'
CONFIG_DEFAULT_MAPPEDATTRIBUTE = ''
class ScopeExtractorProcessor(BaseProcessor):
"""
Extracts the scope from a scoped attribute and maps that to
another a... | apache-2.0 | Python | |
1328a9bad53105930479c900aa1b6b0a3f388304 | load MmDL.model and test | lheadjh/MultimodalDeepLearning | ver_keras/mdl_load_test.py | ver_keras/mdl_load_test.py | __author__ = 'jhlee'
from keras.models import Graph, Sequential
from keras.preprocessing import sequence
from keras.utils import np_utils
from keras.utils.np_utils import accuracy
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import... | mit | Python | |
15d3b72c91b1476eee3541647061bea4ce5525ba | add content type models | podhub-io/website | podhub/website/models/content.py | podhub/website/models/content.py | from sqlalchemy.dialects.postgresql import UUID
from podhub.website import db
from . import Base
tags = db.Table(
'tags',
db.Column('tag_id', UUID, db.ForeignKey('tag.id')),
db.Column('podcast_id', UUID, db.ForeignKey('podcast.id'))
)
class Podcast(Base):
language = db.Column(db.String(80))
subti... | apache-2.0 | Python | |
e6c79dc248d51b38da2d6fa0e92468176b0b21bc | Remove unused fields from model and drop columns from db | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | migrations/versions/1010_remove_unused_fields.py | migrations/versions/1010_remove_unused_fields.py | """Remove unused fields
Revision ID: 1010
Revises: 1000
Create Date: 2017-10-04 15:14:48.532073
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '1010'
down_revision = '1000'
def upgrade():
op.drop_column('contact... | mit | Python | |
28d1c6be31d804310c6c16ea26b9e35ba94da9eb | Fix bug with Eventual | aliasfalse/rowboat,aliasfalse/rowboat,b1naryth1ef/rowboat,b1naryth1ef/rowboat,aliasfalse/rowboat,ThaTiemsz/jetski,aliasfalse/rowboat,ThaTiemsz/jetski,ThaTiemsz/jetski,b1naryth1ef/rowboat,ThaTiemsz/jetski,b1naryth1ef/rowboat | rowboat/util/timing.py | rowboat/util/timing.py | import time
import gevent
from gevent.lock import Semaphore
from datetime import datetime
class Eventual(object):
"""
A function that will be triggered eventually.
"""
def __init__(self, func):
self.func = func
self._next = None
self._t = None
def wait(self, nxt):
... | import time
import gevent
from gevent.lock import Semaphore
from datetime import datetime
class Eventual(object):
"""
A function that will be triggered eventually.
"""
def __init__(self, func):
self.func = func
self._next = None
self._t = None
def wait(self, nxt):
... | mit | Python |
aaf22baad2d0b361e01b8eb2c10de5d03875ecb6 | make project: re-build generic files of the searx project | dalf/searx,dalf/searx,dalf/searx,asciimoo/searx,asciimoo/searx,asciimoo/searx,asciimoo/searx,dalf/searx | searx/brand.py | searx/brand.py | GIT_URL = 'https://github.com/asciimoo/searx'
SEARX_URL = 'https://searx.me'
DOCS_URL = 'https://asciimoo.github.io/searx'
PUBLIC_INSTANCES = 'https://searx.space'
| agpl-3.0 | Python | |
7b1fb12caa08c2f109d60fce78cbf8ab96ba5365 | add moth brain viewer for brain structure and LAL-VPC area | neuroinformatics/bah2015_registration,neuroinformatics/bah2015_registration,neuroinformatics/bah2015_registration | vtk_test/draw_mothbrain.py | vtk_test/draw_mothbrain.py | import vtk
obj_filename = '/mnt/data1/StandardBrain/SB/SB256.obj'
obj2_filename = '../obj/slice.obj'
png_filename = 'CD21594.1-Prlr.png'
plot_filename = '../analysis_obj/tmp.vtk'
#plot_filename = 'mousebrain_small1000.vtk'
poly_filename = '/media/nebula/data/bah/vtk/seg00001.vtk'
plane_scale = 25
plane_ratio = 385. / ... | mit | Python | |
2b9b86a425b9a33d6de3e3ad7ce9a08df05900ec | Add VoxelReader | jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools | problem/pixel/volcanic_voxels.py | problem/pixel/volcanic_voxels.py | #! /usr/bin/env python
from collections import namedtuple
import random
import numpy as np
Voxel = namedtuple('Voxel', 'x y z')
class VoxelReader:
"""Turns text input into a list of Voxels."""
def __init__(self, text: str):
depth = 1 + int(max(text))
lines = text.splitlines()
heig... | mit | Python | |
7725b554629461bc58a996faecc08b2cc33026bf | Create Login, Registeration and ChangePassword forms for user blueprint | dylanshine/streamschool,dylanshine/streamschool | project/user/forms.py | project/user/forms.py | from flask_wtf import Form
from wtforms import TextField, PasswordField
from wtforms.validators import DataRequired, Email, Length, EqualTo
from project.models import User
class LoginForm(Form):
email = TextField('email', validators=[DataRequired(), Email()])
password = PasswordField('password', validators=[... | mit | Python | |
14a1e5fb2afe9c372646ce26a9b2b92c517067b3 | Add initial version of forge download scraper | jbeda/itzg-dockerfiles,zerocoolys/dockerfiles-1,sekka1/dockerfiles,zerocoolys/dockerfiles-1,jbeda/itzg-dockerfiles,jbeda/itzg-dockerfiles,ajthemacboy/dockerfiles,itzg/dockerfiles,sekka1/dockerfiles,sekka1/dockerfiles,zerocoolys/dockerfiles-1 | minecraft-server/minecraftforge_spider.py | minecraft-server/minecraftforge_spider.py | # -*- coding: utf-8 -*-
import scrapy
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
from scrapy.selector import Selector
import re
class Forge(scrapy.Item):
versions = scrapy.Field()
latest = scrapy.Field()
class ForgeVersions(scrapy.Item):
i... | apache-2.0 | Python | |
fddf32e014ea3026a4a212d12d9b6e7e70b5341d | Create post.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | gateway/src/post.py | gateway/src/post.py | #!/usr/bin/env python
import requests
HTTP POST message to cloud platform
| mit | Python | |
2d8082346769906d48359d5c196b1ba55dab4288 | add auto-update-webpage | kiya-z/Kython | gray-hat-python/auto-update-webpage.py | gray-hat-python/auto-update-webpage.py | #coding:utf-8
import webbrowser
import threading
from sys import exit
def updateKX():
webbrowser.open('http://bbs.pediy.com',new=0)
global t #Notice: use global variable!
t = threading.Timer(300.0, updateKX)
t.start()
global i
i += 1
print i
if i ... | apache-2.0 | Python | |
027aa7152e3873c3bfa96c04e4d2ea0b6c345020 | Add the usage example of sqlalchemy ORM. | xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet | snippet/example/python/sqlalchemy-orm-example.py | snippet/example/python/sqlalchemy-orm-example.py | # encoding: utf8
from __future__ import print_function
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
id = Column(Integer, prima... | mit | Python | |
c58a30b5b410595b76aebc8db7025a49b231b75b | Add script to print time of most recent gobble. | foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm | scripts/most_recent.py | scripts/most_recent.py | from datetime import datetime
from optparse import OptionParser
from urllib2 import urlopen
from BeautifulSoup import BeautifulSoup
if __name__ == '__main__':
usage = "%prog <USERNAME> <WEB SERVER>"
parser = OptionParser(usage=usage)
opts,args = parser.parse_args()
if len(args) != 2:
parser.e... | agpl-3.0 | Python | |
febfaffb2bdbb9529cbb7df004b62ae8a2a07ad0 | Add example, Jeffress net with 180 neurons | timqian/neurons,johannesmik/neurons | tests/test_jeffress_big.py | tests/test_jeffress_big.py | """
In this test we create a bigger Jeffress model.
- It consists of 180 output neurons.
- The axonal delay between the input neurons and the inter-layer neurons are sampled from 0ms to 100ms.
- We create the same spiketrain with 50 ms difference between the two input neurons.
One can see that the better the weigh... | bsd-2-clause | Python | |
d64682c3c531fbcd51d075f972e4f8818fbd227b | Add simple benchmark. | google-research/torchsde | benchmarks/brownian_path.py | benchmarks/brownian_path.py | import argparse
import logging
import time
import numpy.random as npr
import torch
import torchsde
import brownian_lib # Requires installing the C++ extension.
t0, t1 = 0.0, 1.0
reps, steps = 10, 1000
small_batch_size, small_d = 128, 5
large_batch_size, large_d = 512, 128
def _compare(w0, ts, msg=''):
bm = b... | apache-2.0 | Python | |
a4d28a5a34761270188ff3f6262f760cff845197 | Create kruskal.py | NKPyo/kruskal | kruskal.py | kruskal.py | import math
import networkx as grapher
import random as random
class ufds: # class for union-find data structure
def __init__(self, nodes):
self._set = dict((node, node) for node in nodes) # the set id
self.length = dict((node, 1) for node in nodes) # size of the set
self.items = dict((... | mit | Python | |
518cbba1e5b6b25568205be6d299b59d9ccd6cca | add test_views_list.py | vicalloy/django-lb-workflow,vicalloy/django-lb-workflow,vicalloy/django-lb-workflow | lbworkflow/tests/test_views_list.py | lbworkflow/tests/test_views_list.py | from django.core.urlresolvers import reverse
from .test_base import BaseTests
class ViewTests(BaseTests):
def test_my_wf(self):
self.client.login(username='owner', password='password')
resp = self.client.get(reverse('wf_my_wf'))
self.assertEqual(resp.status_code, 200)
def test_list_... | mit | Python | |
ac9b4a1f4eb862e3f401f322b4a06f3e5698cc40 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/contains_duplicate_ii/py/solution.py | leetcode/easy/contains_duplicate_ii/py/solution.py | class Solution(object):
def containsNearbyDuplicate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
indices = sorted(range(len(nums)), key=lambda x: nums[x])
for i in range(1, len(indices)):
if (abs(indices[i] - ind... | mit | Python | |
e468d35b17d4137e4f71e250aaeba022c74a0cab | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/medium/flatten_binary_tree/py/solution.py | leetcode/medium/flatten_binary_tree/py/solution.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def flatten(self, root):
"""
:type root: TreeNode
:rtype: void Do not return anything, modify roo... | mit | Python | |
b248320bd78308dd8ee0a4b87421a60cf2e0e9bb | Update version number | andy-d-palmer/pyIMS,alexandrovteam/pyImagingMSpec | pyImagingMSpec/__init__.py | pyImagingMSpec/__init__.py | __version__ = u'0.1.2'
| __version__ = u'0.1.1'
| apache-2.0 | Python |
94beb154c786c2b79ae79ec3dc4fe5a492ae1e2b | delete contact operation | alexshepard/aledison | delete_contact.py | delete_contact.py | #!/usr/bin/python
import yaml
config = yaml.safe_load(open("config.yml"))
from contacts import Contacts, Contact
c = Contacts()
# syntax: add_contact.py <name> <number>
import sys
if len(sys.argv) < 2:
print("usage: delete_contact.py <name>")
sys.exit()
script_name = sys.argv.pop(0)
name = sys.argv.pop(0)
conta... | mit | Python | |
e2d381c92e1320d7eeb8c377269b7038f7f8b7c4 | Add API tests | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | rnacentral/apiv1/tests.py | rnacentral/apiv1/tests.py | """
Copyright [2009-2014] 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... | apache-2.0 | Python | |
169b18dc7e702cbae86bb4c1722470dd6e5a1824 | refactor the request helpers out of client | ceph/radosgw-agent,ceph/radosgw-agent | radosgw_agent/request.py | radosgw_agent/request.py | import boto
import logging
from boto.connection import AWSAuthConnection
log = logging.getLogger(__name__)
class MetaData(object):
"""
A basic container class that other than the method, it just registers
all the keyword arguments passed in, so that it is easier/nicer to
re-use the values
"""
... | mit | Python | |
e7335ae5469ad090b7e7ccfe3bf417f12318b2ec | Add snooper server | frostyfrog/mark2,frostyfrog/mark2,SupaHam/mark2,SupaHam/mark2 | snoop_serve.py | snoop_serve.py | import re
from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.internet import reactor
class SnoopResource(Resource):
isLeaf = True
def render_POST(self, request):
d = {}
for k, v in request.args.iteritems():
v = v[0]
if re.match('^... | mit | Python | |
6e64fff28776d7a589890c989a044f9c7ee8430a | add loading pix2pix shoes, bags image | kozistr/Awesome-GANs | DiscoGAN/dataset.py | DiscoGAN/dataset.py | from __future__ import division
import tensorflow as tf
dirs = {
'pix2pix_shoes': '/home/zero/pix2pix/shoes/*.jpg',
'pix2pix_bags': '/home/zero/pix2pix/bags/*.jpg'
}
class Dataset:
def __init__(self, batch_size=256, input_height=64, input_width=64, input_channel=3,
num_threads=8):
... | mit | Python | |
fa9ae87f5adf9d8797068b842114ef9fc15e5af0 | add other.py file | hackerspace-silesia/cebulany-manager,hackerspace-silesia/cebulany-manager,hackerspace-silesia/cebulany-manager,hackerspace-silesia/cebulany-manager | cebulany/resources/other.py | cebulany/resources/other.py | from cebulany.resources.model import ModelResource
from cebulany.models import Other
class OtherResource(ModelResource):
cls = Other
| mit | Python | |
4002633b5a48d825357d38d13588c7b45316216d | Create __init__.py | selvakarthik21/newspaper,selvakarthik21/newspaper | newspaperdemo/newspaper-source/videos/__init__.py | newspaperdemo/newspaper-source/videos/__init__.py | mit | Python | ||
8ab54095a957cba8126daabc42cd438448c12df8 | Add CsoParser | tipsqueal/duwamish-sensor,illumenati/duwamish-sensor | cso_parser.py | cso_parser.py | import csv
import logging
import logging.handlers
import threading
import time
import traceback
import requests
formatter = logging.Formatter('%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s')
logger = logging.getLogger('cso_parser')
logger.setLevel(logging.INFO)
logger.propagate = 0
file_handler = logging.handle... | mit | Python | |
2a51077d78b7b30a1ca751595b6872b9532b070c | Add a script to help to refactor source code. | YanShenChun/cppthread,YanShenChun/cppthread,YanShenChun/cppthread | zthread/refactor/rename.py | zthread/refactor/rename.py | #!/usr/bin/env python
import re,glob,os,sys
def rename(dir_path, search_pattern):
for file_path in glob.iglob(os.path.join(dir_path, search_pattern)):
title, ext = os.path.splitext(os.path.basename(file_path))
res = "_".join([s.group(0).lower() for s in
re.finditer(r"[A-Z][a-z]+", tit... | mit | Python | |
52ca0942faaa52138805f966cb0b242009516a06 | Add py solution for 322. Coin Change | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/coin-change.py | py/coin-change.py | class Solution(object):
def coinChange(self, coins, amount):
"""
:type coins: List[int]
:type amount: int
:rtype: int
"""
min_count = [0] * (amount + 1)
for c in coins:
if c <= amount:
min_count[c] = 1
for i in xrange(min(co... | apache-2.0 | Python | |
f30304ec4b417ef05bc0b828990d04dbfd2b4223 | create the Spider for Bulgaria of McDonalds | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/mcdonalds_bg.py | locations/spiders/mcdonalds_bg.py | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonalsBGSpider(scrapy.Spider):
name = "mcdonalds_bg"
allowed_domains = ["mcdonalds.bg"]
start_urls = (
'http://mcdonalds.bg/map/',
)
def parse(self, response):
stores ... | mit | Python | |
e7d2b2a4e6a1c2ba4efe09517b90ec320ccb291e | create net and forward prop, part1 | hughperkins/pub-prototyping,hughperkins/pub-prototyping,hughperkins/pub-prototyping,hughperkins/pub-prototyping,hughperkins/pub-prototyping,hughperkins/pub-prototyping,hughperkins/pub-prototyping | py/pytorch/net.py | py/pytorch/net.py | import torch
from torch import autograd, nn
import torch.nn.functional as F
batch_size = 5
input_size = 3
hidden_size = 4
num_classes = 2
torch.manual_seed(123)
input = autograd.Variable(torch.rand(batch_size, input_size))
print('input', input)
class Model(nn.Module):
def __init__(self, input_size, hidden_size,... | apache-2.0 | Python | |
6905ab026085f05525852b2de5bfa956e8767421 | Add parser | thatch45/curve | pycurve/parser.py | pycurve/parser.py | '''
Parse command line options
'''
import optparse
def parse():
'''
Parse options for a server
'''
parser = optparse.OptionParser()
parser.add_option(
'--server-ip',
dest='server_ip',
default='127.0.0.1',
help='the server ip')
parser.add_option(... | apache-2.0 | Python | |
0992fcc1d7bcc5f55b95990026879a3b6c8fda4a | Create NBA_Teams.py | meerkatta/36_changers | NBA_Teams.py | NBA_Teams.py | class Team:
def __init__(self, name, location, conference, division, championships, appearances, y_start):
self.name = name
self.location = location
self.conference = conference
self.division = division
self.championships = championships
self.appearances = appearances
self.y_start = y_start
BOS_Celtics ... | mit | Python | |
c2541b27a6259b2c51447943488709982ab1606d | Create fabfile.py | prohank/ubuntu-shell-scripts,prohank/ubuntu-shell-scripts | python/fabfile.py | python/fabfile.py | import csv
# install fabric version < 2 following script is for less than v2.0
# $pip install 'fabric<2.0'
from fabric.api import env, parallel, run, task
from fabric.colors import green, red, yellow
from fabric.state import output
env.user = '<ssh-user-name>'
env.warn_only = True
#env.use_ssh_config = True
output[... | unlicense | Python | |
4a41cfd4a03fc7ccd76b6faca0d32c30296fa33c | Create wordhl.py | TingPing/plugins,TingPing/plugins | HexChat/wordhl.py | HexChat/wordhl.py | import hexchat
__module_name__ = 'wordhl'
__module_author__ = 'TingPing'
__module_version__ = '1'
__module_description__ = 'Highlights some words of importance'
# When you want to notice something, but not really get 'highlighted'
hlwords = ('hexchat', )
edited = False
def print_cb(word, word_eol, userdata, attr):
... | mit | Python | |
8ddda76d25fd2572eccd24353d2347242af063fa | Add tool-info module for CBMC Path | dbeyer/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec | benchexec/tools/cbmc-path.py | benchexec/tools/cbmc-path.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
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
ht... | apache-2.0 | Python | |
462357fb3211bf75e99ff65c41cd6c6a4183d444 | add main of single file demo | faycheng/tpl,faycheng/tpl | examples/single_file/main.py | examples/single_file/main.py | # -*- coding:utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from tpl.tpl import Template
from tpl import path
from tpl import constructor
def main():
cwd = path.get_parent_path(os.path.abspath(__file__), 1)
tpl_dir = os.path.... | mit | Python | |
9b6fd64e8d2db5f3c1e3ca298f77d7e69ed5e353 | Add comment tests | Cal-CS-61A-Staff/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,jordonwii/ok,jordonwii/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,jackzhao-mj/ok | server/tests/unittests/test_comment.py | server/tests/unittests/test_comment.py | #!/usr/bin/env python
# encoding: utf-8
"""
Tests for the permissions system
"""
import unittest
from test_permissions import PermissionsUnitTest
from ddt import ddt, data
PTest = PermissionsUnitTest.PTest
PERMISSIONS_TESTS = [
PTest("student_get_comment",
"student0", "Comment", "first", "get", True),... | apache-2.0 | Python | |
ce71f70a987819abb7b93b7f713b5c1c23c89b16 | Add mgmt command that lists event logs on a remote MN or CN | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | gmn/src/d1_gmn/app/management/commands/get-log.py | gmn/src/d1_gmn/app/management/commands/get-log.py | # -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache License, Version 2.0 ... | apache-2.0 | Python | |
8aaa76b3adb7f7c661eba8d1f4c50e8b0f03fee4 | Add a script that moves files to Azure storage using Copy Blob API | Smerity/cc-quick-scripts,Smerity/cc-quick-scripts | s3_to_azure/move_files.py | s3_to_azure/move_files.py | import sys
import time
from azure.storage import BlobService
from azure import WindowsAzureMissingResourceError
from CREDENTIALS import account_name, account_key
db = BlobService(account_name=account_name, account_key=account_key)
###
bucket = 'crawl-data'
in_progress = set()
#
existing = set([x.name for x in db.list... | mit | Python | |
8f6557f9315e920c6ef90af0e867e127f34eae88 | Add NbaTeamPage class | arosenberg01/asdata | src/classes/NbaTeamPage.py | src/classes/NbaTeamPage.py | import requests
import logging
from bs4 import BeautifulSoup
from src.db.models.model import NbaTeam
logger = logging.getLogger()
class NbaTeamPage:
def __init__(self, team_id):
page = requests.get('http://sports.yahoo.com/nba/teams/' + team_id + '/roster/')
self.team_id = team_id
self.sou... | mit | Python | |
2b7a2f66b7a6cdc223d6a652c1614517130e6105 | add new package (#25742) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-mrcfile/package.py | var/spack/repos/builtin/packages/py-mrcfile/package.py | # Copyright 2013-2021 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 PyMrcfile(PythonPackage):
"""Python implementation of the MRC2014 file format, which is us... | lgpl-2.1 | Python | |
93b694f97386dd36f36b0a37c3d40bbeebf395b6 | add new package (#24979) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-mutagen/package.py | var/spack/repos/builtin/packages/py-mutagen/package.py | # Copyright 2013-2021 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 PyMutagen(PythonPackage):
"""Read and write audio tags for many formats."""
homepage ... | lgpl-2.1 | Python | |
2d96b70960ff5ada7ee8b5ed85d3d8c9a02e11c8 | Add script to set ContainerRun.md5 on existing runs, as part of #751. | cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive | kive/container/management/commands/set_run_md5s.py | kive/container/management/commands/set_run_md5s.py | from __future__ import print_function
from django.core.management.base import BaseCommand
from container.models import ContainerRun
class Command(BaseCommand):
help = "Set MD5 on any runs that still have a blank."
def handle(self, **kwargs):
batch_size = 100
run_count = 0
print('Sta... | bsd-3-clause | Python | |
c1bb965e35f89d598c593e55acdd2d351294cdb7 | Add lc1249_minimum_remove_to_make_valid_parentheses.py | bowen0701/algorithms_data_structures | lc1249_minimum_remove_to_make_valid_parentheses.py | lc1249_minimum_remove_to_make_valid_parentheses.py | """Leetcode 1249. Minimum Remove to Make Valid Parentheses
Medium
URL: https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses/
Given a string s of '(' , ')' and lowercase English characters.
Your task is to remove the minimum number of parentheses ( '(' or ')',
in any positions ) so that the resulti... | bsd-2-clause | Python | |
b3549d4673d115f3f24857aea0707abd805ec221 | Add PollerTask | bboozzoo/sparts,pshuff/sparts,facebook/sparts,pshuff/sparts,djipko/sparts,bboozzoo/sparts,facebook/sparts,djipko/sparts,fmoo/sparts,fmoo/sparts | sparts/tasks/poller.py | sparts/tasks/poller.py | from .periodic import PeriodicTask
from threading import Event
class PollerTask(PeriodicTask):
def initTask(self):
self.current_value = None
self.fetched = Event()
super(PollerTask, self).initTask()
def execute(self, context=None):
new_value = self.fetch()
if self.curr... | bsd-3-clause | Python | |
c3ec949a888896cc2457c391f797c504538bcf51 | Add management command to fill data for given ticket nums | nava45/junction,nava45/junction,ChillarAnand/junction,pythonindia/junction,pythonindia/junction,pythonindia/junction,pythonindia/junction,ChillarAnand/junction,ChillarAnand/junction,nava45/junction,nava45/junction,ChillarAnand/junction | junction/tickets/management/commands/fill_data.py | junction/tickets/management/commands/fill_data.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import optparse
# Third Party Stuff
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
# Junction Stuff
from junction.tickets.models import Ticket
class Comman... | mit | Python | |
ad57e370a026513a3f1e3465feb5d8fa944aff12 | Add __init__.py to lg_nav_to_device module | EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes | lg_nav_to_device/src/lg_nav_to_device/__init__.py | lg_nav_to_device/src/lg_nav_to_device/__init__.py | from device_writer import DeviceWriter
| apache-2.0 | Python | |
f02ec85db1fe8951929fe52b97c5cf139b05fd3b | write the server | snudler6/time-travel | src/tests/example/chat_server.py | src/tests/example/chat_server.py | # Socket server in python using select function
import socket
import functools
from select import select
class ChatServer(object):
"""Manage chat registration and messages."""
clients_list = [] # list of socket clients
outgoing_messages = {}
@staticmethod
def _chat_callback(socket)... | mit | Python | |
afbdc6649575a94044decf7aa61367c10d3db196 | Create ipybind package | aldanor/ipybind,aldanor/ipybind,aldanor/ipybind | ipybind/__init__.py | ipybind/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.1.0'
| mit | Python | |
e86c87f4d97677f18522321ca06f79373722a610 | Add test case for Trust Middleware | stackforge/senlin,openstack/senlin,Alzon/senlin,openstack/senlin,tengqm/senlin-container,openstack/senlin,tengqm/senlin-container,Alzon/senlin,stackforge/senlin | senlin/tests/middleware/test_trust_middleware.py | senlin/tests/middleware/test_trust_middleware.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | apache-2.0 | Python | |
d77a9f8b3d29226ca8dfb7a8cda0aca1c3343917 | Add tick label test | mpld3/mpld3,mpld3/mpld3,jakevdp/mpld3,jakevdp/mpld3 | mpld3/test_plots/test_ticklabels.py | mpld3/test_plots/test_ticklabels.py | """Plot to test date axis"""
import matplotlib.pyplot as plt
import matplotlib
import mpld3
def create_plot():
fig, ax = plt.subplots()
ax.plot([2000,2050], [1,2])
ax.set_title('Tick label test', size=14)
return fig
def test_date():
fig = create_plot()
html = mpld3.fig_to_html(fig)
plt.c... | bsd-3-clause | Python | |
ddbda12b1cb83886b8edab6e50bdde8a6a2d2672 | Test views return response for searched query | andela-osule/bookworm,andela-osule/bookworm | compass/tests/test_views.py | compass/tests/test_views.py | from django.test import TestCase, Client
from ..models import Category, Book
class CompassTest(TestCase):
@classmethod
def setUpClass(cls):
cls.client = Client()
super(CompassTest, cls).setUpClass()
def test_can_view_search_page(self):
response = self.client.get('/')
self... | mit | Python | |
e40f83d177dabdc935dd9060868eedb863c421ad | add new email API file | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | api/email.py | api/email.py | """
Atmosphere api email
"""
from django.utils.timezone import datetime
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from libcloud.common.types import InvalidCredsError
from threepio import logger
from authentication.decorators import api_au... | apache-2.0 | Python | |
76a3b1a977cea619a6b2e262031aa3bda2b0f0ca | Create afRemoveUVSet.py | aaronfang/personal_scripts | scripts/afRemoveUVSet.py | scripts/afRemoveUVSet.py | # remove specific uv set on selected meshes.
setName = 'uvSet'
curSel = cmds.ls(sl=1,fl=1)
for sel in curSel:
for uset in cmds.polyUVSet(sel,auv=1,q=1):
if uset == setName:
cmds.polyUVSet(sel,uvSet=setName,d=1)
| mit | Python | |
bb88f6eec5bd53da21ecbc89d282d946848b304c | Create csv2.py | Serulab/Py4Bio,Serulab/Py4Bio | code/ch5/csv2.py | code/ch5/csv2.py | import csv
data = list(csv.reader(open('../../samples/B1.csv')))
total_len = sum([int(x[1]) for x in data[1:]]))
print(total_len / (len(data)-1))
| mit | Python | |
47f28d09a9c175db9ab71591c2b8d47a012709be | Create players.py - first pass at adding classes for each individual player and their pool picks | prcutler/nflpool,prcutler/nflpool | players.py | players.py |
class Players:
def __init__(self, firstname, lastname, email, twitter):
self.firstname = firstname
self.lastname = lastname
self.email = email
self.twitter = twitter
class PlayerPicks(Players):
def __init__(self, afc_east_first_pick, afc_east_second_pick, afc_east_last_pick, ... | mit | Python | |
7557ff490e130463325a8f05ddd98218c7dd0d98 | Add simplified scipy optimize wrapper. | pmdscully/python_snippets,pmdscully/python_snippets | scipy_optimization_wrapper/scipy_basin_hopping.py | scipy_optimization_wrapper/scipy_basin_hopping.py | from __future__ import division
from abc import ABCMeta
from numbers import Number
from scipy.optimize import basinhopping
import numpy as np
# -------------------------------------------------------------------------------
# --- Search Execuation Class:
# -----------------------------------------------------------... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.