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 |
|---|---|---|---|---|---|---|---|---|
a4f49b988a10afc160c217d32da46ea854059e8c | Add migration file | rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport | ureport/polls/migrations/0060_populate_category_displayed.py | ureport/polls/migrations/0060_populate_category_displayed.py | # Generated by Django 2.2.10 on 2020-05-05 15:01
from django.db import migrations
def noop(apps, schema_editor): # pragma: no cover
pass
def populate_category_displayed(apps, schema_editor): # pragma: no cover
PollResponseCategory = apps.get_model("polls", "PollResponseCategory")
updated = 0
fo... | agpl-3.0 | Python | |
b7cd3081585c0a4695db4f85b7db8e346a525e23 | add to pypi | paroj/libraw.py | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name="libraw.py",
version="1.0",
description="python bindings using ctypes for libraw",
url="https://github.com/paroj/libraw.py",
author="Pavel Rojtberg",
license="LGPLv2",
classifiers=[
'Programming Language :: Python :: 2.7',
... | lgpl-2.1 | Python | |
88cb2155d55100d9b00dca1ecf4f9a01dec7c3f5 | Add missing 'import os' for integrationtest/vm/basic/suite_setup.py | SoftwareKing/zstack-woodpecker,zstackorg/zstack-woodpecker,zstackio/zstack-woodpecker,quarkonics/zstack-woodpecker,zstackorg/zstack-woodpecker,quarkonics/zstack-woodpecker,zstackio/zstack-woodpecker,SoftwareKing/zstack-woodpecker,zstackio/zstack-woodpecker,zstackorg/zstack-woodpecker | integrationtest/vm/basic/suite_setup.py | integrationtest/vm/basic/suite_setup.py | '''
@author: Frank
'''
import os
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.operations.deploy_operations as deploy_operations
import zstackwoodpecker.operations.config_operations as config_operations
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.tes... | '''
@author: Frank
'''
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.operations.deploy_operations as deploy_operations
import zstackwoodpecker.operations.config_operations as config_operations
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_util as t... | apache-2.0 | Python |
f0205534cd1c812db94921b29ebef4207039e56b | work in progress (kind of) | projecthamster/experiments | hamster_sun.py | hamster_sun.py | #!/usr/bin/env python
# - coding: utf-8 -
# Copyright (C) 2010 Toms Bauģis <toms.baugis at gmail.com>
"""Base template"""
import gtk
from lib import graphics
import math
import hamster.client
import datetime as dt
from collections import defaultdict
class Scene(graphics.Scene):
def __init__(self):
graph... | mit | Python | |
e3cbc79cc60e21978fe682b73413e9de19b71543 | add a print hello world function | ctsit/J.O.B-Training-Repo-1 | helloAlyssa.py | helloAlyssa.py | #This is my hello world program
print ('Hello World')
| apache-2.0 | Python | |
9339307b6bd42ad014e528d337fc9f195c632245 | Add tick class | techbureau/zaifbot,techbureau/zaifbot | zaifbot/exchange/tick.py | zaifbot/exchange/tick.py | class Tick:
def __init__(self, currency_pair):
self.size = currency_pair.info['aux_unit_step']
self._decimal_digits = currency_pair.info['aux_unit_point']
def truncate_price(self, price):
remainder = price % self.size
truncated_price = price - remainder
if self._decimal_... | mit | Python | |
d9d84083a488ad1b4643298d7a75b54b4e0e34be | add OptionChainConsistencyRegressionAlgorithm | kaffeebrauer/Lean,jameschch/Lean,AlexCatarino/Lean,QuantConnect/Lean,StefanoRaggi/Lean,jameschch/Lean,JKarathiya/Lean,kaffeebrauer/Lean,JKarathiya/Lean,redmeros/Lean,StefanoRaggi/Lean,JKarathiya/Lean,AlexCatarino/Lean,kaffeebrauer/Lean,jameschch/Lean,kaffeebrauer/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,AlexCatarino/Le... | Algorithm.Python/OptionChainConsistencyRegressionAlgorithm.py | Algorithm.Python/OptionChainConsistencyRegressionAlgorithm.py | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | using System;
namespace QuantConnect.Algorithm.Python
{
public class OptionChainConsistencyRegressionAlgorithm
{
public OptionChainConsistencyRegressionAlgorithm()
{
}
}
}
| apache-2.0 | Python |
aafb77596ae0cb6c27b2564434367d2b4d5debd1 | Add tests | cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3 | Orange/widgets/visualize/tests/test_owscatterplot.py | Orange/widgets/visualize/tests/test_owscatterplot.py | import numpy as np
from Orange.data import Table
from Orange.widgets.tests.base import WidgetTest
from Orange.widgets.visualize.owscatterplot import OWScatterPlot
class TestOWScatterPlot(WidgetTest):
def setUp(self):
self.widget = self.create_widget(OWScatterPlot)
self.data = Table("iris")
d... | bsd-2-clause | Python | |
47ad7f4d3b69315e25ae96099fe73b4d9cd7666e | Use file extension to select config file parser | bchretien/dotbot,imattman/dotbot,imattman/dotbot,anishathalye/dotbot,bchretien/dotbot,bchretien/dotbot,anishathalye/dotbot,imattman/dotbot | dotbot/config.py | dotbot/config.py | import yaml
import json
import os.path
from .util import string
class ConfigReader(object):
def __init__(self, config_file_path):
self._config = self._read(config_file_path)
def _read(self, config_file_path):
try:
_, ext = os.path.splitext(config_file_path)
with open(co... | import yaml
import json
from .util import string
class ConfigReader(object):
def __init__(self, config_file_path):
self._config = self._read(config_file_path)
def _read(self, config_file_path):
try:
with open(config_file_path) as fin:
try:
data =... | mit | Python |
fec74a5401f925755484955a1b38dd3044824eb3 | Create npy2ckpt.py | nasatony/deeplab_resnet,ALISCIFP/tensorflow-resnet-segmentation,ALISCIFP/tensorflow-resnet-segmentation,DrSleep/tensorflow-deeplab-resnet | npy2ckpt.py | npy2ckpt.py | """Conversion of the .npy weights into the .ckpt ones.
This script converts the weights of the DeepLab-ResNet model
from the numpy format into the TensorFlow one.
"""
from __future__ import print_function
import argparse
import os
import tensorflow as tf
import numpy as np
from deeplab_resnet import DeepLabResNetM... | mit | Python | |
8b5bf433b304895f04813c64d556316c48c046fe | add setup.py for distribute | pombredanne/python-v8,pombredanne/python-v8,damoti/python-v8,damoti/python-v8,pombredanne/python-v8,damoti/python-v8,damoti/python-v8,pombredanne/python-v8 | setup.py | setup.py | #!/usr/bin/env python
import os, os.path
from distutils.core import setup, Extension
import distutils.msvccompiler
source_files = ["Engine.cpp", "Wrapper.cpp", "PyV8.cpp"]
macros = [("BOOST_PYTHON_STATIC_LIB", None)]
third_party_libraries = ["python", "boost", "v8"]
include_dirs = os.environ["INCLUDE"].spl... | apache-2.0 | Python | |
e24a354ae65db5874f51305b839a7ce553d44d78 | Build Sticks | Duke-NSOE/GeoHAT | GeoHat_V10/BuildSticks.py | GeoHat_V10/BuildSticks.py | #---------------------------------------------------------------------------------
# BuildSticks.py
#
# Description: Create sticks (lines between connected patches, with appropriate weights),
# from edge list csv file
#
# Requires: NetworkX to be stored in script folder (or installed)
# Create Edge List tool must be ru... | cc0-1.0 | Python | |
56915ed7d290fff6e37859181781687590a2e974 | Remove early_stopping.py from estimator/contrib in favor of estimator/python/estimator/early_stopping.py. And the test. | aam-at/tensorflow,gautam1858/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,renyi533/tensorflow,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,adit-chandra/tensorflow,davidzchen/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,kevin-coder/tensorflo... | tensorflow/contrib/estimator/python/estimator/early_stopping.py | tensorflow/contrib/estimator/python/estimator/early_stopping.py | # Copyright 2018 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 2018 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 |
1ee1d0daab4b8e123bc04996019fb12cc65b8888 | Add tISM SDB module (#36957) | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/sdb/tism.py | salt/sdb/tism.py | # -*- coding: utf-8 -*-
'''
tISM - the Immutalbe Secrets Manager SDB Module
:maintainer: tISM
:maturity: New
:platform: all
.. versionadded:: TBD
This module will decrypt PGP encrypted secrets against a tISM server.
.. code::
sdb://<profile>/<encrypted secret>
sdb://tism/hQEMAzJ+GfdAB3KqAQf9E3cyv... | apache-2.0 | Python | |
8dad8cf8c83eba037b29d3243b29b985dc4004a1 | add setup.py | epage/telepathy-python,PabloCastellano/telepathy-python,epage/telepathy-python,max-posedon/telepathy-python,max-posedon/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/telepathy-python,detrout/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,detrout/t... | setup.py | setup.py | #!/usr/bin/python
from distutils.core import setup
setup(
name='telepathy-python',
version='0.0.1',
packages=['telepathy'],
)
| lgpl-2.1 | Python | |
b5c2986ccf3c70b9cb52d0374c53bc8232719554 | Add dbm_metrics.py script where the AIS method will be stored | woozzu/pylearn2,kastnerkyle/pylearn2,chrish42/pylearn,jeremyfix/pylearn2,goodfeli/pylearn2,lisa-lab/pylearn2,lamblin/pylearn2,daemonmaker/pylearn2,Refefer/pylearn2,cosmoharrigan/pylearn2,ashhher3/pylearn2,fulmicoton/pylearn2,pkainz/pylearn2,fyffyt/pylearn2,lunyang/pylearn2,w1kke/pylearn2,cosmoharrigan/pylearn2,lamblin/... | pylearn2/scripts/dbm/dbm_metrics.py | pylearn2/scripts/dbm/dbm_metrics.py | #!/usr/bin/env python
import argparse
if __name__ == '__main__':
# Argument parsing
parser = argparse.ArgumentParser()
parser.add_argument("metric", help="the desired metric",
choices=["ais"])
parser.add_argument("model_path", help="path to the pickled DBM model")
args = par... | bsd-3-clause | Python | |
a8b079b8be1e9559770dd0f701385b2361158e24 | Add tests_require to setup.py | mpenkov/smart_open,piskvorky/smart_open,RaRe-Technologies/smart_open,RaRe-Technologies/smart_open,mpenkov/smart_open | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
import io
import os
import sys
if sys.version_info < (2, 6):
raise ImportError("smart_open requires python >= 2.6")
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
import io
import os
import sys
if sys.version_info < (2, 6):
raise ImportError("smart_open requires python >= 2.6")
... | mit | Python |
c230fc69e2509c79190e53589457f161accd1626 | Change long_description in setup.py. | MnO2/rediscli,oguzy/mycli,evook/mycli,suzukaze/mycli,oguzy/mycli,j-bennet/mycli,evook/mycli,D-e-e-m-o/mycli,shoma/mycli,MnO2/rediscli,thanatoskira/mycli,jinstrive/mycli,brewneaux/mycli,danieljwest/mycli,thanatoskira/mycli,webwlsong/mycli,D-e-e-m-o/mycli,danieljwest/mycli,brewneaux/mycli,chenpingzhao/mycli,jinstrive/myc... | setup.py | setup.py | import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('mycli/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
description = 'CLI for MySQL Database. With auto-completi... | import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('mycli/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
description = 'CLI for MySQL Database. With auto-completi... | bsd-3-clause | Python |
2a331f0165b2e3874243fcfecc3e3deab2760ff4 | Add python setup filie | bitevery/client-api-python-v1 | setup.py | setup.py | from setuptools import setup
setup(name='bitevery',
version='0.0.1.b2',
description='BitEvery Python API',
url='https://www.bitevery.com',
author='BitEvery',
author_email='support@bitevery.com',
license='MIT',
packages=['bitevery'],
zip_safe=False) | mit | Python | |
57bfd23957bdd535b5ae21ed1df3ff25dd75a8bd | Add setup.py | piotrekw/pirx | setup.py | setup.py | from setuptools import setup
setup(
name='pirx',
version='0.1',
author='Piotr Wasilewski',
author_email='wasilewski.piotrek@gmail.com',
description='Django settings builder',
license='MIT',
keywords='django settings build builder',
url='https://github.com/piotrekw/pirx',
scripts=['s... | mit | Python | |
76a8834243cc70f3065b686dd09004f1dc3ffdb0 | Create rapideye_remover_bordas_catalogo.py | leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing | rapideye_remover_bordas_catalogo.py | rapideye_remover_bordas_catalogo.py | from osgeo import ogr
import os
from osgeo import osr
from qgis.core import *
shapefile = "C:/Users/pedro.mendes/Desktop/Brasil_00_2016.shp"
driver = ogr.GetDriverByName("ESRI Shapefile")
dataSource = driver.Open(shapefile, 0)
layer = dataSource.GetLayer()
proj=layer.GetSpatialRef()
outputMergefn = "C:/Users/pedro.... | mit | Python | |
737dadd2e447c9f03de80ea808e137dcc1206c9b | Create Nvidia_GPU_Temperature.py | jpsingleton/BlinkyTape_Python,Blinkinlabs/BlinkyTape_Python,railsagainstignorance/blinkytape | Nvidia_GPU_Temperature.py | Nvidia_GPU_Temperature.py | import time
from BlinkyTape import BlinkyTape
import subprocess
import os
import re
#bb = BlinkyTape('/dev/tty.usbmodemfa131')
bb = BlinkyTape('COM8')
while True:
output = subprocess.check_output(["C:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe", "-a"], shell=True)
#os.popen('C:\\Program Files\... | mit | Python | |
b39af3af2104875919577f769701e7bde73967fd | clean file initialized | schiob/MusGen | genetic_music.py | genetic_music.py | print('hola chio') | mit | Python | |
fbc780c7beb94d73b2a4ea110e733f8c87763741 | Add location name lookup for ajax_select. | umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator | geoip/lookups.py | geoip/lookups.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## Author: Orcun Avsar <orc.avs@gmail.com>
##
## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as
## pub... | agpl-3.0 | Python | |
af3ba846a8074132c64568c420ecb9b6ade9c6ea | Work on defining RegEx to find and format molecular geometries in Gaussian output files. | thompcinnamon/QM-calc-scripts | geomRegexTest.py | geomRegexTest.py | __author__ = 'Thomas Heavey'
import re
filename = "testg.out"
def findgeoms(filename):
"""A function that takes a file name and returns a list of
geometries."""
relevantelem = [1,3,4,5]
xyzformat = '{:>2} {: f} {: f} {: f}'
geomregex = re.compile(
r'(?:Standard orientation)' # no... | apache-2.0 | Python | |
df9a6ab91eedfe91343ceb103156fe08cd965614 | test script form new Keras 2x API model config | SummaLabs/DLS,SummaLabs/DLS,SummaLabs/DLS,SummaLabs/DLS | app/backend-test/keras_2x_api/run01_print_keras_model_json.py | app/backend-test/keras_2x_api/run01_print_keras_model_json.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
if __name__ == '__main__':
pass | mit | Python | |
1498e786201c1c1e2127da7d23db142559ad68a8 | Add support for Assembla | foauth/oauth-proxy,foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/assembla.py | services/assembla.py | import foauth.providers
class Assembla(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://www.assembla.com/'
docs_url = 'http://api-doc.assembla.com/content/api_reference.html'
category = 'Code'
# URLs to interact with the API
authorize_url = 'https://api.asse... | bsd-3-clause | Python | |
10c7e718488a6daad5bcea97e00aece24179168e | Add regression test for bug #1937084 | openstack/nova,mahak/nova,openstack/nova,openstack/nova,mahak/nova,mahak/nova | nova/tests/functional/regressions/test_bug_1937084.py | nova/tests/functional/regressions/test_bug_1937084.py | # Copyright 2021, Red Hat, 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 ... | apache-2.0 | Python | |
0fc46c92f8682879591d9fc473be34116c9106be | add migration | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | custom/ilsgateway/migrations/0010_auto_20160830_1923.py | custom/ilsgateway/migrations/0010_auto_20160830_1923.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('ilsgateway', '0009_auto_20160413_1311'),
]
operations = [
migrations.AlterField(
model_name='del... | bsd-3-clause | Python | |
3dfa8bb2d428f86c5156a974e84e0756cc6d792f | Create headache.py | scdiniz/headache | headache.py | headache.py | # This is... Headache! One more very simple Brainfuck interpreter! #
# by Sidnei Diniz - sidneidiniz@gmail.com - http://bitworm.com.br #
# GitHub: http://github.com/scdiniz/headache
# Date: 29-12-2015 #
import sys
# Interpreter kernel
class Headache():
# Constructor
def __init__(self):
self.cells = bytearray([0] *... | mit | Python | |
c2b69a51faac56689edc88e747a00b60cf08cc04 | Add default ordering of progress outcome groups | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | dthm4kaiako/poet/migrations/0003_auto_20190731_1912.py | dthm4kaiako/poet/migrations/0003_auto_20190731_1912.py | # Generated by Django 2.1.5 on 2019-07-31 07:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('poet', '0002_progressoutcomegroup'),
]
operations = [
migrations.AlterModelOptions(
name='progressoutcomegroup',
options={'o... | mit | Python | |
32a79573b38c6d2ea7f5b81363610a5d9332ed4e | Add python script to parse JSON output | leo27lijiang/app-monitor,leo27lijiang/app-monitor | src/main/resources/jsonformat.py | src/main/resources/jsonformat.py | #!/usr/bin/python2.7
import json
import socket
import sys
def readOutput(host, port):
data = None
s = None
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, int(port)))
except socket.error as msg:
s = None
print msg
if s is None:
return None
try:
data = s.recv(1024)
except ... | apache-2.0 | Python | |
699469342179fdc4319b5f39ea201015860ef09d | Add migration for CI fix | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | infrastructure/migrations/0020_auto_20210922_0929.py | infrastructure/migrations/0020_auto_20210922_0929.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-09-22 07:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infrastructure', '0019_project_latest_implementation_year'... | mit | Python | |
09d815c6b53c74ae9a2f3831a2eec9c2b266eca7 | add the prototype. | Tynox/SimpleXLS2XML | simple_xls_to_xml.py | simple_xls_to_xml.py | # encoding:utf-8
import codecs
import xlrd
import xml.dom.minidom
filter_words = None
def xlsRead():
global filter_words
data = xlrd.open_workbook("filter.xlsx")
table = data.sheets()[0] # 获取第一个sheet
filter_words = table.col_values(0)
def createXML():
if filter_words is None:
... | unlicense | Python | |
6a268c69fced2a5b9e97086fa2a9089837376db4 | add subfolder | IIS-DIRL/Python-Tools | keras/metrics/empty.py | keras/metrics/empty.py | #
| apache-2.0 | Python | |
9524b824e5edb6e88c776d3420b618b6a2d1b7fa | Add files via upload | fsxfreak/esys-pbi,fsxfreak/esys-pbi,fsxfreak/esys-pbi | src/graph_realtimeEdit.py | src/graph_realtimeEdit.py | from pylsl import StreamInlet, resolve_byprop, local_clock, TimeoutError
from pylsl import StreamInfo,StreamOutlet
from random import random as rand
import collections
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui,QtCore
import time
import signal, sys, os, time, csv
import serial
i... | mit | Python | |
1d1712259a1e6e23b7a6a5541f70573b05619e99 | Create stock.py | glovebx/web_tree_image_order_line,OdooCommunityWidgets/web_tree_image_order_line,OdooCommunityWidgets/web_tree_image_order_line,AlejandroCatalina/web_tree_image_order_line,AlejandroCatalina/web_tree_image_order_line,glovebx/web_tree_image_order_line | stock.py | stock.py | from openerp.osv import fields, osv
class stock_move(osv.Model):
_name = 'stock.move'
_inherit = 'stock.move'
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
loc_dest_id=False, partner_id=False):
res_prod = super(stock_move, self).onchange_produ... | mit | Python | |
ed09ca11fc3586c9782103269b12240ed6b27911 | complete and tested juliaset, HW4 | naslash/juliasets | juliaset.py | juliaset.py | class JuliaSet(object):
def set_plane(self, _d):
self._d=_d
self._complexplane=[]
x=-2
y=-2
while x<=2:
while y<=2:
self._complexplane.append(complex(x,y))
y+=_d
x+=_d
y=-2
return self._complexplane
... | mit | Python | |
8282cca05b784bb0966ba8246900627286c5d98c | Use invoke as build tool | davidbgk/udata,davidbgk/udata,opendatateam/udata,etalab/udata,jphnoel/udata,etalab/udata,grouan/udata,etalab/udata,grouan/udata,davidbgk/udata,jphnoel/udata,opendatateam/udata,jphnoel/udata,grouan/udata,opendatateam/udata | tasks.py | tasks.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from os.path import join, abspath, dirname, exists
from invoke import run, task
ROOT = abspath(join(dirname(__file__)))
I18N_DOMAIN = 'udata-admin'
def green(text):
return '\033[1;32m{0}\033[0;m'.format(text)
def red(text):
... | agpl-3.0 | Python | |
c63144242d9cf2ecf02d58eb9a93cfe426acc6dc | Add script to send unregister user emails | laurenrevere/osf.io,Nesiehr/osf.io,cwisecarver/osf.io,leb2dg/osf.io,crcresearch/osf.io,leb2dg/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,chennan47/osf.io,chrisseto/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,Nesiehr/osf.io,caseyrollins/osf.io,sloria/osf.io,baylee-d/osf.io,cslzchen/osf.io,hmoco/osf.io,TomBaxter/osf.i... | scripts/send_preprint_unreg_contributor_emails.py | scripts/send_preprint_unreg_contributor_emails.py | # -*- coding: utf-8 -*-
"""Sends an unregistered user claim email for preprints created after 2017-03-14. A hotfix was made on that
date which caused unregistered user claim emails to not be sent. The regression was fixed on 2017-05-05. This
sends the emails that should have been sent during that time period.
NOTE: Th... | apache-2.0 | Python | |
fcac525d3f974c7d4a1e90c1adc444c6d6e72018 | Add sed executor #123 | DMOJ/judge,DMOJ/judge,DMOJ/judge | executors/SED.py | executors/SED.py |
from .base_executor import ScriptExecutor
from judgeenv import env
class Executor(ScriptExecutor):
ext = '.sed'
name = 'SED'
command = env['runtime'].get('sed')
test_program = '''s/.*/echo: Hello, World!/
q'''
fs = ['.*\.(so|sed)', '/dev/urandom$', '/proc/self/maps$', '/proc/filesystems$', '/+lib... | agpl-3.0 | Python | |
1f52ef331a3529fe0f8b1ad5528d4d5cdd5d0b7a | add mnist deep auto like hinton's | jasonwbw/EffictiveRBM | rbm/autoencoder/mnist_deep_auto.py | rbm/autoencoder/mnist_deep_auto.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Author : @Jason_wbw
"""
This program pertrains a deep autoencoder for MNIST dataset
You cat set the maxinum number of epochs for pertraining each layer
and you can set the architectrue of the multiplayer nets.
"""
from converter import Converter
from rbm import R... | mit | Python | |
84cf95cde942d91f53959fea4151847902a69d14 | Add a cleanup script. | harvitronix/rl-rc-car | rl-rc-car/cleanup.py | rl-rc-car/cleanup.py | from rccar import RCCar
car = RCCar()
car.cleanup_gpio()
| mit | Python | |
b2741a8316ea1ffbf9e88a9fb883ef9e2507be42 | Upgrade libchromiuncontent to 3245ef8 | greyhwndz/electron,bbondy/electron,pandoraui/electron,ervinb/electron,ervinb/electron,jcblw/electron,shaundunne/electron,shockone/electron,matiasinsaurralde/electron,rhencke/electron,aaron-goshine/electron,Jonekee/electron,wan-qy/electron,carsonmcdonald/electron,howmuchcomputer/electron,Rokt33r/electron,stevemao/electr... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '3245ef802fbf546f1a1d206990aa9d18be6bfbfe'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'f0c3a4546d8e75689c16b9aee1052a72951e58de'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | mit | Python |
a03eaddd3e950f628320d1b5b007d87b11906844 | add saveload.py (with error) | PhysicsEngine/SoundLine-server,PhysicsEngine/SoundLine-server | converter/saveload.py | converter/saveload.py | #!/usr/local/bin/python
# -*- encoding:utf-8
import sys
import subprocess as sp
import numpy
def load_mp3(filename):
command = [ 'ffmpeg',
'-i', sys.argv[1],
'-f', 's16le',
'-acodec', 'pcm_s16le',
'-ar', '44100', # ouput will have 44100 Hz
'-ac', '2', # stereo (set to '1' for mono)
'-']
pipe = sp.Popen(comman... | mit | Python | |
4ab3e59b7e9fe339c96042107c3f59bdf1afc46a | add instagram compliance fix | requests/requests-oauthlib,singingwolfboy/requests-oauthlib | requests_oauthlib/compliance_fixes/instagram.py | requests_oauthlib/compliance_fixes/instagram.py | try:
from urlparse import urlparse, parse_qs
except ImportError:
from urllib.parse import urlparse, parse_qs
from oauthlib.common import add_params_to_uri
def instagram_compliance_fix(session):
def _non_compliant_param_name(url, headers, data):
# If the user has already specified the token, eithe... | isc | Python | |
b9b34eb2bca76e76ba4f7399b12daa27ed2ab7f4 | Create uvSetTgl.py | aaronfang/personal_scripts | af_scripts/uv/uvSetTgl.py | af_scripts/uv/uvSetTgl.py | # This script will switch UV Set between "map1" and "atlasmap".
# Useage:
# Select meshes and run this script
import maya.cmds as cmds
def uvsetTgl():
shape_node = cmds.ls(sl=True, fl=True, dag=True, type='shape')
current_uvset = cmds.polyUVSet(shape_node[0],q=True, currentUVSet=True)
for shape in shap... | mit | Python | |
a9b45bf50dae68c9a801ec7942c4f4cc38fa08f5 | Create GenerateUnifiedReports.py | npburg/EventSalesReport | GenerateUnifiedReports.py | GenerateUnifiedReports.py | import argparse
# Read options on which PayPal records to process (year / month) or run on discovery to find the files or discover new files and generate new unified files but preserve the old ones (default)
# load all the Website records based on discovery
# load the PayPal monthly report(s)
# reconsile each record... | mit | Python | |
24f665e02912a3f79eec9776c86863a9e172d94a | Create HR_pythonPrintFunction.py | bluewitch/Code-Blue-Python | HR_pythonPrintFunction.py | HR_pythonPrintFunction.py | import sys
if __name__ == '__main__':
n = int(input())
# imported sys for a elegant solution, Python 3
# * before range means taking everything 0 or more
print(*range(1,n+1), sep='',end='\n', file= sys.stdout)
| mit | Python | |
ce552a70f77934d4b76b5710b76b22967484d17e | Create folderwatcher.py | bengjerstad/miscellaneous,bengjerstad/miscellaneous | folderwatcher.py | folderwatcher.py | import os
import time
import datetime
outold = []
try:
while True:
out = os.listdir()
if outold != out:
ldate= datetime.datetime.now().strftime('%I:%M:%S')
for x in outold:
if x not in out:
print ('Moved: '+ldate+' '+x)
for x in out:
if x not in outold:
print ('New: '+ldate+' '+... | mit | Python | |
41fc87e402aa2864c22adb5c09a713c2b0eacb72 | Add replace test that shutdowns a node and replaces a pod (#806) | mesosphere/dcos-commons,vishnu2kmohan/dcos-commons,mesosphere/dcos-commons,vishnu2kmohan/dcos-commons,mesosphere/dcos-commons,mesosphere/dcos-commons,vishnu2kmohan/dcos-commons,vishnu2kmohan/dcos-commons,vishnu2kmohan/dcos-commons,mesosphere/dcos-commons | frameworks/cassandra/tests/test_recovery_shutdown.py | frameworks/cassandra/tests/test_recovery_shutdown.py | import pytest
from tests.config import *
import sdk_install as install
import sdk_tasks as tasks
import sdk_utils as utils
import json
import shakedown
import time
import sdk_cmd as cmd
def setup_module(module):
install.uninstall(PACKAGE_NAME)
utils.gc_frameworks()
# check_suppression=False due to https:... | apache-2.0 | Python | |
c11e74d4210c6de8917dfde6cb33d75f6b1b835a | add migration that solves BigAutoField problem | adamcharnock/django-hordak,adamcharnock/django-hordak | hordak/migrations/0032_check_account_type_big_int.py | hordak/migrations/0032_check_account_type_big_int.py | # Generated by Django 4.0.7 on 2022-09-18 10:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("hordak", "0031_alter_account_currencies"),
]
operations = [
migrations.RunSQL(
"""
CREATE OR REPLACE FUNCTION check_account_... | mit | Python | |
d3a11021f8be8e93c5c067b5fcf59bc4f9f92cea | add computation of sts for ISUSM | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/dbutil/compute_isusm_sts.py | scripts/dbutil/compute_isusm_sts.py | """
Figure out when the ISUSM data started...
"""
import psycopg2
import network
import sys
import datetime
import pytz
basets = datetime.datetime.now()
basets = basets.replace(tzinfo=pytz.timezone("America/Chicago"))
isuag = psycopg2.connect(database='isuag', host='iemdb')
icursor = isuag.cursor()
mesosite = psyco... | mit | Python | |
133a4311fdb3c96edeb927250e549fcaf4080696 | add silly module | desaster/uusipuu | modules/silly.py | modules/silly.py | # -*- coding: ISO-8859-15 -*-
from core.Uusipuu import UusipuuModule
import random, time
from core.tdiff import *
class Module(UusipuuModule):
def cmd_noppa(self, user, target, params):
self.log('ok noppaa heitetn!!')
self.chanmsg('%s!' % random.choice((
'ykknen',
'kak... | bsd-2-clause | Python | |
f340bde6e047d86171385b90a023ac01e8914d0c | Add simple neural network (#6452) | TheAlgorithms/Python | neural_network/simple_neural_network.py | neural_network/simple_neural_network.py | """
Forward propagation explanation:
https://towardsdatascience.com/forward-propagation-in-neural-networks-simplified-math-and-code-version-bbcfef6f9250
"""
import math
import random
# Sigmoid
def sigmoid_function(value: float, deriv: bool = False) -> float:
"""Return the sigmoid function of a float.
>>> si... | mit | Python | |
4b07d7cdd791a03ef4c7ec7e6e4188b625ffb8dc | Add migration | Clarity-89/clarityv2,Clarity-89/clarityv2,Clarity-89/clarityv2,Clarity-89/clarityv2 | src/clarityv2/portfolio/migrations/0002_auto_20180228_2055.py | src/clarityv2/portfolio/migrations/0002_auto_20180228_2055.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-28 18:55
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('portfolio', '0001_initial'),
]
operations = [
migrations.Alt... | mit | Python | |
0bc48c7131e0589e7f2980e16bce6c2dfcdbafda | Fix usage message from tag:file to tag=file | MeteorAdminz/phantomjs,DocuSignDev/phantomjs,peakji/phantomjs,bettiolo/phantomjs,ChrisAntaki/phantomjs,fxtentacle/phantomjs,wuxianghou/phantomjs,JingZhou0404/phantomjs,xsyntrex/phantomjs,Lochlan/phantomjs,jjyycchh/phantomjs,fxtentacle/phantomjs,ChrisAntaki/phantomjs,bukalov/phantomjs,AladdinSonni/phantomjs,jefleponot/p... | python/utils.py | python/utils.py | '''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the F... | '''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the F... | bsd-3-clause | Python |
4065a08ea401e0d95e8d40d9d735edf92edda861 | Add unit tests on cache handler | openstack/oslo.policy | oslo_policy/tests/test_cache_handler.py | oslo_policy/tests/test_cache_handler.py | # Copyright (c) 2020 OpenStack Foundation.
# 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 ... | apache-2.0 | Python | |
bcc7dc9bc014dfd17db6fced18de47535a003b60 | add import JSON script for propostions #2 | dpausp/arguments,dpausp/arguments,dpausp/arguments,dpausp/arguments | scripts/import_proposition_json.py | scripts/import_proposition_json.py | import argparse
import json
import logging
import sqlalchemy.orm
import transaction
from eliot import log_call, start_task
logging.basicConfig(level=logging.INFO)
from ekklesia_portal.app import make_wsgi_app
@log_call
def load_proposition_json_file(filepath):
with open(filepath) as f:
json_data = json.... | agpl-3.0 | Python | |
3661ca3947763656165f8fc68ea42358ad37285a | Add stub for qiprofile update test. | ohsu-qin/qipipe | test/unit/helpers/test_qiprofile.py | test/unit/helpers/test_qiprofile.py | import os
import glob
import shutil
from nose.tools import (assert_equal, assert_is_not_none)
import qixnat
from ... import (project, ROOT)
from ...helpers.logging import logger
from qipipe.helpers import qiprofile
COLLECTION = 'Sarcoma'
"""The test collection."""
SUBJECT = 'Sarcoma001'
"""The test subjects."""
SESS... | bsd-2-clause | Python | |
36af45d88f01723204d9b65d4081e74a80f0776b | Add test for layers module. | chrinide/theanets,devdoer/theanets,lmjohns3/theanets | test/layers_test.py | test/layers_test.py | import theanets
import numpy as np
class TestLayer:
def test_build(self):
layer = theanets.layers.build('feedforward', nin=2, nout=4)
assert isinstance(layer, theanets.layers.Layer)
class TestFeedforward:
def test_create(self):
l = theanets.layers.Feedforward(nin=2, nout=4)
a... | mit | Python | |
3dcf251276060b43ac888e0239f26a0cf2531832 | Add tests for proxy drop executable | gdestuynder/MozDef,mozilla/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,mozilla/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mpurzynski/Mo... | tests/test_proxy_drop_executable.py | tests/test_proxy_drop_executable.py | # 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/.
# Copyright (c) 2017 Mozilla Corporation
from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_t... | mpl-2.0 | Python | |
30d4301a04081f3d7a4fdba835a56aa0adac1375 | fix latent slaves started serially with monkey patch instead | ethereum/ethereum-buildbot,ethereum/ethereum-buildbot,ethereum/ethereum-buildbot,vaporry/ethereum-buildbot,vaporry/ethereum-buildbot,vaporry/ethereum-buildbot | monkeypatch.py | monkeypatch.py | from twisted.python import log
from twisted.internet import reactor
def botmaster_maybeStartBuildsForSlave(self, slave_name):
"""
We delay this for 10 seconds, so that if multiple slaves start at the same
time, builds will be distributed between them.
"""
def do_start():
log.msg(format="Re... | mit | Python | |
379aef7e3aebc05352cacd274b43b156e32de18b | Add script to run tests | lamarmeigs/django-clean-fields | runtests.py | runtests.py | #!/usr/bin/env python
import argparse
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
def runtests(test_labels):
settings.configure(INSTALLED_APPS=['tests'])
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = t... | mit | Python | |
abf39931331f54aff5f10345939420041bd2039d | Add test for APS2 instruction merging. | Plourde-Research-Lab/PyQLab,BBN-Q/PyQLab,rmcgurrin/PyQLab,calebjordan/PyQLab | tests/test_APS2Pattern.py | tests/test_APS2Pattern.py | import h5py
import unittest
import numpy as np
from copy import copy
from QGL import *
from instruments.drivers import APS2Pattern
class APSPatternUtils(unittest.TestCase):
def setUp(self):
self.q1gate = Channels.LogicalMarkerChannel(label='q1-gate')
self.q1 = Qubit(label='q1', gateChan=self.q1gat... | apache-2.0 | Python | |
df05088b5a6233cb262017b8489723c23000eb17 | Add variable | robotframework/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,fingeronthebutton/RIDE,robotframework/RIDE | src/robotide/ui/images.py | src/robotide/ui/images.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
aeaf2e1a1207f2094ea4298b1ecff015f5996b5a | Add test cases for gabor filter | blink1073/scikit-image,dpshelio/scikit-image,emon10005/scikit-image,ofgulban/scikit-image,Britefury/scikit-image,chriscrosscutler/scikit-image,keflavich/scikit-image,Hiyorimi/scikit-image,keflavich/scikit-image,warmspringwinds/scikit-image,chintak/scikit-image,vighneshbirodkar/scikit-image,ClinicalGraphics/scikit-image... | skimage/filter/tests/test_gabor.py | skimage/filter/tests/test_gabor.py | import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from skimage.filter import gabor_kernel, gabor_filter
def test_gabor_kernel_sum():
for sigmax in range(1, 10, 2):
for sigmay in range(1, 10, 2):
for frequency in range(0, 10, 2):
kernel... | bsd-3-clause | Python | |
a70f46aac52be5b38b869cfbe18c0421a0032aee | Add script to count parameters of PyTorch model | sauhaardac/training,sauhaardac/training | count_params.py | count_params.py | import sys
import numpy as np
import torch
model = torch.load(sys.argv[1])
params = 0
for key in model:
params += np.multiply.reduce(model[key].shape)
print('Total number of parameters: ' + str(params))
| mit | Python | |
fd4398b1e811aaa2b876c120f99ca7fff08618ca | install on windows via gohlke wheels | maurov/xraysloth,maurov/xraysloth | scripts/install_on_windows.py | scripts/install_on_windows.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script for installing on Microsoft Windows
Wheels from [GOHLKE WINDOWS REPOSITORY](https://www.lfd.uci.edu/~gohlke/pythonlibs/)
"""
try:
from gohlkegrabber import GohlkeGrabber
except ImportError:
print("gohlkegrabber not installed -> 'pip install gohlkegrabb... | bsd-3-clause | Python | |
495c937d39da1902948065a38502f9d582fa2b3b | Add darkobject tests. | LegionXI/pydarkstar,AdamGagorik/pydarkstar | tests/darkobject.py | tests/darkobject.py | """
.. moduleauthor:: Adam Gagorik <adam.gagorik@gmail.com>
"""
import unittest
import pydarkstar.logutils
import pydarkstar.darkobject
pydarkstar.logutils.setDebug()
class TestDarkObject(unittest.TestCase):
def test_init(self):
pydarkstar.darkobject.DarkObject()
if __name__ == '__main__':
unittest.m... | mit | Python | |
6f8699288f79ff856ed58595169cb08956cd210d | Create toeplitz-matrix.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/toeplitz-matrix.py | Python/toeplitz-matrix.py | # Time: O(m * n)
# Space: O(1)
class Solution(object):
def isToeplitzMatrix(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: bool
"""
return all(i == 0 or j == 0 or matrix[i-1][j-1] == val
for i, row in enumerate(matrix)
for j, ... | mit | Python | |
d2a78f252bf9a584569e372ca9474863e4496c7a | Add one test | manu3618/legendary-potato | tests/test_utils.py | tests/test_utils.py | import os
from contextlib import suppress
import numpy as np
import pandas as pd
import pytest
import legendary_potato.kernel
import legendary_potato.utils
TEST_PATH = os.path.join(os.path.abspath(os.path.curdir))
SAMPLE_PATH = os.path.join(TEST_PATH, 'sample')
GRAMMATRIX_PATH = os.path.join(TEST_PATH, 'gram_matrix'... | mit | Python | |
76c040e9da5d94dfcb68d3e9a8003b894c1cf1dc | test file for vimba.py | morefigs/pymba | tests/test_vimba.py | tests/test_vimba.py | import pytest
from pymba import Vimba, VimbaException
def test_version():
version = Vimba().version.split('.')
assert int(version[0]) >= 1
assert int(version[1]) >= 7
assert int(version[2]) >= 0
def test_startup_shutdown():
with pytest.raises(VimbaException) as e:
Vimba().system().featu... | mit | Python | |
295b83d466b90ea812e8c0bda56b4d38a31c956a | Create reversedArrayNum.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | CodeWars/8kyu/reversedArrayNum.py | CodeWars/8kyu/reversedArrayNum.py | def digitize(n):
return [int(i) for i in str(n)][::-1]
| mit | Python | |
7b279117da06af5cf21b61ad810a9c3177de8e3e | Update fabfile.py | frasern/ADL_LRS,varunasingh/ustadmobile-tincanlrs,ljwolford/ADL_LRS,ELSUru/ADL_LRS,ljwolford/ADL_LRS,adlnet/ADL_LRS,Nuevosmedios/ADL_LRS,creighton/ADL_LRS,diagonalwalnut/Experience,frasern/ADL_LRS,daafgo/Server_LRS,adlnet/ADL_LRS,varunasingh/ADL_LRS,creighton/ADL_LRS,daafgo/Server_LRS,adlnet/ADL_LRS,varunasingh/ADL_LRS... | fabfile.py | fabfile.py | from fabric.api import local,run
import os
from os import path
#Add settings module so fab file can see it
os.environ['DJANGO_SETTINGS_MODULE'] = "adl_lrs.settings"
from django.conf import settings
adldir = settings.MEDIA_ROOT
actor_profile = 'actor_profile'
activity_profile = 'activity_profile'
activity_state = 'act... | from fabric.api import local,run
import os
from os import path
#Add settings module so fab file can see it
os.environ['DJANGO_SETTINGS_MODULE'] = "adl_lrs.settings"
from django.conf import settings
adldir = settings.MEDIA_ROOT
actor_profile = 'actor_profile'
activity_profile = 'activity_profile'
activity_state = 'act... | apache-2.0 | Python |
86418c4f3ea786c6eb1aad6579dadfb286dec0a3 | Create InMoov2.minimal.py | sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | toSort/InMoov2.minimal.py | toSort/InMoov2.minimal.py | # a very minimal script for InMoov
# although this script is very short you can still
# do voice control of a right hand or finger box
# for any command which you say - you will be required to say a confirmation
# e.g. you say -> open hand, InMoov will ask -> "Did you say open hand?", you will need to
# respond with a ... | apache-2.0 | Python | |
35e76ec99a3710a20b17a5afddaa14389af65098 | Add some simple MediaWiki importer. | ludovicchabant/Wikked,ludovicchabant/Wikked,ludovicchabant/Wikked | tools/import_mediawiki.py | tools/import_mediawiki.py | import os
import os.path
import argparse
from sqlalchemy import create_engine
def main():
parser = argparse.ArgumentParser()
parser.add_argument('url')
parser.add_argument('-o', '--out', default='wikked_import')
parser.add_argument('--prefix', default='wiki')
parser.add_argument('-v', '--verbose',... | apache-2.0 | Python | |
237041aff9d99ac840572742467772edf1f4d5ef | Add image download example | dtroyer/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk | examples/image/download.py | examples/image/download.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python | |
5ea296703596306ea9895e37db9412f80731543a | Add a protein-plotting example, to show how to visualize nicely a graph | alexandreleroux/mayavi,dmsurti/mayavi,liulion/mayavi,alexandreleroux/mayavi,dmsurti/mayavi,liulion/mayavi | examples/mayavi/protein.py | examples/mayavi/protein.py | """
Visualize a protein graph structure downloaded from the protein database in
standard pdb format.
We parse the pdb file, but extract only a very small amount of
information: the type of atoms, their positions, and the links between them.
We assign a scalar value for the atoms to differenciate the different
types o... | bsd-3-clause | Python | |
ab60bd4f31a185884e0c05fa1a5f70c39a9d903a | add 52 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | python/p052.py | python/p052.py | def same(a, b):
return sorted(str(a)) == sorted(str(b))
for i in xrange(1, 1000000):
if same(i, 2 * i) and same(3 * i, 4 * i) and same(5 * i, 6 * i) and same(i, 6 * i):
print i
break | bsd-3-clause | Python | |
fe6ece236e684d76441280ba700565f7fbce40cc | Create masked version based on pbcov cutogg | e-koch/VLA_Lband,e-koch/VLA_Lband | 14B-088/HI/analysis/pbcov_masking.py | 14B-088/HI/analysis/pbcov_masking.py |
'''
Cut out noisy regions by imposing a mask of the primary beam coverage.
'''
from astropy.io import fits
from spectral_cube import SpectralCube
from spectral_cube.cube_utils import beams_to_bintable
from astropy.utils.console import ProgressBar
import os
from analysis.paths import fourteenB_HI_data_path
# execfil... | mit | Python | |
d8ddd6a843000c8b4125f166645a41443b6c06ba | Add kms_decrypt module | WeAreCloudar/ansible_modules | kms_decrypt.py | kms_decrypt.py | #!/usr/bin/python
import base64
DOCUMENTATION = '''
short_description: Decrypt a secret that was generated by KMS
description:
- This module decrypts the given secret using AWS KMS, and returns it as the Plaintext property
version_added: null
author: Ben Bridts
notes:
- Make sure you read http://docs.aws.amazon.co... | mit | Python | |
4af087e4920124eddb0342d0f22978872f9ba5dc | add landuse_sql.py which convert the .csv files from ArcMap to a SQL database | chengdai/spraw_tax | landuse_sql.py | landuse_sql.py | import sqlite3
import glob
import pandas
#Name of SQL database
sql_schema = 'LandUse_Approx.db'
files = [f for f in glob.glob("*.csv") if "LandUseApprox_" in f]
#Create table names for the SQL database.
#Table names will have 'landuse_' as prefix and the year and length as the ending in the format 'YYYY_Length'
#St... | lgpl-2.1 | Python | |
e23ccb850a6aef017ae91e35f672e6c6b5184e23 | Add image preprocessing functions | jni/skan | skan/pre.py | skan/pre.py | import numpy as np
from scipy import spatial, ndimage as ndi
from skimage import filters, img_as_ubyte
def hyperball(ndim, radius):
"""Return a binary morphological filter containing pixels within `radius`.
Parameters
----------
ndim : int
The number of dimensions of the filter.
radius : ... | bsd-3-clause | Python | |
f8823429d1bc548e4a91fe8ea64086d35dd66676 | Add race migration. | allcaps/tvdordrecht.nl,allcaps/tvdordrecht.nl,allcaps/tvdordrecht.nl,allcaps/tvdordrecht.nl,allcaps/tvdordrecht.nl | tvdordrecht/race/migrations/0003_auto_20150730_2250.py | tvdordrecht/race/migrations/0003_auto_20150730_2250.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('race', '0002_auto_20150729_1906'),
]
... | mit | Python | |
564851a1a7f1378c9ef0e936640b690300a112fb | Add synthtool scripts (#3765) | googleapis/google-cloud-java,googleapis/google-cloud-java,googleapis/google-cloud-java | java-containeranalysis/google-cloud-containeranalysis/synth.py | java-containeranalysis/google-cloud-containeranalysis/synth.py | # Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python | |
e2124aef9cb91dac3a597d353cd217ed328221e5 | Add gyp file to build cpu_features static library. | yongjhih/android_tools,yongjhih/android_tools,yongjhih/android_tools,yongjhih/android_tools,yongjhih/android_tools,yongjhih/android_tools,yongjhih/android_tools,yongjhih/android_tools | ndk/sources/android/cpufeatures/cpu_features.gyp | ndk/sources/android/cpufeatures/cpu_features.gyp | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'cpu_features',
'type': 'static_library',
'direct_dependent_settings': {
'include_dirs': ... | apache-2.0 | Python | |
f4aad329c445415f1306882d386abe43969ba6a9 | Add test for API ticket basics. | Bitergia/allura,apache/allura,Bitergia/allura,apache/allura,apache/allura,leotrubach/sourceforge-allura,lym/allura-git,leotrubach/sourceforge-allura,heiths/allura,Bitergia/allura,heiths/allura,apache/allura,apache/incubator-allura,Bitergia/allura,leotrubach/sourceforge-allura,leotrubach/sourceforge-allura,lym/allura-gi... | Allura/allura/tests/functional/test_rest_api_tickets.py | Allura/allura/tests/functional/test_rest_api_tickets.py | from pprint import pprint
from datetime import datetime, timedelta
import json
from pylons import c
from ming.orm import session
from allura import model as M
from allura.lib import helpers as h
from alluratest.controller import TestController, TestRestApiBase
class TestApiTicket(TestRestApiBase):
def set_api_... | apache-2.0 | Python | |
3eb8e73faf56bf3e3e3eb7cc8209c780d0f71b62 | create nanoparticle class | pewen/ten | nanoparticle.py | nanoparticle.py | from scipy.constants import pi
import numpy as np
from math import cos, sin
class NanoParticle(object):
def __init__(self, r, n_acceptors, tau_D, R_Forster):
"""
Create a nanoparticle object
Parameters
----------
R : float
Radio of nanoparticule
... | mit | Python | |
b6356e4b7a88e1b2034f37aa135794b08e79c70b | Test POC script | zhrif/script-cli | tests/chk.py | tests/chk.py | import paramiko,sys,re,time,subprocess,getpass,os
def main(argv):
os.system('cls') #on windows
mins = 0
print ("\n[info] "+time.strftime("%d/%m/%Y %H:%M:%S") +"\n")
print ("""
_ _
______ _____ ___ ___ _ __(_)_ __ | |_
|_ /\ \/ / __| / __|/ __| '__| | '_ \| __|
/... | apache-2.0 | Python | |
b3e6855489eba5d59507ef6fb4c92f8284526ec1 | Check consecutive elements in an array | prathamtandon/g4gproblems | Arrays/check_consecutive_elements.py | Arrays/check_consecutive_elements.py | import unittest
"""
Given an unsorted array of numbers, return true if the array only contains consecutive elements.
Input: 5 2 3 1 4
Ouput: True (consecutive elements from 1 through 5)
Input: 83 78 80 81 79 82
Output: True (consecutive elements from 78 through 83)
Input: 34 23 52 12 3
Output: False
"""
"""
Approach:
... | mit | Python | |
f325937df3f1f1f972c7a0780d702f7fea5d03f5 | Test `__eq__`, `__ne__`, and `__hash__` | jwodder/permutation | test/test_eq.py | test/test_eq.py | import pytest
from permutation import Permutation
EQUIV_CLASSES = [
[
Permutation(),
Permutation(1),
Permutation(1,2),
Permutation(1,2,3,4,5),
Permutation.transposition(2,2),
Permutation.cycle(),
Permutation.from_cycles(),
Permutation.from_cycles(()... | mit | Python | |
55b33bff9856cc91943f0a5ae492db1fdc7d8d5a | Add missing python 3 only file. | cpcloud/numba,stonebig/numba,gmarkall/numba,numba/numba,seibert/numba,seibert/numba,stonebig/numba,cpcloud/numba,stuartarchibald/numba,stuartarchibald/numba,IntelLabs/numba,sklam/numba,IntelLabs/numba,sklam/numba,numba/numba,numba/numba,seibert/numba,jriehl/numba,cpcloud/numba,jriehl/numba,IntelLabs/numba,seibert/numba... | numba/tests/jitclass_usecases.py | numba/tests/jitclass_usecases.py | """
Usecases with Python 3 syntax in the signatures. This is a separate module
in order to avoid syntax errors with Python 2.
"""
class TestClass1(object):
def __init__(self, x, y, z=1, *, a=5):
self.x = x
self.y = y
self.z = z
self.a = a
class TestClass2(object):
def __init_... | bsd-2-clause | Python | |
e251aff9a232a66b2d24324f394da2ad9345ce79 | Add migration script for changing users with None as email_verifications to {} | rdhyee/osf.io,samanehsan/osf.io,barbour-em/osf.io,saradbowman/osf.io,haoyuchen1992/osf.io,brandonPurvis/osf.io,jolene-esposito/osf.io,emetsger/osf.io,laurenrevere/osf.io,HarryRybacki/osf.io,haoyuchen1992/osf.io,CenterForOpenScience/osf.io,samchrisinger/osf.io,jnayak1/osf.io,caneruguz/osf.io,reinaH/osf.io,binoculars/osf... | scripts/migration/migrate_none_as_email_verification.py | scripts/migration/migrate_none_as_email_verification.py | """ Ensure that users with User.email_verifications == None now have {} instead
"""
import logging
import sys
from tests.base import OsfTestCase
from tests.factories import UserFactory
from modularodm import Q
from nose.tools import *
from website import models
from website.app import init_app
from scripts import util... | apache-2.0 | Python | |
97bf6ba36b27822a9bd73cb9a27d9878e48945e2 | add a decorator to ignore signals from fixture loading | MadeInHaus/django-template,MadeInHaus/django-template,MadeInHaus/django-template,MadeInHaus/django-template | project/apps/utils/signal_decorators.py | project/apps/utils/signal_decorators.py |
from functools import wraps
def disable_for_loaddata(signal_handler):
"""
Decorator that turns off signal handlers when loading fixture data.
based on http://stackoverflow.com/a/15625121
"""
@wraps(signal_handler)
def wrapper(*args, **kwargs):
if kwargs.get('raw'):
retur... | mit | Python | |
f8b5e413b46350f25bd7d231a8102c706fbf34f8 | Add new package: py-devlib (#16982) | iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-devlib/package.py | var/spack/repos/builtin/packages/py-devlib/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyDevlib(PythonPackage):
"""Library for interaction with and instrumentation of remote dev... | lgpl-2.1 | Python | |
de39aa257d845ecb6e1c2e7c4c4911497d00cdcf | add sample, non working, test_wsgi | openstack-infra/os-loganalyze,openstack-infra/os-loganalyze,openstack-infra/os-loganalyze | os_loganalyze/tests/test_wsgi.py | os_loganalyze/tests/test_wsgi.py | #!/usr/bin/python
#
# Copyright (c) 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 a... | apache-2.0 | Python | |
4c8ea40eeec6df07cf8721c256ad8cc3d35fb23e | Add intial unit test file | masterkoppa/whatodo | src/test_main.py | src/test_main.py | import pytest
from main import *
test_files = [ "examples/C/filenames/script", "examples/Clojure/index.cljs.hl",
"examples/Chapel/lulesh.chpl", "examples/Forth/core.fth",
"examples/GAP/Magic.gd", "examples/JavaScript/steelseries-min.js",
"examples/Matlab/FTLE_reg.m", ... | mit | Python | |
33a3e4a8adc6b3284de18fe02c67eafa3a391226 | Create tinycrypt.py | cuhsat/tinycrypt | tinycrypt.py | tinycrypt.py | mit | Python | ||
6cda3951d27e819cb452233f514c953c923d9a53 | Add Python script to check links (#872) | jlopp/lopp.net,jlopp/lopp.net,jlopp/lopp.net,jlopp/lopp.net | check_links.py | check_links.py | import os
from fnmatch import fnmatch
import bs4
from requests import get
from tqdm import tqdm
import webbrowser
import pyinputplus as pyip
from fake_headers import Headers
from random import shuffle
import validators
# Create a list of all the HTML files in lopp.net
all_html_files = []
website_directory = pyip.input... | unlicense | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.