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 |
|---|---|---|---|---|---|---|---|---|
66da5a6bd67ae3645eeff5856ae4614e4be9f5d8 | Add script for downloading latest dmf_control_board | wheeler-microfluidics/microdrop | microdrop/tests/update_dmf_control_board.py | microdrop/tests/update_dmf_control_board.py | import os
import subprocess
if __name__ == '__main__':
os.chdir('microdrop/plugins')
if not os.path.exists('dmf_control_board'):
print 'Clone dmf_control_board repository...'
subprocess.call(['git', 'clone',
'http://microfluidics.utoronto.ca/git/dmf_control_board.git']... | bsd-3-clause | Python | |
952cc2b9f1fdbf4919e06d559d8d0ae27b4bc538 | Add a benchmark comparing lldb vs. gdb with disassembly on a large function (lldb's Driver::MainLoop()). | apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb | test/benchmarks/disassembly/TestDisassembly.py | test/benchmarks/disassembly/TestDisassembly.py | """Disassemble lldb's Driver::MainLoop() functions comparing lldb against gdb."""
import os, sys
import unittest2
import lldb
import pexpect
from lldbbench import *
class DisassembleDriverMainLoop(BenchBase):
mydir = os.path.join("benchmarks", "example")
def setUp(self):
BenchBase.setUp(self)
... | apache-2.0 | Python | |
4173d3abeeda29ffbd81379233e88311780b6b09 | Add a test for library loading | funkybob/knights-templater,funkybob/knights-templater | tests/test_load.py | tests/test_load.py | from .utils import TemplateTestCase, Mock
from knights import Template
class LoadTagTest(TemplateTestCase):
def test_load_default(self):
t = Template('{! knights.defaultfilters !}')
self.assertIn('title', t.parser.filters)
| mit | Python | |
112e3d11cd3c448da73a2b1085bf7cdf9f89441c | Create cmdlinetools.py | dhahaj/py | cmdlinetools.py | cmdlinetools.py | #TODO
| mit | Python | |
4c6314f8bdfced88b2adbabd3b545d1dff513f0a | add unzip with APK“ | momomoxiaoxi/security,momomoxiaoxi/security,momomoxiaoxi/security,momomoxiaoxi/security,momomoxiaoxi/security,momomoxiaoxi/security,momomoxiaoxi/security | Misc/python/APKzip.py | Misc/python/APKzip.py | #!/usr/bin/env python
# Copyright (C) 2013 thuxnder <patrick@bluebox.com>
#
# 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... | apache-2.0 | Python | |
19a1fc05c901dd19b3328389c59718b6f7b1d0e8 | Add multi-line tooltip example | altair-viz/altair,ellisonbg/altair,jakevdp/altair | altair/vegalite/v2/examples/multiline_tooltip.py | altair/vegalite/v2/examples/multiline_tooltip.py | """
Multi-Lite Tooltip
==================
This example shows how you can use selections and layers to create a multi-line tooltip
that tracks the x position of the cursor.
"""
import altair as alt
import pandas as pd
import numpy as np
data = pd.DataFrame(np.cumsum(np.random.randn(100, 3), 0).round(2),
... | bsd-3-clause | Python | |
90988b6f3b2b38873c0002b51b9f6dc2e542c30a | Change test_are to remove zeros in array | jni/gala,janelia-flyem/gala | tests/test_evaluate.py | tests/test_evaluate.py | import numpy as np
from numpy.testing import assert_equal, assert_almost_equal
from gala import evaluate as ev
def test_contingency_table():
seg = np.array([0, 1, 1, 1, 2, 2, 2, 3])
gt = np.array([1, 1, 1, 2, 2, 2, 2, 0])
ct = ev.contingency_table(seg, gt, ignore_seg=[], ignore_gt=[])
ct0 = ev.continge... | import numpy as np
from numpy.testing import assert_equal, assert_almost_equal
from gala import evaluate as ev
def test_contingency_table():
seg = np.array([0, 1, 1, 1, 2, 2, 2, 3])
gt = np.array([1, 1, 1, 2, 2, 2, 2, 0])
ct = ev.contingency_table(seg, gt, ignore_seg=[], ignore_gt=[])
ct0 = ev.continge... | bsd-3-clause | Python |
fe62ab5e609aba0c1739ca81d5cdd266d208a217 | Add MSI generating tool for python updating | int19h/PTVS,int19h/PTVS,int19h/PTVS,int19h/PTVS,int19h/PTVS,int19h/PTVS | Build/make_payload.py | Build/make_payload.py | '''Quick and dirty script to generate vs.payload blocks for a set of URLs.
Usage:
make_payload.py URL [URL ...]
'''
__author__ = 'Steve Dower <steve.dower@microsoft.com>'
__version__ = '0.1'
import hashlib
import os
import urllib.request
import sys
for u in sys.argv[1:]:
is_temp = False
if os.path.isf... | apache-2.0 | Python | |
15c3b4d3636fda50cb7b04541129f876fbe548ef | Add tests for AzureAuth | ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver | tests/opwen_email_server/services/test_auth.py | tests/opwen_email_server/services/test_auth.py | from unittest import TestCase
from unittest.mock import Mock
from opwen_email_server.services.auth import AzureAuth
class AzureAuthTests(TestCase):
# noinspection PyTypeChecker
def setUp(self):
self.mock_client = Mock()
self.auth = AzureAuth(account='account', key='key', table='table',
... | apache-2.0 | Python | |
b0a941684a21c2d9020691b8ff5aecbb24338816 | Add WrapCreatorTest | mesonbuild/wrapweb,mesonbuild/wrapweb,mesonbuild/wrapweb | mesonwrap/wrapcreator_test.py | mesonwrap/wrapcreator_test.py | import git
import hashlib
import io
import os
import os.path
import tempfile
import unittest
import zipfile
from mesonwrap import gitutils
from mesonwrap import upstream
from mesonwrap import wrapcreator
class WrapCreatorTest(unittest.TestCase):
def setUp(self):
self._workdir = tempfile.TemporaryDirecto... | apache-2.0 | Python | |
777678a45d001ef539fc4cdb95c608082faf9710 | package skeleton | pyroscope/torpydo | src/torpydo/__init__.py | src/torpydo/__init__.py | """ Bittorrent metafile handling for Python.
Copyright (c) 2015 The PyroScope Project <pyroscope.project@gmail.com>
"""
# 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-2.0 | Python | |
739e302506cb542011b8f022c6175637feaf20b4 | Add an example for just disabling password complexity | jjohnson42/confluent,jjohnson42/confluent,xcat2/confluent,xcat2/confluent,jjohnson42/confluent,xcat2/confluent,jjohnson42/confluent,xcat2/confluent,xcat2/confluent,jjohnson42/confluent | misc/disablepasscomplexity.py | misc/disablepasscomplexity.py | #!/usr/bin/env python
import pyghmi.util.webclient as webclient
import json
import os
import sys
tmppassword = 'to3BdS91ABrd'
missingargs = False
if 'XCCUSER' not in os.environ:
print('Must set XCCUSER environment variable')
missingargs = True
if 'XCCPASS' not in os.environ:
print('Must set XCCPASS environ... | apache-2.0 | Python | |
6d5d838a1a6d1bd718ca6e3a418eb67963edc587 | Add Tampa Tree Map migration rules | maurizi/otm-core,maurizi/otm-core,maurizi/otm-core,maurizi/otm-core | opentreemap/otm1_migrator/migration_rules/tampa.py | opentreemap/otm1_migrator/migration_rules/tampa.py | from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES
from treemap.models import ITreeCodeOverride, ITreeRegion, User
TAMPA_ITREE_REGION_CODE = 'CenFlaXXX'
# The Tampa species fixture does not include family
MIGRATION_RULES['species']['removed_fields'].remove('family')
# The Tampa species fixtue d... | agpl-3.0 | Python | |
203a1258626b7523abebf3274822c8189246b771 | add solution for Compare Version Numbers | zhyu/leetcode,zhyu/leetcode | src/compareVersionNumbers.py | src/compareVersionNumbers.py | class Solution:
# @param version1, a string
# @param version2, a string
# @return an integer
def compareVersion(self, version1, version2):
v1 = map(int, version1.split('.'))
v2 = map(int, version2.split('.'))
l1, l2 = len(v1), len(v2)
l = max(l1, l2)
v1.extend([0... | mit | Python | |
72c38a8b67b23080ab9fea7a6fd3405b2f88ad7a | Add script to compute articles improved for media collection | Commonists/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics | wm_metrics/count_articles_improved_for_image_collection.py | wm_metrics/count_articles_improved_for_image_collection.py | # -*- coding: utf-8 -*-
"""Analysing a Glamorous report to identify articles improved."""
import sys
import xml.dom.minidom
def handle_node_attribute(node, tag_name, attribute_name):
"""Return the contents of a tag based on his given name inside of a given node."""
element = node.getElementsByTagName(tag_na... | mit | Python | |
26133a34d5dbf8759f2b2aa37be8f9f6f969507d | add simple test for util hashing functions | JsonChiu/openrunlog,JsonChiu/openrunlog,JsonChiu/openrunlog,JsonChiu/openrunlog | openrunlog/tests/test_util.py | openrunlog/tests/test_util.py |
import unittest
from openrunlog import util
class BCryptTests(unittest.TestCase):
def test_bcrypt(self):
password = 'password'
self.assertTrue(util.check_pwd(password, util.hash_pwd(password)))
| bsd-2-clause | Python | |
249d764314a444bed12c269fea40ca06c1a97f17 | Add example script for PIV certificates. | Yubico/yubikey-manager,Yubico/yubikey-manager | examples/piv_certificate.py | examples/piv_certificate.py | """
This script will program an x.509 certificate into a slot of a YubiKey.
By using a script instead of the command line interface, we are able to fully customize
the certificate with arbitrary fields, extensions, etc.
This script is mainly intended as a template, to be customized according to your
liking. For more ... | bsd-2-clause | Python | |
7d8ae6f9ba137c44eb158dab4050d9af74bc7c9a | Add new code example | openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,iabdalkader/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,openmv/openmv | scripts/examples/04-Image-Filters/vflip_hmirror_transpose.py | scripts/examples/04-Image-Filters/vflip_hmirror_transpose.py | # Vertical Flip - Horizontal Mirror - Transpose
#
# This example shows off how to vertically flip, horizontally mirror, or
# transpose an image. Note that:
#
# vflip=False, hmirror=False, transpose=False -> 0 degree rotation
# vflip=True, hmirror=False, transpose=True -> 90 degree rotation
# vflip=True, hmirror=True... | mit | Python | |
c2011ec5e802d50c780138b0472f417a64bb35ef | Update couples-holding-hands.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/couples-holding-hands.py | Python/couples-holding-hands.py | # Time: O(n)
# Space: O(n)
class Solution(object):
def minSwapsCouples(self, row):
"""
:type row: List[int]
:rtype: int
"""
N = len(row)//2
couples = [[] for _ in xrange(N)]
for seat, num in enumerate(row):
couples[num//2].append(seat//2)
... | # Time: O(n)
# Space: O(n)
class Solution(object):
def minSwapsCouples(self, row):
"""
:type row: List[int]
:rtype: int
"""
N = len(row)//2
couples = [[] for _ in xrange(N)]
for seat, num in enumerate(row):
couples[num//2].append(seat//2)
... | mit | Python |
f3e2e2e09c76f0cc93eeedf85e7f9b5c4e413187 | add forgotten romWriter | emeric254/PyHawaiiBiosReader | tools/RomWriter.py | tools/RomWriter.py | # -*- coding: utf-8 -*-
def read_rom(rom_path: str, rom_content: bytes):
with open(rom_path, mode='wb') as bios:
print('Writing "', rom_path, '" bios file ...')
return bios.write(rom_content)
| mit | Python | |
c452b537870e583a17c36a4bf24b54c991cd8baa | add a server view to create authentication tokens | kyouko-taiga/trexmo,kyouko-taiga/trexmo,kyouko-taiga/trexmo,kyouko-taiga/trexmo | trexmo/app/auth.py | trexmo/app/auth.py | from flask import Blueprint
from flask import current_app, jsonify, request
from passlib.hash import pbkdf2_sha256
from sqlalchemy.orm.exc import NoResultFound
from trexmo.core.db.models import User
from trexmo.core.utils.auth import make_auth_token
bp = Blueprint('auth', __name__)
@bp.route('/auth/tokens/', met... | apache-2.0 | Python | |
e01f1dede3af08396d0796ecaef0c70fd0e1e81e | Add Ex1: dummy server | MA3STR0/PythonAsyncWorkshop | code/ex1-dummy_server.py | code/ex1-dummy_server.py | import time
from tornado.web import Application, RequestHandler
from tornado.gen import coroutine, Task
from tornado.ioloop import IOLoop
class DummyAPI(RequestHandler):
@coroutine
def get(self):
yield Task(IOLoop.current().add_timeout, time.time() + 1)
self.write('Hello, World!')
self... | mit | Python | |
869475e2df7eb17411aa7737a798d1a41639ae0a | Implement dynamic array | arvinsim/hackerrank-solutions | all-domains/data-structures/arrays/dynamic-array/solution.py | all-domains/data-structures/arrays/dynamic-array/solution.py | #!/usr/env/bin python
# https://www.hackerrank.com/challenges/dynamic-array
# Python 2
def get_initial_seq_list(N):
seqList = []
for i in xrange(N):
seq = []
# for j in xrange(N-1):
# seq.append(0)
seqList.append(seq)
return seqList
def query_1(seqList, x, y, lastAns,... | mit | Python | |
43cb0191a5067687fdee466defb606d26700bf41 | Put basic repo commands in fabfile/__init__.py | explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc | fabfile/__init__.py | fabfile/__init__.py | from fabric.api import task, local, run, lcd, cd, env
from os.path import exists as file_exists
from fabtools.python import virtualenv
from os import path
PWD = path.join(path.dirname(__file__), '..')
VENV_DIR = path.join(PWD, '.env')
@task
def env():
if file_exists('.env'):
local('rm -rf .env')
lo... | mit | Python | |
e6fc7a6eb1ca79cbb738241a881d8113b3831a15 | add assign role to subservice user flow | telefonicaid/orchestrator,telefonicaid/orchestrator | src/orchestrator/core/flow/assignRoleSubServiceUser.py | src/orchestrator/core/flow/assignRoleSubServiceUser.py | import logging
from orchestrator.core.idm import IdMOperations
logger = logging.getLogger('orchestrator_core')
def assignRoleSubServiceUser(KEYSTONE_PROTOCOL,
KEYSTONE_HOST,
KEYSTONE_PORT,
SERVICE_NAME,
... | agpl-3.0 | Python | |
bd2c1e94426ae35fb10ed8356f402b7d7a08f6bc | Add X-Forward-For Middleware | CodeforHawaii/froide,CodeforHawaii/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,CodeforHawaii/froide,CodeforHawaii/froide,stefanw/froide,fin/froide,fin/froide,fin/froide,CodeforHawaii/froide,stefanw/froide | froide/helper/middleware.py | froide/helper/middleware.py | class XForwardedForMiddleware():
def process_request(self, request):
if 'HTTP_X_FORWARDED_FOR' in request.META:
request.META['REMOTE_ADDR'] = request.META['HTTP_X_FORWARDED_FOR'].split(",")[0].strip()
return None
| mit | Python | |
2d3a32410a7889ac74db7a35c9c75c1ffbbf6d60 | Create fraction.py | DaivdZhang/LittleProject | src/mathematics/fraction.py | src/mathematics/fraction.py | import math
class Fraction(object):
precision = 16
def __init__(self, nume, deno=1):
if not (isinstance(nume, int) and isinstance(deno, int)):
raise ValueError
if deno == 0:
raise ZeroDivisionError
x = math.gcd(nume, deno)
self.nume = nume//x
s... | mit | Python | |
632501287746c12cd612d9e78b86fc59cab13809 | Create generalKnowledge.py | AlexEaton1105/computerScience,JoeClarke12/computerScience | generalKnowledge.py | generalKnowledge.py | # date: 14/09/15
# username: A1fus
# name: Alfie Bowman
# description: Python gneral knowledge quiz
import time #imports the time module which allows for a pause inbetween printing
score = 0 #defines the user's score before starting
print("Welcome to The Quiz!\nWe'll be asking a series of general knowledge que... | mit | Python | |
e5adcfa675a85e5258c5eb49155863c53fe306f8 | Create colors_of_the_week.py | cclauss/Pythonista_ui | colors_of_the_week.py | colors_of_the_week.py | # See: http://omz-forums.appspot.com/pythonista/post/5819625086386176
import calendar, ui
# the colors corresponding to days of the week
# thai people often wear these colors on the day
# of the week. Is related to the Royal Family.
# Currently, the most important is yellow, the
# The King of Thailand was born on a ... | apache-2.0 | Python | |
3216c052b10114a2c0b4aed79714db6e6ac65234 | 转换文本文件编码至UTF-8 | Ficapy/single | convert_file_to_utf-8.py | convert_file_to_utf-8.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '15/7/16'
# FUCK YOU GB2312
import os
import shutil
from chardet.universaldetector import UniversalDetector
from subprocess import Popen
from os import path
dir = path.dirname(path.abspath(__file__))
detector = UniversalDetector()
for root, di... | mit | Python | |
bd2f302e2bcc02a3f222d0c00be9fe61351517e2 | Add first draft of Flask type check decorator | jacopofar/runtime_typecheck | flask_typecheck_decorator.py | flask_typecheck_decorator.py | #!/usr/bin/env python3
import json
from flask import Response, Flask, request
import inspect
from typecheck import typecheck
from typing import (
List,
Dict)
def typed_service(func):
def service():
print(request.json)
print(type(request.json))
args_... | mit | Python | |
0b547b69c9e603f77de6d8855a2fe1f153ba49d5 | Add script which logs realtime data into the db. | katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming | busshaming/fetch_realtime.py | busshaming/fetch_realtime.py | import os
from datetime import datetime, timedelta
import django
import pytz
import requests
from google.transit import gtfs_realtime_pb2
django.setup()
from busshaming.models import Feed, TripDate, RealtimeEntry, Stop
GTFS_API_KEY = os.environ.get('TRANSPORT_NSW_API_KEY')
def process_trip_update(trip_dates, stop... | mit | Python | |
13ec196d93c17f47ea8e097c9d7cdc66007f18d3 | Create code.py | AdityaSoni19031997/Machine-Learning,AdityaSoni19031997/Machine-Learning | Classifying_datasets/AV/code.py | Classifying_datasets/AV/code.py | ###
| mit | Python | |
f226c81bbc7052dcac0993bacdaa4a93761b4dce | Add this little development tester for webapi | trshaffer/cvmfs,MicBrain/cvmfs,cvmfs-testing/cvmfs,alhowaidi/cvmfsNDN,Moliholy/cvmfs,alhowaidi/cvmfsNDN,trshaffer/cvmfs,DrDaveD/cvmfs,Moliholy/cvmfs,cvmfs/cvmfs,djw8605/cvmfs,reneme/cvmfs,MicBrain/cvmfs,cvmfs/cvmfs,Moliholy/cvmfs,trshaffer/cvmfs,cvmfs/cvmfs,alhowaidi/cvmfsNDN,cvmfs-testing/cvmfs,DrDaveD/cvmfs,Moliholy/... | cvmfs/webapi/test-api.py | cvmfs/webapi/test-api.py | #! /usr/bin/env python
# This tester listens on port 8051 for a single http request, with
# a URL that starts with /api/v....
# It exits after one request.
# It assumes that GeoIP is already installed on the current machine
# with an installation of cvmfs-server, but reads the rest from
# the current directory.
fr... | bsd-3-clause | Python | |
876ebfb06e71e6a37eb7c737800b442ab6d8c4d1 | Add field decorator | polygraph-python/polygraph | polygraph/types/decorators.py | polygraph/types/decorators.py | from functools import wraps
from polygraph.types.basic_type import PolygraphOutputType
from polygraph.types.definitions import PolygraphField
from polygraph.utils.trim_docstring import trim_docstring
def field(rename_to=None, deprecation_reason=None):
def inner(method):
@wraps(method)
def wrapper... | mit | Python | |
064dbd9882c786bb51de5e40c5483589a06926c1 | Improve error message when op_def to register does not match the currently registered op_def. | Intel-Corporation/tensorflow,petewarden/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,sarvex/tensorflow,ghchinoy/tensorflow,jhseu/tensorflow,adit-chandra/tensorflow,chemelnucfin/tensorflow,gautam1858/tensorflow,aam-at/tensorflow,frreiss/tensorflow-fred,paolodedios/tensorflow,annarev/tensorflow,a... | tensorflow/python/framework/op_def_registry.py | tensorflow/python/framework/op_def_registry.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... | # 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... | apache-2.0 | Python |
9a2ec8a69e893c4a1d7b83308556eab45f15653b | Add first version of tool | lawrencebenson/de-n-code | decode.py | decode.py | import sys
import argparse
from operator import xor
# Helper functions
def ord_to_string(char_values):
"""Convert list of int values to corresponding string."""
return ''.join(chr(c) for c in char_values)
def string_to_ord(string):
"""Convert string to corresponding list of int values."""
return [o... | mit | Python | |
2dfd9cfc42e17f36446ff5da36e497bfff8d1d89 | Add a state for send requests to Wonderland. | WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Request.py | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Request.py | #!/usr/bin/env python
# encoding=utf8
import requests
from flexbe_core import EventState, Logger
class Wonderland_Request(EventState):
'''
MoveArm receive a ROS pose as input and launch a ROS service with the same pose
># url string url to call
<= response string Finish job.
'''
def __init__(sel... | bsd-3-clause | Python | |
6a50c9defc6ed39b0727220349db6efe27854bd4 | Add dump_latest management command | brianmoose/civet,idaholab/civet,brianmoose/civet,idaholab/civet,brianmoose/civet,idaholab/civet,idaholab/civet,brianmoose/civet | ci/management/commands/dump_latest.py | ci/management/commands/dump_latest.py | from django.core.management.base import BaseCommand
from ci import models
from optparse import make_option
from django.core import serializers
class Command(BaseCommand):
help = 'Dump all the DB tables required to make a good test DB.'
option_list = BaseCommand.option_list + (
make_option('--indent', default... | apache-2.0 | Python | |
6f54d1f94686c56f89accbe188ad20062b21363e | Fix formatting | pearsonlab/thunder,j-friedrich/thunder,jwittenbach/thunder,oliverhuangchao/thunder,kcompher/thunder,poolio/thunder,poolio/thunder,kcompher/thunder,zhwa/thunder,j-friedrich/thunder,oliverhuangchao/thunder,thunder-project/thunder,broxtronix/thunder,broxtronix/thunder,zhwa/thunder,pearsonlab/thunder,mikarubi/thunder,kunal... | python/thunder/utils/shell.py | python/thunder/utils/shell.py | import thunder
from thunder.utils.context import ThunderContext
try:
from termcolor import colored
except ImportError:
colored = lambda x, y: x
tsc = ThunderContext(sc)
print('')
print(colored(' IIIII ', 'yellow'))
print(colored(' IIIII ', 'yellow'))
print(colored(' IIIII... | import thunder
from thunder.utils.context import ThunderContext
try:
from termcolor import colored
except ImportError:
colored = lambda x, y: x
tsc = ThunderContext(sc)
print('')
print(colored(' IIIII ', 'yellow'))
print(colored(' IIIII ', 'yellow'))
print(colored(' IIIIIIIIIII... | apache-2.0 | Python |
0cdd996d5ba2d871aa4398c92a83357d9bcd3deb | Add tests for interpolation | lpsinger/astropy,pllim/astropy,larrybradley/astropy,StuartLittlefair/astropy,dhomeier/astropy,aleksandr-bakanov/astropy,larrybradley/astropy,mhvk/astropy,dhomeier/astropy,StuartLittlefair/astropy,aleksandr-bakanov/astropy,StuartLittlefair/astropy,pllim/astropy,astropy/astropy,saimn/astropy,astropy/astropy,larrybradley/... | astropy/coordinates/tests/test_astrom_manager.py | astropy/coordinates/tests/test_astrom_manager.py | import numpy as np
def test_astrom_manager():
# I was having a pretty hard time in coming
# up with a unit test only testing the get_astrom function
# that would not just test its implementation with its implementation
# so we test a coordinate conversion using it
from astropy.coordinates.astrom_... | bsd-3-clause | Python | |
d947ca1f2c9a33672dcc2b858b55a77fe2e39953 | Test fix_dicom. | ohsu-qin/qipipe | test/unit/staging/test_fix_dicom.py | test/unit/staging/test_fix_dicom.py | from nose.tools import *
import os, glob, shutil
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from qipipe.staging import fix_dicom_headers
from qipipe.helpers.dicom_helper import iter_dicom
# The test parent directory.
ROOT = os.path.normpath(os.path.join(os.path.dirname(__... | bsd-2-clause | Python | |
1f6ec9185edfe3469c5ae0c991a308a06599bcd9 | Add migration script 22->23 (to be completed) | vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks | backend/globaleaks/db/migrations/update_22_23.py | backend/globaleaks/db/migrations/update_22_23.py | # -*- encoding: utf-8 -*-
from storm.locals import Int, Bool, Unicode, DateTime, JSON, Reference, ReferenceSet
from globaleaks.db.base_updater import TableReplacer
from globaleaks.models import BaseModel, Model
class InternalFile_v_22(Model):
__storm_table__ = 'internalfile'
internaltip_id = Unicode()
na... | agpl-3.0 | Python | |
c99a1fe2965469ac6fb340e4091d39ec65fcd072 | Create dfsdff.py (#35) | sajjadelastica/3G45,sajjadelastica/3G45,sajjadelastica/3G45,sajjadelastica/3G45 | dfsdff.py | dfsdff.py | dfsdfsdfsdfsdfsdf
| apache-2.0 | Python | |
0c104935a1191d49cce25c57d4bc20c17b401cc2 | add module having all const variable | OpenEdgeComputing/elijah-provisioning,cmusatyalab/elijah-provisioning,OpenEdgeComputing/elijah-provisioning,OpenEdgeComputing/elijah-provisioning,OpenEdgeComputing/elijah-provisioning,OpenEdgeComputing/elijah-provisioning,cmusatyalab/elijah-provisioning,cmusatyalab/elijah-provisioning,cmusatyalab/elijah-provisioning,cm... | src/server/Const.py | src/server/Const.py | #!/usr/bin/env python
#
# Elijah: Cloudlet Infrastructure for Mobile Computing
# Copyright (C) 2011-2012 Carnegie Mellon University
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation... | apache-2.0 | Python | |
59c765d5ce9a7afc7d88c544dd6df0fdd98bacbe | Update __init__.py | rishubhjain/commons,r0h4n/commons,Tendrl/commons | tendrl/commons/flows/authorize_ssh_key/__init__.py | tendrl/commons/flows/authorize_ssh_key/__init__.py | import logging
from tendrl.commons import flows
from tendrl.commons.flows.exceptions import FlowExecutionFailedError
from tendrl.commons.utils.ssh import authorize_key
LOG = logging.getLogger(__name__)
class AuthorizeSshKey(flows.BaseFlow):
internal = True
def __init__(self, *args, **kwargs):
s... | import logging
from tendrl.commons import flows
from tendrl.commons.flows.exceptions import FlowExecutionFailedError
from tendrl.commons.utils.ssh import authorize_key
LOG = logging.getLogger(__name__)
class AuthorizeSshKey(flows.BaseFlow):
def run(self):
ssh_key = self.parameters['ssh_key']
ret... | lgpl-2.1 | Python |
02b249c5b5b81cb7389b024a0c513b8fda2fea0c | add tests for get_pre_filter_format | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/tests/test_report_builder_filters.py | corehq/apps/userreports/tests/test_report_builder_filters.py | from django.test import SimpleTestCase
from corehq.apps.userreports.reports.builder import const
from corehq.apps.userreports.reports.builder.filter_formats import get_pre_filter_format
class PreFilterFormatTest(SimpleTestCase):
def test_empty_filter_format(self):
self.assertEqual(const.PRE_FILTER_VALUE... | bsd-3-clause | Python | |
132d060276584a550a020a2778d18edacc4420fa | add migration script | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/form_processor/management/commands/set_meta_fields.py | corehq/form_processor/management/commands/set_meta_fields.py | import logging
from datetime import datetime
from bulk_update.helper import bulk_update as bulk_update_helper
from django.core.management.base import BaseCommand
from django.db.models import Q
from corehq.form_processor.interfaces.dbaccessors import FormAccessors
from corehq.form_processor.models import XFormInstance... | bsd-3-clause | Python | |
712ce419c8b06ab468fa2af225f12f7296569f54 | Add settings scene | juangallostra/TicTacToe | src/scenes/settings_scene.py | src/scenes/settings_scene.py | # -*- encoding: utf-8 -*-
import pygame
import os
from scenes import scene
from scenes import game_scene
from game_logic import tic_tac_toe_board
from game_logic import helper
class SettingsScene(scene.Scene):
""" Settings scene that enables configuring the game """
def __init__(self, director, past_scene):... | mit | Python | |
604ce43cd9a66ae52224d174bc5743bcbfc86546 | Add url parsing unit tests | ultrabluewolf/p.url | test/test_url_parser.py | test/test_url_parser.py | import pytest
from lib.purl import Purl
from lib.purl_exc import *
class TestParserFunctions(object):
def test_simple_url(self):
str_url = 'http://blank'
url = Purl(str_url)
assert str(url) == str_url
str_url = 'https://blank'
url = Purl(str_url)
assert str(url) == str_url
str_url = '... | mit | Python | |
c84bdaefd010b8a3356809e31e5b953c2bc1b493 | Add 'Triangle Angles' solution. | ChillyBwoy/empireofcode | _triangle_angles.py | _triangle_angles.py | """
Triangle Angles
Most of the facets on a crystal are triangle. Since these crystals are vital to
our base, we should attempt to learn more about this shape.
You are given the lengths for each side of a triangle. You need to find all
three of the angles for this triangle. If the given side lengths cannot form a
tri... | mit | Python | |
4a60fdf4896a41d52fc90e8a5f719976e605e8cc | Move the lazy classes out for the serializer to be able to find them | holdenk/diversity-analytics,holdenk/diversity-analytics | lazy_helpers.py | lazy_helpers.py | # Lazy objects, for the serializer to find them we put them here
class LazyDriver(object):
_driver = None
def get(self):
if self._driver is None:
from selenium import webdriver
self._driver = webdriver.Firefox()
return self._driver
class LazyPool(object):
_poo... | apache-2.0 | Python | |
683aedaee094b55f7ad1333a69e45166d3901398 | Create __init__.py | carlniger/acitool | acitool/jsondata/FabAdminMgmt/__init__.py | acitool/jsondata/FabAdminMgmt/__init__.py | apache-2.0 | Python | ||
d247427d60944d529fa17865ac4e0556a9ccda3f | Add a timeout attr to NavigateAction. | dushu1203/chromium.src,Just-D/chromium-1,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,ondra-novak/chromium.src,hgl888/chromium-crosswalk,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,ltilve/chromium,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,Just-D/ch... | tools/telemetry/telemetry/page/actions/navigate.py | tools/telemetry/telemetry/page/actions/navigate.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.page.actions import page_action
class NavigateAction(page_action.PageAction):
def __init__(self, attributes=None):
super(NavigateAction... | # 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.page.actions import page_action
class NavigateAction(page_action.PageAction):
def __init__(self, attributes=None):
super(NavigateAction... | bsd-3-clause | Python |
514b5a6dd11f9576c839b6a2469b48a0a1f91b89 | Add couple of test for AuthToken (#4816) | kgeorgy/django-rest-framework,jpadilla/django-rest-framework,atombrella/django-rest-framework,edx/django-rest-framework,davesque/django-rest-framework,ossanna16/django-rest-framework,edx/django-rest-framework,dmwyatt/django-rest-framework,tomchristie/django-rest-framework,davesque/django-rest-framework,kgeorgy/django-r... | tests/test_authtoken.py | tests/test_authtoken.py | import pytest
from django.contrib.admin import site
from django.contrib.auth.models import User
from django.test import TestCase
from rest_framework.authtoken.admin import TokenAdmin
from rest_framework.authtoken.models import Token
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framewo... | bsd-2-clause | Python | |
a5a843a6413b5a457cad093a54144e5f9c6da8e0 | add tests for propagate endpoints | jhuapl-boss/intern,openconnectome/ndio,neurodata/ndio,neurodata/ndio,neurodata/ndio | tests/test_propagate.py | tests/test_propagate.py | import unittest
import ndio.remote.neurodata as neurodata
import ndio.remote.errors
import numpy
import h5py
import os
class TestPropagate(unittest.TestCase):
def setUp(self):
self.nd = neurodata()
def test_propagate_status_fails_on_bad_token(self):
token = 'this is not a token'
with... | apache-2.0 | Python | |
8d867682bb3bf6ee5c8fab4d07aa7ad79c220d37 | fix mix bam with host and feed genome | shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl | lib/Alignment/filterMixBam.py | lib/Alignment/filterMixBam.py | import pysam
import argparse
import sys
import logging
import os
import re
from asyncore import read
def write_reads(fout, refmap, reads, counts):
hasHost = False
for read in reads:
if refmap[read.reference_id]:
hasHost = True
break
if hasHost:
hasFeed = False
for read in reads:
if... | apache-2.0 | Python | |
e74e0b5ff135e3cf1446e6f1a48fe5babd00a0b0 | Add missing camp migration | HStg2015/backend | api/migrations/0009_auto_20151107_2128.py | api/migrations/0009_auto_20151107_2128.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0008_auto_20151107_1900'),
]
operations = [
migrations.RemoveField(
model_name='helptimesearch',
... | mit | Python | |
251812515d8d19e8ca73a57cbb8d4d08391b174b | Create mix_fruit_juice.py | Kunalpod/codewars,Kunalpod/codewars | mix_fruit_juice.py | mix_fruit_juice.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Mix Fruit Juice
#Problem level: 6 kyu
def mix_fruit(arr):
regular = ['banana', 'orange', 'apple', 'lemon', 'grapes']
special = ['avocado', 'strawberry', 'mango']
sum = 0
for item in arr:
if item.lower() in regular: sum += 5
elif item.lo... | mit | Python | |
2de8601c97e9381f3ce88226230d5d065d4a292c | add db-level check on subscription dates | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/accounting/migrations/0013_subscription_dates_check.py | corehq/apps/accounting/migrations/0013_subscription_dates_check.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.sql_db.operations import HqRunSQL
class Migration(migrations.Migration):
dependencies = [
('accounting', '0012_replace__product_type__with__is_product'),
]
operations = [
HqRunS... | bsd-3-clause | Python | |
2d6d4544ba67847cc6594770ffdddb986ad2d99c | Add example UnitTest | MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI | EmeraldAI/UnitTests/_example.py | EmeraldAI/UnitTests/_example.py | import unittest
# https://gist.github.com/mcho421-snippets/4236879
# https://cgoldberg.github.io/python-unittest-tutorial/
class SimplisticTest(unittest.TestCase):
def test(self):
self.assertTrue(True)
def test2(self):
self.assertFalse(False)
if __name__ == '__main__':
unittest.main()
... | apache-2.0 | Python | |
04ea362b35b3d18685a816895950dddc68c97d2a | Bump version | jhamrick/plotchecker | plotchecker/_version.py | plotchecker/_version.py | version_info = (0, 3, 0, 'dev')
__version__ = '.'.join(map(str, version_info))
| version_info = (0, 2, 0, 'dev')
__version__ = '.'.join(map(str, version_info))
| bsd-3-clause | Python |
4bbbca6914e53da6f1362ddaeea913a6b992087d | remove accidentally added code | nschloe/quadpy | quadpy/_scipy_compat.py | quadpy/_scipy_compat.py | import numpy
from .line_segment import integrate_adaptive
# compatibility for scipy.quad
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.quad.html
def quad(f, a, b, args=(), epsabs=1.49e-08, epsrel=1.49e-08, limit=50):
assert a <= b
# See <https://www.gnu.org/software/gsl/doc/html/int... | import numpy
from .line_segment import integrate_adaptive
# compatibility for scipy.quad
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.quad.html
def quad(f, a, b, args=(), epsabs=1.49e-08, epsrel=1.49e-08, limit=50):
assert a <= b
# See <https://www.gnu.org/software/gsl/doc/html/int... | mit | Python |
7a593f1ab6baff2c6fe9094a23035cabeb64f8c9 | implement python encoder for weights hdf5 -> weights gzipped binary buffer file and weights metadata file | qinwf-nuan/keras-js,qinwf-nuan/keras-js,qinwf-nuan/keras-js,transcranial/keras-js,transcranial/keras-js,transcranial/keras-js | encoder.py | encoder.py | import sys
import os
import h5py
import json
import gzip
class Encoder(object):
"""Encoder class.
Weights are serialized sequentially from the Keras flattened_layers representation
into:
- `weights`: a binary string representing the raw data bytes in float32
of all weights, sequentiall... | mit | Python | |
5a86fe754d450dab2b60d67a4f82e49f08f2e72e | Complete execise 12 | sdarji/lpthw,sdarji/lpthw,sdarji/lpthw,sdarji/lpthw | ex/ex12.py | ex/ex12.py | # LPTHW Exercise 12 -- Prompting People
age = raw_input("How old are you? ")
height = raw_input("How tall are you? ")
weight = raw_input("How much do you weigh? ")
print "So, you're %r old, %r tall and %r heavy." % (age, height, weight) | unlicense | Python | |
54c018e9db539d5e1005e3d835c0215582aede3e | Add 103-1 export script from 12/20/2014 | rschiang/ntu-vote-auth-stat,rschiang/ntu-vote-auth-stat | export.py | export.py | from core.models import *
from django.conf import settings
dataset = []
keys = sorted(settings.COLLEGE_NAMES.keys())
# Map
for token in AuthToken.objects.all():
x = token.station_id
y = token.kind[0]
dataset.append((x, y))
result = {}
# Reduce
for x, y in dataset:
x_data = result.get(x, { k : 0 for ... | mit | Python | |
ee66b13c952118f85e0ce14264da29807e8ab814 | Add example using the gaussian smoother/filter. | dopplershift/MetPy,dopplershift/MetPy,deeplycloudy/MetPy,jrleeman/MetPy,ahaberlie/MetPy,ahaberlie/MetPy,ahill818/MetPy,Unidata/MetPy,jrleeman/MetPy,Unidata/MetPy,ShawnMurd/MetPy | trunk/examples/gaussian_smoother.py | trunk/examples/gaussian_smoother.py | import matplotlib.pyplot as plt
x = np.linspace(-10, 10, 40)
y = np.linspace(-15, 15, 60)
Y,X = np.meshgrid(y,x)
noise = np.random.randn(*X.shape) * 10
data = X**2 + Y**2 + noise
data = np.ma.array(data, mask=((X**2 + Y**2) < 0.4))
data_filt = gaussian_filter(x, y, data, 4, 4)
plt.subplot(1, 2, 1)
plt.imshow(data.T,... | bsd-3-clause | Python | |
62955786e7ffd2e961849860dfd2146ef611890c | Add plugin to parse values from log file | innogames/igcollect | src/logfile_values.py | src/logfile_values.py | #!/usr/bin/env python
#
# logfile_values.py
#
# Copyright (c) 2017, InnoGames GmbH
#
"""
logfile_values.py -- a python script to find metrics values in log file
This script is using last line of log file to get metric value by column number
python logfile_values.py --metric="metric1:1" --metric="metric2:2" ...
"""
f... | mit | Python | |
6e487915a53d4f03f7bbce54c9c537a37be151d3 | Add createTestData.py | Wikidata/QueryAnalysis,Wikidata/QueryAnalysis,Wikidata/QueryAnalysis,Wikidata/QueryAnalysis,Wikidata/QueryAnalysis | tools/createTestData.py | tools/createTestData.py | import argparse
import os
import sys
from postprocess import processdata
from utility import utility
import config
import csv
import glob
import gzip
from itertools import izip
from random import random
from pprint import pprint
parser = argparse.ArgumentParser(
description="Creates a smaller testdata set for deve... | apache-2.0 | Python | |
d5a70f5f7e18fcf2a4d0ee3d38ddebca34ca51a1 | add schema.py | mylokin/mongoext | mongoext/schema.py | mongoext/schema.py | import schematec.abc
import schematec.schema
import schematec.converters
import schematec.validators
Schema = schematec.schema.Dictionary
Descriptor = schematec.abc.Descriptor
class Field(schematec.abc.AbstractDescriptor):
def __call__(self, value):
return value
Integer = schematec.converters.Integer... | mit | Python | |
91941a23c67042fc3007167a4cb512761f216d85 | Create download_mnist.py | junbochen/pylearn2,msingh172/pylearn2,ddboline/pylearn2,aalmah/pylearn2,mclaughlin6464/pylearn2,chrish42/pylearn,kose-y/pylearn2,se4u/pylearn2,theoryno3/pylearn2,CIFASIS/pylearn2,lamblin/pylearn2,Refefer/pylearn2,mkraemer67/pylearn2,aalmah/pylearn2,w1kke/pylearn2,lamblin/pylearn2,msingh172/pylearn2,fishcorn/pylearn2,li... | pylearn2/scripts/datasets/download_mnist.py | pylearn2/scripts/datasets/download_mnist.py | import os
import urllib
import gzip
assert os.environ.has_key('PYLEARN2_DATA_PATH'), "PYLEARN2_DATA_PATH not defined"
mnist_path = os.environ['PYLEARN2_DATA_PATH'] + "/mnist"
if not os.path.isdir(mnist_path):
print "creating path:" + mnist_path
os.makedirs(mnist_path)
in_dir = os.listdir(mnist_path)
mnist_f... | bsd-3-clause | Python | |
7ef857d35ffb28ee6afa2c50e6fe27e963115283 | add snappy recipe; | inclement/python-for-android,wexi/python-for-android,rnixx/python-for-android,germn/python-for-android,wexi/python-for-android,inclement/python-for-android,ibobalo/python-for-android,rnixx/python-for-android,PKRoma/python-for-android,wexi/python-for-android,PKRoma/python-for-android,rnixx/python-for-android,kronenpj/py... | pythonforandroid/recipes/snappy/__init__.py | pythonforandroid/recipes/snappy/__init__.py | from pythonforandroid.toolchain import Recipe
class SnappyRecipe(Recipe):
version = '1.1.3'
url = 'https://github.com/google/snappy/releases/download/{version}/snappy-{version}.tar.gz'
def should_build(self, arch):
# Only download to use in leveldb recipe
return False
recipe = SnappyRecip... | mit | Python | |
7c95d5d3c98d7e8c5df55297e060d57f3695262c | Create bottle_app.py | dzil123/dzil123 | bottle_app.py | bottle_app.py | from bottle import *
import beaker.middleware
from web_app import *
session_opts = {
'session.type': 'file',
'session.data_dir': '/home/dzil123/mysite/session/',
'session.auto': True,
}
@hook('before_request') # adds easier cookie sessions
def setup_request():
request.session = request.environ['beake... | agpl-3.0 | Python | |
8abfd1fdae87478d6ad650c45c3d35118f8f7a4a | Add initial version of recursive relation field. | wlanslovenija/django-postgres | postgres/fields/recursive.py | postgres/fields/recursive.py | from django.db import models
SQL = """
WITH RECURSIVE "tree" ("{pk}", "related", "cycle") AS (
SELECT "{pk}", ARRAY[]::integer[], FALSE
FROM "{table}" WHERE "{fk}" IS NULL
UNION ALL
SELECT a."{pk}", b."related" || a."{fk}", a."{fk}" = ANY(b."related")
FROM "tree" b, "{table}" a
WHERE a."{fk}" = b... | bsd-3-clause | Python | |
ac8e1815ff9707205009d109cd0075e0d6fd3f33 | Add placeholder test case for operators | murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado | avocado/tests/meta/operators.py | avocado/tests/meta/operators.py | from django.test import TestCase
from avocado.meta.operators import *
__all__ = ('OperatorTestCase',)
class OperatorTestCase(TestCase):
pass
| bsd-2-clause | Python | |
def3983c73cfbed7ada0301fc651176537baf368 | Add fabfile | johanson/vivir,johanson/vivir | fabfile.py | fabfile.py | from __future__ import print_function
import os
from fabric.api import local
from fabric.colors import red
def build():
if cmd_exists('zip'):
local('zip -r "dist/vivir.zip" . -x "*.git*"')
else:
print(red("Install zip!"), "apt install zip")
def cmd_exists(x):
return any(os.access(os.pa... | mit | Python | |
304794e41a60ec1f1dd2c6dadb1a7344fa75fa36 | remove anyjson | willbarton/regulations-core,grapesmoker/regulations-core | regcore_write/views/notice.py | regcore_write/views/notice.py | import json
from django.views.decorators.csrf import csrf_exempt
from regcore import db
from regcore.responses import success, user_error
@csrf_exempt
def add(request, part_or_docnum, docnum):
""" Add the notice to the db """
part = part_or_docnum
try:
notice = json.loads(request.body)
exce... | import json
from django.views.decorators.csrf import csrf_exempt
from regcore import db
from regcore.responses import success, user_error
@csrf_exempt
def add(request, part_or_docnum, docnum):
""" Add the notice to the db """
part = part_or_docnum
try:
notice = anyjson.deserialize(request.body)... | cc0-1.0 | Python |
5e6f503ebdfc7de584527c8396c7414e1a75afbd | add populate caserepeater tests | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/motech/repeaters/tests/test_populate_caserepeater.py | corehq/motech/repeaters/tests/test_populate_caserepeater.py | from django.core.management import call_command
from django.test import TestCase
from corehq.motech.models import ConnectionSettings
from corehq.motech.repeaters.management.commands.populate_caserepeater import \
Command as MigrationCommand
from corehq.motech.repeaters.models import CaseRepeater, SQLCaseRepeater
... | bsd-3-clause | Python | |
d0e84f8d49917b3580f3d55c2794aac34fe5f13e | Implement the Client-side Monitor | Deyuan/qmsim,Deyuan/qmsim,Deyuan/qmsim | monitor_client.py | monitor_client.py | # Client Monitor
# This monitor is a deamon on client-side to check the spec
# Author: Deyuan Guo, Chunkun Bo
# Date: Dec 10, 2015
import os
import time
import itf_spec
# Update the status.txt for a container
def check_specs(spec_path):
spec = itf_spec.QosSpec()
exist = spec.read_from_file(spec_path)
if ... | apache-2.0 | Python | |
a3dc1ebac114d1591dd9cdb211e6d975a10b0da3 | Add new reschedule teacher weekly poll | unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac | education/management/commands/reschedule_teacher_weekly_polls.py | education/management/commands/reschedule_teacher_weekly_polls.py | '''
Created on Feb 21, 2013
@author: raybesiga
'''
from django.core.management.base import BaseCommand
from education.models import reschedule_teacher_weekly_polls
from optparse import OptionParser, make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option("-g", "... | bsd-3-clause | Python | |
5b6d2754d933f2ca2f728be492c230ee1ee4f219 | Add MATLAB package (#2614) | iulian787/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,lgarren/spack,TheTimmy/spack,EmreAtes/spack,krafczyk/spack,krafczyk/spack,lgarren/spack,iulian787/spack,TheTimmy/spack,iulian787/spack,LLNL/spack,mfherbst/spack,EmreAtes/spack,lgarren/spack,LLNL/spack,skosukhin/spack,iulian787/spack,TheTimmy/spack,matth... | var/spack/repos/builtin/packages/matlab/package.py | var/spack/repos/builtin/packages/matlab/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
348e715da7dfab1964d18b5b999a99febe8d5414 | Add missing readline dependency to sqlite (#4001) | lgarren/spack,iulian787/spack,skosukhin/spack,lgarren/spack,TheTimmy/spack,skosukhin/spack,LLNL/spack,krafczyk/spack,mfherbst/spack,krafczyk/spack,krafczyk/spack,LLNL/spack,lgarren/spack,LLNL/spack,EmreAtes/spack,tmerrick1/spack,LLNL/spack,iulian787/spack,TheTimmy/spack,TheTimmy/spack,TheTimmy/spack,matthiasdiener/spac... | var/spack/repos/builtin/packages/sqlite/package.py | var/spack/repos/builtin/packages/sqlite/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
2249d63cf5574a419fc1aa9a79e338de566d45b6 | Add authentication tests | Storj/accounts | tests/test_authentication.py | tests/test_authentication.py | # -*- coding: utf-8 -*-
import pytest
from accounts.authentication import Authentication
# Database migrations run for each test in this module.
# See `conftest.pytest_runtest*`.
DB_MIGRATIONS = ['0006-create-api-keys']
# Fixtures ###
@pytest.fixture
def auth(db):
return Authentication(db.connection)
# Tests #... | mit | Python | |
081ce1a25fb4406eec02ec7b88421e4d042e4a84 | Add failing test case for #40 | avilaton/sqlalchemy-continuum,kvesteri/sqlalchemy-continuum,rmoorman/sqlalchemy-continuum,piotr-dobrogost/sqlalchemy-continuum | tests/test_column_aliases.py | tests/test_column_aliases.py | import sqlalchemy as sa
from six import PY3
from tests import TestCase
class TestCommonBaseClass(TestCase):
def create_models(self):
class TextItem(self.Model):
__tablename__ = 'text_item'
__versioned__ = {}
id = sa.Column(sa.Integer, autoincrement=True, primary_key=T... | bsd-3-clause | Python | |
d64e576e74ddc68364259ed4ca941165a9038a56 | Add a test for the digitdestroyer filter | mozilla/spicedham,mozilla/spicedham | tests/test_digitdestroyer.py | tests/test_digitdestroyer.py | from unittest import TestCase
from spicedham.digitdestroyer import DigitDestroyer
class TestDigitDestroyer(TestCase):
def test_classify(self):
dd = DigitDestroyer()
dd.filter_match = 1
dd.filter_miss = 0
match_message = ['1', '2', '3', '1', '1']
miss_message = ['a', '1... | mpl-2.0 | Python | |
83442529ef19fb4cf0dadf50ec5d5b3a9c4bcff0 | Test for variable methods | mattmilten/PySCIPOpt,mattmilten/PySCIPOpt,SCIP-Interfaces/PySCIPOpt,SCIP-Interfaces/PySCIPOpt | tests/test_variablebounds.py | tests/test_variablebounds.py | from pyscipopt import Model
m = Model()
x0 = m.addVar(lb=-2, ub=4)
r1 = m.addVar()
r2 = m.addVar()
y0 = m.addVar(lb=3)
t = m.addVar(lb=None)
z = m.addVar()
infeas, tightened = m.tightenVarLb(x0, -5)
assert not infeas
assert not tightened
infeas, tightened = m.tightenVarLbGlobal(x0, -1)
assert not infeas
assert tigh... | mit | Python | |
05c31c66d1a6d1838d7c76d09e2048672384c7fa | Add confusion matrix tests | RamonAranda/ConfusionMatrix | modules/confusion_matrix/test.behaviour/confusion_matrix_test.py | modules/confusion_matrix/test.behaviour/confusion_matrix_test.py | import unittest
import mock
from pyrsistent import pmap
from toolz import map
from confusion_matrix.src._confusion_matrix import ConfusionMatrix
class ConfusionMatrixTest(unittest.TestCase):
def setUp(self):
self.mocked_object_label_a = mock.MagicMock()
self.mocked_object_label_b = mock.MagicMock... | mit | Python | |
dc45eefdd77e32072fe71bd7c9e5b781f7c2349e | Add concurrency measurement tool | biothings/biothings.api,biothings/biothings.api | tests/profiling/batch.py | tests/profiling/batch.py | import asyncio
import random
import string
import time
from urllib.parse import urlencode
from tornado.httpclient import AsyncHTTPClient
URL = "http://localhost:8000/v1/query"
async def request_one_batch(batch_seq="!"):
"""
Make a batch query request.
Typically POST to query endpoint.
"""
http_cl... | apache-2.0 | Python | |
f83ec63bcc85d07983c0999321ca63f6c8c49184 | add stub for chrom tests | schae234/LocusPocus,LinkageIO/LocusPocus | tests/test_Chromosome.py | tests/test_Chromosome.py | import pytest
import locuspocus as lp
def test_init():
pass
| mit | Python | |
32e983f9a02b1313bb988155904b8103559fe2d4 | add utils | biothings/biothings_explorer,biothings/biothings_explorer | tests/test_apis/utils.py | tests/test_apis/utils.py | def get_apis(edges):
apis = []
for v in edges.values():
apis.append(v['info'].get("$api"))
return apis | apache-2.0 | Python | |
0fd33596d292f758a463f95dbbbcbbd729fd15cb | Make simple script for finding terms used in marcframe | libris/librisxl,libris/librisxl,libris/librisxl | datatools/scripts/terms_from_marcframe.py | datatools/scripts/terms_from_marcframe.py | import json
def get_terms(marcframe):
terms = set()
for k, v in marcframe['entityTypeMap'].items():
terms.add(k)
terms.update(v.get('instanceTypes', []))
dfn_keys = {'property', 'addProperty', 'link', 'addLink', 'domainEntity', 'rangeEntity'}
def add_terms(dfn):
for k, v in dfn.... | apache-2.0 | Python | |
15c68366b8ba8fd678d675df5688cf861d1c7235 | Add import ASV benchmark (#7176) | pydata/xarray,pydata/xarray,pydata/xarray,jhamman/xarray,jhamman/xarray,jhamman/xarray | asv_bench/benchmarks/import.py | asv_bench/benchmarks/import.py | class Import:
"""Benchmark importing xarray"""
def timeraw_import_xarray(self):
return """
import xarray
"""
def timeraw_import_xarray_plot(self):
return """
import xarray.plot
"""
def timeraw_import_xarray_backends(self):
return """
fro... | apache-2.0 | Python | |
c8911698f8ccc6e821b3d0234a278d4fee834169 | add tapkick.wsgi | philips/tapkick,philips/tapkick,philips/tapkick,philips/tapkick,philips/tapkick | web/webapp/tapkick.wsgi | web/webapp/tapkick.wsgi | import os, sys
sys.path.append('/home/tapkick/tapkick/web/webapp')
sys.path.append('/home/tapkick/tapkick/web/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
def django_patcher():
from django.db.backends.mysql import base
def valid_connection_replacement(self):
return s... | bsd-2-clause | Python | |
70d42133e8fdbbe7535b42534d58486b8c48b7d6 | Add skill directory to path. | forslund/mycroft-core,MycroftAI/mycroft-core,MycroftAI/mycroft-core,linuxipho/mycroft-core,Dark5ide/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core | mycroft/skills/container.py | mycroft/skills/container.py | import sys
import os
import argparse
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.skills.core import create_skill_descriptor, load_skill
from mycroft.util.log import getLogger
from mycroft.configuration.config import ConfigurationManager
from mycroft.skills.intent import create_skill as create_... | import sys
import os
import argparse
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.skills.core import create_skill_descriptor, load_skill
from mycroft.util.log import getLogger
from mycroft.configuration.config import ConfigurationManager
from mycroft.skills.intent import create_skill as create_... | apache-2.0 | Python |
d9976f0cd48ea5266b7545946080ac42ef20031a | add tool for zeroing precip | akrherz/dep,akrherz/dep,akrherz/dep,akrherz/dep,akrherz/dep | scripts/cligen/zero_precip.py | scripts/cligen/zero_precip.py | """Sometimes, we just want to zero out a precip event."""
import datetime
import glob
import os
import sys
def do(fn, date):
"""Do."""
with open(fn, encoding="utf-8") as fh:
data = fh.read()
dt2 = date + datetime.timedelta(days=1)
pos1 = data.find(date.strftime("%-d\t%-m\t%Y"))
pos2 = data... | mit | Python | |
64bb470bc58d6d467f4bd807f82cc56aa5e674bc | Add eventlet db_pool use for mysql | n0ano/gantt,n0ano/gantt | nova/tests/test_sqlalchemy.py | nova/tests/test_sqlalchemy.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Rackspace Hosting
# 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.apach... | apache-2.0 | Python | |
f10b89d8c2b847555223a4a025d78e1223f57696 | Add a script to fork all feedstocks one is a maintainer on. | conda-forge/conda-forge.github.io,conda-forge/conda-forge.github.io,conda-forge/conda-forge.github.io,conda-forge/conda-forge.github.io | scripts/fork_my_feedstocks.py | scripts/fork_my_feedstocks.py | #!/usr/bin/env conda-execute
"""
This script can be run to fork conda-forge feedstocks to which you are a maintainer.
This is super useful if you maintain many feedstocks and would like to cutdown maintenance on your next PR...
Requires a token stored in the environment variable `GH_TOKEN` with the permissions `publi... | bsd-3-clause | Python | |
5f051e7aa58584a571c1e9b1f35cdb18c2f79776 | create car.py | kumalee/python-101 | part-2/cars/car.py | part-2/cars/car.py | #! /usr/bin/python
# encoding: utf-8
class car(object):
'''
This class the base of car.
'''
def __init__(self, brand, color, types):
self.brand = brand
self.color = color
self.types = types
self.speed = 0
self.running = False
def start(self):
se... | mit | Python | |
773a389f2ae69384f09cbada8b4b2615a7c430de | Add regression test for the message options bug. | frac/celery,cbrepo/celery,frac/celery,ask/celery,ask/celery,WoLpH/celery,mitsuhiko/celery,cbrepo/celery,mitsuhiko/celery,WoLpH/celery | celery/tests/test_messaging.py | celery/tests/test_messaging.py | import unittest
from celery.messaging import MSG_OPTIONS, get_msg_options, extract_msg_options
class TestMsgOptions(unittest.TestCase):
def test_MSG_OPTIONS(self):
self.assertTrue(MSG_OPTIONS)
def test_extract_msg_options(self):
testing = {"mandatory": True, "routing_key": "foo.xuzzy"}
... | bsd-3-clause | Python | |
c9545079517d6c945f59430e83e1cd86d8d1e8da | Implement shuns | Heufneutje/txircd,ElementalAlchemist/txircd | txircd/modules/extra/shun.py | txircd/modules/extra/shun.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.modules.xlinebase import XLineBase
from txircd.utils import durationToSeconds, ircLower, now
from zope.interface import implements
from fnmatch import fnm... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.