code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from direct.distributed import DistributedObject
class DistributedTestObject(DistributedObject.DistributedObject):
def setRequiredField(self, r):
self.requiredField = r
def setB(self, B):
self.B = B
def setBA(self, BA):
self.BA = BA
def setBO(self, BO):
self.BO = BO
... | ToontownUprising/src | otp/distributed/DistributedTestObject.py | Python | mit | 717 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutStringManipulation(Koan):
def test_use_format_to_interpolate_variables(self):
value1 = 'one'
value2 = 2
string = "The values are {0} and {1}".format(value1, value2)
self.assertEqual('The values are ... | KawaiiShepherd/python-koans-practice | python3/koans/about_string_manipulation.py | Python | mit | 2,771 |
from __future__ import absolute_import
from django.test import TestCase
from django.core.exceptions import FieldError
from .models import Poll, Choice, OuterA, Inner, OuterB
class NullQueriesTests(TestCase):
def test_none_as_null(self):
"""
Regression test for the use of None as a query value.
... | atruberg/django-custom | tests/null_queries/tests.py | Python | bsd-3-clause | 2,936 |
import botocore.endpoint
from tornado import gen
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
class AsyncEndpoint(botocore.endpoint.Endpoint):
"""Subclass of Endpoint that uses AsyncHTTPClient to make requests.
The make_request method is wrapped in a coroutine"""
def __init__(self, *args, ... | qudos-com/botocore-tornado | botocore_tornado/endpoint.py | Python | mit | 4,257 |
#!/usr/bin/env python3
import sys
import time
import datetime
from adafruit_dht import measure_and_write
from utils import check_internet
def main(argv = sys.argv):
for index in range(0, 30):
try:
measure_and_write()
return 0
except Exception as e:
if index == ... | munhyunsu/Hobby | PiTemperatureHumidity/main.py | Python | gpl-3.0 | 603 |
from __future__ import absolute_import
input_name = '../examples/multi_physics/thermo_elasticity_ess.py'
output_name = 'test_thermo_elasticity_ess.vtk'
from tests_basic import TestInput
class Test(TestInput):
pass
| vlukes/sfepy | tests/test_input_thermo_elasticity_ess.py | Python | bsd-3-clause | 219 |
XXXXXXXXX XXXXX
XXXXXX
XXXXXX
XXXXX XXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX XXXXXXX X XXX XXXXXXXXX X XXXXXXXXX XXXXXX XXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXX XXXX... | dnaextrim/django_adminlte_x | adminlte/static/plugins/datatables/extensions/TableTools/examples/select_os.html.py | Python | mit | 17,787 |
# -*- coding: windows-1252 -*-
# BOF
# UNCALCED
# INDEX
# Calculation Settings Block
# PRINTHEADERS
# PRINTGRIDLINES
# GRIDSET
# GUTS
# DEFAULTROWHEIGHT
# WSBOOL
# Page Settings Block
# ... | Scemoon/lpts | site-packages/xlwt/Worksheet.py | Python | gpl-2.0 | 47,776 |
# -*- coding: utf-8 -*-
class TaskBase(object):
def __init__(self):
self.reporter = None
self.data = None
self.ignoreFail = False
self.failureStep = None
def do(self):
pass
def build(self):
if not self.do():
if self.failureStep is not None:
... | webbers/pyhammer | pyhammer/tasks/taskbase.py | Python | mit | 650 |
"""
device.api
----------
"""
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from kitchensink.device.models import Make, Device
class MakeResource(ModelResource):
class Meta:
queryset = Make.objects.all()
# read only until we decide the other way... | mozilla/kitchensinkserver | kitchensink/device/api.py | Python | bsd-3-clause | 820 |
# ====================================================================
# 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 re... | romanchyla/pylucene-trunk | samples/LuceneInAction/lia/handlingtypes/msdoc/AntiWordHandler.py | Python | apache-2.0 | 1,520 |
#!/usr/bin/env python
"""
define a category
"""
import branches
class Category:
def __init__(self, name, cut, branch=branches.M4L):
self.name = name
self.branch = branch
self.cut = "("+cut+"&&"+self.branch.get_cut_str()+")"
def __str__(self):
return "{name}".format(**self.__dict... | xju2/hzzws | scripts/category.py | Python | mit | 956 |
# from the dictionary of the number of users for each fragment
flist = []
with open("sortedFragments.txt","r") as ff:
next(ff)
for line in ff:
l = line.strip()
v = l.split(",")
flist.append(v)
# form a data structure for groupid
groupLimits = [1,5,7,9,11,13,15,17,20,30,40,100,100... | willettk/ancientlives | python/separate.py | Python | mit | 894 |
from ..source import URLSource
from ..package import Package
from ..util import target_arch
class GDBM(Package):
version = '1.14.1'
source = URLSource(f'https://ftp.gnu.org/gnu/gdbm/gdbm-{version}.tar.gz')
def prepare(self):
self.run_with_env([
'./configure',
'--prefix=/us... | qpython-android/QPython3-core | pybuild/packages/gdbm.py | Python | apache-2.0 | 583 |
#!/usr/bin/python
import unittest as u
import re, fnmatch, os
rootDir = '../src/'
javaBlacklistFile = '../src/javaswig_blacklist'
pythonBlacklistFile = '../src/pythonswig_blacklist'
nodeBlacklistFile = '../src/nodeswig_blacklist'
class BlacklistConsistency(u.TestCase):
def test_java_blacklist(self):
w... | sasmita/upm | tests/check_consistency.py | Python | mit | 2,099 |
#!/usr/bin/env python3.3
# Copyright 2012 by Douglas Sweetser, sweetser@alum.mit.edu
# Licensed under the Apache License, Version 2.0.
import sys
import os
import re
import subprocess as sp
import collections as co
import argparse as ap
'''Class RunProcessing
Will run processing given setup and draw data.
Author: sw... | dougsweetser/QProcessing | visualphysics/RunProcessing.py | Python | apache-2.0 | 3,786 |
import pytest
@pytest.fixture()
def AnsibleDefaults(Ansible):
return Ansible("include_vars", "defaults/main.yml")["ansible_facts"]
def test_tomcat_user(User, Group, AnsibleDefaults):
assert User(AnsibleDefaults["tomcat_user"]).exists
assert Group(AnsibleDefaults["tomcat_group"]).exists
assert User(A... | aphexlog/ansible-playbooks | tomcat/tests/test_ansible.py | Python | gpl-3.0 | 915 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QAD Quantum Aided Design plugin
comando da inserire in altri comandi per la richiesta di un angolo
-------------------
begin : 2013-12-04
copyright ... | geosim/QAD | qad_getangle_cmd.py | Python | gpl-3.0 | 7,163 |
"""
SPIN Engine
""" | yingerj/rdflib | rdflib/plugins/spin/spin.py | Python | bsd-3-clause | 19 |
import bpy
import os
#bpy.ops.object.select_all(action='DESELECT')
#put object as active
bpy.context.scene.objects.active = bpy.data.objects["chest_left"]
#https://docs.blender.org/api/2.79b/bpy.ops.object.html?highlight=object#bpy.ops.object.select_pattern
#Select objects matching a naming pattern
bpy.ops.object.se... | 22i/minecraft-voxel-blender-models | models/extra/blender-scripting/+/llama.py | Python | gpl-3.0 | 2,828 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from web import a
import sys
a.sayHello()
print 'main', __name__
print sys.argv
print '--------'
# print a.__builtins__
print '__doc__: %s' % a.__doc__
print '__file__:%s' % a.__file__
print '__name__:%s' % a.__name__
print '__package__:%s' % a.__package__
print '__auth... | WellerQu/LearnPython | lesson6/main.py | Python | mit | 344 |
class UserResourceMixin(object):
"""Methods for managing User resources."""
def create_user(self, **attributes):
"""Create a user.
>>> user = yola.create_user(
name='John',
surname='Smith',
email='johnsmith@example.com',
partner_id='WL_PARTNER_ID... | yola/yolapy | yolapy/resources/user.py | Python | mit | 3,841 |
"""
日期基本操作模块
"""
import calendar
from time import strftime, localtime
from datetime import timedelta, date
YEAR = strftime("%Y", localtime())
MONTH = strftime("%m", localtime())
DAY = strftime("%d", localtime())
HOUR = strftime("%H", localtime())
MIN = strftime("%M", localtime())
SEC = strftime("%S", localtime())
de... | a358003542/expython | expython/utils/data_utils.py | Python | mit | 4,972 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2007 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be usef... | marcosbontempo/inatelos | poky-daisy/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel4.py | Python | mit | 1,070 |
#!/usr/bin/env python
'''
ZCR Shellcoder
ZeroDay Cyber Research
Z3r0D4y.Com
Ali Razmjoo
'''
def run(file_to_perm,perm_num):
return 'N'
| firebitsbr/ZCR-Shellcoder | lib/generator/windows_x86/chmod.py | Python | gpl-3.0 | 137 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import pytest
import dawg
class TestBytesDAWG(object):
DATA = (
('foo', b'data3'),
('bar', b'data2'),
('foo', b'data1'),
('foobar', b'data4')
)
DATA_KEYS = list(zip(*DATA))[0]
def dawg(s... | moonlet/DAWG | tests/test_payload_dawg.py | Python | mit | 3,423 |
import os
import pytest
from .. import command_line
from .. import yamale_error
dir_path = os.path.dirname(os.path.realpath(__file__))
parsers = ['pyyaml', 'PyYAML', 'ruamel']
@pytest.mark.parametrize('parser', parsers)
def test_bad_yaml(parser):
with pytest.raises(ValueError) as e:
command_line._rout... | 23andMe/Yamale | yamale/tests/test_command_line.py | Python | mit | 3,370 |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import FlaskForm
from wtforms import (DateTimeField, IntegerField, SelectField, StringField,
ValidationError)
from wtforms.validators import DataRequired, NumberRange
from league.dashboard.models import Color, Game, Player
class PlayerCr... | hwchen/league | app/league/dashboard/forms.py | Python | mit | 4,044 |
#!/usr/bin/env python
import sys
import os
import codecs
from os.path import join, abspath, basename, dirname
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def read_file(name, *args):
try:
return codecs.open(join(dirname(__file__), name), encoding='utf-8')... | infincia/NetRNG | setup.py | Python | mit | 1,734 |
#!/usr/local/bin/python2.7
##
# OOIPLACEHOLDER
#
# Copyright 2014 Raytheon Co.
##
__author__ = 'mworden'
import os
from mi.logging import config
from mi.core.log import get_logger
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.dataset_driver import DataSetDriver
from mi.dataset.parser.n... | JeffRoy/mi-dataset | mi/dataset/driver/nutnr_b/dcl_full/nutnr_b_dcl_full_recovered_driver.py | Python | bsd-2-clause | 1,479 |
# -*- coding: utf-8 -*-
"""
equations.py: Fluid dynamics equations for atmospheric sciences.
"""
# Note that in this module, if multiple equations are defined that compute
# the same output quantity given the same input quantities, they must take
# their arguments in the same order. This is to simplify overriding defau... | atmos-python/atmos | atmos/equations.py | Python | mit | 30,250 |
from __future__ import absolute_import
import unittest
from testutils import harbor_server
from testutils import TEARDOWN
from testutils import ADMIN_CLIENT
from library.system import System
from library.project import Project
from library.user import User
from library.repository import Repository
from library.reposit... | steven-zou/harbor | tests/apitests/python/test_scan_all_images.py | Python | apache-2.0 | 4,551 |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2019 NIWA & British Crown (Met Office) & Contributors.
#
# 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 Free Software Foundation... | trwhitcomb/cylc | cylc/flow/state_summary_mgr.py | Python | gpl-3.0 | 9,131 |
from django.test import TestCase
from corehq.apps.reports.views import calculate_hour, recalculate_hour, calculate_day
class TimeAndDateManipulationTest(TestCase):
def calculate_hour_test(self):
self.assertEqual(calculate_hour(10, 2, 0), (12, 0))
self.assertEqual(calculate_hour(10, -2, 0), (8, 0))... | SEL-Columbia/commcare-hq | corehq/apps/reports/tests/test_time_and_date_manipulations.py | Python | bsd-3-clause | 1,682 |
from Adafruit_ADS1x15 import ADS1x15 as A2DObject
from functools import partial
# create AI channel objects
class aiChannel:
def __init__(self,confDict):
#open connection on physicalChannel
self.name = confDict['labelText']
self.i2cAddress = confDict['i2cAddress']
self.connectionT... | stevens4/rover3 | lowLevelLibrary.py | Python | gpl-2.0 | 9,709 |
# Script for calculation of ferroelectric wall domain profile
from math import *
from numpy import *
import matplotlib.pyplot as plt
axes = plt.gca()
axes.set_xlim([-0.55,0.55])
axes.set_ylim([-0.9,0.9])
beta = -2.92e8
g = 0.54e-10
xi = 1.56e9
alpha0 = 7.6e5
q11 = 0.089
q12 = -0.026
s11 = -2.5
s12 = 9.0
e = 4.0/((8... | JoulesCESAR/domain_wall | polarization_five.py | Python | gpl-3.0 | 2,893 |
# Write a program that helps a person decide whether to buy a hybrid car. Your
# pro gram’s inputs should be:
# • The cost of a new car
# • The estimated miles driven per year
# • The estimated gas price
# • The efficiency in miles per gallon
# • The estimated resale value after 5 years
# Compute the total cost of owni... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter2-Programming-with-Numbers-and-Strings/P2.10.py | Python | mit | 1,168 |
# -*- coding: utf-8 -*-
"""Storj package."""
import io
from abc import ABCMeta
from hashlib import sha256
from ecdsa import SigningKey, SECP256k1
from .api import ecdsa_to_hex
from .configuration import read_config
from .http import Client
from .metadata import __version__
from .model import Bucket, File, Token
... | frdwrd/storj-python-sdk | storj/__init__.py | Python | mit | 5,053 |
import logging
import logging.config
import grpc
from ssedata import ArgType, ReturnType, FunctionType
import ServerSideExtension_pb2 as SSE
class ScriptEval:
"""
Class for SSE plugin ScriptEval functionality.
"""
def EvaluateScript(self, header, request, context, func_type):
"""
Ev... | qlik-oss/server-side-extension | examples/python/helloworld/scripteval.py | Python | mit | 7,033 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | ivano666/tensorflow | tensorflow/python/kernel_tests/one_hot_op_test.py | Python | apache-2.0 | 11,619 |
from mock import patch
from pytest import raises
import mock
from kiwi.package_manager.microdnf import PackageManagerMicroDnf
from kiwi.exceptions import KiwiRequestError
class TestPackageManagerMicroDnf:
def setup(self):
repository = mock.Mock()
repository.root_dir = '/root-dir'
reposi... | SUSE/kiwi | test/unit/package_manager/microdnf_test.py | Python | gpl-3.0 | 5,763 |
import os
from .models import TwoFactorUserSettings
from .routes import settings_routes
SHORT_NAME = 'twofactor'
FULL_NAME = 'Two-factor Authentication'
WIDGET_HELP = 'Two-Factor Authentication (Alpha)'
USER_SETTINGS_MODEL = TwoFactorUserSettings
MODELS = [TwoFactorUserSettings]
ROUTES = [settings_routes, ]
OWNER... | ckc6cz/osf.io | website/addons/twofactor/__init__.py | Python | apache-2.0 | 642 |
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
import os
i... | nuclear-wizard/moose | python/MooseDocs/common/get_requirements.py | Python | lgpl-2.1 | 8,019 |
##
# Copyright 2009-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | ULHPC/modules | easybuild/easybuild-easyblocks/easybuild/easyblocks/s/slepc.py | Python | mit | 5,767 |
from __future__ import absolute_import
from sippers import logger
from sippers.utils import build_dict
from sippers.adapters.endesa import EndesaSipsAdapter, EndesaMeasuresAdapter
from sippers.models.endesa import EndesaSipsSchema, EndesaMeasuresSchema
from sippers.parsers.parser import Parser, register
class Endesa... | gisce/sippers | sippers/parsers/endesa.py | Python | gpl-3.0 | 2,937 |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import threading
from time import sleep, ctime
from bejond.basic.util import dateu
class myThread(threading.Thread):
def __init__(self, threadID, name, s, e):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.... | bejondshao/grape | tests/others/thread.py | Python | gpl-3.0 | 1,856 |
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# 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... | IljaGrebel/OpenWrt-SDK-imx6_HummingBoard | staging_dir/host/lib/scons-2.3.5/SCons/Options/EnumOption.py | Python | gpl-2.0 | 1,980 |
from django.shortcuts import render_to_response
from django.http.response import HttpResponse
from django.contrib.auth.decorators import login_required
from .tasks import test
from django_event.publisher.request import EventRequest
@login_required
def example(request):
return render_to_response('example.html')
... | ailove-dev/django-event | demo/example/views.py | Python | mit | 439 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import soundfile as sf
from matplotlib.font_manager import FontProperties
import pyaudio
from scipy.signal import welch, butter, lfilter, savgol_filter, group_delay
from os import listdir
from os.path import isfile, join
from colour import Colo... | oesst/Sound_Analytics | evaluation/extracting_spectral_cues_test.py | Python | mit | 1,752 |
# Copyright 2016 Quora, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | manannayak/asynq | asynq/async_task.py | Python | apache-2.0 | 17,625 |
import sys
import re
import uuid
from subprocess import PIPE
from subprocess import Popen
from subprocess import run
from .branch import Branch
from .branch import Stage
from .commit import Commit
from .tree import Tree
ENCODING = sys.stdout.encoding
class GitException(Exception):
pass
class GitInteractor:
... | m1trix/branch | branch/git.py | Python | gpl-3.0 | 8,905 |
# -*- coding: utf-8 -*-
import unittest
from nose.tools import ok_, eq_, assert_equal, assert_false, assert_true, assert_raises
# noinspection PyUnresolvedReferences
from .._tins import EthernetII, HWAddress, PDU, IP, TCP, RAW, PDUNotFound, UDP, ICMP, OptionNotFound, DNS, DHCP, IPv4Address
import platform
IS_MACOSX =... | stephane-martin/cycapture | cycapture/libtins/tests/test_dhcp.py | Python | lgpl-3.0 | 7,257 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Aloomaio/googleads-python-lib | examples/ad_manager/v201805/network_service/get_all_networks.py | Python | apache-2.0 | 1,350 |
"""
Clone server Model Six
"""
import random
import time
import zmq
from clone import Clone
SUBTREE = "/client/"
def main():
# Create and connect clone
clone = Clone()
clone.subtree = SUBTREE
clone.connect("tcp://localhost", 5556)
clone.connect("tcp://localhost", 5566)
try:
while ... | soscpd/bee | root/tests/zguide/examples/Python/clonecli6.py | Python | mit | 638 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | michaelkirk/QGIS | python/plugins/processing/modeler/ModelerAlgorithm.py | Python | gpl-2.0 | 25,614 |
from base import *
COMMENT = "This is comment inside the CGI"
TEXT = "It should be printed by the CGI"
CONF = """
vserver!1!rule!1090!match = extensions
vserver!1!rule!1090!match!extensions = prio3
vserver!1!rule!1090!handler = file
vserver!1!rule!1091!match = directory
vserver!1!rule!1091!match!directory = /prio... | lmcro/webserver | qa/109-Priority3.py | Python | gpl-2.0 | 1,118 |
# -*- coding: utf-8 -*-
"""
cloudns API library
~~~~~~~~~~~~~~~~~~~
This is a library that allows simple access to the ClouDNS HTTP API.
:copyright: (c) 2016, Richard Franks
:license: MIT, see LICENSE for more information
"""
__title__ = 'cloudns'
__version__ = '0.2a'
__author__ = 'Richard Franks'
__license__ = 'M... | rf152/python-cloudns | cloudnsapi/__init__.py | Python | mit | 404 |
# Copyright (c) 2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Ref
from .validators import integer, positive_integer, boolean
class MetricDimension(AWSProperty):
props = {
'Name': (basestring, True),
'Value': (ba... | Hons/troposphere | troposphere/cloudwatch.py | Python | bsd-2-clause | 1,123 |
#!/usr/bin/env python
"""
@package mi.dataset.driver.fuelcell_eng.dcl.test
@file mi-dataset/mi/dataset/driver/fuelcell_eng/dcl/test_fuelcell_eng_dcl_telemetered_driver.py
@author Chris Goodrich
@brief Sample test for test_fuelcell_eng_dcl_telemetered_driver
Release notes: Initial Release
"""
import os
import unittes... | oceanobservatories/mi-dataset | mi/dataset/driver/fuelcell_eng/dcl/test/test_fuelcell_eng_dcl_telemetered_driver.py | Python | bsd-2-clause | 1,223 |
#!/usr/bin/env python
'''
Custom button render class for use inside a wx.grid
(ported from http://forums.wxwidgets.org/viewtopic.php?t=14403 )
Michael Day
June 2014
'''
from ..lib.wx_loader import wx
from wx import grid
import copy
class ButtonRenderer(wx.grid.PyGridCellRenderer):
def __init__(self,label,width=75... | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_misseditor/button_renderer.py | Python | gpl-3.0 | 2,907 |
import os
# Django settings for opentreemap project.
OTM_VERSION = 'dev'
API_VERSION = 'v0.1'
FEATURE_BACKEND_FUNCTION = None
USER_ACTIVATION_FUNCTION = None
UITEST_CREATE_INSTANCE_FUNCTION = 'treemap.tests.make_instance'
UITEST_SETUP_FUNCTION = None
# This email is shown in various contact/error pages
# throughout... | gnowledge/OTM2 | opentreemap/opentreemap/settings/default_settings.py | Python | gpl-3.0 | 9,133 |
import logging
import unittest
import vsmlib
from vsmlib.benchmarks import analogy
logging.basicConfig(level=logging.DEBUG)
class Tests(unittest.TestCase):
def test_3cosadd(self):
path_model = "./test/data/embeddings/text/plain_no_file_header"
model = vsmlib.model.load_from_dir(path_model)
... | undertherain/vsmlib | test/test_analogies.py | Python | apache-2.0 | 1,689 |
import os
from dotenv import load_dotenv
load_dotenv()
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = bool(os.getenv('DEBUG', False))
CSRF_COOKIE_HTTPONLY = not DEBUG
CSRF_COOKIE_SECURE = not DEBUG
SECURE_BROWSER_XSS_FILTER = not DEBUG
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROT... | zenofewords/zenofewords | zenofewords/settings.py | Python | mit | 3,678 |
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.tools.translate import _
from odoo.exceptions import UserError
class AccountDebitNote(models.TransientModel):
"""
Add Debit Note wizard: when you want to correct an invoice with a positive amount.
Opposite of a Credit Note, but differe... | rven/odoo | addons/account_debit_note/wizard/account_debit_note.py | Python | agpl-3.0 | 4,301 |
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from Norman.models import User, Hospital
from .factories import UserFactory
@pytest.mark.usefixtures('db')
class TestUser:
"""User tests."""
def __int__(self):
self.user = User(first_name='foo', last_name='bar', em... | Olamyy/Norman | tests/test_models.py | Python | bsd-3-clause | 2,208 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | mdhaman/superdesk-core | content_api/packages/service.py | Python | agpl-3.0 | 2,130 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-09-08 11:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0008_financialaid'),
]
operations = [
migrations.AlterField(
... | benabraham/cz.pycon.org-2017 | pyconcz_2017/proposals/migrations/0009_auto_20160908_1357.py | Python | mit | 530 |
from app.models import all_models
from app.utils import mkdir_p
from app import GENERATED_TILES_FOLDER, RANDOM_FOLDER, BACKPROPS_FOLDER
from scipy import misc
import glob
import numpy as np
import os
from keras.models import load_model, Model
from keras.optimizers import Adam, SGD, Adagrad
from keras.layers import Lo... | Detry322/map-creator | app/random.py | Python | mit | 1,453 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | seankelly/buildbot | master/buildbot/test/unit/test_util_pathmatch.py | Python | gpl-2.0 | 3,436 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'web.view... | diogobaeder/artistaprofissional | myproject/urls.py | Python | bsd-2-clause | 512 |
# Copyright 2013-2015 ARM Limited
#
# 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 w... | Sticklyman1936/workload-automation | wlauto/workloads/video/__init__.py | Python | apache-2.0 | 6,007 |
"""ThreatConnect TI Generic Mappings Object"""
# standard library
import json
import logging
from functools import lru_cache
from typing import TYPE_CHECKING, Optional
from urllib.parse import unquote
# first-party
from tcex.api.tc.v2.threat_intelligence.tcex_ti_tc_request import TiTcRequest
from tcex.exit.error_codes... | ThreatConnect-Inc/tcex | tcex/api/tc/v2/threat_intelligence/mappings/mappings.py | Python | apache-2.0 | 22,780 |
#!/usr/bin/env python3
from os import path
from sys import argv
import numpy as np
import matplotlib.pyplot as plt
from scipy.constants.constants import c
def problem_3(dir, fmt):
c = 1.000e+00
G = 1.000e+00
M_s = 1.476e+03
M_e = 4.434e-03
R_s = 6.960e+08
R_e = 6.371e+06
AU = 1.496e... | dwysocki/ASTP-760 | notes/textbook/py/gr-ch8-exercises.py | Python | mit | 1,576 |
import random
import inspect
import logging
import unittest
import theano
import numpy as np
import pandas as pd
from neupy import environment
from utils import vectors_for_testing
class BaseTestCase(unittest.TestCase):
verbose = False
random_seed = 0
use_sandbox_mode = True
def setUp(self):
... | stczhc/neupy | tests/base.py | Python | mit | 2,280 |
from bottle import request, response, redirect, static_file
from munch import munchify
from simplejson import dumps, load
from uuid import uuid4
import os
ROOT = os.path.dirname(__file__) + '/data/'
API_PATH = '/api/{0}/{1}'
TENDERS_PATH = API_PATH.format('0.10', "tenders")
PLANS_PATH = API_PATH.format('0.10', "plan... | openprocurement/openprocurement.client.python | openprocurement_client/tests/_server.py | Python | apache-2.0 | 11,384 |
from CGATReport.Tracker import *
import collections
#################################################
#################################################
#################################################
class TranscriptClassificationProportion(TrackerSQL):
pattern = "(.*)_class"
slices = ["antisense", "anti... | CGATOxford/CGATPipelines | CGATPipelines/pipeline_docs/pipeline_rnaseqlncrna/trackers/Classification.py | Python | mit | 2,997 |
#
# Copyright (c) 2016 NEC Corporation.
# 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 re... | ge0rgi/cinder | cinder/tests/unit/volume/drivers/nec/volume_common_test.py | Python | apache-2.0 | 12,061 |
"""
Tests for course_metadata_utils.
"""
from collections import namedtuple
from datetime import timedelta, datetime
from unittest import TestCase
from django.utils.timezone import UTC
from xmodule.course_metadata_utils import (
clean_course_key,
url_name_for_course_location,
display_name_with_default,
... | simbs/edx-platform | common/lib/xmodule/xmodule/tests/test_course_metadata_utils.py | Python | agpl-3.0 | 10,000 |
# Copyright 2017 Fortinet, 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 ... | samsu/api_client | api_client/fas_client.py | Python | apache-2.0 | 3,286 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2013)
#
# This file is part of GWpy.
#
# GWpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | andrew-lundgren/gwpy | gwpy/frequencyseries/lal_.py | Python | gpl-3.0 | 7,798 |
# -*- coding: utf-8 -*-
"""
End-to-end tests related to the cohort management on the LMS Instructor Dashboard
"""
import os
import os.path
import uuid
import csv
import unicodecsv
import six
from datetime import datetime
from bok_choy.promise import EmptyPromise
from pytz import UTC, utc
from common.test.acceptanc... | cpennington/edx-platform | common/test/acceptance/tests/discussion/test_cohort_management.py | Python | agpl-3.0 | 41,807 |
from django.contrib import admin
from taggit.models import Tag, TaggedItem, TagTransform
class TaggedItemInline(admin.StackedInline):
model = TaggedItem
extra = 0
class TagAdmin(admin.ModelAdmin):
inlines = [
TaggedItemInline
]
ordering = ['name']
search_fields = ['name']
class TagT... | theatlantic/django-taggit | taggit/admin.py | Python | bsd-3-clause | 591 |
# Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | bgris/ODL_bgris | odl/test/space/fspace_test.py | Python | gpl-3.0 | 23,932 |
from ..serializers.model_serializer import ModelSerializer
from .dragon_test_case import DragonTestCase
from .models import TextModel, TwoFieldModel, ChildModel, ParentModel
class TextModelSerializer(ModelSerializer):
class Meta:
model = TextModel
publish_fields = ('text', )
base_channel =... | h-hirokawa/swampdragon | swampdragon/tests/test_model_serializer_serialize.py | Python | bsd-3-clause | 2,587 |
import argparse
import sys
from . import _util as util
def main(argv=None, parsed=None):
parser = argparse.ArgumentParser(parents=[util.universal],
prog='doapi-ssh-key',
description='Manage DigitalOcean SSH keys')
cmds = parser.add_sub... | jwodder/doapi | doapi/cli/ssh_key.py | Python | mit | 3,379 |
# Copyright (C) 2011-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at you... | adam-iris/mailman | src/mailman/rest/tests/test_root.py | Python | gpl-3.0 | 4,853 |
def getSublists(L, n):
sublists = []
for i in range(len(L)):
next_sublist = L[i:i+n]
if len(next_sublist) == n:
sublists.append(next_sublist)
return sublists
# Test Cases
L = [10, 4, 6, 8, 3, 4, 5, 7, 7, 2]
print getSublists(L, 4) == [[10, 4, 6, 8], [4, 6, 8, 3], [6, 8, 3, 4]... | NicholasAsimov/courses | 6.00.1x/final/p4-1.py | Python | mit | 459 |
import sublime, sublime_plugin
import re
def match(rex, str):
m = rex.match(str)
if m:
return m.group(0)
else:
return None
# This responds to on_query_completions, but conceptually it's expanding
# expressions, rather than completing words.
#
# It expands these simple expressions:
# tag.cl... | herove/dotfiles | sublime/Packages/HTML/html_completions.py | Python | mit | 10,848 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import subprocess
from pants.base.build_environment import get_buildroot
from pants.testutil.pants_run_integration_test import PantsRunIntegrationTest
from pants.util.contextuti... | tdyas/pants | tests/python/pants_test/backend/jvm/tasks/test_binary_create_integration.py | Python | apache-2.0 | 7,537 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class TestServer:
"""Base class for any server that needs to be set up for the tests."""
def __init__(self, *args, **kwargs):
pass
def SetUp(sel... | ric2b/Vivaldi-browser | chromium/build/android/pylib/base/test_server.py | Python | bsd-3-clause | 457 |
# epydoc.py: manpage-style text output
# Edward Loper
#
# Created [01/30/01 05:18 PM]
# $Id: man.py,v 1.6 2003/07/18 15:46:19 edloper Exp $
#
"""
Documentation formatter that produces man-style documentation.
@note: This module is under development. It generates incomplete
documentation pages, and is not yet incorpe... | dabodev/dabodoc | api/epydoc/man.py | Python | mit | 8,842 |
class InvalidPhoneNumber(Exception):
"""
The backends can use this exception to raise a standardized exception, if the
backend returns an error code related to the phone number.
"""
pass
| stefanfoulis/django-sendsms | sendsms/exceptions.py | Python | mit | 208 |
"""
The MIT License (MIT)
Copyright (c) 2015 Robert Hodgen
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... | roberthodgen/thought-jot | src/api_v2.py | Python | mit | 37,593 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
from django.core.urlresolvers import resolve, Resolver404
try:
from django.conf import settings
ACTION_LOG_SETTING = settings.ACTION_LOG_SETTING
except AttributeError:
ACTION_LOG_SETTING = {'handler_type': 'null'}
try:
from... | fujimisakari/django-actionlog | django_actionlog/middleware.py | Python | bsd-3-clause | 3,152 |
# -*- coding: utf-8 -*-
#
# ns-3 documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 14 09:00:39 2010.
#
# 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
# autogenerated file.
#
# All co... | maxrosan/NS-3-support-for-OBS | doc/tutorial/source/conf.py | Python | gpl-2.0 | 6,980 |
# Copyright (C) 2012 Google, Inc.
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# 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
# n... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/test/main.py | Python | bsd-3-clause | 10,405 |
from rest_framework import viewsets, filters
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.permissions import IsAuthenticated, IsAuthenticatedOrReadOnly
from rest_condition import Or
from rest_framework import mixins
from rest_framework.pagination import PageNumberPagination
import ... | mateusluizfb/unb-oportunidade | api/views.py | Python | mit | 4,410 |
from django.contrib import admin
from .models import Post, Author
admin.site.register(Post)
admin.site.register(Author) | pattu777/LearningDjango | apps/blog/admin.py | Python | mit | 121 |
# -*- coding: utf-8 -*-
"""
Plotting simple sin function on a black background
==================================================
A simple example of the plot of a sin function on a black background
"""
# Code source: Loïc Estève
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
bg_color =... | lesteve/sphinx-gallery | examples/sin_func/plot_sin_black_background.py | Python | bsd-3-clause | 834 |
import numpy as np
import scipy.linalg as la
from auxiliary import *
a = np.matrix([
[2, 0, 0],
[0, 3, 4],
[0, 4, 9],
], dtype=float)
w, vl, vr = la.eig(a, left=True, right=True)
print 'w =', w
print 'vl =\n', vl
print 'vr =\n', vr
w, v = la.eigh(a)
print
print 'w =', w
print 'v =\n', v
print
print
prin... | cpmech/gosl | la/oblas/data/jacobi01.py | Python | bsd-3-clause | 1,005 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.