code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Copyright 2018 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... | ghchinoy/tensorflow | tensorflow/python/eager/wrap_function_test.py | Python | apache-2.0 | 18,966 |
# Copyright 2009 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, ... | jimpick/jaikuengine | common/user.py | Python | apache-2.0 | 6,537 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | google-research/language | language/labs/memory/synthetic_dataset.py | Python | apache-2.0 | 7,696 |
# Copyright (c) 2011 Intel Corporation
# Copyright (c) 2011 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.... | ge0rgi/cinder | cinder/scheduler/filter_scheduler.py | Python | apache-2.0 | 29,487 |
# Copyright 2014 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 agre... | brettcannon/caniusepython3 | caniusepython3/test/test_check.py | Python | apache-2.0 | 2,493 |
#!/usr/bin/env python
#
# 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
# "... | jai1/pulsar | pulsar-functions/instance/src/main/python/util.py | Python | apache-2.0 | 2,346 |
"""ACME client API."""
import collections
import datetime
import heapq
import logging
import time
import six
from six.moves import http_client # pylint: disable=import-error
import OpenSSL
import requests
import sys
import werkzeug
from acme import errors
from acme import jose
from acme import jws
from acme import ... | twstrike/le_for_patching | acme/acme/client.py | Python | apache-2.0 | 23,969 |
from daiquiri.exceptions import DaiquiriException
class Data():
def __init__(self, connection, dryrun=False):
self.connection = connection
self.dryrun = dryrun
def fetch_databases(self):
response = self.connection.get('/data/databases/')
if response['status'] != 'ok':
... | aipescience/daiquiri-admin | daiquiri/data.py | Python | apache-2.0 | 2,181 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
import __builtin__
import __future__
import contextlib
import collections
from pathlib import Path, PurePath
from pywatchman import WatchmanError
from .deterministic_set i... | LegNeato/buck | python-dsl/buck_parser/buck.py | Python | apache-2.0 | 67,707 |
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file ex... | gridengine/config-api | test/test_parallel_environment.py | Python | apache-2.0 | 5,641 |
# Copyright (c) 2010 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | hurricanerix/swift | test/unit/common/middleware/test_staticweb.py | Python | apache-2.0 | 41,893 |
from __future__ import division
import number_range as n
import time
import Adafruit_PCA9685
import delays
MIN = 0
MAX = 180
# RPi code
# !/usr/bin/python
# Initialise the PWM device using the default address
pwm = Adafruit_PCA9685.PCA9685(0x41)
# Note if you'd like more debug output you can instead run:
# pwm = PWM... | jeryfast/piflyer | piflyer/servo_handler.py | Python | apache-2.0 | 5,739 |
# Copyright (c) 2018 PaddlePaddle 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
#
# Unlessf required by ap... | PaddlePaddle/Paddle | python/paddle/fluid/layers/tensor.py | Python | apache-2.0 | 67,174 |
# -*- coding: utf-8 -*-
"""Shared functions and classes for testing."""
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
class BaseTestCase(unittest.TestCase):
"""The base test case."""
_DATA_PATH = os.path.join(os.getcwd(), 'data')
_TEST_DATA_PATH = os.path.joi... | Onager/artifacts | tests/test_lib.py | Python | apache-2.0 | 1,770 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic list exercises
# Fill in the code for the functions below. main() is already set ... | KevinHanson/google-python | basic/list1.py | Python | apache-2.0 | 3,962 |
from setuptools import setup
setup(
name='dreaml',
version='0.0.7',
author = 'Zico Kolter, Eric Wong, Terrence Wong',
author_email = 'zkolter@cs.cmu.edu, ericwong@cs.cmu.edu, tw@andrew.cmu.edu',
packages = ['dreaml',
'dreaml.dataframe',
'dreaml.loss',... | locuslab/dreaml | setup.py | Python | apache-2.0 | 710 |
def bloup(n):
for i in xrange(0,n):
print "%s pikachu lol %d soup soup" % (" "*(i%10), i)
bloup(666)
| refnil/CS_Game_Practice | test.py | Python | apache-2.0 | 121 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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... | tseaver/google-cloud-python | phishingprotection/google/cloud/phishingprotection_v1beta1/__init__.py | Python | apache-2.0 | 1,064 |
# 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/bayesflow/examples/reinforce_simple/reinforce_simple_example.py | Python | apache-2.0 | 5,012 |
from django.db import models
class YankUser(models.Model):
username = models.CharField(max_length=98, unique=True)
password_digest = models.CharField(max_length=128)
api_key = models.CharField(max_length=128, null=True)
| yank-team/yank-server | auth/models.py | Python | apache-2.0 | 248 |
#!/usr/bin/env python
"""
loadSolexa.py
Author: Tony Papenfuss
Date: Tue Jun 24 14:27:34 EST 2008
"""
import os, sys
from maq import *
from useful import progressMessage
oFilename = 'tmp/PlatySolexa.txt'
if not os.path.exists(oFilename):
oFile = open(oFilename, 'w')
dataDir = '/Users/papenfuss/databa... | PapenfussLab/Srtools | bin/old/loadSolexa.py | Python | artistic-2.0 | 796 |
#
# Copyright (C) 2009-2013 Vinay Sajip. See LICENSE.txt for details.
#
import logging.handlers
import re
import sys
try:
basestring
except NameError:
basestring = str
try:
StandardError
except NameError:
StandardError = Exception
IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I)
def valid_ident(s... | cherry-hyx/hjb-test | pluginsAgent/RichAPM/packages/dictconfig.py | Python | artistic-2.0 | 22,792 |
#===============================================================
# DMXIS Macro (c) 2010 db audioware limited
#===============================================================
RgbColour(0,100,0)
| rec/DMXIS | Macros/Colours/Greens/Dark Green.py | Python | artistic-2.0 | 199 |
"""
WSGI config for d3matt project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "d3matt.settings")
from django.core.wsg... | d3matt/d3matt.com | src/d3matt/d3matt/wsgi.py | Python | bsd-2-clause | 387 |
class base(object):
proc = dict
pagesize = pow(2, 12)
arch = None
# and other host-specific attributes
def __init__(self, **kwds):
pass
def __getitem__(self, processid):
return self.proc[processid]
def list(self):
pass
def create(self, executable, args, env=[]... | arizvisa/syringe | lib/mpdebug/default/host.py | Python | bsd-2-clause | 491 |
from django.core import management
from ._utils import AstaporCommand
class Command(AstaporCommand):
help = 'Call other commands in sequence to perform the full data import and initial processing.'
def add_arguments(self, parser):
parser.add_argument('specimen_csv_file')
parser.add_argument(... | BelgianBiodiversityPlatform/Astapor | website/specimens/management/commands/full_import.py | Python | bsd-2-clause | 792 |
#!/usr/bin/env python
#
# Generate test and training lists of absolute paths to files within
# subdirectories for a given top level directory. Each test path is randomly
# selected for a given input directory. The test and training paths are written
# out to separate files.
#
import os
import sys
import random
i... | wjbeksi/rgbd-covariance-descriptors | utilities/generate_random_paths.py | Python | bsd-2-clause | 932 |
# Copyright (c) 2014-2015, Doug Kelly
# 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... | vangdfang/conspace-register | admin.py | Python | bsd-2-clause | 14,624 |
"""
Turbulence
==========
Turbulence in the atmosphere affects wave propagation.
This module contains implementations of models that can be used to create random turbulence fields.
References are made to the book 'Computational Atmospheric Acoustics' by 'Erik M. Salomons', published in 2001.
================
Abs... | FRidh/turbulence | turbulence/turbulence.py | Python | bsd-2-clause | 32,642 |
"""
Preprocess
----------
"""
import numpy as np
import sklearn.preprocessing as skl_preprocessing
import bottlechest
import Orange.data
from . import impute, discretize
from ..misc.enum import Enum
__all__ = ["Continuize", "Discretize", "Impute", "SklImpute"]
def is_continuous(var):
return isinstance(var, Ora... | qusp/orange3 | Orange/preprocess/preprocess.py | Python | bsd-2-clause | 6,516 |
import maya.cmds as cm
import maya.mel as mm
import pymel.core as pm
try:
from PySide2 import QtWidgets, QtCore, QtGui
except ImportError:
from PySide import QtCore, QtGui
QtWidgets = QtGui
# Get Maya Main Window
mayaMainWindow = pm.ui.Window('MayaWindow').asQtObject()
# Wrapper
SIGNAL = QtCore.Signal
# UI... | josephkirk/PipelineTools | main/qtui.py | Python | bsd-2-clause | 2,163 |
# Copyright (c) Citrix Systems Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions a... | xenserver/auto-cert-kit | autocertkit/operations_tests.py | Python | bsd-2-clause | 13,353 |
import pprint
def period_ns(freq):
return 1e9/freq
def csr_map_update(csr_map, csr_peripherals):
csr_map.update(dict((n, v)
for v, n in enumerate(csr_peripherals, start=(max(csr_map.values()) + 1) if csr_map else 0)))
def csr_map_update_print(csr_map, csr_peripherals):
print()
print("-"*75... | mithro/HDMI2USB-litex-firmware | targets/utils.py | Python | bsd-2-clause | 1,695 |
#------------------------------------------------------------------------
# Terms
#------------------------------------------------------------------------
class ATerm(object):
def __init__(self, term, annotation=None):
self.term = term
self.annotation = annotation
def __str__(self):
... | seibert/blaze-core | blaze/aterm/terms.py | Python | bsd-2-clause | 3,957 |
"""
Common OpenGL functionality.
"""
from OpenGL import GL
import rave.log
from .math import ortho, identity
from .versions import get_version_range
def dump_info(context):
context.make_current()
_log('OpenGL context: {profile} {major}.{minor}', profile=context.profile, major=context.major, minor=context.mino... | rave-engine/rave | modules/opengl/common/__init__.py | Python | bsd-2-clause | 648 |
# everything is comming from https://github.com/dirkjanm/CVE-2020-1472
# credit to @dirkjanm
# module by : @mpgn_x64
import sys
from impacket.dcerpc.v5 import nrpc, epm
from impacket.dcerpc.v5.dtypes import NULL
from impacket.dcerpc.v5 import transport
from impacket import crypto
import hmac, hashlib, struct, sys, soc... | byt3bl33d3r/CrackMapExec | cme/modules/zerologon.py | Python | bsd-2-clause | 3,386 |
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
from elopic.data.elopicdb import EloPicDB, EloPicDBError
from elopic.logic.elo import INITIAL_ELO_SCORE
from tests.utils import copy_all_files, delete_files_matching_pattern
class TestDatabase(unittest.TestCase):
"""... | mmanhertz/elopic | tests/test_db.py | Python | bsd-2-clause | 3,055 |
from typing import List, Dict, TYPE_CHECKING
from string import digits as ascii_digits
import logging
import math
import claripy
from ... import sim_type
from ...sim_procedure import SimProcedure
from ...storage.file import SimPackets
if TYPE_CHECKING:
from angr.sim_type import SimType
l = logging.getLogger(nam... | angr/angr | angr/procedures/stubs/format_parser.py | Python | bsd-2-clause | 27,862 |
#!/usr/bin/env python
# Copyright (c) 2016 The aionotify project
# This code is distributed under the two-clause BSD License.
import codecs
import os
import re
import sys
from setuptools import setup
root_dir = os.path.abspath(os.path.dirname(__file__))
def get_version(package_name):
version_re = re.compile(r"... | rbarrois/aionotify | setup.py | Python | bsd-2-clause | 1,579 |
import funk
from funk import expects
from funk import allows
from funk.tools import assert_that
import funk.matchers as m
from abuse.generate import RuleSet
from abuse.generate import NonTerminal
from abuse.parse import parse
from abuse.parse import MissingArrow
from abuse.parse import MissingClosingBrace
from abuse.p... | mwilliamson/abuse | python/test/abuse/test_parse.py | Python | bsd-2-clause | 5,846 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ngw', '0009_config_eventdefaultperms'),
]
operations = [
migrations.DeleteModel(
name='ChoiceContactField',
),
... | nirgal/ngw | core/migrations/0010_auto_drop_proxy_models.py | Python | bsd-2-clause | 1,407 |
"""
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.
Written (W) 2013 Heiko Strathmann
Written (W) 2013 Dino Sejdinovic
"""
fro... | karlnapf/kameleon-mcmc | kameleon_mcmc/tools/Visualise.py | Python | bsd-2-clause | 5,656 |
from wheelcms_axle.content import Content, FileContent, ImageContent
from wheelcms_axle.spoke import Spoke, action, FileSpoke
from wheelcms_axle.content import type_registry
from django.db import models
class Type1(Content):
t1field = models.TextField(null=True, blank=True)
class Type1Type(Spoke):
model = T... | wheelcms/wheelcms_axle | wheelcms_axle/tests/models.py | Python | bsd-2-clause | 2,181 |
# -*- coding: utf-8 -*-
from .context import fredlibs
import unittest
class AdvancedTestSuite(unittest.TestCase):
"""Advanced test cases."""
def test_thoughts(self):
self.assertIsNone(fredlibs.main())
if __name__ == '__main__':
unittest.main()
| azafred/fredlibs | tests/test_advanced.py | Python | bsd-2-clause | 271 |
import simuvex
class UserHook(simuvex.SimProcedure):
NO_RET = True
# pylint: disable=arguments-differ
def run(self, user_func=None, user_kwargs=None, default_return_addr=None, length=None):
result = user_func(self.state, **user_kwargs)
if result is None:
self.add_successor(self... | chubbymaggie/simuvex | simuvex/procedures/stubs/UserHook.py | Python | bsd-2-clause | 527 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import... | jmcnamara/XlsxWriter | xlsxwriter/test/worksheet/test_worksheet09.py | Python | bsd-2-clause | 4,659 |
from datetime import date, timedelta
from sys import argv
class TrainWeeks(object):
def __init__(self, month, day, year, nr_weeks=16, nr_days=0):
self._race = date(year, month, day)
self._duration = timedelta(weeks=nr_weeks, days=nr_days)
self._start = self._race - self._duration + timedelt... | henglinyang/Pace | TrainWeeks.py | Python | bsd-2-clause | 1,931 |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc.
# 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,
... | apyrgio/snf-ganeti | lib/watcher/state.py | Python | bsd-2-clause | 6,797 |
#!/usr/bin/env python3
from flask import Flask, url_for, render_template, make_response, request
from recipe import Recipe
from sources.allrecipes import AllRecipesSource
from average import average
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/recipe/search/<te... | kkelk/MeanRecipes | meanrecipes/__main__.py | Python | bsd-2-clause | 832 |
import numpy as np
import alg3dpy
class Elements(object):
__slots__ = [ 'id', 'model', 'xvec', 'yvec', 'zvec', 'mask', 'tmp', \
'grids', 'cg', 'pobj', 'entryclass', 'card', 'panel' ]
def __init__(self):
self.grids = []
self.mask = False
self.panel = None
def reb... | saullocastro/mapy | mapy/model/elements/__init__.py | Python | bsd-2-clause | 3,526 |
from django.contrib import admin
from models import *
admin.site.register(Section) | igudym/twango | twango/template/default/src/apps/twango_dashboard/admin.py | Python | bsd-3-clause | 83 |
#
# Andrei Korostelev <andrei at korostelev dot net>
#
# Before using this product in any way please read the license agreement.
# If you do not agree to the terms in this agreement you are not allowed
# to use this product or parts of it. You can read this license in the
# file named LICENSE.
#
"""
CcPy project ... | kindkaktus/CcPy | ccpy/ccpyconfparser.py | Python | bsd-3-clause | 9,656 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = [
os.path.join(BASE_DIR, 'tests'),
os.path.join(BASE_DIR, 'tri_form/templates'),
]
TEMPLATE_DEBUG = True
# Django >=1.9
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': TEM... | TriOptima/tri.form | tests/settings.py | Python | bsd-3-clause | 710 |
import os
from unittest import mock
from django.utils.timezone import datetime, timedelta
from django.core.files.base import ContentFile
from django.core.exceptions import ValidationError
from django.conf import settings
from test_plus.test import TestCase
from ..models import Chart
class TestChart(TestCase):
de... | frRoy/Benchmarklib | benchmarklib/charts/tests/test_models.py | Python | bsd-3-clause | 1,543 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from yepes.contrib.registry import Registry
from yepes.contrib.registry.fields import *
registry = Registry(namespace='core')
registry.register(
'ALLOWED_SUBDOMAINS',
CommaSeparatedField(
... | samuelmaudo/yepes | yepes/registry.py | Python | bsd-3-clause | 2,951 |
# -*- coding: utf-8 -*-
__author__ = 'Agam Dua'
__email__ = 'agam@comfylabs.io'
__version__ = '0.1.0' | agamdua/burrow | burrow/__init__.py | Python | bsd-3-clause | 102 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Httpie(PythonPackage):
"""Modern, user-friendly command-line HTTP client for the API era."... | jakubroztocil/httpie | docs/packaging/spack/package.py | Python | bsd-3-clause | 1,904 |
# proxy module
from __future__ import absolute_import
from envisage.developer.developer_plugin import *
| enthought/etsproxy | enthought/envisage/developer/developer_plugin.py | Python | bsd-3-clause | 104 |
import pyaf.Bench.web_traffic.Forecaster as fo
PROJECTS = ['en.wikipedia.org']
data_dir = 'data/web-traffic-time-series-forecasting'
lForecaster = fo.cProjectForecaster()
lForecaster.mDataDirectory = data_dir
lForecaster.mBackendName = 'pyaf_hierarchical_top_down'
lForecaster.mKeysFileName = 'key_1.csv.zip'
last_da... | antoinecarme/pyaf | tests/bench/web_traffic_jobs/en.wikipedia.org/test_web_traffic_en.wikipedia.org_pyaf_hierarchical_top_down.py | Python | bsd-3-clause | 447 |
import matplotlib.pyplot as plt
import pytest
import seaborn as sns
class TestPlotterMixin(object):
pass
class TestScatterPlotter(object):
pass
@pytest.fixture
def iris(self):
return sns.load_dataset('iris')
def test_scatterplots(self, iris):
"""Smoke test of high level scatterp... | olgabot/cupcake | cupcake/tests/test_scatter.py | Python | bsd-3-clause | 712 |
from django.db.backends import BaseDatabaseIntrospection
import pyodbc as Database
import types
import datetime
import decimal
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Map type codes to Django Field types.
data_types_reverse = {
types.StringType: 'TextField',
type... | msabramo/django-netezza | netezza/pyodbc/introspection.py | Python | bsd-3-clause | 4,001 |
import logging
from django.db.models.signals import post_init, post_save, post_delete
from django_snailtracker.models import (snailtracker_post_init_hook,
snailtracker_post_save_hook, snailtracker_post_delete_hook)
from django_snailtracker.helpers import snailtracker_enabled
from django_snailtracker.sites imp... | aquametalabs/django-snailtracker | django_snailtracker/utils.py | Python | bsd-3-clause | 965 |
# -*- coding: utf-8 -*-
"""
Module for automatically serving /api-docs* via Pyramid.
"""
from __future__ import absolute_import
import copy
import os.path
import simplejson
import yaml
from bravado_core.spec import strip_xscope
from six.moves.urllib.parse import urlparse
from six.moves.urllib.parse import urlunparse
... | striglia/pyramid_swagger | pyramid_swagger/api.py | Python | bsd-3-clause | 10,269 |
"""Application base, containing global templates."""
default_app_config = 'pontoon.base.apps.BaseConfig'
MOZILLA_REPOS = (
'ssh://hg.mozilla.org/users/m_owca.info/firefox-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-aur... | vivekanand1101/pontoon | pontoon/base/__init__.py | Python | bsd-3-clause | 561 |
# Copyright (c) 2011-2012, 30loops.net
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of condition... | 30loops/libthirty | libthirty/base.py | Python | bsd-3-clause | 3,588 |
import logging
from django.core.management.base import BaseCommand
from django.db import connection
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""
Textquestions for surveys need to be modified after loading the fixture
as they contain an instance dependant polymorphic content id
... | rackerlabs/django-DefectDojo | dojo/management/commands/migrate_textquestions.py | Python | bsd-3-clause | 900 |
# encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | enthought/distarray | distarray/localapi/format.py | Python | bsd-3-clause | 11,157 |
from setuptools import setup
__version__ = "0.5.0"
# Get the long description by reading the README
try:
readme_content = open("README.md").read()
except:
readme_content = ""
# Create the actual setup method
setup(name='pypred',
version=__version__,
description='A Python library for simple evaluat... | armon/pypred | setup.py | Python | bsd-3-clause | 1,228 |
import pytest
from unittest.mock import patch
from case import mock
from kombu import Connection
class test_get_manager:
@mock.mask_modules('pyrabbit')
def test_without_pyrabbit(self):
with pytest.raises(ImportError):
Connection('amqp://').get_manager()
@mock.module_exists('pyrabbi... | ZoranPavlovic/kombu | t/unit/utils/test_amq_manager.py | Python | bsd-3-clause | 1,196 |
import warnings
from random import randint
from unittest import TestCase
from .models import (
ColumnFamilyTestModel,
ColumnFamilyIndexedTestModel,
ClusterPrimaryKeyModel,
ForeignPartitionKeyModel,
DictFieldModel
)
from .util import (
connect_db,
destroy_db,
create_model
)
class Colu... | Knotis/djangocassandra | tests/test_columnfamily.py | Python | bsd-3-clause | 6,473 |
"""Cement testing utilities."""
import unittest
from tempfile import mkstemp, mkdtemp
from ..core import backend, foundation
from ..utils.misc import rando
# shortcuts
from nose import SkipTest
from nose.tools import ok_ as ok
from nose.tools import eq_ as eq
from nose.tools import raises
from nose.plugins.attrib imp... | rjdp/cement | cement/utils/test.py | Python | bsd-3-clause | 2,208 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
from .estestcase import ESTestCase
from pyes.facets import DateHistogramFacet
from pyes.filters import TermFilter, RangeFilter
from pyes.query import FilteredQuery, MatchAllQuery, Search
from pyes.utils import ESRange
import datetime
class ... | Yelp/pyes | tests/test_facets.py | Python | bsd-3-clause | 6,193 |
import logging
import time
from typing import Optional, Final, Any
import numpy as np
from PyQt5 import QtWidgets, QtGui, QtCore
from matplotlib.axes import Axes
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT, FigureCanvasQTAgg
from matplotlib.figure import Figure
from matplotlib.lines import Line... | awacha/cct | cct/qtgui2/measurement/monitor/monitor.py | Python | bsd-3-clause | 17,577 |
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 = "ConstantTrend", cycle_length = 5, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Integration/trend_ConstantTrend/cycle_5/ar_12/test_artificial_1024_Integration_ConstantTrend_5_12_20.py | Python | bsd-3-clause | 272 |
"""Provides Django-Admin form field."""
# coding=utf-8
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import Field, ValidationError
from tempo.django.widgets import RecurrentEventSetWidget
from tempo.recurrenteventset import RecurrentEventSet
class RecurrentEventSetField(Field):
... | AndrewPashkin/python-tempo | src/tempo/django/forms.py | Python | bsd-3-clause | 859 |
import torch
from .module import Module
from torch.nn.parameter import Parameter
from .. import functional as F
# TODO: check contiguous in THNN
# TODO: use separate backend functions?
class _BatchNorm(Module):
def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=True):
super(_BatchNorm, self)... | RPGOne/Skynet | pytorch-master/torch/nn/modules/batchnorm.py | Python | bsd-3-clause | 6,848 |
"""
Template tags for Offsite payment gateways
"""
from django import template
from billing.templatetags.paypal_tags import paypal
from billing.templatetags.world_pay_tags import world_pay
from billing.templatetags.google_checkout_tags import google_checkout
from billing.templatetags.amazon_fps_tags import amazon_fps
f... | SimpleTax/merchant | billing/templatetags/billing_tags.py | Python | bsd-3-clause | 740 |
from __future__ import print_function
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchv... | bmccann/examples | dcgan/main.py | Python | bsd-3-clause | 9,656 |
#!/usr/bin/env python
import roslib; roslib.load_manifest('ar_slam_base')
import rospy
from std_msgs.msg import Float64,Float32
from sensor_msgs.msg import JointState
from geometry_msgs.msg import PointStamped
import tf
import numpy
import message_filters
from ar_slam_base.mapping_kf import *
from ar_track_alvar_msg... | cedricpradalier/vrep_ros_ws | src/ar_slam_base/nodes/rover_mapping.py | Python | bsd-3-clause | 6,109 |
# Copyright 2020 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.
"""Methods related to outputting script results in a human-readable format.
Also probably a good example of how to *not* write HTML.
"""
from __future__ imp... | nwjs/chromium.src | testing/unexpected_passes_common/result_output.py | Python | bsd-3-clause | 21,925 |
import pytest
from pupa.scrape import Membership as ScrapeMembership
from pupa.scrape import Person as ScrapePerson
from pupa.importers import MembershipImporter, PersonImporter, OrganizationImporter
from pupa.exceptions import NoMembershipsError
from opencivicdata.core.models import Organization, Post, Person, Divisio... | opencivicdata/pupa | pupa/tests/importers/test_membership_importer.py | Python | bsd-3-clause | 8,414 |
# encoding: utf8
from django.db import models, migrations
def copy_manualness(apps, schema_editor):
Transaction = apps.get_model("argus", "Transaction")
fractions = Transaction.objects.filter(split='manual',
share__fraction_is_manual=True)
fractions.update(split=... | littleweaver/django-argus | argus/migrations/0006_auto_20140310_1718.py | Python | bsd-3-clause | 1,256 |
from django.contrib import admin
from .models import Gallery
class GalleryAdmin(admin.ModelAdmin):
list_display = ('title', 'gallery_image', 'alt_text', 'display_order', 'visibility')
search_fields = ['title', 'alt_text']
admin.site.register(Gallery, GalleryAdmin) | zacherytapp/wedding | weddingapp/apps/gallery/admin.py | Python | bsd-3-clause | 269 |
"""
Created on Oct 5, 2012
@author: nigel
"""
from dc24_ingester_platform.utils import format_timestamp, parse_timestamp
from dc24_ingester_platform.service import BaseRepositoryService
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, DECIMAL, Boolean, ForeignKey,... | jcu-eresearch/TDH-dc24-ingester-platform | dc24_ingester_platform/service/repodb.py | Python | bsd-3-clause | 13,401 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | colinbrislawn/scikit-bio | skbio/sequence/_iupac_sequence.py | Python | bsd-3-clause | 16,530 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
def solve_it(input_data):
# return a positive integer, as a string
return '10'
if __name__ == '__main__':
print('This script submits the integer: %s\n' % solve_it(''))
| kastnerkyle/discrete-opt | week1/solver.py | Python | bsd-3-clause | 225 |
"""
Two diode model equations.
"""
import numpy as np
from pvmismatch.contrib.gen_coeffs import diode
def fdidv(isat1, isat2, rs, rsh, ic, vc, vt):
"""
Derivative of IV curve and its derivatives w.r.t. Isat1, Isat2, Rs, Rsh, Ic,
Vc and Vt.
:param isat1: diode 1 saturation current [A]
:param isat... | SunPower/PVMismatch | pvmismatch/contrib/gen_coeffs/two_diode.py | Python | bsd-3-clause | 11,016 |
# -*- coding: utf-8 -*-
import os
from django import forms
from django.conf import settings
from django.db.models import Q
from django.forms.models import BaseModelFormSet, modelformset_factory
from django.utils.functional import cached_property
from django.utils.safestring import mark_safe
from django.utils.translati... | harry-7/addons-server | src/olympia/devhub/forms.py | Python | bsd-3-clause | 33,216 |
import logging
import sys
from collections import namedtuple
import numpy as np
import pandas as pd
from scipy.stats import chisquare
from . import categorizer as cat
from . import draw
from .ipf.ipf import calculate_constraints
from .ipu.ipu import household_weights
logger = logging.getLogger("synthpop")
FitQuality... | hanase/synthpop | synthpop/synthesizer.py | Python | bsd-3-clause | 5,123 |
"""Unit tests for strunk_white_eos."""
# from __future__ import absolute_import
# from .check import Check
# from proselint.checks.strunkwhite import elementary_composition as chk
# class TestCheck(Check):
# """Define the suite of checks."""
# __test__ = True
# @property
# def this_check(self):
# ... | jstewmon/proselint | tests/test_strunk_white_eos.py | Python | bsd-3-clause | 707 |
"""Python STIX2 FileSystem Source/Sink"""
import errno
import io
import json
import os
import re
import stat
from stix2 import v20, v21
from stix2.base import _STIXBase
from stix2.datastore import (
DataSink, DataSource, DataSourceError, DataStoreMixin,
)
from stix2.datastore.filters import Filter, FilterSet, appl... | oasis-open/cti-python-stix2 | stix2/datastore/filesystem.py | Python | bsd-3-clause | 28,607 |
from django.contrib.auth.models import User
from funfactory.urlresolvers import reverse
from nose.tools import eq_, ok_
from airmozilla.main.models import Event, EventOldSlug
from airmozilla.comments.models import Discussion
from airmozilla.base.tests.testbase import DjangoTestCase
class TestEventDiscussion(DjangoT... | Nolski/airmozilla | airmozilla/main/tests/views/test_eventdiscussion.py | Python | bsd-3-clause | 4,385 |
"""Tasks for invoke."""
from invoke import task, run
@task
def test():
run('./setup.py test --quick')
@task
def fulltest():
run('./setup.py test')
@task
def coverage():
run('./setup.py test', hide='stdout')
run('coverage html')
| beregond/jsonmodels | tasks.py | Python | bsd-3-clause | 251 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('epicrisis', '0002_auto_20150510_1155'),
]
operations = [
migrations.AlterField(
model_name='epicrisis',
... | btenaglia/hpc-historias-clinicas | hpc-historias-clinicas/epicrisis/migrations/0003_auto_20150510_1157.py | Python | bsd-3-clause | 469 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity 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
# au... | sebest/pystash | docs/conf.py | Python | bsd-3-clause | 8,370 |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
from __future__ import unicode_literals
import logging
import re
import string
from django.conf import settings
from django.core.urlresolvers import get_callable
from... | jyotsna1820/django | django/middleware/csrf.py | Python | bsd-3-clause | 12,394 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Andi Albrecht, albrecht.andi@gmail.com
#
# This module is part of python-sqlparse and is released under
# the BSD License: https://opensource.org/licenses/BSD-3-Clause
import itertools
import re
from collections import deque
from contextlib import contextmanager
from sqlp... | zorroz/microblog | flask/lib/python2.7/site-packages/sqlparse/utils.py | Python | bsd-3-clause | 3,484 |
import calendar
from bs4 import BeautifulSoup
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from django.conf import settings
from django.http import Http404
from django.core.cache import caches
from django.contrib.contenttypes.models import ContentType
from wagtail.core.... | PARINetwork/pari | article/views.py | Python | bsd-3-clause | 8,919 |
import pytest
from sqlcomplete.parseutils.tables import extract_tables
from sqlcomplete.parseutils.utils import find_prev_keyword, is_open_quote
def test_empty_string():
tables = extract_tables('')
assert tables == ()
def test_simple_select_single_table():
tables = extract_tables('select * from abc')
... | dbcli/sqlcomplete | tests/parseutils/test_parseutils.py | Python | bsd-3-clause | 8,627 |
from concurrent.futures import ThreadPoolExecutor
import importlib
import logging
from numbers import Number
from operator import add
import os
import psutil
import sys
from time import sleep
import traceback
import asyncio
import dask
from dask import delayed
from dask.utils import format_bytes
from dask.system impor... | blaze/distributed | distributed/tests/test_worker.py | Python | bsd-3-clause | 46,667 |