code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
# Copyright 2021 DeepMind Technologies Limited and Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
deepmind/dd_two_player_games
dd_two_player_games/drift_utils_test.py
Python
apache-2.0
3,547
# Copyright 2018 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...
google/loaner
loaner/web_app/backend/lib/bootstrap.py
Python
apache-2.0
13,356
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-17 19:24 from __future__ import unicode_literals import c3nav.mapdata.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('mapdata', '0047_remove_mapupdat...
c3nav/c3nav
src/c3nav/mapdata/migrations/0048_ramp.py
Python
apache-2.0
1,532
from test.lib.testing import eq_ from sqlalchemy.orm import mapper, relationship, create_session, \ clear_mappers, sessionmaker, class_mapper from sqlalchemy.orm.mapper import _mapper_registry from sqlalchemy.orm.session import _sessions import operator from test.lib import testing, engines from sqlalchemy import M...
ioram7/keystone-federado-pgid2013
build/sqlalchemy/test/aaa_profiling/test_memusage.py
Python
apache-2.0
19,051
# Copyright 2014 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 requ...
scality/manila
manila_tempest_tests/tests/api/admin/test_share_types_negative.py
Python
apache-2.0
4,282
# Copyright 2020 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
quantumlib/Cirq
cirq-google/cirq_google/ops/physical_z_tag_test.py
Python
apache-2.0
1,084
# 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 the...
levythu/swift
swift/common/storage_policy.py
Python
apache-2.0
33,131
# (c) Copyright 2014 Brocade Communications Systems Inc. # All Rights Reserved. # # Copyright 2014 OpenStack Foundation # # 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 # # ...
Akrog/cinder
cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py
Python
apache-2.0
10,817
#!/usr/bin/env python # Copyright 2017, Major Hayden <major@mhtx.net> # # 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...
major/monitorstack
monitorstack/cli.py
Python
apache-2.0
3,975
from lxml import etree from nxpy.interface import Interface from nxpy.vlan import Vlan from nxpy.flow import Flow from util import tag_pattern class Device(object): # Singleton _instance = None def __new__(cls, *args, **kwargs): if not cls._instance: cls._instance = super( ...
Kent1/nxpy
nxpy/device.py
Python
apache-2.0
2,884
# # 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 # ...
steveb/heat
heat/db/sqlalchemy/models.py
Python
apache-2.0
17,625
""" Copyright 2017-present Airbnb, 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, sof...
airbnb/streamalert
tests/unit/streamalert/shared/test_alert.py
Python
apache-2.0
20,111
#coding=utf-8 from PIL import Image#需要pillow库 import glob, os in_dir ='background'#源图片目录 out_dir = in_dir+'_out'#转换后图片目录 if not os.path.exists(out_dir): os.mkdir(out_dir) #图片批处理 def main(): for files in glob.glob(in_dir+'/*'): filepath,filename = os.path.split(files) im = Image.open(files) ...
cleverZY/Helloworld
jizhidezy.py
Python
apache-2.0
513
# -*- coding: utf-8 -*- """ Created on Mon Apr 27 09:30:47 2015 @author: martin """ from Bio.Seq import Seq from Bio.Alphabet import IUPAC from Bio.SubsMat.MatrixInfo import blosum62 #remarque : Ceci n'est pas une maélioration de modifDoublon, #c'est une version alternative qui ne s'applique pas aux même doublons. de...
MartinSilvert/overlappingGenesCreator
src/modifDoublon2.py
Python
apache-2.0
1,846
# -*- coding: utf-8 -*- # Copyright 2022 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...
googleapis/python-aiplatform
samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_sync.py
Python
apache-2.0
1,468
import sys from CTFd import create_app app = create_app() app.run(debug=True, host="0.0.0.0", port=int(sys.argv[1]))
rosatolen/CTFd
serve.py
Python
apache-2.0
117
# -*- coding: utf-8 -*- from optparse import make_option from django.core.management.base import BaseCommand from messytables import XLSTableSet, headers_guess, headers_processor, offset_processor from data.models import Source, Course, MerlotCategory class Command(BaseCommand): help = "Utilities to merge our da...
ocwc/ocwc-data
search/data/management/commands/courses.py
Python
apache-2.0
3,372
################################################################################ # nc.py # # Base class for NC code creation # And global functions for calling current creator # # Hirutso Enni, 2009-01-13 # altered by Dan Falck 2010-08-04 # added tap() arguments Michael Haberler 2010-10-07 #############################...
JohnyEngine/CNC
heekscnc/nc/nc.py
Python
apache-2.0
20,018
# -*- coding: utf-8 -*- """ Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? """ __author__ = 'yelongyu1024@gmail.com' class Solution(object): def __init_...
yelongyu/leetcode
136.single_number.py
Python
apache-2.0
801
import subprocess, os, sys from reverseZone_naming import reverseZone_name from netaddr import * zone_files_path="/etc/bind/zones" def remove_reverse_record(): host_name_to_be_removed= sys.argv[1] reverse_zone_file_name,reverse_zone_name=reverseZone_name() os.chdir(zone_files_path) readFiles = open(reverse_zone_f...
anilveeramalli/cloudify-azure-plugin
blueprints/clustered-dns/dns/dns_remove_reverse_record.py
Python
apache-2.0
927
__all__ = ["gauth", "gcalendar", "lectio", "lesson", "run"]
Hanse00/LecToCal
lectocal/__init__.py
Python
apache-2.0
60
#!/usr/bin/env python """beanstalkc - A beanstalkd Client Library for Python""" import logging import socket import sys __license__ = ''' Copyright (C) 2008-2016 Andreas Bolka Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obt...
earl/beanstalkc
beanstalkc.py
Python
apache-2.0
10,921
""".. Ignore pydocstyle D400. =============== Signal Handlers =============== """ from asgiref.sync import async_to_sync from django.conf import settings from django.db import transaction from django.db.models.signals import post_delete, post_save from django.dispatch import receiver from resolwe.flow.managers impo...
genialis/resolwe
resolwe/flow/signals.py
Python
apache-2.0
2,030
#!/usr/bin/env python3 #coding:utf8 # *** TROUBLESHOOTING *** # 1) If you get the error "ImportError: No module named zope.interface" then add an empty __init__.py file to the PYTHONDIR/Lib/site-packages/zope directory # 2) It is expected that you will have NSIS 3 NSIS from http://nsis.sourceforge.net installed. imp...
alby128/syncplay
buildPy2exe.py
Python
apache-2.0
31,233
# 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...
Jay-Jay-D/LeanSTP
Algorithm.Python/StandardDeviationExecutionModelRegressionAlgorithm.py
Python
apache-2.0
3,090
# -*- coding: utf-8 -*- ''' fantastic Add-on 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, either version 3 of the License, or (at your option) any later version. This pro...
TheWardoctor/Wardoctors-repo
script.module.fantastic/lib/resources/lib/sources/en/sceper.py
Python
apache-2.0
6,854
# ####### # Copyright (c) 2018-2020 Cloudify Platform Ltd. 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...
cloudify-cosmo/cloudify-gcp-plugin
cloudify_gcp/admin/__init__.py
Python
apache-2.0
1,945
# Copyright 2014 Diamond Light Source Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
mjn19172/Savu
savu/test/simple_tomo_test.py
Python
apache-2.0
1,360
# coding=utf-8 # Copyright 2022 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
tensorflow/datasets
tensorflow_datasets/question_answering/xquad_test.py
Python
apache-2.0
1,233
# -*- coding: utf-8 -*- # Copyright 2022 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...
googleapis/python-appengine-admin
google/cloud/appengine_admin_v1/services/instances/transports/grpc.py
Python
apache-2.0
16,909
"""Support for RainMachine devices.""" import asyncio from datetime import timedelta import logging from regenmaschine import Client from regenmaschine.errors import RainMachineError import voluptuous as vol from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT,...
balloob/home-assistant
homeassistant/components/rainmachine/__init__.py
Python
apache-2.0
15,955
""" Installs and configures Cinder """ import os import re import uuid import logging from packstack.installer import exceptions from packstack.installer import processors from packstack.installer import validators from packstack.installer import basedefs from packstack.installer import utils from packstack.modules...
radez/packstack
packstack/plugins/cinder_250.py
Python
apache-2.0
16,938
from models.tridentnet.builder import TridentFasterRcnn as Detector from models.tridentnet.builder_v2 import TridentResNetV1bC4 as Backbone from models.tridentnet.builder import TridentRpnHead as RpnHead from models.tridentnet.builder import process_branch_outputs, process_branch_rpn_outputs from symbol.builder import ...
TuSimple/simpledet
config/resnet_v1b/tridentnet_r152v1bc4_c5_2x.py
Python
apache-2.0
9,529
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
alfasin/st2
st2common/st2common/config.py
Python
apache-2.0
8,282
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Cloudbase Solutions Srl # # 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/LICEN...
telerik/cloudbase-init
cloudbaseinit/tests/test_init.py
Python
apache-2.0
6,047
# Copyright 2019 The Sonnet 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 applicable l...
deepmind/sonnet
sonnet/src/scale_gradient.py
Python
apache-2.0
1,288
# -*- coding: utf-8 -*- ''' Tests for the Git state ''' # Import python libs from __future__ import absolute_import import os import shutil import socket import subprocess import tempfile # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath, skip_if_binaries_missing ensure_in_syspath('../../')...
stephane-martin/salt-debian-packaging
salt-2016.3.2/tests/integration/states/git.py
Python
apache-2.0
8,866
# Copyright 2013 IBM 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 required ...
BeenzSyed/tempest
tempest/services/compute/xml/hypervisor_client.py
Python
apache-2.0
3,235
# Copyright (c) 2013 Mirantis 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 writ...
crobby/sahara
sahara/tests/unit/service/validation/utils.py
Python
apache-2.0
14,870
# -*- coding: utf-8 -*- from operator import attrgetter from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType from pyangbind.lib.yangtypes import RestrictedClassType from pyangbind.lib.yangtypes import TypedListType from pyangbind.lib.yangtypes import YANGBool from pyangbind.lib.yangtypes import YANGListTy...
napalm-automation/napalm-yang
napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/isis_neighbor_attribute/neighbors/__init__.py
Python
apache-2.0
14,460
from mosaic import app if __name__ == '__main__': app.run()
BumagniyPacket/mosaic
run.py
Python
apache-2.0
65
''' Created on Nov 2, 2012 @author: maodouzi ''' import logging from keystoneclient.v2_0 import client as keystone_client from novaclient.v1_1 import client as nova_client from cinderclient.v1 import client as cinder_client from keystoneclient.exceptions import BadRequest from openstack_dashboard.local.local_setting...
99cloud/keystone_register
openstack_dashboard/register/register.py
Python
apache-2.0
6,455
# -*- coding: utf-8 -*- ''' Use a git repository as a Pillar source --------------------------------------- .. note:: This external pillar has been rewritten for the :doc:`2015.8.0 </topics/releases/2015.8.0>` release. The old method of configuring this external pillar will be maintained for a couple relea...
smallyear/linuxLearn
salt/salt/pillar/git_pillar.py
Python
apache-2.0
16,836
import os import re import asyncio import logging from collections import OrderedDict from pypeman.message import Message from pypeman.errors import PypemanConfigError logger = logging.getLogger("pypeman.store") DATE_FORMAT = '%Y%m%d_%H%M' class MessageStoreFactory(): """ Message store factory class can gener...
jrmi/pypeman
pypeman/msgstore.py
Python
apache-2.0
9,722
#!/usr/bin/env python3.9 # -*- coding: utf-8 -*- """Eris Codebase Monitor Eris maintains an up-to-date set of reports for every file in a codebase. A status indicator summarises the state of each report, and a report is viewed by selecting this status indicator with the cursor. The reports are cached in the codeba...
ahamilton/vigil
eris/__main__.py
Python
artistic-2.0
48,571
from hamcrest import assert_that, contains, has_properties from mammoth.styles.parser.tokeniser import tokenise def test_unknown_tokens_are_tokenised(): assert_tokens("~", is_token("unknown", "~")) def test_empty_string_is_tokenised_to_end_of_file_token(): assert_tokens("") def test_whitespace_is_tokenis...
mwilliamson/python-mammoth
tests/styles/parser/tokeniser_tests.py
Python
bsd-2-clause
2,864
#!/usr/bin/env python # ----------------------------------------------------------------------------- # VORONOI.ACCRETION # Laura L Watkins [lauralwatkins@gmail.com] # - converted from IDL code by Michele Cappellari (bin2d_accretion) # ----------------------------------------------------------------------------- from ...
lauralwatkins/voronoi
voronoi/accretion.py
Python
bsd-2-clause
4,862
""" Tests for priors. """ # pylint: disable=missing-docstring from __future__ import division from __future__ import absolute_import from __future__ import print_function import numpy as np import numpy.testing as nt import scipy.optimize as spop import reggie.core.priors as priors ### BASE TEST CLASS ###########...
mwhoffman/reggie
tests/test_core_priors.py
Python
bsd-2-clause
1,591
#!/usr/bin/python """nrvr.xml.etree - Utilities for xml.etree.ElementTree The main class provided by this module is ElementTreeUtil. To be expanded as needed. Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com> Public repository - https://github.com/srguiwiz/nrvr-commander Copyright (c) Nirvan...
srguiwiz/nrvr-commander
src/nrvr/xml/etree.py
Python
bsd-2-clause
4,914
# -*- coding: utf-8 -*- from amnesia.exc import AmnesiaError class PasteError(AmnesiaError): def __init__(self, container): super() self.container = container def __str__(self): return 'Paste into container {} failed'.format(self.container.id)
silenius/amnesia
amnesia/modules/folder/exc.py
Python
bsd-2-clause
280
from __future__ import unicode_literals import os import sys import threading from contextlib import contextmanager from django.contrib.sites.models import Site from mezzanine.conf import settings from mezzanine.core.request import current_request from mezzanine.utils.conf import middlewares_or_subclasses_installed ...
wbtuomela/mezzanine
mezzanine/utils/sites.py
Python
bsd-2-clause
4,584
import itertools import unittest from parameterized import parameterized import torch import torch.nn as nn from nsoltChannelConcatenation2dLayer import NsoltChannelConcatenation2dLayer nchs = [ [3, 3], [4, 4] ] datatype = [ torch.float, torch.double ] nrows = [ 4, 8, 16 ] ncols = [ 4, 8, 16 ] class NsoltChannelConca...
shodimaggio/SaivDr
appendix/torch_nsolt/test_nsoltChannelConcatenation2dLayer.py
Python
bsd-2-clause
7,477
import random class Character: def __init__(self): self.name = "" self.life = 20 self.health = random.choice(0, life) self.zombie_life = 10 self.zombie_health = random.choice(0, zombie_life) def attack(self, zombie): self.hit = self.health - self.zombie_health ...
bobbybabra/codeGuild
zombieHS.py
Python
bsd-2-clause
5,598
# flake8: noqa from .elementwise import ( Unary, Binary, ColsBinary, Reduce, func2class_name, unary_module, make_unary, binary_module, make_binary, reduce_module, make_reduce, binary_dict_int_tst, unary_dict_gen_tst, binary_dict_gen_tst, ) from .linear_map import ...
jdfekete/progressivis
progressivis/linalg/__init__.py
Python
bsd-2-clause
6,390
from indra.statements import * from rdflib import URIRef, Namespace from rdflib.namespace import RDF import collections import urllib import re import keyword BEL = Namespace("http://www.openbel.org/") prefixes = """ PREFIX belvoc: <http://www.openbel.org/vocabulary/> PREFIX belsc: <http://www.openbel.org/be...
decarlin/indra
indra/bel/processor.py
Python
bsd-2-clause
27,816
#!/usr/bin/python2.7 -tt """ Copyright (c) 2013, Adel Qodmani All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of con...
adel-qod/zipper
zipper.py
Python
bsd-2-clause
6,014
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky # 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 notice, this # list of condit...
cnheitman/barf-project
tests/core/smt/test_smtsolver.py
Python
bsd-2-clause
13,055
from __future__ import absolute_import, division, print_function from dynd._pydynd import w_type, \ make_var_dim, make_strided_dim, make_fixed_dim, make_cfixed_dim __all__ = ['var', 'strided', 'fixed', 'cfixed'] class _Dim(object): __slots__ = [] def __mul__(self, rhs): if isinstance(rhs, w...
aterrel/dynd-python
dynd/ndt/dim_helpers.py
Python
bsd-2-clause
4,145
# -------------------------------------------------------- # Theano @ Dragon # Copyright(c) 2017 SeetaTech # Written by Ting Pan # -------------------------------------------------------- import numpy as np import dragon.core.workspace as ws from dragon.core.tensor import Tensor, GetTensorName def shared(value, name...
neopenx/Dragon
Dragon/python/dragon/vm/theano/compile/sharedvalue.py
Python
bsd-2-clause
890
from ..tools import add_bias, confirm from ..activation_functions import softmax_function from ..cost_functions import softmax_neg_loss import numpy as np def resilient_backpropagation(network, trainingset, testset, cost_function, ERROR_LIMIT=1e-3, max_iterations = (), weight_step_max = 50., weight_step_min = 0., sta...
jorgenkg/python-neural-network
nimblenet/learning_algorithms/resilient_backpropagation.py
Python
bsd-2-clause
6,265
# Copyright (c) 2014-2021, Freja Nordsiek # 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 # notice, this list of conditions ...
frejanordsiek/hdf5storage
tests/test_marshaller_plugins.py
Python
bsd-2-clause
3,575
### extends 'class_empty.py' ### block ClassImports # NOTICE: Do not edit anything here, it is generated code from . import gxapi_cy from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref from .GXDB import GXDB from .GXVA import GXVA from .GXVV import GXVV ### endblock ClassImports ### block Header # NOTIC...
GeosoftInc/gxpy
geosoft/gxapi/GXDBWRITE.py
Python
bsd-2-clause
11,130
# -*- coding: UTF-8 -*- # Copyright 2019-2020 Rumma & Ko Ltd # License: GNU Affero General Public License v3 (see file COPYING for details) from django.db import models from lino_xl.lib.ledger.choicelists import VoucherStates from lino.api import dd, _ class OrderStates(VoucherStates): pass add = OrderStates....
lino-framework/xl
lino_xl/lib/orders/choicelists.py
Python
bsd-2-clause
992
import unittest import numpy as np import socket import Pyro4 from nested_sampling import NestedSampling, MonteCarloWalker, Harmonic, Replica class TestNS(unittest.TestCase): """to test distributed computing must start a dispatcher with --server-name test and --port 9090 """ def setUp(self): self.s...
js850/nested_sampling
nested_sampling/tests/_test_ns.py
Python
bsd-2-clause
2,120
__all__ = [ "CorruptedMessage", "Stats", "UnexpectedCommand", "UnexpectedEOF", "UnknownCommand", "log", ] import logging import struct log = logging.getLogger("offhand") class UnexpectedEOF(Exception): def __init__(self): Exception.__init__(self, "Connection closed unexpectedly"...
ninchat/offhand
python/offhand/__init__.py
Python
bsd-2-clause
1,817
# -*- coding:utf-8 -*- from django import forms try: from django.utils.encoding import smart_unicode as smart_text except ImportError: from django.utils.encoding import smart_text from cached_modelforms.tests.utils import SettingsTestCase from cached_modelforms.tests.models import SimpleModel from cached_mode...
drtyrsa/django-cached-modelforms
cached_modelforms/tests/test_fields.py
Python
bsd-2-clause
6,699
#! /usr/bin/env python # $Id: makedep.py 1054 2008-12-03 00:38:43Z kena $ import sys import notes thenote = sys.argv[1] outfile = sys.argv[2] notes.init_repo(sys.argv[3:]) note = notes.repo.get(thenote) deps = note.get_deps() print "%s.txt(note) -> %s(referenced keys)" % (thenote, outfile) f = file(outfile, 'w') f...
knz/restcrumbs
compiler/tools/makedep.py
Python
bsd-2-clause
368
#!/usr/bin/env python """interpret a comapct grid specification using regex""" import re # use a compact regular expression with nested OR expressions, # and hence many groups, but name the outer (main) groups: real_short1 = \ r'\s*(?P<lower>-?(\d+(\.\d*)?|\d*\.\d+)([eE][+\-]?\d+)?)\s*' real_short2 = \ r'\s*(?P<uppe...
sniemi/SamPy
sandbox/src1/TCSE3-3rd-examples/src/py/regex/fdmgrid.py
Python
bsd-2-clause
2,941
import pandas as pd import numpy as np import cobra from pyefm.ElementaryFluxModes import EFMToolWrapper from tqdm import tqdm class EFVWrapper(EFMToolWrapper): def create_matrices(self, extra_g=None, extra_h=None): """ Initialize the augmented stoichiometric matrix. extra_g: (n x nr) array ...
pstjohn/pyefm
pyefm/ElementaryFluxVectors.py
Python
bsd-2-clause
5,857
""" """ from django.core.urlresolvers import reverse from django.test import TestCase from wagtail.tests.utils import WagtailTestUtils class BaseTestIndexView(TestCase, WagtailTestUtils): """ Base test case for CRUD index view. """ url_namespace = None template_dir = None def _create_s...
rfosterslo/wagtailplus
wagtailplus/tests/views.py
Python
bsd-2-clause
14,293
from __future__ import unicode_literals from future.builtins import str from future.utils import with_metaclass from json import loads try: from urllib.request import urlopen from urllib.parse import urlencode except ImportError: from urllib import urlopen, urlencode from django.contrib.contenttypes.gener...
cccs-web/mezzanine
mezzanine/core/models.py
Python
bsd-2-clause
17,835
from PyObjCTools.TestSupport import * from Quartz.QuartzCore import * from Quartz import * class TestCIPluginInterfaceHelper (NSObject): def load_(self, h): return 1 class TestCIPlugInInterface (TestCase): def testMethods(self): self.assertResultIsBOOL(TestCIPluginInterfaceHelper.load_) def no_t...
albertz/music-player
mac/pyobjc-framework-Quartz/PyObjCTest/test_ciplugininterface.py
Python
bsd-2-clause
488
# Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions # are met: # # Redistributions of source ...
nephomaniac/eutester
eutester/euca/euproperties.py
Python
bsd-2-clause
29,433
"""Unittests that do not require the server to be running an common tests of responses. The TestCase here just calls the functions that provide the logic to the ws views with DummyRequest objects to mock a real request. The functions starting with `check_...` are called with UnitTest.TestCase instance as the first ar...
mtholder/pyraphyletic
phylesystem_api/tests.py
Python
bsd-2-clause
7,707
# Importing standard libraries import sys ''' Returns the index of the element in the grid. Element passed in must have a unique position. If not present returns [-1, -1]. If multiple occurences present, returns the first one ''' def findIndex(grid,charElem): for i in range(len(grid)): ...
tejasnikumbh/Algorithms
genericCode/matrixAndGraphUtility/matrixDFS.py
Python
bsd-2-clause
5,021
import unittest from mock import Mock from nosealert.plugin import AlertPlugin from nosealert.notifications import Notification class TestAlertPlugin(unittest.TestCase): def setUp(self): self.plugin = AlertPlugin() def test_get_notification_success(self): result = Mock( failures=...
lukaszb/nose-alert
nosealert/tests/test_plugin.py
Python
bsd-2-clause
1,067
# -*- coding: utf-8 -*- """ hydrogen ~~~~~~~~ Hydrogen is an extremely lightweight workflow enhancement tool for Python web applications, providing bower/npm-like functionality for both pip and bower packages. :author: David Gidwani <david.gidwani@gmail.com> :license: BSD, see LICENSE for ...
darvid/hydrogen
hydrogen.py
Python
bsd-2-clause
26,677
from __future__ import unicode_literals import os.path from setuptools import setup, find_packages def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='django-aloha-edit', version='0.4.0', description='Django Aloha Edit', author='Nathaniel Tucker', ...
ntucker/django-aloha-edit
setup.py
Python
bsd-2-clause
1,190
from __future__ import unicode_literals from future.builtins import str from datetime import datetime import re try: from urllib.parse import quote except ImportError: # Python 2 from urllib import quote from django.db import models from django.utils.encoding import python_2_unicode_compatible from djang...
Kniyl/mezzanine
mezzanine/twitter/models.py
Python
bsd-2-clause
6,647
fig, ax = plt.subplots() data['2012':].mean().plot(kind='bar', ax=ax, rot=0, color='C0') ax.set_ylabel("NO$_2$ concentration (µg/m³)") ax.axhline(y=40., color='darkorange') ax.text(0.01, 0.48, 'Yearly limit is 40 µg/m³', horizontalalignment='left', fontsize=13, transform=ax.transAxes, color='darkorange...
jorisvandenbossche/DS-python-data-analysis
notebooks/_solutions/case4_air_quality_analysis9.py
Python
bsd-3-clause
327
""" OOB configuration. This module should be included in (or replace) the default module set in settings.OOB_PLUGIN_MODULES All functions defined in this module are made available to be called by the OOB handler. See src/server/oob_msdp.py for more information. function execution - the oob protocol can execute ...
Pathel/deuterium
game/gamesrc/conf/examples/oobfuncs.py
Python
bsd-3-clause
1,435
import os.path import os import random def rename(src, dst): "Atomic rename on windows." # This is taken from mercurial try: os.rename(src, dst) except OSError, err: # If dst exists, rename will fail on windows, and we cannot # unlink an opened file. Instead, the destination is ...
abadger/Bento
bento/compat/rename.py
Python
bsd-3-clause
1,100
from dateutil.relativedelta import relativedelta from script.models import Script, ScriptProgress from rapidsms.models import Connection import datetime from rapidsms.models import Contact from rapidsms.contrib.locations.models import Location from poll.models import Poll from script.models import ScriptStep from djang...
unicefuganda/edtrac
edtrac_project/rapidsms_edtrac/education/utils.py
Python
bsd-3-clause
12,792
import os from example_builder import ExampleBuilder RST_TEMPLATE = """ .. _%(sphinx_tag)s: %(docstring)s %(image_list)s .. raw:: html <div class="toggle_trigger"><a href="#"> **Code output:** .. raw:: html </a></div> <div class="toggle_container"> .. literalinclude:: %(stdout)s .. raw:: html ...
cigroup-ol/metaopt
docs/_extensions/gen_figure_rst.py
Python
bsd-3-clause
1,626
from importlib import import_module from django.core.urlresolvers import (RegexURLPattern, RegexURLResolver, LocaleRegexURLResolver) from django.core.exceptions import ImproperlyConfigured from django.utils import six __all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'patterns', 'url'...
ericholscher/django
django/conf/urls/__init__.py
Python
bsd-3-clause
2,589
from __future__ import absolute_import import datetime import jwt import re import logging from six.moves.urllib.parse import parse_qs, urlparse, urlsplit from sentry.integrations.atlassian_connect import get_query_hash from sentry.shared_integrations.exceptions import ApiError from sentry.integrations.client import...
beeftornado/sentry
src/sentry/integrations/jira/client.py
Python
bsd-3-clause
8,782
import fbchat from fbchat import PageData def test_page_from_graphql(session): data = { "id": "123456", "name": "Some school", "profile_picture": {"uri": "https://scontent-arn2-1.xx.fbcdn.net/v/..."}, "url": "https://www.facebook.com/some-school/", "category_type": "SCHOOL"...
carpedm20/fbchat
tests/threads/test_page.py
Python
bsd-3-clause
669
import tempfile import shutil from voltgrid import GitManager def git_checkout(git_url, git_branch=None, git_tag=None, git_hash=None): git_dst = tempfile.mkdtemp() g = GitManager(url=git_url, git_dst=git_dst, git_branch=git_branch, git_tag=git_tag, git_hash=git_hash) g.run() shutil.rmtree(git_dst) ...
voltgrid/voltgrid-pie
tests/test_git.py
Python
bsd-3-clause
840
""" =========================================== Main Components (:mod:`artview.components`) =========================================== .. currentmodule:: artview.components ARTview offers some basic Components for visualization of weather radar data using Py-ART and ARTview functions. .. autosummary:: :toctree:...
jjhelmus/artview
artview/components/__init__.py
Python
bsd-3-clause
1,065
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class TiebaItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() pass class ThreadItem(scrapy.Item): ...
fozzysec/tieba-keyword-spider
tieba/items.py
Python
bsd-3-clause
730
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details __version__=''' $Id$ ''' ___doc__='' #odyssey.py # #Demo/benchmark of PDFgen rendering Homer's Odyssey. #results on my humble P266 with 64MB: # Without page compression: # 239 pages in 3.76 seconds = 77 pages per second # With textOut r...
MatthewWilkes/reportlab
demos/odyssey/odyssey.py
Python
bsd-3-clause
4,323
import os import sys from distutils.core import setup from distutils.sysconfig import get_python_lib def fullsplit(path, result=None): """ Split a pathname into components (the opposite of os.path.join) in a platform-neutral way. """ if result is None: result = [] head, tail = os.path...
richardbolt/django-bibletext
setup.py
Python
bsd-3-clause
2,316
""" CharNullField from http://stackoverflow.com/questions/454436/unique-fields-that-allow-nulls-in-django/1934764#1934764 """ from django.db import models class CharNullField(models.CharField): description = "CharField that stores NULL but returns ''" def to_python(self, value): """return django-frien...
fwenzel/millimeter
apps/shortener/fields.py
Python
bsd-3-clause
709
"""Base material for signature backends.""" from django.urls import reverse class SignatureBackend(object): """Encapsulate signature workflow and integration with vendor backend. Here is a typical workflow: * :class:`~django_anysign.models.SignatureType` instance is created. It encapsulates the ba...
novafloss/django-anysign
django_anysign/backend.py
Python
bsd-3-clause
5,255
from wrapper import get, run import logging import requests @get('/') def f(*args, **kwargs): return '<html><head></head><body><h1>Hello!</h1></body></html>' @get('/test', ['php']) def test_f(*args, **kwargs): arguments = kwargs['arguments'] php = arguments['php'][0] self = args[0] self.write("H...
eeue56/just-columns
just-columns/test.py
Python
bsd-3-clause
447
def extract17LiterarycornerWordpressCom(item): ''' Parser for '17literarycorner.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('King Of Hell\'s Genius Pampered Wife', 'King ...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extract17LiterarycornerWordpressCom.py
Python
bsd-3-clause
1,613
class SqliteMixin: config_params = {'DATASTORE': 'sqlite://'} class OdmUtils: config_file = 'tests.odm' async def _create_task(self, token, subject='This is a task', person=None, **data): data['subject'] = subject if person: data['assigned'] = pers...
quantmind/lux
tests/odm/utils.py
Python
bsd-3-clause
2,440
from django.conf.urls import patterns, include, url from django.utils.translation import ugettext_lazy as _ from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf import settings from django.contrib.auth.decorators import login_required from django.views.ge...
praekelt/jmbo-foundry
foundry/urls.py
Python
bsd-3-clause
12,605
# -*- coding: utf-8 -*- # Copyright 2019 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. """An implementation of the ReplicationConfig proto interface.""" from __future__ import print_function import json import os im...
endlessm/chromium-browser
third_party/chromite/lib/replication_lib.py
Python
bsd-3-clause
5,370
import math from sympy.mpmath import * def test_bessel(): mp.dps = 15 assert j0(1).ae(0.765197686557966551) assert j0(pi).ae(-0.304242177644093864) assert j0(1000).ae(0.0247866861524201746) assert j0(-25).ae(0.0962667832759581162) assert j1(1).ae(0.440050585744933516) assert j1(pi).ae(0.284...
mattpap/sympy-polys
sympy/mpmath/tests/test_functions2.py
Python
bsd-3-clause
66,026