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 |
|---|---|---|---|---|---|---|---|---|
b67dd1f240e913c3423bd4c382852b7c234b487c | Support the 'localtime_into_day' type | dtcooper/python-fitparse,pR0Ps/python-fitparse | fitparse/processors.py | fitparse/processors.py | import datetime
class FitFileDataProcessor(object):
# TODO: Document API
#def process_type_<type_name> (field_data)
#def process_field_<field_name> (field_data) -- can be unknown_DD but NOT recommended
#def process_message_<mesg_name / mesg_type_num> (data_message)
def process_type_bool(self, fie... | import datetime
class FitFileDataProcessor(object):
# TODO: Document API
#def process_type_<type_name> (field_data)
#def process_field_<field_name> (field_data) -- can be unknown_DD but NOT recommended
#def process_message_<mesg_name / mesg_type_num> (data_message)
def process_type_bool(self, fie... | mit | Python |
09fafb87c4d1230f47900ed2029eeaee8e44f61d | Add dataset extraction from database. | daskol/mipt-classifier,daskol/mipt-classifier,daskol/mipt-classifier | miptclass/dataset.py | miptclass/dataset.py | #!/usr/bin/env python3
# encoding: utf8
# dataset.py
import logging
from itertools import count
from miptclass import models
from numpy import zeros
from operator import itemgetter
from os.path import realpath
from scipy.io import savemat
from scipy.sparse import csr_matrix, lil_matrix
from tqdm import tqdm
DATA... | mit | Python | |
a50b96ece7db9b732a6dc96c6d981588a5760311 | Add script to convert tests from RethinkDB core. | grandquista/ReQL-Core,grandquista/ReQL-Core,grandquista/ReQL-Core,grandquista/ReQL-Core | test_builder.py | test_builder.py | import re
try:
import yaml
except:
print('PyYAML not installed')
from pathlib import Path
def mkdir(path):
try:
path.mkdir(parents=True)
except FileExistsError:
pass
def test_loop(path, c_path, cpp_path):
for file in path.glob('**/*.yaml'):
each_test(path, file, c_path, c... | apache-2.0 | Python | |
b7785c53dbf8bd07360fa2ae62590fb0fcd1012e | Add gpio test | iver56/auto-light | gpio_test.py | gpio_test.py | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
for i in range(5):
GPIO.output(7, False)
sleep(2)
GPIO.output(7, True)
sleep(2)
GPIO.cleanup()
| mit | Python | |
f47a7678072471c7f78232138c850a2a7b5800a0 | add kattis/flexible | mjenrungrot/competitive_programming,mjenrungrot/competitive_programming,mjenrungrot/algorithm,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming | Kattis/flexible.py | Kattis/flexible.py | """
Problem: flexible
Link: https://open.kattis.com/problems/flexible
Source: ACM ICPC 2014 North America Qualifier
"""
W, P = list(map(int, input().split()))
A = [0] + list(map(int, input().split())) + [W]
answer = set()
for i in range(len(A)-1):
for j in range(i+1,len(A)):
answer.add(A[j] - A[i])
space... | mit | Python | |
3b75bc7254dbccc139635c2b7ccf52b12a8eef19 | Add brain_curses.py for curses attributes defined at runtime (#456) | PyCQA/astroid | astroid/brain/brain_curses.py | astroid/brain/brain_curses.py | # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
import astroid
def _curses_transform():
return astroid.parse('''
A_ALTCHARSET = 1
A_BLINK = 1
A_BOLD = 1
A_DIM = 1
A_INVIS = 1
A_... | lgpl-2.1 | Python | |
42dfe9e99f24c0e05b2f411ea48ccee03612c711 | Add hfsm.py | rokujyouhitoma/tips,rokujyouhitoma/tips,rokujyouhitoma/tips,rokujyouhitoma/tips | hfsm/hfsm.py | hfsm/hfsm.py | # -*- coding: utf-8 -*-
#TODO
class State(object):
def __init__(self, name, parent):
self.name = name
self.parent = parent
def entry(self):
print('%s entry' % (self.name))
def execute(self):
print('%s execute' % (self.name))
def exit(self):
print('%s exit' % (... | mit | Python | |
d99f5fd775d0ab57e964d8403266fc1adc7a4004 | add a script to print a json summary of our jenkins configs | kplus/devstack-moonshot,yamt/devstack,avvocatodemarchis/devstack,sstrato/devstack,avvocatodemarchis/devstack,neerja28/Devstack_GlusterFS,mc2014/devstack,LoHChina/devstack,nawawi/openstack,jamielennox/devstack,williamthegrey/devstack,bljgaurav/openstack-test,liuquansheng47/devstack,samgoon/devstack,srics/devstack,vsham2... | tools/jenkins/jenkins_home/print_summary.py | tools/jenkins/jenkins_home/print_summary.py | #!/usr/bin/python
import urllib
import json
import sys
def print_usage():
print "Usage: %s [jenkins_url (eg. http://50.56.12.202:8080/)]"\
% sys.argv[0]
sys.exit()
def fetch_blob(url):
return json.loads(urllib.urlopen(url + '/api/json').read())
if len(sys.argv) < 2:
print_usage()
BASE_U... | apache-2.0 | Python | |
9819658d9cc343d67c1b2c438853c6f065394751 | Add Flask example. | rduplain/wsgi_party,rduplain/wsgi_party | examples/flask/flask_party.py | examples/flask/flask_party.py | from flask import Flask, request
from wsgi_party import WSGIParty, PartylineConnector
class PartylineFlask(Flask, PartylineConnector):
def __init__(self, import_name, *args, **kwargs):
super(PartylineFlask, self).__init__(import_name, *args, **kwargs)
self.add_url_rule(WSGIParty.invite_path, endpo... | bsd-3-clause | Python | |
69b1e1bdf50991e609b548c02dd14225642cae85 | Add focus-last example | xenomachina/i3ipc-python,chrsclmn/i3ipc-python,acrisci/i3ipc-python,nicoe/i3ipc-python | examples/focus-last.py | examples/focus-last.py | #!/usr/bin/env python3
import os
import socket
import selectors
from argparse import ArgumentParser
from multiprocessing import Process, Value
from gi.repository import i3ipc
SOCKET_FILE = '/tmp/i3_focus_last'
class FocusWatcher:
def __init__(self):
self.window_id = Value('i', 0)
self.old_windo... | bsd-3-clause | Python | |
54f3c05d369a3256d1adac1118ca6b2a8cd9b77e | add proximity example | francois-berder/PyLetMeCreate | examples/proximity_example.py | examples/proximity_example.py | #!/usr/bin/env python3
"""This example shows how to read a measure from the Proximity Click inserted
in Mikrobus 1.
"""
from letmecreate.core import i2c
from letmecreate.core.common import MIKROBUS_1
from letmecreate.click import proximity
# Initialise I2C on Mikrobus 1
i2c.init()
i2c.select_bus(MIKROBUS_1)
# Read ... | bsd-3-clause | Python | |
e5ad0f3029df610a308c107a640de438f62eb00b | Add test for early stopping trigger | rezoo/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,aonotas/chainer,chainer/chainer,hvy/chainer,niboshi/chainer,ktnyt/chainer,tkerola/chainer,niboshi/chainer,chainer/chainer,niboshi/chainer,anaruse/chainer,wkentaro/chainer,okuta/chainer,ktnyt/chainer,ronekko/chainer,hvy/chainer,hvy/chainer,jnishi/chainer,okut... | tests/chainer_tests/training_tests/triggers_tests/test_early_stopping_trigger.py | tests/chainer_tests/training_tests/triggers_tests/test_early_stopping_trigger.py | import unittest
import chainer
import numpy
from chainer import testing
from chainer import training
from chainer.training import triggers
from chainer.training import util
class DummyUpdater(training.Updater):
def __init__(self):
self.iteration = 0
def finalize(self):
pass
def get_al... | mit | Python | |
ca8d539f39015b043d51eff8c1359dca0818f348 | Include scratch script to duplicate cropped dataset | seung-lab/Julimaps,seung-lab/Julimaps | src/tasks/python/create_test_cutout.py | src/tasks/python/create_test_cutout.py | from cloudvolume import CloudVolume
image_in = 'gs://neuroglancer/pinky100_v0/image_single_slices'
image_out = 'gs://neuroglancer/pinky100_v0/test_image'
image_mip = 0
roi_in = 'gs://neuroglancer/pinky100_v0/image_single_slices/roicc'
roi_out = 'gs://neuroglancer/pinky100_v0/test_image/roicc'
roi_mip = 6
cfsplit_in = ... | mit | Python | |
b28e8b94191752a92de24845f99db1f59da32a9b | Add module | dgu-dna/DNA-Bot | apps/word.py | apps/word.py | from apps.decorators import on_command
from bs4 import BeautifulSoup
from urllib.request import urlopen, quote
import json
import re
CACHE_DEFAULT_URL = './apps/game_cache/relay.json'
NAVER_DICTIONARY_URL = 'http://krdic.naver.com/search.nhn?query=%s&kind=keyword'
@on_command(['!๋จ์ด'])
def run(robot, channel... | mit | Python | |
9f088ee18bafb3b3d3fbc445bdc46298dea4850c | Create v2 of PWMController | thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x | app_v2/pwm_controller.py | app_v2/pwm_controller.py | import Adafruit_PCA9685
class Device:
def __init__(self, parent, name, channel, on, off):
self.parent = parent
self.name = name
self.channel = channel
self._on = on
self._off = off
self.initial_on = on
self.initial_off = off
@property
def on(self):
... | mit | Python | |
f1ba28d900e6a06aeab34fa67ef8d4552f438c99 | Create ImageNormalize.py | lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples | src/Python/ImageData/ImageNormalize.py | src/Python/ImageData/ImageNormalize.py | #!/usr/bin/env python
import vtk
def main():
colors = vtk.vtkNamedColors()
# Create an image
source = vtk.vtkImageSinusoidSource()
source.Update()
normalizeFilter = vtk.vtkImageNormalize()
normalizeFilter.SetInputConnection(source.GetOutputPort())
normalizeFilter.Update()
... | apache-2.0 | Python | |
dc7b2e1674806511c0ec117b5d13f9e4c4f8e5b6 | Bump version to 0.3.2 | pekermert/django-socketio,clarkperkins/django-socketio,DESHRAJ/django-socketio,freylis/django-socketio,freylis/django-socketio,Solution4Future/django-socketio,stephenmcd/django-socketio,pekermert/django-socketio,kostyll/django-socketio,stephenmcd/django-socketio,Solution4Future/django-socketio,Solution4Future/django-so... | django_socketio/__init__.py | django_socketio/__init__.py |
from django_socketio.utils import NoSocket, send, broadcast, broadcast_channel
__version__ = "0.3.2"
|
from django_socketio.utils import NoSocket, send, broadcast, broadcast_channel
__version__ = "0.3.1"
| bsd-2-clause | Python |
748f335059ce25d1e8177cfbd42c075c51fc450e | Create ifonemail.py | ioangogo/ifon | ifonemail.py | ifonemail.py | import os
import time
from subprocess import Popen, PIPE
import re
import os
import socket
import stmplib
from email.mime.text import MIMEText
def sendemail(msg, email, personin):
msg=MIMEText(msg)
msg['Subject'] = personin + "Is home"
msg['From'] = "ioan.loosley@loosleyweb.co.uk"
msg['To'] = email
s = smtpli... | unlicense | Python | |
c4a05cfc469793fccb4bb958e51ef536a8f8e983 | Add Support Vector regression with Python | a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms | Regression/SupportVectorRegression/regularSVMRegression.py | Regression/SupportVectorRegression/regularSVMRegression.py | # -*- coding: utf-8 -*-
"""Support Vector regression for machine learning.
Support Vector Machine can also be used as a regression method, maintaining all
the main features that characterize the algorithm (maximal margin). The Support
Vector Regression (SVR) uses the same principles as the SVM for classification,
with... | mit | Python | |
f6d3594042f41866b7b590539700d000c01d0e91 | add script to integrate disambiguated results | yngcan/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor | integrate.py | integrate.py | #!/usr/bin/env python
"""
Takes in a CSV file that represents the output of the disambiguation engine:
Patent Number, Firstname, Lastname, Unique_Inventor_ID
Groups by Unique_Inventor_ID and then inserts them into the Inventor table using
lib.alchemy.match
"""
import sys
import lib.alchemy as alchemy
from lib.util.c... | bsd-2-clause | Python | |
3dd99c1e3f2776a44ff9d9354d15e209fccbffbb | Add simple script to send order with the joystick | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | Motors/motorJoy.py | Motors/motorJoy.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
#
# Copyright (c) 2013 Nautilabs
#
# Licensed under the MIT License,
# https://github.com/baptistelabat/robokite
# Authors: Baptiste LABAT
import time
import serial
import numpy as np
import pygame
from pygame.locals import *
pygame.init()
fenetre = pygame.display.set_mode(... | mit | Python | |
704f3441de39a07901faaf8b0622de77aa3d0f86 | Fix error in loader.discover() call | rakeshmi/tempest,xbezdick/tempest,vedujoshi/tempest,alinbalutoiu/tempest,cisco-openstack/tempest,flyingfish007/tempest,bigswitch/tempest,Juraci/tempest,pandeyop/tempest,zsoltdudas/lis-tempest,dkalashnik/tempest,NexusIS/tempest,Juniper/tempest,masayukig/tempest,Tesora/tesora-tempest,sebrandon1/tempest,tonyli71/tempest,p... | tempest/test_discover/test_discover.py | tempest/test_discover/test_discover.py | # Copyright 2013 IBM Corp.
#
# 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 t... | # Copyright 2013 IBM Corp.
#
# 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 t... | apache-2.0 | Python |
0483be7fc08f429461d2901d22ef220ab9ee59e5 | allow to run tox as 'python -m tox', which is handy on Windoze | msabramo/tox,msabramo/tox | tox/__main__.py | tox/__main__.py | from tox._cmdline import main
main()
| mit | Python | |
91f961fa73bc193ba72700814fd8cec0c81168b4 | add iris classification example | ramon-oliveira/aorun | examples/classification.py | examples/classification.py | import os
import sys
sys.path.insert(0, os.path.abspath('..'))
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn import metrics
import torch
import numpy as np
from aorun.models import Model
from aorun.layers import Dense
fr... | mit | Python | |
3644df1b645d4fd607f22b24c5e676644be4a9da | Test script for the bsddb C extension module. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_bsddb.py | Lib/test/test_bsddb.py | #! /usr/bin/env python
"""Test script for the bsddb C module
Roger E. Masse
"""
import bsddb
import tempfile
from test_support import verbose
def test(openmethod, what):
if verbose:
print '\nTesting: ', what
fname = tempfile.mktemp()
f = openmethod(fname, 'c')
if verbose:
print 'creation...'
... | mit | Python | |
a99cf844a8a50a70a65347dad0d656763bc8a408 | Add tests to validate SystemML's deep learning APIs. | niketanpansare/incubator-systemml,apache/incubator-systemml,nakul02/incubator-systemml,deroneriksson/systemml,nakul02/incubator-systemml,deroneriksson/incubator-systemml,deroneriksson/systemml,nakul02/systemml,niketanpansare/systemml,dusenberrymw/incubator-systemml,nakul02/incubator-systemml,gweidner/incubator-systemml... | src/main/python/tests/test_nn_numpy.py | src/main/python/tests/test_nn_numpy.py | #!/usr/bin/python
#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this f... | apache-2.0 | Python | |
7cb4a7290b2af1983e1e291073c0a740d9e1334e | Add some useful finder tests | harlowja/failure | failure/tests/test_finders.py | failure/tests/test_finders.py | # -*- coding: utf-8 -*-
# Copyright (C) 2016 GoDaddy Inc. 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-... | apache-2.0 | Python | |
0f5716b10afff9ccbc17fb595cd7cc2f85b45f8f | Add name attribute to each Page in ServiceWorkerPageSet | Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk,Chilledheart/chromium,axinging/ch... | tools/perf/page_sets/service_worker.py | tools/perf/page_sets/service_worker.py | # Copyright 2014 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 import page as page
from telemetry.page import page_set as page_set
archive_data_file_path = 'data/service_worker.json'
class Service... | # Copyright 2014 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 import page as page
from telemetry.page import page_set as page_set
archive_data_file_path = 'data/service_worker.json'
class Service... | bsd-3-clause | Python |
b071df5de1316807e955e9ec6b4463ec44203fdf | add libhessian.gyp | pmq20/libhessian,pmq20/libhessian | libhessian.gyp | libhessian.gyp | # Copyright (c) 2017 Minqi Pan <pmq2001@gmail.com>
#
# This file is part of libhessian, distributed under the MIT License
# For full terms see the included LICENSE file
{
'targets': [
{
'target_name': 'libhessian',
'type': 'static_library',
'sources': [
'include/hessian.h',
'in... | mit | Python | |
41d0716d9e8fc16df2c67bd0ec12be706d41c678 | add an examples folder, has waterfall to start | matthewperkins/abf_reader | examples/waterfall_plot.py | examples/waterfall_plot.py | from abf_reader import *
import matplotlib.pyplot as plt
from abf_epoch import epoch, waterfall
import matplotlib.gridspec as gridspec
from scale_bars import *
if __name__=='__main__':
import os
labdir = os.environ.get("LABDIR")
# change some legend plot stuff
plt.rcParams.update(\
{'legen... | mit | Python | |
b2a0247746756cc86074754bc993a757d6702b12 | Add coin flip simulator (hw02) | JMill/edX-Learning-From-Data-Programming | hw02/exercise-02-01.py | hw02/exercise-02-01.py | '''
For Homework 02, Exercieses 01-02. EdX Learning From Data course.
Jonathan Miller
'''
import random
# FUNCTIONS ###########################
def runTrial(numCoins, numFlips):
def flipCoin():
if random.random() > 0.5:
return head
else:
return tail
def findv1(vList... | apache-2.0 | Python | |
c67dc16e73eea093befaa03790bd8d6f1b452c9a | Add simple test for FormDesignerPlugin | kcsry/django-form-designer,andersinno/django-form-designer,kcsry/django-form-designer,andersinno/django-form-designer,andersinno/django-form-designer-ai,andersinno/django-form-designer-ai | form_designer/tests/test_cms_plugin.py | form_designer/tests/test_cms_plugin.py | import pytest
from cms import api
from cms.page_rendering import render_page
from django.contrib.auth.models import AnonymousUser
from django.utils.crypto import get_random_string
from form_designer.contrib.cms_plugins.form_designer_form.cms_plugins import FormDesignerPlugin
from form_designer.models import FormDefini... | bsd-3-clause | Python | |
a7220b46393bac832c9a922afaa125f0512bf53e | add handmappedtrack migration | brki/rpspot,brki/rpspot,brki/rpspot,brki/rpspot | trackmap/migrations/0003_handmappedtrack.py | trackmap/migrations/0003_handmappedtrack.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('rphistory', '0001_initial'),
('trackmap', '0002_trackavailability_score'),
]
operations = [
migrations.CreateModel(
... | bsd-2-clause | Python | |
f908dd5fda528b4ce6ebaed082050348bf6f23a5 | Test the console scripts entry point | gbenson/i8c | i8c/tests/test_entry_point.py | i8c/tests/test_entry_point.py | from i8c.tests import TestCase
import i8c
import sys
class TestEntryPoint(TestCase):
"""Test the console scripts entry point."""
def setUp(self):
self.saved_argv = sys.argv
self.saved_stderr = sys.stderr
def tearDown(self):
sys.argv = self.saved_argv
sys.stderr = self.save... | lgpl-2.1 | Python | |
f7b875bb3d4b313e9c1e22297918d33e67633104 | Add test trek_dtail_pdf language none | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | geotrek/altimetry/tests/test_models.py | geotrek/altimetry/tests/test_models.py | import os
from django.test import TestCase
from django.conf import settings
from geotrek.trekking.factories import TrekFactory
from geotrek.trekking.models import Trek
class AltimetryMixinTest(TestCase):
def test_get_elevation_chart_none(self):
trek = TrekFactory.create(no_path=True)
trek.get_el... | bsd-2-clause | Python | |
4a96826205a628d9b3215418841a9ad552d8f2c2 | Add Climbing the leaderboard solution in Python | julianespinel/training,julianespinel/training,julianespinel/training,julianespinel/training | hackerrank/climbing_the_leaderboard.py | hackerrank/climbing_the_leaderboard.py | '''
https://www.hackerrank.com/challenges/climbing-the-leaderboard
# Climbing the leaderboard
The function that solves the problem is:
```python
get_positions_per_score(ranks, scores)
```
The solution uses `deque` instead of lists. Why?
To have O(1) in appends and pops from either side of the deque.
See: https://do... | mit | Python | |
05471fc9d02335915d3697f92189f33c2e557624 | add missing coordinate_space.py file | google/neuroglancer,janelia-flyem/neuroglancer,janelia-flyem/neuroglancer,janelia-flyem/neuroglancer,google/neuroglancer,google/neuroglancer,google/neuroglancer,google/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer,google/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer | python/neuroglancer/coordinate_space.py | python/neuroglancer/coordinate_space.py | # coding=utf-8
# @license
# Copyright 2019-2020 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python | |
cea956d06e63e2f4c63a35e72a3eaf4861394671 | Create RotateArray.py | lingcheng99/LeetCode | RotateArray.py | RotateArray.py | """
Rotate Array
Rotate an array of n elements to the right by k steps.
For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
Note:
Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
"""
#First solution with slicing
class Solut... | mit | Python | |
b3dc26a391fac6de26140c0ff6590a85820a8091 | Update hyperparameters for sklearn model | lilleswing/deepchem,ktaneishi/deepchem,ktaneishi/deepchem,rbharath/deepchem,rbharath/deepchem,deepchem/deepchem,Agent007/deepchem,lilleswing/deepchem,miaecle/deepchem,Agent007/deepchem,lilleswing/deepchem,joegomes/deepchem,ktaneishi/deepchem,miaecle/deepchem,miaecle/deepchem,Agent007/deepchem,deepchem/deepchem,joegomes... | examples/gdb7/gdb7_sklearn.py | examples/gdb7/gdb7_sklearn.py | """
Script that trains Sklearn singletask models on GDB7 dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import deepchem as dc
import numpy as np
import shutil
from sklearn.kernel_ridge import KernelRidge
np.random.seed(123)
base_di... | """
Script that trains Sklearn singletask models on GDB7 dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import deepchem as dc
import numpy as np
import shutil
from sklearn.kernel_ridge import KernelRidge
np.random.seed(123)
base_di... | mit | Python |
8a0d40f9874119084f5f7a1471cb565bb85d6938 | Add match to wd script. | lawlesst/c4l16-idhub | match_to_wd.py | match_to_wd.py | import csv
import pickle
import sys
def load_index():
with open('data/wd_issn.pkl') as inf:
data = pickle.load(inf)
return data
wd_idx = load_index()
def match(issn, eissn):
for isn in [issn, eissn]:
if issn != "":
wd = wd_idx.get(issn)
if wd is not None:
... | mit | Python | |
b6d829177391f59d32614c54670fa993b93a64ee | add simple menu for first iteration of program | marshki/pyWipe,marshki/pyWipe | menu_simple.py | menu_simple.py | #!/usr/bin/env
def menu():
"""Menu prompt for user to select program option"""
while True:
print '1. Overwrite all sectors with zeros (Faster, less secure).'
print '2. Overwrite all sectors with random data (Slower, more secure).'
print '3. I want to quit.'
print()
choi... | mit | Python | |
7716818beb0dba581cd3536e321676d756e282d9 | Remove the lms_comerce_api_url field from partners object | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | course_discovery/apps/core/migrations/0011_remove_partner_lms_commerce_api_url.py | course_discovery/apps/core/migrations/0011_remove_partner_lms_commerce_api_url.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-04-12 17:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0010_partner_lms_coursemode_api_url'),
]
operations = [
migrations.RemoveF... | agpl-3.0 | Python | |
e95daed610d840fe2230c3ca515dea1b0a6f4f27 | Add CN client with simple async wrappers for two APIs | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | gmn/src/d1_gmn/app/management/commands/async_client.py | gmn/src/d1_gmn/app/management/commands/async_client.py | # -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache License, Version 2.0 ... | apache-2.0 | Python | |
bb1aafd72899d35bfcad5a84373281f732ad01ab | Add integration test for minerva-dump script | hendrikx-itc/minerva,hendrikx-itc/minerva | integration_tests/test_minerva_dump.py | integration_tests/test_minerva_dump.py | from contextlib import closing
import subprocess
import unittest
from nose.tools import eq_
from minerva.test import connect
class MinervaDump(unittest.TestCase):
"""
Use standard Python unittest TestCase here because of the assertMultiLineEqual
function.
"""
def test_run(self):
self.max... | agpl-3.0 | Python | |
5c6b0c5e070ee9c67fa00bb3bc17c0b5dfec0bd0 | Create get_started_with_syntax.py | Soyofuki/python-playyard | get_started_with_syntax.py | get_started_with_syntax.py | # ๆฌๆ็ฎ็๏ผๆป่ง Python ็ไธป่ฆ่ฏญๆณ๏ผๅนถไพๆฅๅๅคๅฟใ
# ้
่ฏปๆๅ๏ผๆฌๆไธๆฏๆๆกฃใ้่ฟ้่ฏปๆฌๆ๏ผๅฏไปฅไบ่งฃ Python ๅบๆฌ็่ฏญๆณๅไธไบๅธธ็จ็ๆนๆณใ่ฏป่
ๅฏไปฅๅฐๅ
ถไธๅ
ถไป่ฏญ่จๆฏ่พ๏ผ็่งฃๅ
ถๆๅพไธๅซไนใ
# ็ฎๆ ่ฏป่
๏ผๅ
ทๆ็จๅบ่ฎพ่ฎกๅบ็ก็ฅ่ฏ๏ผ็่งฃ้ขๅๅฏน่ฑก็จๅบ่ฎพ่ฎกๅบๆฌๆฆๅฟต็็จๅบๅ
# ๆจกๅๅฏผๅ
ฅ
from math import pi, sqrt # ๅๆถๅฏผๅ
ฅๅคไธชๆจกๅ
from re import match as re_match # ้ๅฝๅ
# ็ฑป็ๅฎไนไธๅณๆ
class Animal:
__character = "Positive" # ไธไผ็ป่ฟ "from module_name import *" ๅฏผๅ
ฅ
_gend... | mit | Python | |
186b231b7149b52dc95837aabd5f44b1c02c8e41 | Add PyQtGraph random walk without datetime | scls19fr/numpy-buffer | samples/sample_pyqtgraph_no_datetime.py | samples/sample_pyqtgraph_no_datetime.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This example demonstrates a random walk with pyqtgraph.
"""
import sys
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from numpy_buffer import RingBuffer # https://github.com/scls19fr/numpy-buffer
class RandomWalkPlot:
def __init... | bsd-3-clause | Python | |
fc5714951bac61f17509eacf8ec2413e14a79ddc | Add a snomask for OPER attempts | ElementalAlchemist/txircd,Heufneutje/txircd | txircd/modules/core/sno_oper.py | txircd/modules/core/sno_oper.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class SnoOper(ModuleData):
implements(IPlugin, IModuleData)
name = "ServerNoticeOper"
core = True
def hookIRCd(self, ircd):
self.ircd = ircd
def actions(se... | bsd-3-clause | Python | |
e02a633ef268a58a0054c0f9ab1a03dacdb3919f | Add preferences converter | senttech/Cura,Curahelper/Cura,hmflash/Cura,ynotstartups/Wanhao,totalretribution/Cura,fieldOfView/Cura,fieldOfView/Cura,totalretribution/Cura,hmflash/Cura,senttech/Cura,ynotstartups/Wanhao,Curahelper/Cura | plugins/VersionUpgrade/VersionUpgrade21to22/Preferences.py | plugins/VersionUpgrade/VersionUpgrade21to22/Preferences.py | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import configparser #To read config files.
import io #To output config files to string.
import UM.VersionUpgrade #To indicate that a file is of the wrong format.
## Creates a new preferences instance by parsing a seriali... | agpl-3.0 | Python | |
5dde2f07399e09fd9e15467b5df78447ae6b2404 | Create add.py | WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,... | add2numbers/add.py | add2numbers/add.py | # Python Program - Add Two Numbers
while True:
print("Enter '0' for exit.")
print("Enter two numbers: ")
val1 = int(input())
val2 = int(input())
if val1 == 0:
break
else:
sum = val1 + val2
print("Sum of the given two number:",sum,"\n")
| mit | Python | |
af43e5009e6f21e75ee7244d13a2a80e88bf5288 | add add_grid_config.py | tahoe-lafs/perf-tests,tahoe-lafs/perf-tests,tahoe-lafs/perf-tests | add_grid_config.py | add_grid_config.py | from gcloud import datastore
key = datastore.Key("GridConfig")
c = datastore.Entity(key)
c.update({
"num_server_instances": 3,
"server_instance_types": ["n1-standard-1"]*3,
"num_servers": 6,
"server_versions": ["1.10.0"]*6,
"server_latencies": [0]*6,
"client_instance_type": "n1-standard-1",
... | mit | Python | |
9df2c8ad6208d89fc1865b36a94115731492f902 | test code for resize_to_yolo | Swall0w/clib | tests/converts/test_format_image_size.py | tests/converts/test_format_image_size.py | import unittest
from clib.converts import resize_to_yolo
from skimage import data
class ResizeYoloTest(unittest.TestCase):
def setUp(self):
self.grayimg = data.coins()
self.rgbimg = data.astronaut()
def test_resize_to_yolo(self):
self.assertEqual(resize_to_yolo(self.rgbimg).shape,
... | mit | Python | |
8f3c5dc924b0a8ad35d99d66eb809a51b49fc178 | Add a management command to rename a stream. | eeshangarg/zulip,dhcrzf/zulip,wavelets/zulip,hengqujushi/zulip,praveenaki/zulip,armooo/zulip,JanzTam/zulip,glovebx/zulip,amanharitsh123/zulip,dxq-git/zulip,xuxiao/zulip,stamhe/zulip,pradiptad/zulip,akuseru/zulip,bitemyapp/zulip,JPJPJPOPOP/zulip,zorojean/zulip,kokoar/zulip,zwily/zulip,LAndreas/zulip,christi3k/zulip,nata... | zerver/management/commands/rename-stream.py | zerver/management/commands/rename-stream.py | from __future__ import absolute_import
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_rename_stream
from zerver.models import Realm, get_realm
class Command(BaseCommand):
help = """Change the stream name for a realm.
Usage: python manage.py rename-stream <domain> <old name... | apache-2.0 | Python | |
9d7acb2b629667e166464bb9b8c43922ed21c1d9 | add utility to copy events to another ES server | mozilla/MozDef,mpurzynski/MozDef,gsssrao/MozDef,eXcomm/MozDef,netantho/MozDef,triplekill/MozDef,abhijithch/MozDef,mpurzynski/MozDef,serbyy/MozDef,netantho/MozDef,DarkPrince304/MozDef,jeffbryner/MozDef,eXcomm/MozDef,netantho/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,526avijitgupta/MozDef,jvehent/MozDef,t... | mq/cpEvents.py | mq/cpEvents.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import pyes
from kombu import Connection,Queue,Exchange
from kombu.mixins imp... | mpl-2.0 | Python | |
9f3b3f068bfb53b00a2ec8420816c6deb02729e3 | Add a configuration to fetch "ios_internal" project. | primiano/depot_tools,primiano/depot_tools,CoherentLabs/depot_tools,CoherentLabs/depot_tools,primiano/depot_tools | fetch_configs/ios_internal.py | fetch_configs/ios_internal.py | # Copyright 2016 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.
import sys
import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
cla... | bsd-3-clause | Python | |
583155db6a85808c69fa25ba4959ebd370aa2fba | Add script to check if modules up | dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet | etc/config/check_modules.py | etc/config/check_modules.py | from subprocess import call
import os
modules = [
'backend.unichat.eu',
'realtime.unichat.eu',
'presence.unichat.eu',
'matchmaker.unichat.eu',
]
for m in modules:
with open(os.devnull, 'w') as devnull:
call(
['curl', '-m', '1', m],
stdout=devnull,
stderr... | mit | Python | |
c641456dc339169eb7bb4fb6ddc6e5e14cfba80e | add ROACH monitor | HERA-Team/hera_mc,HERA-Team/hera_mc,HERA-Team/Monitor_and_Control | scripts/mc_monitor_roach_temps.py | scripts/mc_monitor_roach_temps.py | #! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2017 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""Gather temperatures from the correlator ROACH devices and log them into M&C
The temperatures cycle out of the Redis store every minute, so cron can't
sample quickly enough... | bsd-2-clause | Python | |
fbf6542af6001e385612d0e2e98dbae357a52e77 | use setuptools to dynamic load freeze pyzmq egg | Mustard-Systems-Ltd/pyzmq,caidongyun/pyzmq,swn1/pyzmq,caidongyun/pyzmq,swn1/pyzmq,dash-dash/pyzmq,dash-dash/pyzmq,dash-dash/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,caidongyun/pyzmq,yyt030/pyzmq,ArvinPan/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq,ArvinPan/pyzmq | zmq/__init__.py | zmq/__init__.py | """Python bindings for 0MQ."""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2012 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distributed ... | """Python bindings for 0MQ."""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2012 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distributed ... | bsd-3-clause | Python |
50db2fa37aab219c9273cf3f76269de11e2dc86b | Add a migration to allow Auditor role to see mappings defined in the Audit context. | andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,hyperNURb/ggrc-core,jmakov/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,hyperNURb/ggrc-core,kr41/ggrc-core,NejcZupec/ggrc-core,jmakov/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,V... | src/ggrc_basic_permissions/migrations/versions/20131204014446_54b6efd65a93_add_mappings_to_audi.py | src/ggrc_basic_permissions/migrations/versions/20131204014446_54b6efd65a93_add_mappings_to_audi.py |
"""Add mappings to Auditor role
Revision ID: 54b6efd65a93
Revises: 13b49798db19
Create Date: 2013-12-04 01:44:46.023974
"""
# revision identifiers, used by Alembic.
revision = '54b6efd65a93'
down_revision = '13b49798db19'
import sqlalchemy as sa
from alembic import op
from datetime import datetime
from sqlalchemy.... | apache-2.0 | Python | |
17ae440f509ada010ee3e3b84f0a2c50b196ff82 | Add test for pickle | spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc | thinc/tests/integration/test_pickle.py | thinc/tests/integration/test_pickle.py | from __future__ import unicode_literals
import pytest
import pickle
from ...api import with_flatten
from ...v2v import Affine
@pytest.fixture
def affine():
return Affine(5, 3)
def test_pickle_with_flatten(affine):
Xs = [affine.ops.allocate((2, 3)),
affine.ops.allocate((4, 3))]
model = with_flat... | mit | Python | |
6be2917b4f46c55eefcbfe57bdc517f9316fe897 | Add the generated version file | jupyter/jupyterlab,charnpreetsingh185/jupyterlab,charnpreetsingh185/jupyterlab,eskirk/jupyterlab,eskirk/jupyterlab,eskirk/jupyterlab,jupyter/jupyterlab,charnpreetsingh185/jupyterlab,jupyter/jupyterlab,eskirk/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,charnpreetsingh185/jupyterlab,eskirk/jupyterlab,charnpreetsingh... | jupyterlab/_version.py | jupyterlab/_version.py | # This file is auto-generated, do not edit!
__version__ = "0.7.0"
| bsd-3-clause | Python | |
c74ce3d4561a7367903863aaabe1af113d43aa0c | Add base model obect to project. | 0xporky/mgnemu-python | mgnemu/models/BaseModel.py | mgnemu/models/BaseModel.py | # -*- coding: utf-8 -*-
"""
Base model of project.
Contains to basic methods:
dumps(object_data) - writes object into json.
loads(json_data) - converts json into model object.
"""
import json
class BaseModel():
def dumps(object_data):
return json.dumps(object_data)
def loads(json_data):
... | mit | Python | |
4bbdf36d7f001d9dc7f6e451bd733698895646b6 | Create carpenter.py | 11harrisonh/school-stuff | carpenter.py | carpenter.py | # -*- coding: cp1252 -*-
print("Welcome to Harry Harrison's Carpentization IV: Beyond the Window\n'Build a Window to Stand the Test of Time'")
raw_input("Press enter to start the program")
priceOfWood = int( input("How expensive is the wood per metre? (in pounds): ") * 100)
windows = int( input("How many windows would ... | mit | Python | |
a574db21148de297970647d137d0f9b094a4dc46 | add local storage driver for grypedb files | anchore/anchore-engine,anchore/anchore-engine,anchore/anchore-engine | anchore_engine/services/policy_engine/engine/feeds/storage.py | anchore_engine/services/policy_engine/engine/feeds/storage.py | import hashlib
import io
import tempfile
from contextlib import contextmanager
from os import path
from types import TracebackType
from typing import Generator, Optional, Type
class ChecksumMismatchError(Exception):
"""
Exception raised when file data is corrupt (calculated checksum does not match expected va... | apache-2.0 | Python | |
4f105f48b20e70415ede60c19cd7d6cdea07fc28 | Add tests for monitors | google/openhtf,fahhem/openhtf,grybmadsci/openhtf,ShaperTools/openhtf,ShaperTools/openhtf,google/openhtf,grybmadsci/openhtf,fahhem/openhtf,jettisonjoe/openhtf,jettisonjoe/openhtf,amyxchen/openhtf,ShaperTools/openhtf,google/openhtf,amyxchen/openhtf,jettisonjoe/openhtf,grybmadsci/openhtf,fahhem/openhtf,google/openhtf,jett... | test/util/monitors_test.py | test/util/monitors_test.py | # Copyright 2016 Google Inc. 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 applicable law or agre... | apache-2.0 | Python | |
51ee3dae7cab41ff46cbd1cde87db9cb7997e5f9 | Add a separate file for loading app views | gr1d99/shopping-list,gr1d99/shopping-list,gr1d99/shopping-list | views.py | views.py | from functools import wraps
from flask import flash, redirect, render_template, request, session, url_for
from flask.views import View
def check_shoppinglist(func):
@wraps(func)
def _wrapped(view):
my_shopping_list = session.get('shopping_list', {})
if not my_shopping_list:
flash('... | mit | Python | |
ffb69023f1399d345a4d389f6864bd25c9285c18 | add if_for_while.py | hewentian/python-learning | src/python27/basic/if_for_while.py | src/python27/basic/if_for_while.py | # -*- coding: utf-8 -*-
age = 20
if age >= 18:
print 'your age is', age
print 'adult'
else:
print 'your age is', age
print 'teenager'
age = 3
if age >= 18:
print 'adult'
elif age >= 6:
print 'teenage'
else:
print 'kid'
if 'non null':
print 'True'
names = ['Michael', 'Bob', 'Tracy']
fo... | apache-2.0 | Python | |
cead4c6e8508f1504c57e3dfdc919ee88ee4cbbb | mark unuploaded | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | selfdrive/loggerd/tools/mark_unuploaded.py | selfdrive/loggerd/tools/mark_unuploaded.py | #!/usr/bin/env python3
import sys
from common.xattr import removexattr
from selfdrive.loggerd.uploader import UPLOAD_ATTR_NAME
for fn in sys.argv[1:]:
print("unmarking %s" % fn)
removexattr(fn, UPLOAD_ATTR_NAME)
| mit | Python | |
acd843632e7e8608bef2d56eb2c805acf08602d2 | add phase estimation routine for pulse calibration | BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex | src/auspex/pulsecal/phase_estimation.py | src/auspex/pulsecal/phase_estimation.py | # Copyright 2016 Raytheon BBN Technologies
#
# 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
import numpy as np
import matplotlib.pyplot as pl... | apache-2.0 | Python | |
9d667d2d194a9bb7a3c166e47b2c32cf33c7b19c | add code samples for recipe 1.19 | ordinary-developer/book_python_cookbook_3_ed_d_beazley_b_k_jones | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/19-transforming_and_reducing_data_at_the_same_time/main.py | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/19-transforming_and_reducing_data_at_the_same_time/main.py | def example_1():
nums = [1, 2, 3, 4, 5]
s = sum(x * x for x in nums)
print(s)
def example_2():
import os
files = os.listdir('./')
if any(name.endswith('.py') for name in files):
print('Ther be python!')
else:
print('Sorry, no python.')
def example_3():
s = ('ACME', 50... | mit | Python | |
d5c96dbd94119d10bd8fcf506ba389d56b5e0fca | Add new package py-libensemble (#6525) | matthiasdiener/spack,mfherbst/spack,mfherbst/spack,krafczyk/spack,mfherbst/spack,LLNL/spack,krafczyk/spack,mfherbst/spack,matthiasdiener/spack,EmreAtes/spack,krafczyk/spack,tmerrick1/spack,matthiasdiener/spack,iulian787/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,tmerrick1/spack,LLNL/spack,EmreAtes/spack,LLNL/spac... | var/spack/repos/builtin/packages/py-libensemble/package.py | var/spack/repos/builtin/packages/py-libensemble/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
17fe9d01b6771888a44d6a039b337a84c32e64e8 | Add test case for interval_sum | JaviMerino/bart,ARM-software/bart | tests/test_common_utils.py | tests/test_common_utils.py | from bart.common import Utils
import unittest
import pandas as pd
class TestCommonUtils(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestCommonUtils, self).__init__(*args, **kwargs)
def test_interval_sum(self):
"""Test Utils Function: interval_sum"""
array = [0, 0,... | apache-2.0 | Python | |
5ac6848633d9eb373cf44aed77645449a5a926cf | Create session class | trond-snekvik/pyUV | session.py | session.py | import hashlib
import binascii
import json
import os
from os import path, environ
class Session:
def __init__(self, directory):
self.directory = directory
self.options = {}
h = hashlib.new("SHA1")
h.update(self.directory)
self.tempstore = path.join(environ["TEMP"], binascii... | mit | Python | |
c10244d72051325659a85ac46207d25102ef225b | Create HBV_APRI_FIB4.py | kyokyos/bioinform | HBV_APRI_FIB4.py | HBV_APRI_FIB4.py | # -*- coding: utf-8 -*-
"""
Spyder Editor
APRIๅFIB4ๆจๆต่็บค็ปดๅๆ่็กฌๅๆ
ๅต
This is a temporary script file.
"""
import math
#APRI็ผฉๅ๏ผAST to Platelet Ratio Index
#ASTๅไฝiu/l
#PRIๅไฝ10**9/L
#ๅฆๆAPRI>2๏ผๅฏ่ฝๆ่็กฌๅ
def APRI(AST,upper_AST,PRI):
apri=((AST*1.0/upper_AST)*100)/PRI
return apri
#FIB-4็ผฉๅFibrosis-4
#ageๅไฝ๏ผๅนด
#ASTๅALTๅ... | unlicense | Python | |
91347ba6d18706cb791ea3d9063392671c9f653f | add tests for load utils | robinandeer/chanjo | tests/load/test_load_utils.py | tests/load/test_load_utils.py | # -*- coding: utf-8 -*-
from chanjo.load.utils import exon, _exon_kwargs
DATA = {'chrom': 'chr1', 'chromStart': 100, 'chromEnd': 220, 'name': 'exon1',
'score': 0, 'strand': '+', 'sampleName': 'sample1', 'readCount': 10,
'meanCoverage': 6.341, 'thresholds': {10: 95.421, 20: 86.21, 100: 10.21}}
def te... | mit | Python | |
8b0a2abaf9c942f2fd49827e898700de54fdb8af | Add failing 2.6 test | pre-commit/pre-commit,philipgian/pre-commit,pre-commit/pre-commit,chriskuehl/pre-commit-1,chriskuehl/pre-commit-1,Teino1978-Corp/pre-commit,Teino1978-Corp/pre-commit,barrysteyn/pre-commit,philipgian/pre-commit,chriskuehl/pre-commit,philipgian/pre-commit,beni55/pre-commit,philipgian/pre-commit,pre-commit/pre-commit,Luca... | tests/logging_handler_test.py | tests/logging_handler_test.py | import __builtin__
import mock
import pytest
from pre_commit import color
from pre_commit.logging_handler import LoggingHandler
@pytest.yield_fixture
def print_mock():
with mock.patch.object(__builtin__, 'print', autospec=True) as print_mock:
yield print_mock
class FakeLogRecord(object):
def __init... | mit | Python | |
5c282b901986e689c68f0a43dbf2cf37b977d1b7 | fix tests | sumit12dec/pyquora,iammxt/pyquora,rohithpr/pyquora | tests/test_user_statistics.py | tests/test_user_statistics.py | from quora import User
expected_user_stat_keys = ['answers',
'edits',
'followers',
'following',
'questions',
'name',
'username'
... | from quora import User
expected_user_stat_keys = ['answers',
'edits',
'followers',
'following',
'questions',
'name',
'username'
... | agpl-3.0 | Python |
1f0e023e972954a2f654705f2c7b596fc56e90b8 | Add missing __init__.py file for proper PyPi inclusion of task. | google/starthinker,google/starthinker,google/starthinker | starthinker/task/drive/__init__.py | starthinker/task/drive/__init__.py | ###########################################################################
#
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/l... | apache-2.0 | Python | |
6e083bce7328dba9e84f16e9c12e0e129658176a | Create config618.py | davidfergusonaz/davidtest,davidfergusonaz/davidtest | config618.py | config618.py | provider "aws" {
access_key = "AKIAIDPZGSRRD6Q6XFLA"
secret_key = "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"
region = "${var.region}"
}
| mit | Python | |
689083a97625dd99633c3116565cdb498d63abd2 | Add functions to crosswalk file to select checkboxes | RyanJennings1/crosswalk | crosswalk.py | crosswalk.py | #!/usr/bin/python
from sys import argv
from selenium import webdriver
from bs4 import BeautifulSoup
import requests, time, time
class Crosswalk(object):
def getEmail(self):
# Select email address to use
email = raw_input("Enter email address: ")
return email
def openBrowser(self):
#email = self.... | mit | Python | |
2acaec94042d1a7db93d0ccc0ed06672174f73fc | add tf dataset examples | jeffzhengye/pylearn,jeffzhengye/pylearn,jeffzhengye/pylearn,jeffzhengye/pylearn | tensorflow_learning/tf2/dataset.py | tensorflow_learning/tf2/dataset.py | # -*- coding: utf-8 -*-
'''
@author: jeffzhengye
@contact: yezheng@scuec.edu.cn
@file: dataset.py
@time: 2021/1/7 14:20
@desc:
'''
import tensorflow as tf
def test_cache_dataset():
def map_fun(x):
print(x, type(x))
return 2 * x
d = tf.data.Dataset.range(5)
d = d.... | unlicense | Python | |
e6a3e2ac8267ae3a0f361138bd8cb25f82b12b9d | Create a tool-info module for AVR | sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec | benchexec/tools/avr.py | benchexec/tools/avr.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.result as result
import benchexec.tools.template
class Tool(benchexec.t... | apache-2.0 | Python | |
270261ea47190e411076a7216190e1a488e7e7db | Update the extract_lhl_structures_in_a_cluster.py script | Kortemme-Lab/protein_feature_analysis,Kortemme-Lab/protein_feature_analysis | inputs/loop_helix_loop/extract_lhl_structures_in_a_cluster.py | inputs/loop_helix_loop/extract_lhl_structures_in_a_cluster.py | #!/usr/bin/env python3
'''Extract LHL structures in a cluster
Save the structures into a directory called clustered_lhl_structure.
Also save the information of insertion points.
Usage:
./extract_lhl_structures_in_a_cluster.py pdbs_path cluster_file
'''
import os
import sys
import json
import pyrosetta
from pyros... | mit | Python | |
e2994c09ecf0e5b18ad587cb656ce014e009d99f | fix library name on macos | freedomtan/tensorflow,arborh/tensorflow,adit-chandra/tensorflow,ghchinoy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,ppwwyyxx/tensorflow,adit-chandra/tensorflow,cxxgtxy/tensorflow,adit-chandra/tensorflow,xzturn/tensorflow,davidzchen/tensorflow,arborh/tensorflow,alsrgv/tensorflow,gunan/tensorflow,petewarden/tens... | tensorflow/python/platform/sysconfig.py | tensorflow/python/platform/sysconfig.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 |
4a10969e62475bba4bbf7fe441a0880dd8842bc2 | Add simple type system | Inaimathi/pykit,flypy/pykit,flypy/pykit,Inaimathi/pykit,ContinuumIO/pykit,ContinuumIO/pykit | pykit/types.py | pykit/types.py | from collections import namedtuple, defaultdict, deque, Set, Mapping
from pykit.ir import parser
alltypes = frozenset(['Bool', 'Int', 'Real', 'Complex', 'Array', 'Struct',
'Typedef', 'Object', 'Tuple', 'List'])
def typetuple(name, elems):
ty = namedtuple(name, elems)
for tyname in alltyp... | bsd-3-clause | Python | |
e0fccab95662dfca2c0f84b946517df4e85e2c34 | Add config for L/32 BatchEnsemble model. | google/uncertainty-baselines | baselines/jft/experiments/vit_be/jft300m_be_vit_large_32.py | baselines/jft/experiments/vit_be/jft300m_be_vit_large_32.py | # coding=utf-8
# Copyright 2021 The Uncertainty Baselines Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | apache-2.0 | Python | |
61ee58ae699c83574538ffedc4b4965acdb27f0c | Add basic Markov Chain generator. | Fifty-Nine/github_ebooks | Markov.py | Markov.py | from collections import deque, defaultdict
from random import choice
class SequenceGenerator:
def __init__(self, order):
self.order = order
self.table = defaultdict(list)
def addSample(self, sequence):
st = deque([None] * self.order, self.order)
len = 0
for v in sequence:
self.table[tup... | mit | Python | |
3df411232c6dda6692118bc4348099778c4b681a | Create db.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | cloud/db/db.py | cloud/db/db.py | #!/usr/bin/env python
import pymysql #Python3
db = pymysql.connect("localhost","sips","root","zaijian" )
cursor = db.cursor()
cursor.execute("SELECT VERSION()")
data = cursor.fetchone()
print ("Database version : %s " % data)
db.close()
def create_table():
db = pymysql.connect("localhost","sips","root","zaijian"... | mit | Python | |
b373eaab5918488292075c962f4374dc8815c395 | Add script to generate partition ids. | medallia/voldemort,HB-SI/voldemort,voldemort/voldemort,HB-SI/voldemort,cshaxu/voldemort,squarY/voldemort,medallia/voldemort,cshaxu/voldemort,stotch/voldemort,rickbw/voldemort,birendraa/voldemort,voldemort/voldemort,birendraa/voldemort,PratikDeshpande/voldemort,HB-SI/voldemort,null-exception/voldemort,mabh/voldemort,jal... | test/integration/generate_partitions.py | test/integration/generate_partitions.py | import sys
import random
if len(sys.argv) != 3:
print >> sys.stderr, "USAGE: python generate_partitions.py nodes partitions_per_node"
sys.exit()
FORMAT_WIDTH = 10
nodes = int(sys.argv[1])
partitions = int(sys.argv[2])
ids = range(nodes * partitions)
# use known seed so this is repeatable
random.seed(928734... | apache-2.0 | Python | |
805f5abc98864d5543f9a5d94f9279926a8730fc | Add pppd.py back | frank-deng/retro-works,frank-deng/retro-works,frank-deng/retro-works,frank-deng/retro-works,frank-deng/retro-works,frank-deng/retro-works | misc/pppd.py | misc/pppd.py | #!/usr/bin/env python3
import os, sys, time, subprocess, pty, fcntl, socket, select, argparse;
parser = argparse.ArgumentParser();
parser.add_argument(
'--host',
'-H',
help='Specify binding host for the PPP server.',
default=''
);
parser.add_argument(
'--port',
'-P',
help='Specify port for... | mit | Python | |
28897fa74e1883388712704233e85ab60fe4d823 | Create Paddle.py | petehopkins/Untitled-CSET1100-Project | Paddle.py | Paddle.py | import pygame
class Paddle(pygame.sprite.Sprite):
def __init__(self, window):
pygame.sprite.Sprite.__init__(self)
self.limitLeft = 20
self.limitRight = window.get_width() - self.limitLeft
self.width = 75
self.height = 25
self.color = (0, 0 , 96)
self.image = ... | mit | Python | |
759dbe3f6b601be7d5560b610b6b429fdca4d8b8 | add gevent echo | supercocoa/HelloBackend,supercocoa/HelloBackend | net/python/gevent/simple/echo/echo.py | net/python/gevent/simple/echo/echo.py | import socket
import gevent
HOST = 'localhost'
PORT = 50009
def handleReq(conn, addr):
print 'handleReq'
while 1:
data = conn.recv(1024)
if not data:
break
conn.sendall(data)
conn.close()
def createSvr():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | apache-2.0 | Python | |
11b6764eb4acef700e81a07ba7d68327374c8f20 | Test inactive_users job. | PyBossa/pybossa,jean/pybossa,OpenNewsLabs/pybossa,stefanhahmann/pybossa,jean/pybossa,geotagx/pybossa,inteligencia-coletiva-lsd/pybossa,stefanhahmann/pybossa,OpenNewsLabs/pybossa,PyBossa/pybossa,Scifabric/pybossa,geotagx/pybossa,Scifabric/pybossa,inteligencia-coletiva-lsd/pybossa | test/test_jobs/test_engage_old_users.py | test/test_jobs/test_engage_old_users.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2014 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | agpl-3.0 | Python | |
5caf67f27d82689babf5dcf0a234dfe3c261ff9c | Implement a framework for data retention policies | akuseru/zulip,AZtheAsian/zulip,KJin99/zulip,EasonYi/zulip,rishig/zulip,seapasulli/zulip,gigawhitlocks/zulip,dotcool/zulip,wdaher/zulip,dattatreya303/zulip,arpith/zulip,aps-sids/zulip,natanovia/zulip,wangdeshui/zulip,fw1121/zulip,JanzTam/zulip,natanovia/zulip,mansilladev/zulip,littledogboy/zulip,bowlofstew/zulip,dhcrzf/... | zephyr/retention_policy.py | zephyr/retention_policy.py | """
Implements the per-domain data retention policy.
The goal is to have a single place where the policy is defined. This is
complicated by needing to apply this policy both to the database and to log
files. Additionally, we want to use an efficient query for the database,
rather than iterating through messages one ... | apache-2.0 | Python | |
f4646f863cd72d4f788dfe35efe478dc85707d07 | add tool to generate lang to font table | moyogo/nototools,anthrotype/nototools,googlefonts/nototools,googlei18n/nototools,dougfelt/nototools,googlei18n/nototools,anthrotype/nototools,dougfelt/nototools,googlei18n/nototools,anthrotype/nototools,googlefonts/nototools,dougfelt/nototools,googlefonts/nototools,moyogo/nototools,moyogo/nototools,googlefonts/nototool... | nototools/generate_lang_font_table.py | nototools/generate_lang_font_table.py | #!/usr/bin/python
#
# Copyright 2015 Google Inc. 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... | apache-2.0 | Python | |
b1bc68413efcf757dc6430f33820d5ff27e22269 | Enhance testing for macro support | ssarangi/numba,stefanseefeld/numba,IntelLabs/numba,GaZ3ll3/numba,IntelLabs/numba,stuartarchibald/numba,pombredanne/numba,stonebig/numba,numba/numba,gdementen/numba,cpcloud/numba,jriehl/numba,numba/numba,GaZ3ll3/numba,cpcloud/numba,gmarkall/numba,pitrou/numba,seibert/numba,jriehl/numba,pombredanne/numba,gdementen/numba,... | numba/cuda/tests/cudapy/test_macro.py | numba/cuda/tests/cudapy/test_macro.py | from __future__ import print_function, division, absolute_import
import numpy as np
from timeit import default_timer as time
from numba import cuda, float32
from numba.cuda.testing import unittest
GLOBAL_CONSTANT = 5
GLOBAL_CONSTANT_2 = 6
GLOBAL_CONSTANT_TUPLE = 5, 6
def udt_global_constants(A):
sa = cuda.shared... | bsd-2-clause | Python | |
5ff659676f7c1164aeadba0ce7f7f41824bad5fd | update : minor changes | black-perl/ptop | ptop/plugins/cpu_sensor.py | ptop/plugins/cpu_sensor.py | '''
CPU sensor plugin
Generates the CPU usage stats
'''
from ptop.core import Plugin
import psutil
class CPUSensor(Plugin):
def __init__(self,**kwargs):
super(CPUSensor,self).__init__(**kwargs)
# overriding the update method
def update(self):
# there will be two parts of the retur... | mit | Python | |
c7557de36799bfbe8318e05e370cee0ad09262e4 | Add connection handler | devicehive/devicehive-python | devicehive/connection_handler.py | devicehive/connection_handler.py | from devicehive.handlers.base_handler import BaseHandler
from devicehive.api import Token
class ConnectionHandler(BaseHandler):
"""Connection handler class."""
def __init__(self, transport, handler_class, handler_options,
authentication):
BaseHandler.__init__(self, transport)
... | apache-2.0 | Python | |
c405f4afe48a6dfa0fa592c2b1a2ab6a621377ec | Add sample_crop() | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/random.py | nn/random.py | import tensorflow as tf
from .util import static_shape
def sample_crop(xs, n):
return tf.random_crop(xs, [n, *static_shape(xs)[1:]])
| unlicense | Python | |
27a7bf62ee2ef7b42a659261f36890eb922c9747 | Create ex_read_log.py | mariuszha/SPSE | Module_2/Lesson_1/ex_read_log.py | Module_2/Lesson_1/ex_read_log.py | #!/usr/bin/env python
# ex_read_log.py by mariuszha
#
# Purpose:
# Find all the logs in the /var/log/syslog which pertain to CMD
# and print them out selectively
#
with open("/var/log/syslog") as f:
for line in f:
if "CMD" in line:
print line
| mit | Python | |
8953b336dfcb8bd6c69b2af8e960a215a47838f8 | Add reverse a list of characters in place | HKuz/Test_Code | Problems/reverseStringInPlace.py | Problems/reverseStringInPlace.py | #!/Applications/anaconda/envs/Python3/bin
def main():
# Test suite
tests = [ None, [''], ['f','o','o',' ','b','a','r']]
for t in tests:
print('Testing: {}'.format(t))
print('Result: {}'.format(reverse_string_in_place(t)))
return 0
def reverse_string_in_place(chars):
''' Reverses... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.