code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
""" Sending/Receiving Messages. """ from itertools import count from carrot.utils import gen_unique_id import warnings from carrot import serialization class Consumer(object): """Message consumer. :param connection: see :attr:`connection`. :param queue: see :attr:`queue`. :param exchange: see :att...
ask/carrot
carrot/messaging.py
Python
bsd-3-clause
37,722
#!/usr/bin/python # # Copyright 2013, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. import base64 import logging import threading import struct import time import unittest from vtdb import keyrange_constants from vtdb import keys...
apmichaud/vitess-apm
test/keyspace_test.py
Python
bsd-3-clause
10,189
from os.path import basename from django.db import models from django.utils.translation import ugettext_lazy as _ class AttachmentBase(models.Model): attachment = models.FileField(upload_to="letters/%Y/%m/%d", verbose_name=_("File")) @property def filename(self): return basename(self.attachment....
ad-m/django-atom
atom/models.py
Python
bsd-3-clause
587
# -*- coding: utf-8 -*- import sys, numpy, scipy import scipy.cluster.hierarchy as hier import scipy.spatial.distance as dist import csv import scipy.stats as stats import json import networkx as nx from networkx.readwrite import json_graph def makeNestedJson(leaf) : leaf=json.loads(leaf) #A tree is ...
ChunggiLee/ChunggiLee.github.io
Heatmap/newData.py
Python
bsd-3-clause
22,372
class NodeVisitor: def visit(self, node, *args): try: return getattr(self, 'visit_' + node.__class__.__name__)(node, *args) except AttributeError: pass for child in node.iter_child_nodes(): self.visit(child, *args)
nnabeyang/MY_jinja2
MY_jinja2/visitor.py
Python
bsd-3-clause
247
from sqlalchemy import String, Column, Float, Integer, Boolean, ForeignKey from sqlalchemy.orm import relationship from base import Base from unit import Unit class Variable(Base): __tablename__ = 'Variables' id = Column('VariableID', Integer, primary_key=True) code = Column('VariableCode', String, n...
UCHIC/h2outility
src/GAMUTRawData/odmdata/variable.py
Python
bsd-3-clause
1,443
################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # # ############...
saltastro/pysalt
proptools/ImageDisplay.py
Python
bsd-3-clause
3,112
from django.conf.urls import * import views # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', url(r'^multiply/', views.multiply, name="multiply"), )
cbrepo/celery
examples/httpexample/urls.py
Python
bsd-3-clause
246
""" Caching facility for SymPy """ # TODO: refactor CACHE & friends into class? # global cache registry: CACHE = [] # [] of # (item, {} or tuple of {}) from sympy.core.decorators import wraps def print_cache(): """print cache content""" for item, cache in CACHE: item = str(item) ...
ichuang/sympy
sympy/core/cache.py
Python
bsd-3-clause
3,434
from mongrel2.config import * main = Server( uuid="f400bf85-4538-4f7a-8908-67e313d515c2", access_log="/logs/access.log", error_log="/logs/error.log", chroot="./", default_host="localhost", name="test", pid_file="/run/mongrel2.pid", port=6767, hosts = [ Host(name="localhost"...
bnoordhuis/mongrel2
examples/configs/multi_conf.py
Python
bsd-3-clause
1,384
#!/usr/bin/env python # -*- coding: utf-8 -*- # # cRedditscore documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # 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 ...
gautsi/cRedditscore
docs/conf.py
Python
bsd-3-clause
9,078
try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='morphounit', version='1.0.4', author='Shailesh Appukuttan, Pedro Garcia-Rodriguez', author_email='shailesh.appukuttan@cnrs.fr, pedro.garcia@cnrs.fr', packages=['morphounit', 'mo...
pedroernesto/morphounit
setup.py
Python
bsd-3-clause
1,115
"""Wiring string id example.""" import sys from dependency_injector import containers, providers from dependency_injector.wiring import inject, Provide class Service: ... class Container(containers.DeclarativeContainer): service = providers.Factory(Service) @inject def main(service: Service = Provide['...
rmk135/objects
examples/wiring/example_string_id.py
Python
bsd-3-clause
469
# -*- coding: utf-8 -*- import sys import pygeoip import os.path import socket import sqlite3 import time import re DATAFILE = os.path.join(sys.path[0], "GeoIP.dat") # STANDARD = reload from disk # MEMORY_CACHE = load to memory # MMAP_CACHE = memory using mmap gi4 = pygeoip.GeoIP(DATAFILE, pygeoip.MEMORY_CACHE) def ...
rnyberg/pyfibot
pyfibot/modules/module_geokick.py
Python
bsd-3-clause
5,174
import geopandas as gpd import numpy as np import pandas as pd import pytest from distutils.version import LooseVersion folium = pytest.importorskip("folium") branca = pytest.importorskip("branca") matplotlib = pytest.importorskip("matplotlib") mapclassify = pytest.importorskip("mapclassify") import matplotlib.cm as ...
jorisvandenbossche/geopandas
geopandas/tests/test_explore.py
Python
bsd-3-clause
29,278
# -*- coding: utf-8 -*- # @Date : Jul 13, 2016 # @Author : Ram Prakash, Sharath Puranik # @Version : 1 import CART from QuillLanguage import QuillLanguage import pickle class QuillTrainer(object): def __init__(self,quillLang): if isinstance(quillLang,QuillLanguage): self.langua...
teamtachyon/Quillpad-Server
QuillTrainer.py
Python
bsd-3-clause
4,979
import collections import struct class BitArray(object): def __init__(self, size, bits): self.size = size if len(bits) > size: raise ValueError("size > len(bits)") bits_list = [] for bit in bits: x = int(bit) if x not in [0, 1]: ...
sogeti-esec-lab/LKD
windows/native_exec/simple_x86.py
Python
bsd-3-clause
29,548
#!/usr/bin/python import sys import numpy as np try: import OpenGL.GL as gl import OpenGL.GLUT as glut import OpenGL.GLU as glu except ImportError: ImportError('PyOpenGL is not installed') import mouse # objects SELECT_BUFFER_SIZE=100 def drawLines(mode): pass def drawRects(m...
fos/fos-legacy
scratch/very_scratch/old_core/picking_test.py
Python
bsd-3-clause
4,325
from __future__ import absolute_import from django.http import Http404 from sentry.constants import ObjectStatus from sentry.api.bases.organization import ( OrganizationEndpoint, OrganizationIntegrationsPermission ) from sentry.integrations.exceptions import IntegrationError from sentry.integrations.repositories ...
ifduyue/sentry
src/sentry/api/endpoints/organization_integration_repos.py
Python
bsd-3-clause
1,418
def extractSpiritGodShura(item): """ # Sousetsuka """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if item['title'].startswith('Chapter') and item['tags'] == ['Chapters']: if ':' in item['title'] and not postfi...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractSpiritGodShura.py
Python
bsd-3-clause
484
#! /usr/bin/env python """ This script tests the 'data stream' oriented feature of the socket interface. """ from morse.testing.testing import MorseTestCase try: # Include this import to be able to use your test file as a regular # builder script, ie, usable with: 'morse [run|exec] <your test>.py from mo...
Arkapravo/morse-0.6
testing/base/gyroscope_testing.py
Python
bsd-3-clause
1,647
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 0, transform = "Quantization", sigma = 0.0, exog_count = 20, ar_order = 0);
antoinecarme/pyaf
tests/artificial/transf_Quantization/trend_MovingAverage/cycle_0/ar_/test_artificial_1024_Quantization_MovingAverage_0__20.py
Python
bsd-3-clause
272
from nose.tools import (raises, assert_raises, assert_true, assert_equal, assert_not_equal, assert_almost_equal) import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from deepjets.preprocessing import zoom_image, pixel_edges def test_zoom(): edges =...
deepjets/deepjets
deepjets/tests/test_preprocessing.py
Python
bsd-3-clause
1,088
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ import pytest from byceps.services.ticketing import ( category_service, ticket_bundle_service as bundle_service, ticket_creation_service as creation_service, ticket_service, ) from tests.helpers ...
homeworkprod/byceps
tests/integration/blueprints/admin/ticketing/conftest.py
Python
bsd-3-clause
1,795
#!/usr/bin/env python # coding=utf-8 # # Copyright 2013 snowy.in ''' @author: Manuel Mejia ''' import pickle import hmac import uuid import hashlib import memcache class SessionData(dict): def __init__(self, session_id, hmac_key): self.session_id = session_id self.hmac_key = hmac_key class S...
sllt/snowy
lib/session.py
Python
bsd-3-clause
3,403
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): """ this migration will be used to add 2 field to deal with things that will go wrong that will then trigger mail to admin and author of the trig...
foxmask/django-th
th_twitter/migrations/0003_fav.py
Python
bsd-3-clause
581
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from datetime import datetime from textwrap import dedent import psutil import pyexcel as p from _compact import StringIO, OrderedDict from nose.tools import eq_ def test_bug_01(): """ if first row of csv is shorter than the rest of the rows, the ...
chfw/pyexcel
tests/test_bug_fixes.py
Python
bsd-3-clause
15,003
# # Stochastic logistic model. # # This file is part of PINTS (https://github.com/pints-team/pints/) which is # released under the BSD 3-clause license. See accompanying LICENSE.md for # copyright notice and full license details. # import numpy as np from scipy.interpolate import interp1d import pints from . import To...
martinjrobins/hobo
pints/toy/_stochastic_logistic_model.py
Python
bsd-3-clause
5,807
""" Scatter Plot with LOESS Lines ----------------------------- This example shows how to add a trend line to a scatter plot using the LOESS transform (LOcally Estimated Scatterplot Smoothing). """ # category: scatter plots import altair as alt import pandas as pd import numpy as np np.random.seed(1) source = pd.Da...
altair-viz/altair
altair/examples/scatter_with_loess.py
Python
bsd-3-clause
755
import cProfile import pstats class Profiler: def __init__(self, sortby=None): self.profiler = None self.sortby = sortby or ('cumtime',) def __enter__(self): self.profiler = cProfile.Profile() self.profiler.enable() return self def __exit__(self, exc_type, exc_va...
quantmind/pulsar
pulsar/utils/profiler.py
Python
bsd-3-clause
521
import argparse from pathlib import Path from unittest import mock import json import os import io from urllib.request import urlopen import pytest import requests import responses from httpie.cli.argtypes import ( PARSED_DEFAULT_FORMAT_OPTIONS, parse_format_options, ) from httpie.cli.definition import parse...
jakubroztocil/httpie
tests/test_output.py
Python
bsd-3-clause
18,705
# ============================================================================= # Authors: PAR Government # Organization: DARPA # # Copyright (c) 2016 PAR Government # All rights reserved. # ============================================================================== from tests.test_support import TestSupport from m...
rwgdrummer/maskgen
tests/batch/test_batch_converter.py
Python
bsd-3-clause
772
import pulsar as psr def load_ref_system(): """ Returns l-glutamic_acid as found in the IQMol fragment library. All credit to https://github.com/nutjunkie/IQmol """ return psr.make_system(""" N 0.1209 -2.2995 -0.2021 C 0.4083 -0.9510 -0.7668 C -0...
pulsar-chem/Pulsar-Core
lib/systems/l-glutamic_acid.py
Python
bsd-3-clause
1,099
import sys sys.path.append('..') from helpers import render_frames from graphs.ForwardRendering import ForwardRendering as g from falcor import * m.addGraph(g) m.loadScene('Cerberus/Standard/Cerberus.pyscene') # default render_frames(m, 'default', frames=[1,16,64]) exit()
NVIDIAGameWorks/Falcor
Tests/image_tests/renderpasses/test_Skinning.py
Python
bsd-3-clause
276
# HSPF Model Plot Routines # # David J. Lampert, PhD, PE # # Last updated: 10/16/2013 # # Purpose: Lots of routines here to generate images for development of an HSPF # model. Descriptions below. # from matplotlib import pyplot, gridspec, path, patches, ticker, dates from calendar import isleap from scipy impor...
kbrannan/PyHSPF
src/pyhspf/core/hspfplots.py
Python
bsd-3-clause
89,979
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Nodes import Node, Nodes from PLC.Slices import Slice, Slices from PLC.Auth import Auth class AddSliceToNodesWhitelist(Method): """ Adds the specified slice to the whitelist on the specified nodes. Nodes ...
dreibh/planetlab-lxc-plcapi
PLC/Methods/AddSliceToNodesWhitelist.py
Python
bsd-3-clause
1,708
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-10-29 23:47 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependen...
tecnicatura-villa-el-libertador/CentroAsistencialH3
CentroAsist/migrations/0007_profesional_user.py
Python
bsd-3-clause
729
# Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details. # All rights reserved. Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file.) from logging.handlers import RotatingFileHandler from os import path import logging import logging.config ...
guillermooo/dart-sublime-bundle-releases
sublime_plugin_lib/__init__.py
Python
bsd-3-clause
4,790
#!/usr/bin/env python # (C) Copyright IBM Corporation 2004, 2005 # All Rights Reserved. # # 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 # ...
ayoubg/gem5-graphics
Mesa-7.11.2_GPGPU-Sim/src/mapi/glapi/gen/gl_XML.py
Python
bsd-3-clause
24,796
import copy import re import astropy.io.fits as fits import numpy as np from threeML.exceptions.custom_exceptions import custom_warnings from threeML.io.file_utils import file_existing_and_readable from threeML.io.progress_bar import progress_bar from threeML.plugins.DispersionSpectrumLike import DispersionSpectrumLi...
giacomov/3ML
threeML/utils/data_builders/time_series_builder.py
Python
bsd-3-clause
44,553
""" Copyright (c) 2014-2015, The University of Texas at Austin. All rights reserved. This file is part of BLASpy and is available under the 3-Clause BSD License, which can be found in the LICENSE file at the top-level directory or at http://opensource.org/licenses/BSD-3-Clause """ from blaspy im...
nicholas-moreles/blaspy
bp_unit_tests/level_1/unit_test_dot.py
Python
bsd-3-clause
6,815
import inspect import functools class DependencyNode: def __init__(self, cls, cached): self.cls = cls self.deps = self.get_deps(cls) self.cached = cached def get_deps(self, cls): try: return inspect.getargspec(cls.__init__).args[1:] except Attr...
sbergot/invok
invok/DependencyNode.py
Python
bsd-3-clause
552
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fragmentsdemo.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
bianchimro/django-cms-fragments
cms_fragments/demo/fragmentsdemo/manage.py
Python
bsd-3-clause
256
#!/usr/bin/env python # # Computation of the rate-distortion function for source coding with side # information at the decoder using the Blahut-Arimoto algorithm. # # Formulation similar to R.E. Blahut "Computation of Channel Capacity and # Rate-Distortion Functions," IEEE Transactions on Information Theory, 18, # no. ...
isloux/Shannon
python/rbawz2.py
Python
bsd-3-clause
3,690
from django.db import models from django.utils.translation import ugettext_lazy as _ from django_dzenlog.models import GeneralPost class TextPost(GeneralPost): body_detail_template = 'blog/text_post.html' feed_description_template = 'blog/text_feed_detail.html' body = models.TextField(_('Post\'s body')) ...
svetlyak40wt/django-dzenlog
example/blog/models.py
Python
bsd-3-clause
621
# -*- coding: utf-8 -*- from __future__ import unicode_literals from collections import OrderedDict from django.core import exceptions from django.core.cache import cache from django.db import models from django.template import RequestContext from django.template import TemplateDoesNotExist from django.template.loader...
rfleschenberg/django-shop
shop/rest/serializers.py
Python
bsd-3-clause
14,995
# -*- coding: utf-8 -*- """ANTS Apply Transforms interface Change directory to provide relative paths for doctests >>> import os >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) >>> os.chdir(datadir) """ from __fu...
mick-d/nipype
nipype/interfaces/ants/utils.py
Python
bsd-3-clause
11,113
class DeferredForeignKey(object): def __init__(self, *args, **kwargs): self.name = kwargs.pop('name', None) self.args = args self.kwargs = kwargs
danfairs/django-dfk
dfk/models.py
Python
bsd-3-clause
176
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-02-07 20:55 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('questio...
MauricioDinki/hatefull
hatefull/apps/answers/migrations/0001_initial.py
Python
bsd-3-clause
1,380
#!/usr/bin/env python from __future__ import print_function import roslib roslib.load_manifest('lane_detection') import rospy import sys from std_msgs.msg import Int32 import cv2 from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError from picamera import PiCamera from picamera.array import PiRG...
isarlab-department-engineering/ros_dt_lane_follower
deprecated_nodes/old-lane-detection.py
Python
bsd-3-clause
9,077
# ----------------------------------------------------------------------------- # Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. # -----------------------------------------------------------------...
bokeh/bokeh
bokeh/sphinxext/example_handler.py
Python
bsd-3-clause
4,630
def extractSanguniangWordpressCom(item): ''' Parser for 'sanguniang.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translated'), ('Loi...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractSanguniangWordpressCom.py
Python
bsd-3-clause
560
from __future__ import absolute_import, print_function, division import os.path import theano from theano import Apply, Variable, tensor from theano.compile import optdb from theano.compile.ops import shape_i from theano.gof import local_optimizer, COp from theano.scalar import as_scalar, constant from . import opt f...
JazzeYoung/VeryDeepAutoEncoder
theano/gpuarray/nerv.py
Python
bsd-3-clause
6,598
import time from datetime import datetime, timedelta from StringIO import StringIO from django.core.handlers.modpython import ModPythonRequest from django.core.handlers.wsgi import WSGIRequest, LimitedStream from django.http import HttpRequest, HttpResponse, parse_cookie, build_request_repr from django.utils import un...
mitsuhiko/django
tests/regressiontests/requests/tests.py
Python
bsd-3-clause
15,031
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from uslug import uSlug as slugify __all__ = ['Country'] class Country(models.Model): name = models.CharField(_('Country name'), max_length=128, unique=True, db_index=True, blank=False, null=False) slu...
un33k/django-worldwide
src/worldwide/models/country.py
Python
bsd-3-clause
2,460
from __future__ import absolute_import from datetime import datetime from django.core.urlresolvers import reverse from sentry.models import Release from sentry.testutils import APITestCase class ProjectReleaseListTest(APITestCase): def test_simple(self): self.login_as(user=self.user) team = sel...
jokey2k/sentry
tests/sentry/api/endpoints/test_project_releases.py
Python
bsd-3-clause
1,979
""" Lonely Planet Sight Model """ from __future__ import absolute_import, print_function import re from bs4 import BeautifulSoup from django.db import models from django.utils.translation import ugettext as _ from core.models.sight import THSight from core.utils import urllib2 from .abstract import LonelyPlanetAbst...
jricardo27/travelhelper
travelhelper/apps/lonelyplanet/models/sight.py
Python
bsd-3-clause
8,871
import heapq import os import numpy from smqtk.algorithms.nn_index.hash_index import HashIndex from smqtk.utils.bit_utils import ( bit_vector_to_int_large, int_to_bit_vector_large, ) from smqtk.utils.metrics import hamming_distance __author__ = "paul.tunison@kitware.com" class LinearHashIndex (HashIndex):...
Purg/SMQTK
python/smqtk/algorithms/nn_index/hash_index/linear.py
Python
bsd-3-clause
3,373
# Copyright (c) 2011-2022 Berkeley Model United Nations. All rights reserved. # Use of this source code is governed by a BSD License (see LICENSE). import json, logging, sys, traceback from django.core.mail.backends import dummy, smtp from django.db import transaction from smtplib import SMTPException class DevLog...
bmun/huxley
huxley/logging/mail.py
Python
bsd-3-clause
1,598
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.core import web_contents DEFAULT_TAB_TIMEOUT = 60 class Tab(web_contents.WebContents): """Represents a tab in the browser The import...
codenote/chromium-test
tools/telemetry/telemetry/core/tab.py
Python
bsd-3-clause
3,230
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
flgiordano/netcash
+/google-cloud-sdk/lib/surface/auth/application_default/revoke.py
Python
bsd-3-clause
1,851
#!/usr/bin/env python # Copyright (c) 2015 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Parse specification extracted from NEXRAD ICD PDFs and generate Python code.""" from __future__ import print_function import warnings def register_proces...
jrleeman/MetPy
metpy/io/_nexrad_msgs/parse_spec.py
Python
bsd-3-clause
6,685
"""Defines the unit tests for the :mod:`colour.temperature.hernandez1999` module.""" import numpy as np import unittest from itertools import permutations from colour.temperature import xy_to_CCT_Hernandez1999, CCT_to_xy_Hernandez1999 from colour.utilities import ignore_numpy_errors __author__ = "Colour Developers" ...
colour-science/colour
colour/temperature/tests/test_hernandez1999.py
Python
bsd-3-clause
4,583
# PyQuantFi - payoffs.py # (c) 2012 Nick Collins def VanillaCall(k): def call(s): return max(s - k, 0) return call def VanillaPut(k): def call(s): return max(k - s, 0) return call def DigitalCall(k): def call(s): if s > k: return 1 else: return 0 return call...
ncollins/pyquantfi
payoffs.py
Python
bsd-3-clause
425
from __future__ import absolute_import import socket import types from collections import defaultdict from itertools import count from kombu import Connection, Exchange, Queue, Consumer, Producer from kombu.exceptions import InconsistencyError, VersionMismatch from kombu.five import Empty, Queue as _Queue from kombu...
jindongh/kombu
kombu/tests/transport/test_redis.py
Python
bsd-3-clause
40,008
def is_lazy_user(user): """ Return True if the passed user is a lazy user. """ # Anonymous users are not lazy. if user.is_anonymous: return False # Check the user backend. If the lazy signup backend # authenticated them, then the user is lazy. backend = getattr(user, 'backend', None) ...
danfairs/django-lazysignup
lazysignup/utils.py
Python
bsd-3-clause
570
""" ================================================================ Continuous and analytical diffusion signal modelling with MAPMRI ================================================================ We show how to model the diffusion signal as a linear combination of continuous functions from the MAPMRI basis [Ozarsla...
demianw/dipy
doc/examples/reconst_mapmri.py
Python
bsd-3-clause
2,453
""" site: importerror routes: exports: """ import doesnotexist doesnotexist
willowtreeapps/tango-core
tests/errors/importerror.py
Python
bsd-3-clause
77
import asyncore import email import email.policy import re from smtpd import SMTPServer from django.core.management.base import BaseCommand from django.db import connections from hc.api.models import Check RE_UUID = re.compile( "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{...
healthchecks/healthchecks
hc/api/management/commands/smtpd.py
Python
bsd-3-clause
2,479
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from unittest.mock import patch import pytest # Test against an admin app because that doesn't require setup of brand # party. After all, both admin and party apps should react the same. def test_healthcheck_...
homeworkprod/byceps
tests/integration/blueprints/monitoring/healthcheck/test_healthcheck.py
Python
bsd-3-clause
1,360
from django.template.defaultfilters import default from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class DefaultTests(SimpleTestCase): """ Literal string arguments to the default filter are always treated as safe strings, regardless...
yephper/django
tests/template_tests/filter_tests/test_default.py
Python
bsd-3-clause
2,219
import torch def rmsprop(opfunc, x, config, state=None): """ An implementation of RMSprop ARGS: - 'opfunc' : a function that takes a single input (X), the point of a evaluation, and returns f(X) and df/dX - 'x' : the initial point - 'config` : a table with configuration para...
RPGOne/Skynet
pytorch-master/torch/legacy/optim/rmsprop.py
Python
bsd-3-clause
2,014
""" This tutorial introduces denoising auto-encoders (dA) using Theano. Denoising autoencoders are the building blocks for SdA. They are based on auto-encoders as the ones used in Bengio et al. 2007. An autoencoder takes an input x and first maps it to a hidden representation y = f_{\theta}(x) = s(Wx+b), paramete...
webeng/DeepLearningTutorials
code/dA_v2.py
Python
bsd-3-clause
16,442
#!/usr/bin/env python ''' Installation script for the fos package ''' from os.path import join as pjoin from glob import glob from distutils.core import setup from distutils.extension import Extension import numpy as np from build_helpers import make_cython_ext # we use cython to compile the module if we have it tr...
fos/fos-legacy
setup.py
Python
bsd-3-clause
971
#!/usr/bin/env python # Copyright (C) 2014 Aldebaran Robotics # # 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 applic...
ArthurVal/RIDDLE_naoqi_bridge
naoqi_sensors_py/src/naoqi_sensors/naoqi_microphone.py
Python
bsd-3-clause
4,844
import devon.maker from devon.tags import * import datetime, os.path, shutil # ************************************************************************************************** class DiskImage(devon.maker.MakerManyToOne): path = "hdiutil" def getTarget(self, project): return "%s.dmg" % project....
joehewitt/devon
devon/makers/mac/diskImage.py
Python
bsd-3-clause
3,981
# -*- coding: utf-8 -*- from django.db import models, migrations import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('auth', '0001_initial'), ] operations = [ migrations.CreateModel( name='User', fields=[ ('id', ...
WebCampZg/conference-web
people/migrations/0001_initial.py
Python
bsd-3-clause
2,302
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from asdf.tags.core import NDArrayType from astropy.coordinates.spectral_coordinate import SpectralCoord from astropy.io.misc.asdf.types import AstropyType from astropy.io.misc.asdf.tags.unit.unit import UnitType __all__ = ['Spec...
astropy/astropy
astropy/io/misc/asdf/tags/coordinates/spectralcoord.py
Python
bsd-3-clause
1,569
''' Functions for working with DESI mocks and fiberassignment TODO (maybe): This contains hardcoded hacks, especially wrt priorities and interpretation of object types ''' from __future__ import print_function, division import sys, os import numpy as np from astropy.table import Table, Column from fiberassign import...
desihub/fiberassign
old/py/mock.py
Python
bsd-3-clause
3,161
import os from jflow.utils.importlib import import_module from jflow.conf import global_settings #If django is installed used the django setting object try: from django.conf import settings as django_settings except: django_settings = None ENVIRONMENT_VARIABLE = "JFLOW_SETTINGS_MODULE" cla...
lsbardel/flow
flow/conf/__init__.py
Python
bsd-3-clause
1,191
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
bokeh/bokeh
bokeh/protocol/receiver.py
Python
bsd-3-clause
7,389
import base64 from django.contrib.auth.models import AnonymousUser from django.http import HttpResponse from django.test import TestCase, RequestFactory from corehq.apps.api.resources.auth import LoginAuthentication, LoginAndDomainAuthentication, \ RequirePermissionAuthentication from corehq.apps.domain.models im...
dimagi/commcare-hq
corehq/apps/api/tests/test_auth.py
Python
bsd-3-clause
19,030
from __future__ import absolute_import, division, print_function import pytest from datashape import dshape from into.backends.csv import CSV from into import into, resource from into.utils import tmpfile import sqlalchemy @pytest.yield_fixture def engine(): tbl = 'testtable' ds = dshape('var * {a: int32, b:...
mrocklin/into
into/backends/tests/test_sqlite_into.py
Python
bsd-3-clause
1,103
from StringIO import StringIO import unittest from shunter.request import HTTPRequest import mockapp class TestApplication(unittest.TestCase): def setUp(self): self.app = mockapp.application def test_get_response(self): request = HTTPRequest({'REQUEST_METHOD': 'GET', ...
ridgek/shunter
tests/test_application.py
Python
bsd-3-clause
1,174
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Renaming column for 'Comment.parent_content' to match new field type. db.rename_column('canvas_comment',...
drawquest/drawquest-web
website/canvas/migrations/0021_auto__chg_field_comment_parent_content__chg_field_comment_reply_conten.py
Python
bsd-3-clause
9,191
import datetime import decimal import re import random import logging from cStringIO import StringIO from string import letters from hashlib import md5 from unittest import skipIf # LIBRARIES import django from django.conf import settings from django.core.files.uploadhandler import StopFutureHandlers from django.core...
grzes/djangae
djangae/tests/test_connector.py
Python
bsd-3-clause
94,756
# -*- coding: utf-8 -*- """ Created on Sat May 16 18:33:20 2015 @author: oliver """ from sympy import symbols, lambdify, sign, re, acos, asin, sin, cos, bspline_basis from matplotlib import pyplot as plt from scipy.interpolate import interp1d import numpy as np def read_kl(filename): with open(filename, 'r') a...
DocBO/mubosym
mubosym/interp1d_interface.py
Python
mit
1,728
# -*- coding: utf-8 -*- line endings: unix -*- """A bare-bones cross-platform Telnet server.""" # miniboa.py # Copyright 2009 Jim Storch # 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://w...
whutch/atria
cwmud/libs/miniboa.py
Python
mit
35,233
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/encoded_disk/shared_encoded_disk_base.iff" result.attribute_templat...
obi-two/Rebelion
data/scripts/templates/object/tangible/encoded_disk/shared_encoded_disk_base.py
Python
mit
458
# -*- coding: utf-8 -*- from __future__ import division, print_function import numpy as np __all__ = ["function", "integrated_time", "AutocorrError"] def function(x, axis=0, fast=False): """Estimate the autocorrelation function of a time series using the FFT. Args: x: The time series. If multidime...
ga7g08/emcee
emcee/autocorr.py
Python
mit
4,742
# -*- coding: utf-8 -*- #! /usr/bin/env python import os import subprocess from setuptools import setup import six here = os.path.dirname(os.path.abspath(__file__)) README = open(os.path.join(here, 'README.md')).read() REQUIREMENTS = open(os.path.join(here, 'requirements/base.txt')).readlines() def get_version_from_...
DictGet/ecce-homo
setup.py
Python
mit
1,454
MAJOR = 1 MINOR = 0 PATCH = 0 __version__ = "{0}.{1}.{2}".format(MAJOR, MINOR, PATCH)
Rdbaker/Rank
rank/__init__.py
Python
mit
87
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Intangible() result.template = "object/draft_schematic/food/shared_drink_charde.iff" result.attribute_template_id...
anhstudios/swganh
data/scripts/templates/object/draft_schematic/food/shared_drink_charde.py
Python
mit
446
import datetime import EWSv2 import logging import dateparser import pytest from exchangelib import Message from EWSv2 import fetch_last_emails from exchangelib import EWSDateTime, EWSTimeZone class TestNormalCommands: """ """ class MockClient: class MockAccount: def __init__(self...
demisto/content
Packs/EWS/Integrations/EWSv2/EWSv2_test.py
Python
mit
10,212
import subprocess """ ideas from https://gist.github.com/godber/7692812 """ class PdfInfo: def __init__(self, filepath): self.filepath = filepath self.info = {} self.cmd = "pdfinfo" self.process() def process(self): labels = ['Title', 'Author', 'Creator', 'Producer', '...
manishgs/pdf-processor
pdftools/PdfInfo.py
Python
mit
1,046
# Generated by Django 2.2.10 on 2020-04-05 11:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('support', '0004_templateconfirmationcomment'), ] operations = [ migrations.AlterField( model_name='priority', name=...
opennode/nodeconductor-assembly-waldur
src/waldur_mastermind/support/migrations/0005_extend_icon_url_size.py
Python
mit
437
# The MIT License # # Copyright (c) 2015 the bpython authors. # # 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, mo...
MarkWh1te/xueqiu_predict
python3_env/lib/python3.4/site-packages/bpython/curtsiesfrontend/_internal.py
Python
mit
2,126
from django.conf.urls.defaults import * from django.views.generic import DetailView, ListView from archive.models import Catalogue, Document urlpatterns = patterns('archive.views', url(r'^$', ListView.as_view( context_object_name="catalogues", queryset=Catalogu...
nathangeffen/tbonline-old
tbonlineproject/archive/urls.py
Python
mit
1,184
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe from frappe import _ from frappe.model.document import Document from frappe.model import no_value_fields class Workflow(Document): def validate(self): self.set_active() self.create_custom_field_for_wor...
frappe/frappe
frappe/workflow/doctype/workflow/workflow.py
Python
mit
3,996
from ..vendor.Qt import QtWidgets, QtCore class DeselectableTreeView(QtWidgets.QTreeView): """A tree view that deselects on clicking on an empty area in the view""" def mousePressEvent(self, event): index = self.indexAt(event.pos()) if not index.isValid(): # clear the selection ...
mindbender-studio/core
avalon/tools/views.py
Python
mit
504