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 |
|---|---|---|---|---|---|
"""
Module for base class for Data API objects.
"""
# Imports
# Stdlib
from collections import namedtuple
import logging
import os
import re
try:
import cStringIO as StringIO
except ImportError:
import StringIO as StringIO
# Local
from doekbase.data_api.util import get_logger, log_start, log_end
from doekbase... | kkellerlbl/data_api | lib/doekbase/data_api/core.py | Python | mit | 16,991 |
import exploration_bidder
__all__ = ['exploration_bidder'] | strands-project/strands_exploration | exploration_bid_manager/src/exploration_bid_manager/__init__.py | Python | mit | 59 |
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from socialregistration.models import (FacebookProfile, TwitterProfile, OpenIDProfile)
class Auth(object):
def get_user(self, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotE... | coxmediagroup/django-socialregistration | socialregistration/auth.py | Python | mit | 1,238 |
import datetime
from pyramid.view import view_config
from couchdbkit import *
import logging
log = logging.getLogger(__name__)
class Page(Document):
author = StringProperty()
page = StringProperty()
content = StringProperty()
date = DateTimeProperty()
@view_config(route_name='home', renderer='templ... | benoitc/couchdbkit | examples/pyramidapp/pyramid_couchdb_example/views.py | Python | mit | 1,100 |
"""
Currency exchange rate support that comes from Yahoo Finance.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.yahoo_finance/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor impor... | srcLurker/home-assistant | homeassistant/components/sensor/yahoo_finance.py | Python | mit | 3,667 |
"""
* Mini-Max Sum (Python)
* HackerRank Algorithm Challenge
* https://www.hackerrank.com/challenges/mini-max-sum
*
* michael@softwareontheshore.com
*
* The goal is to find the minimum sum and the maximum sum of 5 numbers by only using 4.
"""
##arr = map(int, raw_input().strip().split(' '))
testA = [1, 2, 3, ... | masharp/algorithm-challenges-n-stuff | coding-challenges/hacker-rank/algorithms/MiniMaxSum.py | Python | mit | 566 |
import numpy as np
import pytest
from landlab import FieldError, RasterModelGrid
from landlab.utils.return_array import return_array_at_link, return_array_at_node
def test_no_field():
mg = RasterModelGrid((10, 10))
with pytest.raises(FieldError):
return_array_at_node(mg, "spam")
with pytest.raise... | cmshobe/landlab | tests/utils/test_return_grid.py | Python | mit | 765 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Emblem'
db.create_table(u'chat_emblem', (
(u'... | crazyskateface/LC | chat/migrations/0014_initial.py | Python | mit | 8,645 |
#-*- coding: utf-8 -*-
import functools
from django.contrib import messages
from django.utils.translation import ugettext as _
from .ratelimit import RateLimit
__all__ = ['ratelimit', ]
def ratelimit(method=None, field=None, rate='5/5m'):
def decorator(func):
@functools.wraps(func)
def wrappe... | bjorncooley/rainforest_makers | spirit/utils/ratelimit/decorators.py | Python | mit | 737 |
#!/usr/bin/env python3
""" Script for getting status information about this cluster of central servers.
By default the request is made to the local server and reflects the view of the
cluster as seen by the local node.
"""
import requests
import json
import sys
HOST = "localhost"
PORT = 8083 # The internal listenin... | ria-ee/X-Road | src/packages/xroad/cluster/check_ha_cluster_status.py | Python | mit | 1,290 |
import itertools
def cached(func):
def wrapper(*args, **kwargs):
host = args[0]
if not hasattr(host, 'cache'):
setattr(host, 'cache', {})
if func not in host.cache:
host.cache[func] = func(*args, **kwargs)
return host.cache[func]
return wrapper
def ... | jpalladino84/Python-Roguelike-Framework | util/decorators.py | Python | mit | 992 |
import math
import warnings
import numpy
import six
from chainer.backends import cuda
from chainer import configuration
from chainer import FunctionNode
from chainer import testing
from chainer import variable
class NondifferentiableError(Exception):
pass
def _copy_arrays(xs):
xp = cuda.get_array_module(*... | ronekko/chainer | chainer/gradient_check.py | Python | mit | 29,683 |
#!/usr/bin/python
# fix.py - mass fix some goof
from process import process
from main.models import Show, Location, Episode, Raw_File, Cut_List
class fix(process):
# this will bump everything from 5 back to 4
ready_state = 7
def process_ep(self, ep):
if self.options.verbose: print(ep.id, ep.na... | CarlFK/veyepar | dj/scripts/fix.py | Python | mit | 492 |
from __future__ import absolute_import
from django import template
from ..models import Question, Topic
register = template.Library()
class FaqListNode(template.Node):
def __init__(self, num, varname, topic=None):
self.num = template.Variable(num)
self.topic = template.Variable(topic) if topic el... | Mercy-Nekesa/sokoapp | sokoapp/fack/templatetags/faqtags.py | Python | mit | 2,785 |
from pcs import settings
from pcs.common import (
file_type_codes,
reports,
)
from pcs.common.file import RawFileError
from pcs.common.reports.item import ReportItem
from pcs.common.tools import format_environment_error
from pcs.lib.communication.nodes import SendPcsdSslCertAndKey
from pcs.lib.communication.too... | tomjelinek/pcs | pcs/lib/commands/pcsd.py | Python | gpl-2.0 | 3,265 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011, 2013, 2014 CERN.
##
## Invenio 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 2 of the
## License, or (at yo... | egabancho/invenio | invenio/modules/messages/views.py | Python | gpl-2.0 | 10,605 |
'''
Videozed urlresolver plugin
Copyright (C) 2013 Vinnydude
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 program is d... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.module.urlresolver/lib/urlresolver/plugins/videozed.py | Python | gpl-2.0 | 4,224 |
# -*- coding: utf-8 -*-
__author__, __date__ = 'mehdy', '5/4/15'
| TelePy/TelePy | telepy/models/__init__.py | Python | gpl-2.0 | 66 |
import discord
from sigma.core.utilities.data_processing import user_avatar
from .move_log_embed import make_move_log_embed
async def leave_move_log(ev, guild):
if ev.bot.cfg.pref.movelog_channel:
mlc_id = ev.bot.cfg.pref.movelog_channel
mlc = discord.utils.find(lambda x: x.id == mlc_id, ev.bot.g... | AXAz0r/apex-sigma-core | sigma/modules/core_functions/system/leave_move_log.py | Python | gpl-3.0 | 717 |
#
# Copyright 2007-2012 Free Software Foundation, Inc.
# Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.
#
# This file is part of GREX
#
# GREX 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 Founda... | manojgudi/sandhi | modules/grex/sources/noise_source_test.py | Python | gpl-3.0 | 2,098 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Markus Bergholz (markuman@gmail.com)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version... | aperigault/ansible | lib/ansible/modules/source_control/gitlab_project_variable.py | Python | gpl-3.0 | 7,894 |
f1=open("file_before_enc.txt","r")
s=f1.read()
f1.close()
s=list(s)
s.reverse()
for i in range(len(s)):
s[i]=chr(ord(s[i])+len(s)-i)
s="".join(s)
f2=open("encrypted_file.txt","w+")
f2.write(s)
f2.close()
| hacktoberfest17/programming | encryption_algorithms/simple_encryption_algo_python3/encrypt.py | Python | gpl-3.0 | 205 |
# Copyright 2012-2013, University of Amsterdam. This program is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
#
# This program... | redreamality/semanticizer | semanticizer/wpm/utils/emphasis_resolver.py | Python | gpl-3.0 | 9,642 |
# -*- coding: Latin-1 -*-
"""
@file GenerateRawFCD.py
@author Sascha Krieg
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-07-26
Creates files with a comparison of speeds for each edge between the taxis and the average speed from the current edge.
Dependent of the frequency and the taxi quota.
... | rudhir-upretee/Sumo_With_Netsim | tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsOLD.py | Python | gpl-3.0 | 7,055 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('contentstore.api.tests', 'cms.djangoapps.contentst... | eduNEXT/edunext-platform | import_shims/studio/contentstore/api/tests/__init__.py | Python | agpl-3.0 | 389 |
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | sysadminmatmoz/odoo-clearcorp | account_invoice_journal_defaults/__openerp__.py | Python | agpl-3.0 | 1,847 |
"""Processing of implementation manifests.
A manifest is a string representing a directory tree, with the property
that two trees will generate identical manifest strings if and only if:
- They have extactly the same set of files, directories and symlinks.
- For each pair of corresponding directories in the two se... | timdiels/0install | zeroinstall/zerostore/manifest.py | Python | lgpl-2.1 | 19,123 |
"""
Unit tests for stem.descriptor.microdescriptor.
"""
import unittest
import stem.exit_policy
import stem.descriptor
from stem import str_type
from stem.descriptor.microdescriptor import Microdescriptor
from test.mocking import (
get_microdescriptor,
CRYPTO_BLOB,
)
from test.unit.descriptor import get_resou... | lokeshh/stem | test/unit/descriptor/microdescriptor.py | Python | lgpl-3.0 | 6,106 |
#!/usr/bin/env python
import argparse
import sys
import os
import time
import datetime
import tempfile
import commands
import getpass
from jira.client import JIRA
def get_jira_config():
# read the config file
home=jira_home=os.getenv('HOME')
home=home.rstrip('/')
if not (os.path.isfile(home + '/jira.ini')):
... | confluentinc/kafka-deprecated-fork | kafka-patch-review.py | Python | apache-2.0 | 7,486 |
from strato.racktest.hostundertest import plugins
import os
import time
import socket
class RPM:
def __init__(self, host):
self._host = host
def installRPMPackage(self, path):
basename = os.path.basename(path)
self._host.ssh.ftp.putFile(basename, path)
self._retryInstallPackag... | Stratoscale/pyracktest | py/strato/racktest/hostundertest/builtinplugins/rpm.py | Python | apache-2.0 | 1,467 |
# Copyright 2019 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 applica... | gunan/tensorflow | tensorflow/python/keras/layers/preprocessing/normalization_test.py | Python | apache-2.0 | 10,124 |
#
# Copyright (c) 2016 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | yasharmaster/scancode-toolkit | tests/licensedcode/test_query.py | Python | apache-2.0 | 28,212 |
"""Support for LCN scenes."""
import pypck
from homeassistant.components.scene import DOMAIN as DOMAIN_SCENE, Scene
from homeassistant.const import CONF_ADDRESS, CONF_DOMAIN, CONF_ENTITIES, CONF_SCENE
from . import LcnEntity
from .const import (
CONF_DOMAIN_DATA,
CONF_OUTPUTS,
CONF_REGISTER,
CONF_TRA... | w1ll1am23/home-assistant | homeassistant/components/lcn/scene.py | Python | apache-2.0 | 2,350 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FIXME: This doesn't really provide a means for people to ask for
# the service and release the service. The problem this
# causes is that the selector has no simple means of shutting
# down when no one is using it.
#
# Copyright 2010 British Broadca... | sparkslabs/kamaelia_ | Sketches/MH/RTP/Selector.py | Python | apache-2.0 | 16,564 |
import json
import sys
import ethereum.testutils as testutils
from ethereum.slogging import get_logger, configure_logging
logger = get_logger()
# customize VM log output to your needs
# hint: use 'py.test' with the '-s' option to dump logs to the console
if '--trace' in sys.argv: # not default
configure_logging(':... | EthereumWebhooks/blockhooks | lib/ethereum/tests/test_vm.py | Python | apache-2.0 | 1,230 |
from keystone import utils
from keystone.common import wsgi
from keystone.logic.types.service import Service
import keystone.config as config
from . import get_marker_limit_and_url
class ServicesController(wsgi.Controller):
"""Controller for Service related operations"""
def __init__(self, options):
... | ntt-pf-lab/backup_keystone | keystone/controllers/services.py | Python | apache-2.0 | 1,298 |
import json
import logging
import os
from ..constants import IS_WINDOWS_PLATFORM
DOCKER_CONFIG_FILENAME = os.path.join('.docker', 'config.json')
LEGACY_DOCKER_CONFIG_FILENAME = '.dockercfg'
log = logging.getLogger(__name__)
def find_config_file(config_path=None):
paths = list(filter(None, [
config_path... | vdemeester/docker-py | docker/utils/config.py | Python | apache-2.0 | 1,724 |
from django.shortcuts import render
from django.core import serializers
import json
import datetime
import os
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django... | AcademicsToday/py-academicstoday | academicstoday_project/publisher/views/my_publication.py | Python | apache-2.0 | 4,339 |
"""The tests the for Locative device tracker platform."""
from unittest.mock import Mock, patch
import pytest
from homeassistant import data_entry_flow
from homeassistant.components import locative
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER_DOMAIN
from homeassistant.components.locati... | leppa/home-assistant | tests/components/locative/test_init.py | Python | apache-2.0 | 9,135 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy_nstimer_binding.py | Python | apache-2.0 | 5,544 |
#!/usr/bin/env python
"""
Wrapper for the Spark EC2 launch script that additionally
installs Anaconda, Thunder, and its dependencies, and optionally
loads example data sets
"""
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed wit... | zhwa/thunder | thunder/utils/ec2.py | Python | apache-2.0 | 31,603 |
# Copyright 2016 Google 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, ... | quom/google-cloud-python | speech/unit_tests/test_sample.py | Python | apache-2.0 | 3,192 |
from __future__ import unicode_literals
# Ensure 'assert_raises' context manager support for Python 2.6
import tests.backport_assert_raises
from nose.tools import assert_raises
from moto.ec2 import ec2_backends
import boto
from boto.exception import EC2ResponseError
import sure # noqa
from moto import mock_ec2
@mo... | mrucci/moto | tests/test_ec2/test_elastic_block_store.py | Python | apache-2.0 | 14,810 |
"""Support for MQTT lights."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_MODE,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_EFFECT_LIST,
ATTR_HS_COLOR,
ATTR_MAX_MIREDS,
ATTR_MIN_MIREDS,
ATTR_RGB_COLOR,
ATTR_RGBW_COLOR... | Danielhiversen/home-assistant | homeassistant/components/mqtt/light/schema_basic.py | Python | apache-2.0 | 41,759 |
#!/usr/bin/env python
PRIMARY_OS = 'RHEL-7.1'
PRIMARY = '''#!/bin/sh
#
FQDN="{fqdn}"
# /etc/hostname - /etc/hosts
sed -i "1 c\\127.0.0.1 $FQDN localhost" /etc/hosts
echo $FQDN > /etc/hostname
service hostname restart
sleep 5
{{dinfo}}
'''
def pre_process():
"""Anything added to this function is executed before ... | superseb/train | train/labs/base/scripts/rhel-7.1.py | Python | apache-2.0 | 470 |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import unittest
from pyxb.utils.domutils import *
from xml.dom import Node
import xml.dom
import pyxb.namespace
def NonTextSibling (n):
while n.TEXT_NODE == n.nodeType:
n = n.nextS... | jonfoster/pyxb-upstream-mirror | tests/utils/test-domutils.py | Python | apache-2.0 | 5,087 |
#!/usr/bin/env python
"""Test GAUGE main."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Innovation Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may no... | trungdtbk/faucet | tests/unit/gauge/test_main.py | Python | apache-2.0 | 1,527 |
# 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... | cshallue/models | research/syntaxnet/dragnn/python/spec_builder.py | Python | apache-2.0 | 12,239 |
# -*- coding: utf-8 -*-
'''
Manage RabbitMQ Clusters
========================
Example:
.. code-block:: yaml
rabbit@rabbit.example.com:
rabbitmq_cluster.join:
- user: rabbit
- host: rabbit.example.com
'''
from __future__ import absolute_import
# Import python libs
import logging
# Import s... | smallyear/linuxLearn | salt/salt/states/rabbitmq_cluster.py | Python | apache-2.0 | 2,051 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | StackStorm/st2 | st2client/st2client/models/rbac.py | Python | apache-2.0 | 1,243 |
"""Generic socket server classes.
This module tries to capture the various aspects of defining a server:
For socket-based servers:
- address family:
- AF_INET{,6}: IP (Internet Protocol) sockets (default)
- AF_UNIX: Unix domain sockets
- others, e.g. AF_DECNET are conceivable (see <socket.h>
... | akiokio/centralfitestoque | src/.pycharm_helpers/pydev/_pydev_SocketServer.py | Python | bsd-2-clause | 23,375 |
from collections import defaultdict
from collections.abc import Sequence
import types as pytypes
import weakref
import threading
import contextlib
import operator
import numba
from numba.core import types, errors
from numba.core.typeconv import Conversion, rules
from numba.core.typing import templates
from numba.core.... | seibert/numba | numba/core/typing/context.py | Python | bsd-2-clause | 24,612 |
#-------------------------------------------------------------------------------
# Name: modulo1
# Purpose:
#
# Author: tasora
#
# Created: 14/02/2012
# Copyright: (c) tasora 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/... | Bryan-Peterson/chrono | src/demos/python/demo_irrlicht.py | Python | bsd-3-clause | 2,990 |
"""DelegatedCallable provider tests."""
from dependency_injector import providers
from .common import example
def test_inheritance():
assert isinstance(providers.DelegatedCallable(example), providers.Callable)
def test_is_provider():
assert providers.is_provider(providers.DelegatedCallable(example)) is Tr... | ets-labs/python-dependency-injector | tests/unit/providers/callables/test_delegated_callable_py2_py3.py | Python | bsd-3-clause | 695 |
from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.decorators import method_decorator
from django.views import generic
from .test_forms import AuthorF... | ZhaoCJ/django | tests/generic_views/views.py | Python | bsd-3-clause | 7,341 |
# -*- coding: utf-8 -*-
"""
##########
# Fields #
##########
Each Field class does some sort of validation. Each Field has a clean() method,
which either raises django.forms.ValidationError or returns the "clean"
data -- usually a Unicode object, but, in some rare cases, a list.
Each Field's __init__() takes at least... | dex4er/django | tests/forms_tests/tests/test_fields.py | Python | bsd-3-clause | 69,654 |
#
# Author: Joris Vankerschaver 2013
#
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.linalg
from scipy.misc import doccer
from scipy.special import gammaln, psi, multigammaln
from scipy._lib._util import check_random_state
__all__ = ['multivariate_normal',
... | larsmans/scipy | scipy/stats/_multivariate.py | Python | bsd-3-clause | 92,794 |
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
from pylearn2.testing.skip import skip_if_no_gpu
skip_if_no_gpu()
import numpy as np
from theano... | ml-lab/pylearn2 | pylearn2/sandbox/cuda_convnet/tests/test_weight_acts.py | Python | bsd-3-clause | 4,679 |
from django.test import SimpleTestCase
from corehq.apps.receiverwrapper.util import J2ME, guess_phone_type_from_user_agent, ANDROID
class TestPhoneType(SimpleTestCase):
def testJavaUserAgents(self):
corpus = [
# observed from c2 submission
'NokiaC2-01/5.0 (11.10) Profile/MIDP-2.1 ... | puttarajubr/commcare-hq | corehq/apps/receiverwrapper/tests/test_guess_phone_type.py | Python | bsd-3-clause | 14,799 |
from __future__ import absolute_import
from builtins import zip
from past.builtins import basestring
import itertools
from functools import reduce
import collections
from operator import attrgetter
from .validation import assert_no_duplicates
from ..exceptions import NineMLUsageError
from nineml.base import ContainerOb... | INCF/lib9ML | nineml/utils/iterables.py | Python | bsd-3-clause | 9,425 |
from tests.testing_framework.base_test_cases import BaseTestCase
from hamcrest import *
from flexmock import flexmock
from framework.http.requester import Requester
import re
class RequesterTests(BaseTestCase):
def before(self):
self.core_mock = flexmock()
self.core_mock.Config = flexmock()
... | sharad1126/owtf | tests/test_cases/framework/http/requester_tests.py | Python | bsd-3-clause | 2,784 |
from __future__ import absolute_import, division, print_function
from functools import partial
import numpy as np
import numpy.fft as npfft
from .core import map_blocks
chunk_error = ("Dask array only supports taking an FFT along an axis that \n"
"has a single chunk. An FFT operation was tried on ax... | pombredanne/dask | dask/array/fft.py | Python | bsd-3-clause | 2,467 |
import six
from sqlalchemy import types
from sqlalchemy_utils import i18n, ImproperlyConfigured
from sqlalchemy_utils.primitives import Currency
from .scalar_coercible import ScalarCoercible
class CurrencyType(types.TypeDecorator, ScalarCoercible):
"""
Changes :class:`.Currency` objects to a string represen... | spoqa/sqlalchemy-utils | sqlalchemy_utils/types/currency.py | Python | bsd-3-clause | 1,984 |
import os
import sys
from optparse import OptionParser
import matplotlib
matplotlib.use('PDF')
from matplotlib.backends.backend_pdf import PdfPages
from mirnylib.systemutils import setExceptionHook
sys.path.append(os.path.split(os.getcwd())[0])
from hiclib.binnedData import binnedData, binnedDataAnalysis,\
experi... | BauerLab/ngsane | tools/hiclibCorrelate.py | Python | bsd-3-clause | 13,472 |
from cms.utils.compat.dj import python_2_unicode_compatible
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin, Page
@python_2_unicode_compatible
class Link(CMSPlugin):
"""
A link to an other page or to an external website
"""
name = ... | SinnerSchraderMobileMirrors/django-cms | cms/plugins/link/models.py | Python | bsd-3-clause | 1,377 |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# :copyright: (c) 2014, Isis Lovecruft
# (c) 2014, The Tor Project, Inc.
# :license: 3-Clause BSD, see LICENSE for licensing information
from t... | pagea/bridgedb | lib/bridgedb/test/test_translations.py | Python | bsd-3-clause | 2,789 |
# !! WARNING !!
# Don't put any code here, because Sublime Text will load this file twice and
# it may cause unexpected behavior. Use _init_.py instead.
| guillermooo/dart-sublime-bundle | __init__.py | Python | bsd-3-clause | 153 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-NetGPO',
'Author': ['@harmj0y'],
'Description': ('Gets a list of all current GPOs in a domain. Part of PowerView.'),
'Background' : True,
... | Hackplayers/Empire-mod-Hackplayers | lib/modules/powershell/situational_awareness/network/powerview/get_gpo.py | Python | bsd-3-clause | 4,131 |
from .helper import IntegrationHelper
class TestGitHubIterator(IntegrationHelper):
def test_resets_etag(self):
cassette_name = self.cassette_name('resets_etag')
with self.recorder.use_cassette(cassette_name):
users_iter = self.gh.iter_all_users(number=10)
assert users_iter.... | adrianmoisey/github3.py | tests/integration/test_structs.py | Python | bsd-3-clause | 505 |
from pyquery import PyQuery as pq
from nose.tools import eq_
import amo.tests
from translations import models, widgets
class TestWidget(amo.tests.TestCase):
def test_avoid_purified_translation(self):
# Even if we pass in a LinkifiedTranslation the widget switches to a
# normal Translation before... | Joergen/zamboni | apps/translations/tests/test_widgets.py | Python | bsd-3-clause | 954 |
#
# Readout.py -- Readout for displaying image cursor information
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from ginga.gw import Widgets
from ginga.misc import Bu... | rajul/ginga | ginga/gw/Readout.py | Python | bsd-3-clause | 883 |
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2015 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
import struct
... | cyberpepe/pepecoin-core | src/contrib/linearize/linearize-hashes.py | Python | mit | 2,846 |
from launch_params import LaunchParamsMixin
from request_validator import (
RequestValidatorMixin,
FlaskRequestValidatorMixin,
DjangoRequestValidatorMixin,
WebObRequestValidatorMixin
)
from outcome_request import OutcomeRequest
from collections import defaultdict
import re
from urllib import urlencode
f... | tophatmonocle/ims_lti_py | ims_lti_py/tool_provider.py | Python | mit | 7,132 |
import cupy
# TODO(okuta): Implement asfarray
def asfortranarray(a, dtype=None):
"""Return an array laid out in Fortran order in memory.
Args:
a (~cupy.ndarray): The input array.
dtype (str or dtype object, optional): By default, the data-type is
inferred from the input data.
... | cemoody/chainer | cupy/manipulation/kind.py | Python | mit | 684 |
"""This file defines MIDI standard constants, which are useful for converting
between numeric MIDI data values and human-readable text.
"""
# INSTRUMENT_MAP[program_number] maps the program_number to an instrument name
INSTRUMENT_MAP = ['Acoustic Grand Piano', 'Bright Acoustic Piano',
'Electric Gran... | douglaseck/pretty-midi | pretty_midi/constants.py | Python | mit | 4,378 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : Victor Lin
# E-mail : linxianwusx@gmail.com
# Date : 15/02/04 19:59:23
#
import sae
import tornado.web
import shortuuid
import datetime
import time
import MySQLdb
import base64
applyTime = 30
def checkClientId(secureclientId):
try:
... | XianwuLin/vscan | server/linxianwu/1/handler/FreeQc.py | Python | mit | 4,195 |
# -*- coding: utf-8 -*-
"""
=================================
Wasserstein Discriminant Analysis
=================================
This example illustrate the use of WDA as proposed in [11].
[11] Flamary, R., Cuturi, M., Courty, N., & Rakotomamonjy, A. (2016).
Wasserstein Discriminant Analysis.
"""
# Author: Remi F... | aje/POT | examples/plot_WDA.py | Python | mit | 3,084 |
from backdoor import *
import os
class Windows(Backdoor):
prompt = Fore.RED + "(windows) " + Fore.BLUE + ">> " + Fore.RESET
def __init__(self, core):
cmd.Cmd.__init__(self)
self.intro = GOOD + "Using Windows module..."
self.core = core
self.options = {
"port" ... | krintoxi/NoobSec-Toolkit | NoobSecToolkit /scripts/sshbackdoors/backdoors/windows/windows.py | Python | gpl-2.0 | 1,540 |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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 2 of the License, or
# (at your o... | fengxiaoiie/volatility | volatility/plugins/linux/netscan.py | Python | gpl-2.0 | 4,373 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id$
"""
VirtualBox Validation Kit - CGI - Log out page.
"""
__copyright__ = \
"""
Copyright (C) 2012-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can red... | svn2github/vbox | src/VBox/ValidationKit/testmanager/cgi/logout.py | Python | gpl-2.0 | 2,233 |
from .csv import CSVCommPlugin
from .ros import ROSCommPlugin
plugin_map = {
"csv": CSVCommPlugin,
"csv_comm": CSVCommPlugin,
"ros": ROSCommPlugin,
"ros_comm": ROSCommPlugin
}
| davoclavo/openag_brain | src/openag_lib/firmware/plugins/__init__.py | Python | gpl-3.0 | 193 |
import os
BASEDIR = os.path.abspath(os.path.dirname(__file__))
# If BASE is https these has to be specified
SERVER_CERT = "%s/certificates/server.crt" % BASEDIR
SERVER_KEY = "%s/certificates/server.key" % BASEDIR
#CERT_CHAIN = None
CA_BUNDLE = None
VERIFY_SSL = False
| mokemokechicken/oictest_docker | example/etc/rp/sslconf.py | Python | gpl-3.0 | 271 |
#!/usr/bin/env python
########################################################################
# File : dirac-start-mysql
# Author : Ricardo Graciani
########################################################################
"""
Start DIRAC MySQL server
"""
__RCSID__ = "$Id$"
#
from DIRAC.Core.Base import Script
Scri... | Andrew-McNab-UK/DIRAC | Core/scripts/dirac-start-mysql.py | Python | gpl-3.0 | 776 |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os
import shutil
import mimetypes
from tornado import web
from .filecheckpoints import FileCheckpoints
from .fileio import File... | madelynfreed/rlundo | venv/lib/python2.7/site-packages/IPython/html/services/contents/filemanager.py | Python | gpl-3.0 | 16,487 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed... | dav1x/ansible | lib/ansible/modules/cloud/amazon/ec2_elb_lb.py | Python | gpl-3.0 | 53,260 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterf... | nrwahl2/ansible | lib/ansible/modules/cloud/amazon/sts_session_token.py | Python | gpl-3.0 | 5,043 |
#!/usr/bin/env python
"""Functions for calculating nucleotide coordinates"""
# Copyright 2010, 2011, 2012 Kevin Keating
#
# Licensed under the Educational Community 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
#
# h... | jlec/coot | rcrane/calcCoords.py | Python | gpl-3.0 | 77,459 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, IntoPIX SA
# Contact: support@intopix.com
# Author: Even Rouault
#
# 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 cod... | AlienCowEatCake/ImageViewer | src/ThirdParty/OpenJPEG/openjpeg-2.4.0/tests/profiling/filter_massif_output.py | Python | gpl-3.0 | 1,727 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import hashlib
import StringIO
import gzip
import web
import mock
from nose.tools import eq_, ok_
from datetime import ... | spthaolt/socorro | socorro/unittest/collector/test_wsgi_breakpad_collector.py | Python | mpl-2.0 | 17,622 |
"""
Tests of the instructor dashboard spoc gradebook
"""
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from six import text_type
from capa.tests.response_xml_factory import StringResponseXMLFactory
from courseware.tests.factories import StudentModuleFactory
from lms.djangoapps.grad... | hastexo/edx-platform | lms/djangoapps/instructor/tests/test_spoc_gradebook.py | Python | agpl-3.0 | 6,456 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CoreConfig(AppConfig):
name = "core"
verbose_name = _("Hosting Service Core")
| tejo-esperanto/pasportaservo | core/apps.py | Python | agpl-3.0 | 184 |
"""
Support to check for available updates.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/updater/
"""
import asyncio
import json
import logging
import os
import platform
import uuid
from datetime import timedelta
# pylint: disable=no-name-in-module, i... | alexmogavero/home-assistant | homeassistant/components/updater.py | Python | apache-2.0 | 6,075 |
# Copyright (c) 2015 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... | sebrandon1/neutron | neutron/cmd/ipset_cleanup.py | Python | apache-2.0 | 3,313 |
from openflow.optin_manager.sfa.util.sfalogging import logger
from openflow.optin_manager.sfa.util.xml import XpathFilter
from openflow.optin_manager.sfa.util.xrn import Xrn
from openflow.optin_manager.sfa.rspecs.elements.element import Element
from openflow.optin_manager.sfa.rspecs.elements.node import Node
from open... | dana-i2cat/felix | optin_manager/src/python/openflow/optin_manager/sfa/rspecs/elements/versions/sfav1Lease.py | Python | apache-2.0 | 4,499 |
# 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 u... | siddaartha/spork | bin/pig.py | Python | apache-2.0 | 13,326 |
# -*- coding: utf-8 -*-
import furl
import responses
import mock
from nose.tools import * # flake8: noqa (PEP8 asserts)
import unittest
from framework.auth import cas
from tests.base import OsfTestCase, fake
from osf_tests.factories import UserFactory
def make_successful_response(user):
return cas.CasResponse(... | erinspace/osf.io | tests/test_cas_authentication.py | Python | apache-2.0 | 14,414 |
# 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 applica... | tongwang01/tensorflow | tensorflow/contrib/learn/python/learn/estimators/linear_test.py | Python | apache-2.0 | 59,870 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
import io
__doc__ = ("Custom user model app for Django featuring email as username and"
" class-based views for authentication.")
def read(fname):
return io.open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8"... | vuchau/django-authtools | setup.py | Python | bsd-2-clause | 1,342 |
# python imports
import hotshot
import hotshot.stats
import sys
import tempfile
from cStringIO import StringIO
# django imports
from django.conf import settings
from django.http import HttpResponseServerError
class ProfileMiddleware(object):
"""
Displays hotshot profiling for any view.
http://yoursite.co... | pigletto/django-lfs | lfs/utils/middleware.py | Python | bsd-3-clause | 2,254 |
# coding: utf8
# try something like
try:
from gluon.contrib.pyfpdf import Template
except ImportError:
# import local module until we can update web2py...
Template = local_import('template').Template
raise
@auth.requires_membership(role="manager")
def speakers():
template_id = int(request.args... | bkahlerventer/web2congress | controllers/certificate.py | Python | bsd-3-clause | 2,022 |