repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
igsor/HDPy | test/acd.py |
import HDPy
import PuPy
import pylab
import numpy as np
# Create and initialize Policy
gait = PuPy.Gait(params={
'frequency' : (1.0, 1.0, 1.0, 1.0),
'offset' : ( -0.23, -0.23, -0.37, -0.37),
'amplitude' : ( 0.56, 0.56, 0.65, 0.65),
'phase' : (0.0, 0.0, 0.5, 0.5)
})
policy = HDPy.FRA(gait)
# P... |
all-of-us/raw-data-repository | rdr_service/alembic/versions/a53100879199_add_senamtic_version_column_to_.py | """add senamtic_version column to questionnaire
Revision ID: a53100879199
Revises: 4a4457c6b497
Create Date: 2019-10-01 10:13:58.703085
"""
from alembic import op
import sqlalchemy as sa
import rdr_service.model.utils
from sqlalchemy.dialects import mysql
from rdr_service.participant_enums import PhysicalMeasurementsS... |
travcunn/snake-vm | snake/assembler.py | OP_CODES = {
"inp": 0,
"cla": 1,
"add": 2,
"tac": 3,
"sft": 4,
"out": 5,
"sto": 6,
"sub": 7,
"jmp": 8,
"hlt": 9,
"mul": 10,
"div": 11,
"noop": 12
}
class InstructionError(Exception):
pass
class Assembler(object):
def __init__(self, inputfile):
sel... |
praekeltfoundation/ndoh-hub | registrations/migrations/0010_auto_20180212_0802.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2018-02-12 08:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("registrations", "0009_auto_20171027_0928")]
operations = [
migrations.AlterField(
... |
btenaglia/hpc-historias-clinicas | hpc-historias-clinicas/antecedentes_familiares/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AntecedentesFamiliares',
fields=[
('id', models... |
pigletto/django-lfs | lfs/customer/forms.py | # payment imports
import datetime
# django imports
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.db.models import Q
from django.forms.utils import ErrorList
from django.utils.translation import ugettext_lazy as _
# lfs imports... |
archman/phantasy | tests/test_pvutils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Unittest for pvutils module.
"""
import unittest
import os
from phantasy.library.pv import get_readback
curdir = os.path.dirname(__file__)
class TestGetReadback(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test... |
gfyoung/scipy | scipy/io/harwell_boeing/hb.py | """
Implementation of Harwell-Boeing read/write.
At the moment not the full Harwell-Boeing format is supported. Supported
features are:
- assembled, non-symmetric, real matrices
- integer for pointer/indices
- exponential format for float values, and int format
"""
from __future__ import division, print_... |
ghisvail/scikit-fftw | skfftw/wrappers/libfftwl.py | # coding: utf8
# Copyright (c) 2014, 2015 Ghislain Antony Vaillant.
#
# This file is distributed under the new BSD License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/BSD-3-Clause).
from skfftw.bindings.cffi import ffi, lib
__all__ = ('execute', 'plan_dft', 'execute_dft',... |
caktus/tequila | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Tequila documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 26 14:30:10 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... |
seqan/anise_basil | scripts/best_blat.py | #!/usr/bin/env python
"""Filter BLAT file and obtain best BLAT match for each reference/query.
USAGE: best_blat.py -b in.psl --best-for query_name >out.tsv
"""
from __future__ import print_function
__author__ = 'Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>'
import argparse
import math
import sys
class PslBloc... |
roycehaynes/scrapy-redis | scrapy_redis/queue.py | from scrapy.utils.reqser import request_to_dict, request_from_dict
try:
import cPickle as pickle
except ImportError:
import pickle
class Base(object):
"""Per-spider queue/stack base class"""
def __init__(self, server, spider, key):
"""Initialize per-spider redis queue.
Parameters:
... |
dato-code/Strata-Now | deploy/run.py | import graphlab as gl
from models import *
path = "s3://gl-demo-usw2/predictive_service/demolab/ps-1.6"
ps = gl.deploy.predictive_service.load(path)
# Define dependencies
state = {'details_filename': '../data/talks.json',
'speakers_filename': '../data/speakers.json',
'details_sf': '../data/talks.g... |
RPGOne/Skynet | pytorch-master/tools/cwrap/plugins/GenericNN.py | import copy
from string import Template
from . import CWrapPlugin
class GenericNN(CWrapPlugin):
INPUT_TYPE_CHECK = Template("checkTypes(is_cuda, $type, $tensor_args);")
HEADER_TEMPLATE = Template("void $name($args);")
WRAPPER_TEMPLATE = Template("""\
void $name($args)
{
bool is_cuda = $input->isCuda()... |
DavidWhittingham/arcpyext | arcpyext/exceptions/change_data_sources_error.py | # coding=utf-8
# Python 2/3 compatibility
# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-order,wrong-import-position
from __future__ import (absolute_import, division, print_function, unicode_literals)
from future.builtins.disabled import *
from future.builtins import *
from future.standard_libr... |
yephper/django | django/contrib/gis/db/backends/base/adapter.py | class WKTAdapter(object):
"""
This provides an adaptor for Geometries sent to the
MySQL and Oracle database backends.
"""
def __init__(self, geom):
self.wkt = geom.wkt
self.srid = geom.srid
def __eq__(self, other):
if not isinstance(other, WKTAdapter):
... |
bnbowman/HlaTools | src/pbhla/amplicons/separate_alleles.py | #! /usr/bin/env python
__author__ = 'bbowman@pacificbiosciences.com'
import logging
from collections import Counter
from pbcore.io.FastaIO import FastaReader, FastaWriter
from pbhla.external.utils import align_best_reference
from pbhla.io.BlasrIO import BlasrReader
from pbhla.utils import valid_file
from pbhla.typ... |
taoliu/MACS | test/test_ScoreTrack.py | #!/usr/bin/env python
# Time-stamp: <2019-09-25 14:44:07 taoliu>
import io
import unittest
from numpy.testing import assert_equal, assert_almost_equal, assert_array_equal
from MACS2.IO.ScoreTrack import *
from MACS2.IO.BedGraph import bedGraphTrackI
class Test_TwoConditionScores(unittest.TestCase):
def setUp(se... |
jesuejunior/golingo | quiz/models.py | from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
class Unity(models.Model):
name = models.CharField(verbose_name='Name', max_length=120)
number = models.IntegerField(verbose_name='Unity', unique=True)
description = models.TextField(verbose_name='Descr... |
HFO-detect/HFO-detect-python | examples/HFO_detection.py | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 16 09:18:10 2016
Example script to detect HFO with pyhfo-detect
Script load file, detect and dump to pandas dataframe
@author: jan_cimbalnik
"""
import os, requests, tempfile, pickle, time
from pyhfo_detect.io import add_metadata
from pyhfo_detect.core import (ll_dete... |
diofant/diofant | diofant/tests/functions/test_hyperbolic.py | import pytest
from diofant import (E, I, O, Rational, Symbol, acosh, acoth, asinh, atanh,
cos, cosh, cot, coth, csch, exp, log, nan, oo, pi, sec,
sech, sin, sinh, sqrt, symbols, tan, tanh, zoo)
from diofant.abc import x, y
from diofant.core.function import ArgumentIndexError
f... |
ZeitOnline/zeit.content.cp | src/zeit/content/cp/source.py | import zeit.cms.content.contentsource
import zeit.cms.content.sources
import zope.dottedname.resolve
class CPTypeSource(zeit.cms.content.sources.XMLSource):
product_configuration = 'zeit.content.cp'
config_url = 'cp-types-url'
attribute = 'name'
class CPExtraSource(zeit.cms.content.sources.XMLSource):
... |
euanlau/django-betainvite | betainvite/templatetags/betainvite_tags.py | from django import template
from betainvite.forms import WaitingListEntryForm
from betainvite.models import InvitationKey
register = template.Library()
@register.simple_tag(takes_context = True)
def remaining_invites(context):
"""
Get the remaning invites available for the current user
Syntax::
... |
PADAS/django-raster | raster/rasterize.py | from ctypes import POINTER, c_double, c_int, c_void_p
import numpy
from django.contrib.gis.gdal import OGRGeometry
from django.contrib.gis.gdal.libgdal import std_call
from django.contrib.gis.gdal.prototypes.generation import voidptr_output
# Reference for GDALRasterizeGeometries
# http://gdal.org/gdal__alg_8h.html#... |
all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/client.py | # -*- coding: utf-8 -*-
import logging
from .server import FHIRNotFoundException, FHIRServer, FHIRUnauthorizedException
__version__ = '3.0.0'
__author__ = 'SMART Platforms Team'
__license__ = 'APACHE2'
__copyright__ = "Copyright 2017 Boston Children's Hospital"
scope_default = 'user/*.* patient/*.read openid profil... |
cjhopman/JavaProxyCompiler | py4j/tests/java_gateway_test.py | # -*- coding: UTF-8 -*-
'''
Created on Dec 10, 2009
@author: barthelemy
'''
from __future__ import unicode_literals, absolute_import
from decimal import Decimal
import gc
from multiprocessing.process import Process
import os
from socket import AF_INET, SOCK_STREAM, socket
import subprocess
from threading import Threa... |
GetStream/stream-django | stream_django/feed_manager.py | from stream_django.conf import FEED_MANAGER_CLASS
from stream_django.conf import DJANGO_MAJOR_VERSION
from django.db.models.signals import class_prepared
from stream_django.utils import get_class_from_string
feed_manager_class = get_class_from_string(FEED_MANAGER_CLASS)
feed_manager = feed_manager_class()
class_prep... |
CWolfRU/freedoom | graphics/text/tint.py | #/usr/bin/env python
# SPDX-License-Identifier: MIT
# Copyright (c) 2017 Martin Miller, Nick Zatkovich
# https://stackoverflow.com/questions/12251896/colorize-image-while-preserving-transparency-with-pil
from PIL import Image, ImageColor, ImageOps
def image_tint(image, tint=None):
if tint is None:
return image
i... |
praekeltfoundation/ndoh-hub | eventstore/migrations/0018_auto_20200205_1033.py | # Generated by Django 2.2.8 on 2020-02-05 10:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("eventstore", "0017_pmtctregistration")]
operations = [
migrations.AddField(
model_name="chwregistration",
name="channel",
... |
sphinx-gallery/sphinx-gallery | sphinx_gallery/tests/test_full_noexec.py | # -*- coding: utf-8 -*-
# License: 3-clause BSD
"""
Test the SG pipeline using Sphinx and tinybuild
"""
from io import StringIO
import os.path as op
import shutil
from sphinx.application import Sphinx
from sphinx.util.docutils import docutils_namespace
import pytest
@pytest.fixture(scope='module')
def sphinx_app(tm... |
desihub/desispec | py/desispec/quicklook/qlconfig.py | import numpy as np
import json
import yaml
import astropy.io.fits as pyfits
from desiutil.log import get_logger
from desispec.io import findfile
from desispec.calibfinder import CalibFinder
import os,sys
from desispec.quicklook import qlexceptions,qllogger
class Config(object):
"""
A class to generate Quicklo... |
andrewsmedina/django-admin2 | djadmin2/apiviews.py | # -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
from django.utils.encoding import force_str
from rest_framework import fields, generics, serializers
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIVie... |
TheProjecter/sqlany-django | setup.py | #!/usr/bin/env python
# ***************************************************************************
# Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved.
# ***************************************************************************
r"""sqlany-django - SQL Anywhere driver for Django.
http://cod... |
h-mayorquin/mnist_deep_neural_network_BPNNs | deep_learning/tutorial_logistic_regresion.py | import numpy
import theano
import theano.tensor as T
rng = numpy.random
N = 400
feats = 784
D = (rng.randn(N, feats), rng.randint(size=N, low=0, high=2))
training_steps = 10000
# Declare Theano symbolic variables
x = T.matrix("x")
y = T.vector("y")
w = theano.shared(rng.randn(feats), name="w")
b = theano.shared(0., n... |
iicsys/pypmu | setup.py | import sys
from distutils.core import setup
if not sys.version_info[0] == 3:
sys.exit("[ERROR] Package syncrhrophasor is only available for Python 3.")
setup(name = 'synchrophasor',
packages = ['synchrophasor'],
version = '1.0.0-alpha',
description = 'Synchrophasor module represents implementa... |
Eric89GXL/vispy | vispy/util/svg/path.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Nicolas P. Rougier
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
import re
import math... |
SiLab-Bonn/ccpdv4 | ccpdv4/ccpd/ccpd_defaults.py | # from collections import OrderedDict
# CCPDv4
ccpdv4 = {
'flavor': 'ccpdv4',
# 'calibration_parameters': OrderedDict([
# (,),
# ]),
'CCPD_GLOBAL': {
'BLBias': 1,
'VNNew': 0,
'BLRes': 1,
'ThRes': 0,
'VNClic': 0,
'VN': 60,
'VNFB': 1,
... |
tsuru/rabbitmqapi | rabbitmqapi/utils.py | from __future__ import unicode_literals
import hmac
import hashlib
from flask import current_app
def generate_password(instance_name, app_host):
"""Generate a password for a RabbitMQ user"""
hm = hmac.new(current_app.config['SALT'].encode('utf-8'), digestmod=hashlib.sha1)
hm.update(instance_name.encode(... |
revolutionarysystems/merge | merge/views.py | import os
import zipfile
from django.shortcuts import render
from django.http import JsonResponse, HttpResponse
from .docMerge import mergeDocument
from .xml4doc import getData
from random import randint
from datetime import datetime
from django.views.decorators.csrf import csrf_exempt
#from .merge_utils import get_loc... |
pablorecio/djangae | djangae/db/utils.py | #STANDARD LIB
from datetime import datetime
from decimal import Decimal
from itertools import chain
import warnings
#LIBRARIES
import django
from django.conf import settings
from django.db import models
from django.db.backends.util import format_number
from django.db import IntegrityError
from django.utils import tim... |
lpedit-devs/lpedit | lpedit/AssembleOutRst.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
(1) takes an outfile (i.e. out.txt) and using the original file
combines the results into a single reST document.
inFileName is a file path to a *.rst | *.Rnw file
outFileName is a file path to a out file (i.e. out.txt)
USAGE:
$ python ParsePython.py -i... |
mxOBS/deb-pkg_trusty_chromium-browser | third_party/chromite/scripts/merge_package_status.py | # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Merge multiple package status CSV files into one csv file.
This simplifies uploading to a Google Docs spreadsheet.
"""
# pylint: disable=bad-cont... |
cihologramas/pyueye | wxueye/floatcombo.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Thu Sep 2 15:32:04 2010
import wx
wxEVT_FLOATCOMBO = wx.NewEventType()
EVT_FLOATCOMBO = wx.PyEventBinder(wxEVT_FLOATCOMBO, 0)
wxEVT_FLOATCOMBO_SPINUP = wx.NewEventType()
EVT_FLOATCOMBO_SPINUP = wx.PyEventBinder(wxEVT_FLOATCOMBO_SPINUP, 0)... |
Troyhy/cmsplugin-poll | cmsplugin_poll/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
from django.contrib.auth.models import User
class Poll(models.Model):
question = models.CharField(_('question'), max_length=300)
pub_date = models.DateTimeField(_('date published'))
close_... |
turon/openthread | tools/harness-automation/cases/commissioner_9_2_3.py | #!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... |
ResearchSoftwareInstitute/MyHPOM | hs_core/tests/api/views/test_group_CRUD.py | import os
import shutil
from django.contrib.auth.models import Group
from django.contrib.messages import get_messages
from django.core.urlresolvers import reverse
from rest_framework import status
from hs_core.testing import ViewTestCase
from hs_core import hydroshare
from hs_core.views import create_user_group, upd... |
molejar/pyIMX | imx/img/header.py | # Copyright (c) 2017-2018 Martin Olejar
#
# SPDX-License-Identifier: BSD-3-Clause
# The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution
# or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText
from easy_enum import Enum
from struct import pack, unpack_from, ca... |
sybenzvi/3ML | threeML/plugins/FermiGBMLike.py | import collections
import os
import warnings
import astropy.io.fits as pyfits
import numpy
import scipy.integrate
from threeML.minimizer import minimization
from threeML.plugin_prototype import PluginPrototype
from threeML.plugins.gammaln import logfactorial
from threeML.plugins.ogip import OGIPPHA
from astromodels.... |
rocco8773/bapsflib | bapsflib/_hdf/maps/controls/templates.py | # This file is part of the bapsflib package, a Python toolkit for the
# BaPSF group at UCLA.
#
# http://plasma.physics.ucla.edu/
#
# Copyright 2017-2018 Erik T. Everson and contributors
#
# License: Standard 3-clause BSD; see "LICENSES/LICENSE.txt" for full
# license terms and contributor agreement.
#
"""Module for t... |
aallai/pyobfsproxy | obfsproxy/network/socks.py | import csv
from twisted.protocols import socks
from twisted.internet.protocol import Factory
import obfsproxy.common.log as logging
import obfsproxy.network.network as network
import obfsproxy.transports.base as base
log = logging.get_obfslogger()
def split_socks_args(args_str):
"""
Given a string containin... |
larsoner/mne-python | examples/time_frequency/time_frequency_erds.py | """
===============================
Compute and visualize ERDS maps
===============================
This example calculates and displays ERDS maps of event-related EEG data. ERDS
(sometimes also written as ERD/ERS) is short for event-related
desynchronization (ERD) and event-related synchronization (ERS)
:footcite:`Pf... |
all-of-us/raw-data-repository | rdr_service/alembic/versions/9bc7f48f18df_specimen_participantid_to_biobankid.py | """specimen participantid to biobankid
Revision ID: 9bc7f48f18df
Revises: 079772728b59
Create Date: 2020-05-05 10:54:36.467929
"""
from alembic import op
import sqlalchemy as sa
import model.utils
from sqlalchemy.dialects import mysql
from rdr_service.participant_enums import PhysicalMeasurementsStatus, Questionnair... |
rossant/spiky | experimental/_correlation/selection.py | """Functions for selecting portions of arrays."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import numpy as np
import pandas as pd
# --------------------------------------------------------... |
abak-press/kozmic-ci | migrations/versions/1c314d48261a_introduce_project_is_public_field.py | """Introduce Project.is_public field
Revision ID: 1c314d48261a
Revises: 390c1805c002
Create Date: 2014-02-07 21:01:43.164197
"""
# revision identifiers, used by Alembic.
revision = '1c314d48261a'
down_revision = '390c1805c002'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('organi... |
PhonologicalCorpusTools/CorpusTools | tests/test_spontaneous_classes.py |
import pytest
import os
import sys
from corpustools.corpus.classes import (Word, Corpus, FeatureMatrix,
Environment, EnvironmentFilter, Transcription,
WordToken, Discourse, SpontaneousSpeechCorpus)
def test_init():
word_type_only = ... |
chisholm/cti-pattern-validator | stix2patterns/v20/grammars/STIXPatternParser.py | # Generated from STIXPattern.g4 by ANTLR 4.8
# encoding: utf-8
from __future__ import print_function
from io import StringIO
import sys
from antlr4 import *
def serializedATN():
with StringIO() as buf:
buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3")
buf.write(u"\67\u00e9\4\2\t... |
keitaroyam/yamtbx | yamtbx/dataproc/xds/idxreflp.py | """
(c) RIKEN 2015. All rights reserved.
Author: Keitaro Yamashita
This software is released under the new BSD License; see LICENSE.
"""
import re
import math
import numpy
import copy
from yamtbx.dataproc.xds.xparm import XPARM
from yamtbx.dataproc.xds import get_xdsinp_keyword
from cctbx import uctbx
re_outof = re.... |
leeon/annotated-django | tests/serializers_regress/tests.py | """
A test spanning all the capabilities of all the serializers.
This class defines sample data and a dynamically generated
test case that is capable of testing the capabilities of
the serializers. This includes all valid data values, plus
forward, backwards and self references.
"""
from __future__ import unicode_lite... |
alex/sentry | sentry/management/commands/start.py | """
sentry.management.commands.start
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from optparse ... |
oscaro/django-oscar-adyen | setup.py | from setuptools import setup, find_packages
setup(
name='django-oscar-adyen',
version='0.8.0',
url='https://github.com/oscaro/django-oscar-adyen',
author='Oscaro',
description='Adyen HPP payment module for django-oscar',
long_description=open('README.rst').read(),
keywords='payment, django... |
geosoco/periscrape | csv_unicode.py | #!/usr/bin/env python
"""Pull periscope text and links from twitter json files."""
import csv
import codecs
import cStringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encodi... |
all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/testscript_tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07.
# 2019, SMART Health IT.
import os
import io
import unittest
import json
from . import testscript
from .fhirdate import FHIRDate
class TestScriptTests(unittest.TestCase):
def instantiate_from(self, filename):... |
holzman/glideinwms-old | factory/stopFactory.py | #!/usr/bin/env python
#
# Project:
# glideinWMS
#
# File Version:
#
# Description:
# Stop a running glideinFactory
#
# Arguments:
# $1 = glidein submit_dir (i.e. factory dir)
#
# Author:
# Igor Sfiligoi May 6th 2008
#
import signal
import sys
import os
import os.path
import fcntl
import string
import time
im... |
ClifHouck/desperado | tests/test_desperado.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_desperado
----------------------------------
Tests for `desperado` module.
"""
import unittest
from desperado import desperado
class TestDesperado(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tear... |
elfi-dev/elfi | tests/unit/test_testbench.py | import numpy as np
from numpy.lib.function_base import quantile
import pytest
import elfi
import elfi.examples.ma2 as exma2
from elfi.methods.inference.parameter_inference import ParameterInference
def test_testbenchmethod_init():
method = elfi.TestbenchMethod(method=elfi.SMC, name="SMC_1")
method.set_metho... |
mennis/oTTo | src/otto/connections/ssh.py | # -*- coding: utf-8 -*-
"""
Paramiko based ssh module
"""
import os
import logging
import socket
from time import sleep, time
from multiprocessing import Process, Value, Array
import paramiko
from otto.lib.contextmanagers import ignored
from otto.lib.otypes import ReturnCode, ConnectionError, Data, Namespace
instanc... |
michaelBenin/django-oscar | tests/integration/offer/percentage_benefit_tests.py | from decimal import Decimal as D
from django.test import TestCase
from django_dynamic_fixture import G
from oscar.apps.offer import models
from oscar.apps.basket.models import Basket
from oscar.test.factories import create_product
class TestAPercentageDiscountAppliedWithCountCondition(TestCase):
def setUp(self... |
Joble/CumulusCI | cumulusci/tasks/release_notes/tests/test_parser.py | import httplib
import os
import unittest
import responses
from cumulusci.tasks.release_notes.generator import GithubReleaseNotesGenerator
from cumulusci.tasks.release_notes.parser import ChangeNotesLinesParser
from cumulusci.tasks.release_notes.parser import CommentingGithubIssuesParser
from cumulusci.tasks.release_n... |
AgentVi/DIGITS | digits/model/images/classification/views.py | # Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
import random
import re
import tempfile
import flask
import numpy as np
import werkzeug.exceptions
from .forms import ImageClassificationModelForm
from .job import ImageClassificationModelJob
import ... |
hu7241/nao_slam_amcl | src/nao_walker_v2.py | #!/usr/bin/env python
#
# ROS node to control Nao's walking engine (omniwalk and footsteps)
# This code is currently compatible to NaoQI version 1.6 or newer (latest
# tested: 1.12)
#
# Copyright 2009-2011 Armin Hornung & Stefan Osswald, University of Freiburg
# http://www.ros.org/wiki/nao
#
# Redistribution and use i... |
gmimano/commcaretest | corehq/apps/reminders/event_handlers.py | from .models import Message, METHOD_SMS, METHOD_SMS_CALLBACK, METHOD_SMS_SURVEY, METHOD_IVR_SURVEY, METHOD_EMAIL, METHOD_TEST, METHOD_SMS_CALLBACK_TEST, RECIPIENT_USER, RECIPIENT_CASE, RECIPIENT_SURVEY_SAMPLE
from corehq.apps.smsforms.app import submit_unfinished_form
from corehq.apps.smsforms.models import XFormsSessi... |
johansteffner/raven-python | raven/events.py | """
raven.events
~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import sys
from raven.utils.encoding import to_unicode
from raven.utils.stacks import get_stack_info, iter_t... |
zfrenchee/pandas | pandas/tests/io/parser/test_network.py | # -*- coding: utf-8 -*-
"""
Tests parsers ability to read and parse non-local files
and hence require a network connection to be read.
"""
import pytest
import pandas.util.testing as tm
import pandas.util._test_decorators as td
from pandas import DataFrame
from pandas.io.parsers import read_csv, read_table
from panda... |
kanzure/ctypesgen | test/testsuite.py | #!/usr/bin/env python
# -*- coding: ascii -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
"""Simple test suite using unittest.
By clach04 (Chris Clark).
Calling:
python test/testsuite.py
or
cd test
./testsuite.py
Could use any unitest compatible test runner (nose, etc.)
Aims to test for regres... |
DavidHickman/calendary | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
]
test_requirements = [
"pytest"
]
setup(
name='calendary',
ve... |
IgnitionProject/ignition | setup.py | #!/usr/bin/env python
"""Distutils based setup script for ignition."""
from distutils.core import Command, setup
import sys
import subprocess
try:
import sympy
except:
print "Exception occurred whem importing sympy. You must install sympy "\
"to use ignition"
import ignition
class test_ignition (C... |
tBaxter/tango-comments | tango_comments/urls.py | from django.urls import path, re_path
from django.contrib.contenttypes.views import shortcut
from .views.comments import post_comment, comment_done
from .views.moderation import flag, flag_done, delete, delete_done, approve, approve_done
urlpatterns = [
path('post/', post_comment, name='comments-post-comment'),
... |
RonnyPfannschmidt/execnet-test | execnet/gateway_io.py | """
execnet io initialization code
creates io instances used for gateway io
"""
import os
import sys
import shlex
try:
from execnet.gateway_base import Popen2IO, Message
except ImportError:
from __main__ import Popen2IO, Message
from functools import partial
class Popen2IOMaster(Popen2IO):
def __init__... |
laughingman7743/PyAthenaJDBC | pyathenajdbc/error.py | # -*- coding: utf-8 -*-
__all__ = [
"Error",
"Warning",
"InterfaceError",
"DatabaseError",
"InternalError",
"OperationalError",
"ProgrammingError",
"DataError",
"NotSupportedError",
]
class Error(Exception):
pass
class Warning(Exception):
pass
class InterfaceError(Error... |
ianstalk/Flexget | flexget/components/trakt/trakt_list.py | from collections.abc import MutableSet
from loguru import logger
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils import json
from flexget.utils.cached_input import cached
from flexget.utils.requests import RequestException, TimedLimiter
from flexget.utils.... |
exoscale/vcloudtools | test/unit/test_vcloud.py | import copy
from nose.tools import *
from vcloudtools.vcloud import Link, Org, OrgList
MOCK_LINK = {
'type': 'application/foo+xml',
'href': 'https://test/foo',
'rel': 'test_rel',
'name': 'foo',
}
MOCK_ORG = {
'type': 'application/vnd.vmware.vcloud.org+xml',
'href': 'http://test-api-client/org... |
schef/schef.github.io | source/11/mc-11-06-sk-wht.py | #!/usr/bin/python
# Written by Stjepan Horvat
# ( zvanstefan@gmail.com )
# by the exercises from David Lucal Burge - Perfect Pitch Ear Traning Supercourse
# Thanks to Wojciech M. Zabolotny ( wzab@ise.pw.edu.pl ) for snd-virmidi example
# ( wzab@ise.pw.edu.pl )
import random
import time
import sys
import re
fname="/de... |
ambitioninc/django-issue | docs/conf.py | # -*- coding: utf-8 -*-
#
# django-issue documentation build configuration file
import inspect
import os
import re
# -- Django configuration -------------------------------------------------
import sys
sys.path.insert(0, os.path.abspath('..'))
from settings import configure_settings
configure_settings()
from django.u... |
kespindler/puffin | fabfile.py | from fabric.api import task, local
@task
def publish():
local('rm dist/*')
local('python setup.py sdist')
local('twine upload dist/*')
@task
def cover():
local('coverage run --omit="venv/*,tests/*,/usr/local/lib/python*" -m unittest discover tests')
local('coverage report')
local('coverage h... |
ktan2020/legacy-automation | win/Lib/multiprocessing/pool.py | #
# Module providing the `Pool` class for managing a process pool
#
# multiprocessing/pool.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
... |
flwh/you-get | src/you_get/extractors/netease.py | #!/usr/bin/env python
__all__ = ['netease_download']
from ..common import *
from json import loads
import hashlib
import base64
import os
def netease_cloud_music_download(url, output_dir='.', merge=True, info_only=False):
rid = match1(url, r'id=(.*)')
if rid is None:
rid = match1(url, r'/(\d+)/?$')... |
doingmathwithpython/code | chapter1/solutions/enhanced_unit_converter.py | '''
enhanced_unit_converter.py
Unit converter:
Miles and Kilometers
Kilograms and Pounds
Celsius and Fahrenheit
'''
def print_menu():
print('1. Kilometers to Miles')
print('2. Miles to Kilometers')
print('3. Kilograms to Pounds')
print('4. Pounds to Kilograms')
print('5. Celsius to Fahrenheit')... |
YNedderhoff/named-entity-recognizer | modules/evaluation.py | import time
import codecs
import token as tk
def evaluate(file_in, out_file):
t0 = time.time()
print "\tEvaluate predictions"
pos_dict = {}
counter = 0
prediction_count = 0
# unique_tags will contain every existing POS tag as key, whether it exists
# only in gold, predicted, or both. ... |
ToFuProject/tofu | tofu/openadas2tofu/_read_files.py |
# Built-in
import os
import re
import itertools as itt
import warnings
# Common
import numpy as np
from scipy.interpolate import RectBivariateSpline as scpRectSpl
__all__ = ['step03_read', 'step03_read_all']
_DTYPES = {'adf11': ['acd', 'ccd', 'scd', 'plt', 'prb'],
'adf15': None}
_DEG = 1
_PECASFUNC = T... |
goldsborough/your_app | your_app/code.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Your application's badass source code.
"""
def square(x):
"""
Squares a value.
Equivalent to calling x**2.
Arguments:
x (int|float): The value to square.
Returns:
The squared value.
"""
return x * x |
jianjunz/online-judge-solutions | leetcode/1572-subrectangle-queries.py | class SubrectangleQueries:
def __init__(self, rectangle: List[List[int]]):
self.rect=rectangle
def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None:
for r in range(row1,row2+1):
for l in range(col1, col2+1):
... |
wegamekinglc/Finance-Python | PyFin/tests/DateUtilities/testSchedule.py | # -*- coding: utf-8 -*-
u"""
Created on 2015-7-15
@author: cheng.li
"""
import unittest
import copy
import tempfile
import pickle
import os
from PyFin.DateUtilities import Date
from PyFin.DateUtilities import Schedule
from PyFin.DateUtilities import Period
from PyFin.DateUtilities import Calendar
from PyFin.Enums imp... |
danieljf24/cmrf | simpleknn/im2fea.py | import sys
import os
import numpy as np
from basic.common import ROOT_PATH, makedirsforfile, checkToSkip, printStatus
from bigfile import BigFile
INFO = 'simpleknn.%s' % os.path.basename(__file__)
def process(options, feat_dir, imsetfile, result_dir):
resultfile = os.path.join(result_dir, 'feature.bin')
if c... |
rohitranjan1991/home-assistant | homeassistant/components/axis/light.py | """Support for Axis lights."""
from axis.event_stream import CLASS_LIGHT
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers... |
realityone/CetTicket | setup.py | #!/usr/bin/env python
import os
import sys
from setuptools import setup
ROOT_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(ROOT_DIR)
with open(os.path.join(SOURCE_DIR, 'requirements.txt'), 'r') as f:
requirements = f.read().splitlines()
setup(
name="libcet",
version='0.2',
description="R... |
iCandyLabs/Port-Scanner | Port Scanner/sub_program/filehand.py | import os
class File_handling():
'''
File handling module used to save data of open port in text file
'''
def __init__(self,name="Result Port-scanner.txt",st='Result of Port Sacn'):
self.fname=name
self.info=st
def f_do_it(self,ls):
'''
Create a text file ... |
lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/public_ip_address_paged.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
Cysu/open-reid | reid/models/__init__.py | from __future__ import absolute_import
from .inception import *
from .resnet import *
__factory = {
'inception': inception,
'resnet18': resnet18,
'resnet34': resnet34,
'resnet50': resnet50,
'resnet101': resnet101,
'resnet152': resnet152,
}
def names():
return sorted(__factory.keys())
... |
birsoyo/conan | conans/test/integration/build_id_test.py | import os
import unittest
from parameterized.parameterized import parameterized
from conans.model.ref import PackageReference, ConanFileReference
from conans.test.utils.tools import TestClient
from conans.util.files import load
conanfile = """from conans import ConanFile
from conans.util.files import save
class MyT... |
datalogics/scons | test/SCONSFLAGS.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.