repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
clld/concepticon
migrations/versions/1aabb3eb6546_update_unique_null.py
# coding=utf-8 """update unique null Revision ID: 1aabb3eb6546 Revises: 5a9b3ae30643 Create Date: 2018-01-17 11:39:36.592369 """ # revision identifiers, used by Alembic. revision = '1aabb3eb6546' down_revision = 'c440e8ef9626' import datetime from alembic import op import sqlalchemy as sa UNIQUE_NULL = [ ('c...
JuanbingTeam/djangobbs
djangobbs/uploads/tools.py
#!/usr/bin/env python #coding=utf-8 from djangobbs.uploads.models import * from djangobbs.uploads.config import UPLOAD_FILE_FOLDER from djangobbs.uploads.config import MAX_THUMBNAIL_SIZE import djangobbs.uploads.exif from settings import MEDIA_ROOT from md5 import md5 from cStringIO import StringIO imp...
EDRN/labcas-backend
common/src/main/python/gov/nasa/jpl/edrn/labcas/client/update_solr_metadata.py
# Script to update the Solr metadata using input metadata stored in JSON files. # # Example invocation: python common/src/main/python/gov/nasa/jpl/edrn/labcas/client/update_solr_metadata.py datasets add input.json # where input.json is as follows: # #{ # "id:Boston_University_Lung_Tumor_Sequencing.FFPE_Lung_Tumor_Seq...
racker/fleece
fleece/raxauth.py
import requests from fleece.httperror import HTTPError TOKEN_URL_FMT = "https://identity.api.rackspacecloud.com/v2.0/tokens/{token}" # nosec def authenticate(): def wrap(fxn): """Return a decorated callable.""" def wrapped(*args, **kwargs): """Validate token and return auth context...
h2oai/h2o-3
h2o-py/tests/testdir_algos/rulefit/pyunit_credit_rulefit.py
import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.estimators.rulefit import H2ORuleFitEstimator def credit(): df = h2o.import_file(pyunit_utils.locate("smalldata/kaggle/CreditCard/creditcard_train_cat.csv")) df["DEFAULT_PAYMENT_NEXT_MONTH"] = df["DEFAULT_PAYMENT_NEXT...
rmyers/trove-dashboard
trove_dashboard/utils/hacking/check.py
__author__ = 'dmakogon' import logging import re # Don't need this for testing logging.disable('LOG') def _check_for_exact_apache(start, lines): """Check for the Apache 2.0 license header. We strip all the newlines and extra spaces so this license string should work regardless of indentation in the file. """ ...
willrogers/pytac
pytac/cothread_cs.py
import logging from cothread.catools import caget, caput, ca_nothing from pytac.cs import ControlSystem from pytac.exceptions import ControlSystemException class CothreadControlSystem(ControlSystem): """A control system using cothread to communicate with EPICS. N.B. this is the default control system. It i...
googleinterns/via-content-understanding
videoretrieval/helper/youtube_video_downloader.py
""" Copyright 2020 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 applicable law or agreed to in writing, software di...
etdub/speakeasy
docs/conf.py
# -*- coding: utf-8 -*- # # speakeasy documentation build configuration file, created by # sphinx-quickstart on Thu Dec 4 14:47:28 2014. # # 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. # #...
eske/seq2seq
translate/rnn.py
from tensorflow.python.ops import init_ops from tensorflow.python.util import nest import tensorflow as tf def stack_bidirectional_dynamic_rnn(cells_fw, cells_bw, inputs, initial_states_fw=None, initial_states_bw=None, dtype=None, sequence_length=None, parallel_iterations=None, sco...
Zehaos/MobileNet
nets/nets_factory.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
erigones/esdc-ce
api/signals.py
from gui.signals import (dc_relationship_changed, group_relationship_changed, user_relationship_changed, user_profile_changed) from vms.signals import (vm_defined, vm_undefined, vm_updated, vm_define_reverted, node_status_changed, node_online, node_offline, node_unlicen...
cloudify-cosmo/cloudify-nsx-plugin
cloudify_nsx/network/ospf_area.py
######## # Copyright (c) 2016 GigaSpaces Technologies 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...
megaprojectske/megaprojects.co.ke
megaprojects/megaprojects/settings/test.py
from base import * ## TEST CONFIGURATION TEST_RUNNER = 'discover_runner.DiscoverRunner' TEST_DISCOVER_TOP_LEVEL = SITE_ROOT TEST_DISCOVER_ROOT = SITE_ROOT TEST_DISCOVER_PATTERN = "test_*.py" ## END TEST CONFIGURATION ## DATABASE CONFIGURATION DATABASES = { "default": { "ENGINE": "django.db.backends.sqli...
StratusLab/client
api/code/src/test/python/messaging/MsgClientTest.py
# # Created as part of the StratusLab project (http://stratuslab.eu), # co-funded by the European Commission under the Grant Agreement # INFSO-RI-261552." # # Copyright (c) 2012, SixSq Sarl # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
h2oai/sparkling-water
py-scoring/src/ai/h2o/sparkling/ml/params/H2OGridSearchParams.py
# # Licensed to the Apache Software Foundation (ASF) 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 us...
DTUWindEnergy/Python4WindEnergy
py4we/my_dat_file_io.py
""" IO classes for YOUR_FILE_TYPE_NAME file types Copyright (C) 2013 DTU Wind Energy Author: YOUR_NAME Email: YOUR_EMAIL Last revision: DATE License: Apache v2.0, http://www.apache.org/licenses/LICENSE-2.0 """ from __future__ import print_function from we_file_io import WEFileIO, TestWEFileIO import ...
amitdhiman000/MyOffers
error/urls.py
"""MyOffers URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-base...
tseaver/google-cloud-python
translate/setup.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
laichunpongben/machine_learning
linear_regression.py
import numpy as np import random class TestCase: def __init__(self): self.n = 10 self.d = 2 self.p0 = [1] + [random.uniform(-1,1) for x in range(2)] self.p1 = [1] + [random.uniform(-1,1) for x in range(2)] self.w = [0 for x in range(self.d+1)] self.X = np.array([[1] ...
mannickutd/project_euler
src/questions/question_11.py
# -*- coding: utf-8 -*- """ Description of question 11 Nicholas Staples 2014-04-15 """ from utils.include_decorator import include_decorator description = ''' In the 20 * 20 grid below, 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 ...
opendatagroup/hadrian
titus/setup.py
#!/usr/bin/env python # Copyright (C) 2014 Open Data ("Open Data" refers to # one or more of the following companies: Open Data Partners LLC, # Open Data Research LLC, or Open Data Capital LLC.) # # This file is part of Hadrian. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this...
tensorflow/agents
tf_agents/bandits/agents/lin_ucb_agent.py
# coding=utf-8 # Copyright 2020 The TF-Agents 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
hrhtspr/IkaLog
IkaUI.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # IkaLog # ====== # Copyright (C) 2015 Takeshi HASEGAWA # # 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/l...
baigk/compass-core
bin/poll_switch.py
#!/usr/bin/env python # # Copyright 2014 Huawei Technologies Co. 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 ...
yamahata/neutron
neutron/plugins/ryu/ryu_neutron_plugin.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Isaku Yamahata <yamahata at private email ne jp> # <yamahata at valinux co jp> # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with...
jld23/saspy
saspy/sasets.py
# # Copyright SAS Institute # # 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...
googleads/googleads-python-lib
examples/ad_manager/v202111/inventory_service/update_ad_units.py
#!/usr/bin/env python # # 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 requir...
AsparagusEdu/GraviSwitch
main.py
import pygame, os, sys, code.constants as C from code.menu import Demo_Menu, Main_Menu def main(): pygame.init() icon = pygame.image.load('images/icon.png').convert() icon.set_colorkey(C.CHROMA_KEY) pygame.display.set_icon(icon) pygame.display.set_caption(C.GAME_NAME) Main_Menu() pygame.quit() main() #-------...
ros2/launch
launch_pytest/test/launch_pytest/examples/check_node_msgs.py
# Copyright 2021 Open Source Robotics Foundation, 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...
googleapis/python-securitycenter
samples/generated_samples/securitycenter_v1beta1_generated_security_center_get_organization_settings_sync.py
# -*- 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...
jessica-younker/I-Got-Bugs
api/Bugz/views/news_view.py
# from django.contrib.auth import logout, login, authenticate # from django.contrib.auth.models import User # from django.contrib.auth.decorators import login_required # from django.shortcuts import render # from Bugz.views.login_view import LoginViewSet # from django.views.decorators.csrf import csrf_exempt # from res...
marcusangeloni/smc2016
processing/feature_extraction.py
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Marcus de Assis Angeloni <marcus@liv.ic.unicamp.br> # Thu 7 Apr 2016 21:12:03 import numpy import bob.ip.base import bob.ip.gabor import os import sys import math import skimage.feature from skimage.feature import greycomatrix, greycoprops from scipy.stats import...
bogdanbabych/morphosyntax
src/s010cognatematch/md070crosslevenshteinPhon.py
''' Created on Dec 3, 2013 @author: bogdan requires python3 ''' import os, sys, re from collections import defaultdict import math import md060graphonoLev class clCrossLevenshtein(object): ''' classdocs ''' def __init__(self, SFInA, SFInB, SLangIDa, SLangIDb): ''' Constructor ...
stfc/apel
apel/db/loader/loader.py
''' Copyright (C) 2012 STFC 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 writi...
google/upvote_py2
upvote/gae/datastore/models/alert_test.py
# Copyright 2017 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...
genius1611/Keystone
keystone/logic/types/endpoint.py
# Copyright (c) 2010-2011 OpenStack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
dscorbett/pygments
pygments/lexers/amdgpu.py
""" pygments.lexers.amdgpu ~~~~~~~~~~~~~~~~~~~~~~ Lexers for the AMDGPU ISA assembly. :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.lexer import RegexLexer, words from pygments.token import Name, Text, Keyword, Whitesp...
jaywink/cartridge-reservable
cartridge/shop/migrations/0024_add_reservableproductavailabilities.py
# -*- coding: 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): # Adding model 'ReservableProductAvailability' db.create_table(u'shop_reservableproductavailability', ( ...
chrisspen/django-feeds
djangofeeds/tasks.py
from django.core.cache import cache try: from celery.utils import noop, chunks from celery.decorators import task use_celery = True except ImportError: use_celery = False from djangofeeds import conf from djangofeeds.models import Feed from djangofeeds.importers import FeedImporter ENABLE_LOCKS = Fal...
Yoplitein/gadget
gadget/default_plugins/update.py
import os from twisted.internet import reactor from gadget.commands import SubprocessProtocol, register_command from gadget.globals import Globals from gadget.plugins import require_auth, make_deferred, simple_callback, load_plugins from gadget.messages import _subscribers, load_routes @require_auth def handle_reloa...
nids-io/ampt-generator
setup.py
''' ampt-generator setup ''' # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README....
mit-ll/python-keylime
keylime/ca_impl_cfssl.py
''' SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. ''' import base64 import os import subprocess import socket import time import shutil import sys import requests import simplejson as json from M2Crypto import EVP, X509 from keylime import config from keylime import keylim...
njsmith/zs
zs/cmdline/validate.py
# This file is part of ZS # Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com> # See file LICENSE.txt for license information. import sys from zs import ZSCorrupt from .util import open_zs def command_validate(opts): """Check a .zs file for errors or data corruption. Usage: zs validate [-j PARALLELISM] [...
stefanseifert/redash
tests/__init__.py
import os import logging import datetime import json from unittest import TestCase from contextlib import contextmanager os.environ['REDASH_REDIS_URL'] = "redis://localhost:6379/5" # Use different url for Celery to avoid DB being cleaned up: os.environ['REDASH_CELERY_BROKER'] = "redis://localhost:6379/6" # Dummy valu...
howardwkim/ctci
Algorithms_Data_Structures/Trie.py
class Trie(): def __init__(self): self.root = {} def check_and_update(self, word): is_new_word = False current = self.root #explain why! for char in word: if char not in current: is_new_word = True current[char] = {} curre...
windelbouwman/ppci-mirror
test/util/test_collections.py
#!/usr/bin/python import unittest from ppci.utils.collections import OrderedSet class OrderedSetTestCase(unittest.TestCase): """ Test if graph works. - Add nodes - add edges - mask and unmask nodes - combine nodes. """ def test_example(self): """ Test example from ...
hardc0d3/sppy
sppy_test_cmp/test_u32l.py
import cffi import sp_index_cmp.cmpdef as cmpdef from sppy.spapi_cffi_codecs import ListU32 ffi = cffi.FFI() ffi.cdef ( cmpdef.cdef ) lib = ffi.dlopen("./sp_index_cmp/cmp.so") def pycmp( a,b ): if a<b: return -1 elif a>b: return 1 else: return 0 cases = [ [[3,2],[3,2,1]], [[3,2,1],[3,2]], [[3,2,2],[3,2,2]...
CompOpt4Apps/IEGenLib
doc/PythonScriptExamples/README-example.py
# Examples from the README, which are also on the web page. import iegenlib S1 = iegenlib.Set("{[s,i]: 0<=s && s<T && 0<=i && i<N}") print "S1 = ", S1 R1 = iegenlib.Relation("{[s,i]->[0,s,1,i,0]}") print "R1 = ", R1 # The following Python statements are examples on how to apply operations # (such as Apply, ...
oooits72/rrrr
rrtimetable/rrtimetable/tests/exportv3_tests.py
import unittest import helper from model.transit import * from exporter.timetable3 import export import datetime class TestSequenceFunctions(unittest.TestCase): def test_integration(self): tdata = Timetable(datetime.date(2014,1,1)) sa = StopArea(tdata,'SA1',name='SA1') sa = StopArea(tdata,...
jpic/pescator
pescator/urls.py
from django.conf.urls import patterns, include, url from django.conf.urls.i18n import i18n_patterns from django.conf import settings from django.conf.urls.static import static from django.contrib import admin admin.autodiscover() import autocomplete_light autocomplete_light.autodiscover() import views urlpatterns =...
greyhavens/thane
tamarin-central/test/cmdline/testDebugger.py
#!/usr/bin/env python #!/usr/bin/env python #* ***** BEGIN LICENSE BLOCK ***** #* Version: MPL 1.1/GPL 2.0/LGPL 2.1 #* #* The contents of this file are subject to the Mozilla Public License Version #* 1.1 (the "License"); you may not use this file except in compliance with #* the License. You may obtain a copy of the...
mmetak/streamlink
src/streamlink/plugins/viagame.py
"""Plugin for Viasat's gaming site Viagame.""" import re from streamlink.plugin.api import http, validate from streamlink.plugin.api.utils import parse_json from streamlink.plugin.api.support_plugin import viasat STREAM_API_URL = "http://playapi.mtgx.tv/v3/videos/stream/{0}" _embed_url_re = re.compile( '<meta i...
Pushjet/Pushjet-Server-Api
controllers/service.py
from flask import Blueprint, jsonify, request from utils import Error, is_service, is_secret, has_secret, queue_zmq_message from models import Service, Message from shared import db from json import dumps as json_encode from config import zeromq_relay_uri service = Blueprint('service', __name__) @service.route('/ser...
hoffmann/tropo
tests/test_base.py
import json from tropo.base import Template, Resource, dump, dumps def test_template(): t = Template() expected = {'$schema': 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#', 'contentVersion': '1.0.0.0', 'resources': []} assert dump(t) == e...
sushi-irc/tekka
todowidget.py
""" Copyright (c) 2009-2010 Marian Tietz 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 and the follow...
octobear2/ob2
ob2/util/inst_account.py
import ob2.config as config from os.path import exists, join def get_inst_account_form_path(login): """ Returns the path to the PDF file that contains the account form for user with login. login -- The instructional account login without any prefix (e.g. aa) """ if not config.inst_account_enabl...
windelbouwman/ppci-mirror
test/samples/test_samples_on_microblaze.py
import unittest from sample_helpers import add_samples, build from helper_util import has_qemu, qemu, relpath from helper_util import do_long_tests, make_filename from ppci.format import uboot_image @unittest.skipUnless(do_long_tests("microblaze"), "skipping slow tests") @add_samples("simple", "medium") class Microb...
fraxtil/pyfrax
stamina.py
#!/usr/bin/env python import math from random import random, randrange from pyfrax.canvas import * from pyfrax.model import * from pyfrax.rendertools import * from pyfrax.colors.rgb import * FRAMES = 32 WIDTH = 500 HEIGHT = 500 TRIANGLES = FRAMES TSIZE = 80. triangles = [] triangles = [{ 'x': randrange(WIDTH), ...
dpshelio/sunpy
sunpy/util/sysinfo.py
""" This module provides functions to retrieve system information. """ import datetime import platform __all__ = ['get_sys_dict', 'system_info'] def get_sys_dict(): """ Test which packages are installed on system. Returns ------- `dict` A dictionary containing the programs and versions i...
ContinuumIO/gulinalg
gulinalg/tests/test_inverse.py
""" Tests different implementations of inverse functions. """ from __future__ import print_function from unittest import TestCase, skipIf import numpy as np from numpy.testing import run_module_suite, assert_allclose from pkg_resources import parse_version import gulinalg class TestInverseTriangular(TestCase): "...
Jumpscale/jumpscale6_core
lib/JumpScale/lib/platform/uname/cmdtools/UnameCommand.py
from JumpScale import j from JumpScale.core.baseclasses.CommandWrapper import CommandWrapper class UnameCommand(CommandWrapper): _UNAME_GET_ALL = "uname -a" def getKernelName(self): """ Get System Kernel name """ return self._executeCommand(UnameCommand._UNAME_GET_ALL) ...
mphoward/flyft
fft.py
import numpy as np __all__ = ['convolve'] def convolve(f,g,fft=True, periodic=True): """Compute the linear or circular convolution of two discrete data sets. For small problems, it is usually faster to perform the convolution directly. In this case, `convolve` defaults to the ``numpy.convolve`` routi...
Nitron/django-cas-provider
cas_provider/utils.py
from random import Random import string from models import ServiceTicket, LoginTicket def _generate_string(length=8, chars=string.ascii_letters + string.digits): """ Generates a random string of the requested length. Used for creation of tickets. """ return ''.join(Random().sample(chars, length)) def create_...
sephii/django
django/core/management/base.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ import os import sys import warnings from argparse import ArgumentParser from optparse import OptionParser import dj...
tinyms/ArchiveX
tinyms/dao/point.py
#coding=UTF8 __author__ = 'tinyms' from sqlalchemy import func from tinyms.core.orm import SessionFactory from tinyms.core.entity import SecurityPoint #动态权限增删改,像树节点 class DynamicPointHelper(): def __init__(self, c, g): self.category = c self.group = g def add(self, key, desc): sf = S...
rstoneback/pysat
pysat/tests/test_instrument_listgen.py
"""Unit tests for the list generation methods in `pysat.Instrument`.""" from importlib import reload import pysat from pysat.utils import generate_instrument_list class TestInstListGeneration(object): """Tests to ensure the instrument test class is working as expected.""" def setup(self): """Set up...
matthiaskramm/corepy
corepy/arch/ptx/isa/__init__.py
# Copyright (c) 2006-2009 The Trustees of Indiana University. # All rights reserved. # # Redistribution and use in source and binary forms, with or without ...
chebee7i/dit
dit/divergences/_kl_nonmerge.py
""" These are special interest implementations that should be used only in very particular situations. cross_entropy_pmf relative_entropy_pmf DKL_pmf These functions should be used only if the pmfs that are passed in have the same exact length and correspond to the same outcome probabilities. They also ass...
ergodicbreak/evennia
evennia/server/portal/webclient_ajax.py
""" AJAX/COMET fallback webclient The AJAX/COMET web client consists of two components running on twisted and django. They are both a part of the Evennia website url tree (so the testing website might be located on http://localhost:8000/, whereas the webclient can be found on http://localhost:8000/webclient.) /webcli...
schinckel/django-boardinghouse
tests/tests/test_contrib_demo.py
import datetime try: from unittest.mock import patch except ImportError: from mock import patch from django.contrib.auth.models import User from django.core.management import call_command try: from django.urls import reverse except ImportError: from django.core.urlresolvers import reverse from django....
pacahon/Hoep
setup.py
''' Hoep ==== Hoep is a Python binding for the `Hoedown`_ Markdown library. Install ------- Hoep is available on PyPI so installation is only a quick ``pip`` away. :: $ pip install hoep Unicode ------- Hoep only accepts and returns ``unicode`` objects in Python 2 and ``str`` objects in Python 3. This goes ...
moradology/django-pgjson
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages description = """ PostgreSQL json field support for Django. """ setup( name="azv-django-pgjson", version="0.0.0", url="https://github.com/moradology/azv-django-pgjson", license="BSD", platforms=["OS Independ...
Shouqun/crosswalk
build/android/make_apk.py
#!/usr/bin/env python # Copyright (c) 2013 Intel Corporation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import operator import optparse import os import re import shutil import subprocess import sys def Which(name): """Search PATH for...
helenwarren/pied-wagtail
wagtail/wagtailimages/tests.py
from django.test import TestCase from django import template from django.contrib.auth.models import User, Group, Permission from django.core.urlresolvers import reverse from django.core.files.uploadedfile import SimpleUploadedFile from wagtail.tests.utils import unittest, WagtailTestUtils from wagtail.wagtailimages.mo...
murrayrm/python-control
control/modelsimp.py
#! TODO: add module docstring # modelsimp.py - tools for model simplification # # Author: Steve Brunton, Kevin Chen, Lauren Padilla # Date: 30 Nov 2010 # # This file contains routines for obtaining reduced order models # # Copyright (c) 2010 by California Institute of Technology # All rights reserved. # # Redistributio...
pandas-dev/pandas
pandas/tests/arrays/masked/test_arrow_compat.py
import numpy as np import pytest import pandas as pd import pandas._testing as tm pa = pytest.importorskip("pyarrow", minversion="1.0.1") from pandas.core.arrays._arrow_utils import pyarrow_array_to_numpy_and_mask arrays = [pd.array([1, 2, 3, None], dtype=dtype) for dtype in tm.ALL_INT_EA_DTYPES] arrays += [pd.arra...
qedsoftware/commcare-hq
corehq/apps/users/tests/create.py
from django.test import TestCase from corehq.apps.users.dbaccessors.all_commcare_users import delete_all_users from corehq.apps.users.models import CouchUser, WebUser, CommCareUser from corehq.apps.domain.models import Domain from corehq.apps.domain.shortcuts import create_domain class CreateTestCase(TestCase): ...
mlavergn/codeunbox
codeunbox.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # __author__ = "Marc Lavergne" # __copyright__ = "Copyright 2013, Marc Lavergne" # __license__ = "Modified BSD (http://directory.fsf.org/wiki/License:BSD_3Clause)" from __future__ import print_function import sys import os import sqlite3 def LogConsole(arg): print("%s...
klen/fquest
base/fquest/views.py
# coding: utf-8 from flask import Blueprint, redirect, url_for, render_template, request from flask_login import current_user from functools import wraps from .forms import CharacterCreateForm from .models import Character, db, Event fquest = Blueprint( 'fquest', __name__, template_folder='templates', ...
bqbn/addons-server
src/olympia/constants/permissions.py
from collections import defaultdict, namedtuple AclPermission = namedtuple('AclPermission', 'app, action') # Null rule. Only useful in tests really as no access group should have this. NONE = AclPermission('None', 'None') # A special wildcard permission to use when checking if someone has access to # any admin, or...
beeftornado/sentry
src/sentry/api/endpoints/project_rule_details.py
from __future__ import absolute_import from rest_framework import status from rest_framework.response import Response from sentry.api.bases.project import ProjectEndpoint, ProjectSettingPermission from sentry.api.exceptions import ResourceDoesNotExist from sentry.api.serializers import serialize from sentry.api.seria...
jhunkeler/hstcal
tests/wfc3/test_ir_16asn.py
import subprocess from ..helpers import BaseWFC3 class TestIR16ASN(BaseWFC3): """Tests for WFC3/IR.""" detector = 'ir' def test_ir_16asn(self): """Ported from ``calwf3_ir_16``.""" asn_file = 'ib8t01010_asn.fits' # Prepare input file. self.get_input_file(asn_file) ...
qsnake/numpy
numpy/lib/tests/test_arraysetops.py
""" Test functions for 1D array set operations. """ from numpy.testing import * import numpy as np from numpy.lib.arraysetops import * import warnings class TestAso(TestCase): def test_unique( self ): a = np.array( [5, 7, 1, 2, 1, 5, 7] ) ec = np.array( [1, 2, 5, 7] ) c = unique( a ) ...
uwcirg/true_nth_usa_portal
tests/test_auth.py
"""Unit test module for auth""" from collections import namedtuple import datetime from flask import url_for from flask_webtest import SessionScope import pytest from werkzeug.exceptions import Unauthorized from portal.extensions import db from portal.models.auth import AuthProvider, Token, create_service_token from ...
orbitvu/django-mama-cas
mama_cas/tests/test_models.py
from datetime import timedelta from mock import patch import re from django.test import TestCase from django.test.utils import override_settings from django.utils.timezone import now import requests from .factories import ProxyGrantingTicketFactory from .factories import ProxyTicketFactory from .factories import Ser...
saifulazad/myApp
app/__init__.py
from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask import Flask UPLOAD_FOLDER = '/home/azad/myApp/app/static/img' ALLOWED_EXTENSIONS = set(['jpg', 'jpeg', 'gif', 'png']) login_manager = LoginManager() app = Flask(__name__) app.config.from_object('config') app.config['UPLOA...
sympy/scipy-2017-codegen-tutorial
scipy2017codegen/odesys_cvode.py
import os import sys import uuid import sympy as sym import setuptools import numpy as np import setuptools import pyximport from scipy2017codegen import templates from scipy2017codegen.odesys import ODEsys pyximport.install() kw = { 'sources': [], 'include_dirs': [os.getcwd(), np.get_include()], 'librari...
YourCyborg/Sun-RPI
src/commands/cmdsethandler.py
""" CmdSethandler The Cmdsethandler tracks an object's 'Current CmdSet', which is the current merged sum of all CmdSets added to it. A CmdSet constitues a set of commands. The CmdSet works as a special intelligent container that, when added to other CmdSet make sure that same-name commands are treated correctly (usua...
larsoner/mne-python
tutorials/stats-source-space/60_cluster_rmANOVA_spatiotemporal.py
""" ====================================================================== Repeated measures ANOVA on source data with spatio-temporal clustering ====================================================================== This example illustrates how to make use of the clustering functions for arbitrary, self-defined contr...
fboers/jumeg
jumeg/gui/tsv/utils/jumeg_tsv_io_data.py
import os,sys import numpy as np import mne from jumeg.base.jumeg_base import JuMEG_Base_IO import logging logger = logging.getLogger('jumeg') __version__="2019-04-11-001" #print "########## Refchan geo data:" # This is just for info to locate special 4D-refs. #for iref in refpick: # print raw.info['chs'][iref][...
hsoft/hsaudiotag
hsaudiotag/tests/id3v1_test.py
# Created By: Virgil Dupras # Created On: 2004/12/12 # Copyright 2010 Hardcoded Software (http://www.hardcoded.net) # This software is licensed under the "BSD" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/b...
sibiryakov/frontera
frontera/core/manager.py
from collections import OrderedDict from frontera.exceptions import NotConfigured from frontera.utils.misc import load_object from frontera.settings import Settings, BaseSettings from frontera.core.components import Backend, Middleware from frontera.logger import FrontierLogger from frontera.core import models class...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractIsekailunaticCom.py
def extractIsekailunaticCom(item): ''' Parser for 'isekailunatic.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'), ('Loiterous', 'Loi...
detrout/debian-statsmodels
statsmodels/genmod/cov_struct.py
from statsmodels.compat.python import iterkeys, itervalues, zip, range from statsmodels.stats.correlation_tools import cov_nearest import numpy as np from scipy import linalg as spl from statsmodels.tools.sm_exceptions import (ConvergenceWarning, IterationLimitWarning) impor...
softak/webfaction_demo
apps/stores/migrations/0002_auto__add_shoppingregion.py
# 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): # Adding model 'ShoppingRegion' db.create_table('stores_shoppingregion', ( ('id', self.gf('dja...
clouserw/olympia
sites/altdev/settings_base.py
"""private_base will be populated from puppet and placed in this directory""" import logging import os import dj_database_url from lib.settings_base import CACHE_PREFIX, ES_INDEXES, KNOWN_PROXIES, LOGGING from .. import splitstrip import private_base as private ENGAGE_ROBOTS = False EMAIL_BACKEND = 'django.core.m...
yephper/django
django/template/loader_tags.py
import logging from collections import defaultdict from django.utils import six from django.utils.safestring import mark_safe from .base import ( Node, Template, TemplateSyntaxError, TextNode, Variable, token_kwargs, ) from .library import Library register = Library() BLOCK_CONTEXT_KEY = 'block_con...
RJT1990/pyflux
pyflux/gas/tests/gas_llev_tests_skewt.py
import numpy as np import pyflux as pf noise = np.random.normal(0,1,200) data = np.zeros(200) for i in range(1,len(data)): data[i] = 1.0*data[i-1] + noise[i] countdata = np.random.poisson(3,200) def test_skewt_couple_terms(): """ Tests latent variable list length is correct, and that the estimated latent variab...
percyfal/bokeh
bokeh/plotting/helpers.py
from __future__ import absolute_import from collections import Iterable, OrderedDict, Sequence import difflib import itertools import re import warnings import numpy as np import sys from six import string_types, reraise from ..models import ( BoxSelectTool, BoxZoomTool, CategoricalAxis, TapTool, CrosshairTo...