code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# Copyright 2019 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,... | google/personfinder | tests/views/test_admin_global_index.py | Python | apache-2.0 | 6,931 |
#!/usr/bin/env python3
from GModServer import Variables
import os
def StartGarrysModServer(steanApiAuthKey=Variables.SteamApiAuthKey, steamWorkShopID=Variables.SteamWorkShopId,
serverGamemode=Variables.ServerGamemode, serverDefaultMap=Variables.ServerDefaultMap,
serve... | Kloenk/GarrysModserver | GModServer/StartServer.py | Python | apache-2.0 | 1,006 |
import keras | jadsonjs/DataScience | DeepLearning/keras/hello_world.py | Python | apache-2.0 | 12 |
# Copyright 2014 Cloudbase Solutions Srl
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | saeki-masaki/cinder | cinder/tests/unit/test_smbfs.py | Python | apache-2.0 | 25,862 |
import sys
import logging
import pexpect
class Session(object):
NO_SESSION = 1
SESSION_AVAILABLE = 2
PRIVILEDGE_MODE = 3
CONFIGURATION_MODE = 4
def __init__(self, hostname, username='', password='', enable_username='', enable_password=''):
''' Sets up configuration to be transfered '''
... | pjimmybrcd/campus_ztp_nps | actions/lib/Session.py | Python | apache-2.0 | 12,262 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/django_coverage_plugin/blob/master/NOTICE.txt
"""
Pytest auto configuration.
This module is run automatically by pytest, to define and enable fixtures.
"""
import re
import warnings
import django... | nedbat/django_coverage_plugin | tests/conftest.py | Python | apache-2.0 | 1,344 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import pkg... | tejal29/pants | src/python/pants/backend/jvm/tasks/eclipse_gen.py | Python | apache-2.0 | 6,935 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-channel | google/cloud/channel_v1/types/channel_partner_links.py | Python | apache-2.0 | 3,498 |
import re
class Solution:
def isPalindrome(self, s: str) -> bool:
ret = re.findall(r'[\da-zA-Z]+', s)
final = ''.join(ret).lower()
return final == final[::-1]
| fy0/my-leetcode | 125. Valid Palindrome/main.py | Python | apache-2.0 | 188 |
# -*- coding: utf-8 -*-
class AutocompleteMeta:
"""
Simple meta class to allow the model to define aspects of the autocomplete.
:var name: used for the named url
:var path: the path to autocomplete view
:var follow_fks: when searching should ForeignKey fields be followed.
:var fields: list of... | darrylcousins/django-autocomplete | django_autocomplete/meta.py | Python | apache-2.0 | 1,979 |
# coding=utf-8
# Copyright 2020 The PI-SAC 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 applicable law or... | google-research/pisac | pisac/tanh_normal_projection_network.py | Python | apache-2.0 | 5,102 |
"""Model for an access log."""
import functools
import logging
import numpy as np
from django.conf import settings
from django.db import models
from django.utils import timezone
logger = logging.getLogger(__name__)
class AccessLogMixin(models.Model):
"""Base class which logs access of information."""
# The ... | auvsi-suas/interop | server/auvsi_suas/models/access_log.py | Python | apache-2.0 | 4,701 |
import numpy as np
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.tf.misc import normc_initializer
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.torch.misc import SlimFC, normc_initializer as \
torch_normc_initializer
from ray.rllib.models.torch.torch_modelv2 import... | richardliaw/ray | rllib/examples/models/batch_norm_model.py | Python | apache-2.0 | 7,538 |
# -*- coding: utf-8 -*-
# Copyright 2015-2019 grafana-dashboard-builder contributors
#
# 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 ... | jakubplichta/grafana-dashboard-builder | grafana_dashboards/exporter.py | Python | apache-2.0 | 3,057 |
#!/usr/bin/python
import os
import sys
extra_opts = {'test_suite': 'tests'}
extra_deps = []
extra_test_deps = []
if sys.version_info[:2] == (2, 6):
extra_deps.append('argparse')
extra_deps.append('simplejson')
extra_test_deps.append('unittest2')
extra_opts['test_suite'] = 'unittest2.collector'
try:
... | agilemobiledev/mongo-orchestration | setup.py | Python | apache-2.0 | 2,438 |
import decimal
import json
from datetime import date, datetime, time
import dateutil.parser
from django.conf import settings
from django.db.models import Model
from versions.models import Versionable
DEFAULTS = {
'user_mail_required': {
'default': 'False',
'type': bool
},
'max_items_per_or... | lab2112/pretix | src/pretix/base/settings.py | Python | apache-2.0 | 7,483 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | UManPychron/pychron | pychron/pipeline/plot/plotter/arar_figure.py | Python | apache-2.0 | 24,577 |
# Copyright 2016 Matthew Egan Odendahl
#
# 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 wr... | gilch/drython | drython/expression.py | Python | apache-2.0 | 13,683 |
# This file is part of the GBI project.
# Copyright (C) 2015 Omniscale GmbH & Co. KG <http://omniscale.com>
#
# 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/licens... | omniscale/gbi-server | app/gbi_server/search/__init__.py | Python | apache-2.0 | 654 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import warnings
from builtins import object, str
from contextlib import contextmanager
i... | twitter/pants | tests/python/pants_test/base/test_deprecated.py | Python | apache-2.0 | 7,818 |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/prop/nsr/uks.py | Python | apache-2.0 | 2,350 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the storage file CLI arguments helper."""
import argparse
import unittest
from plaso.cli import tools
from plaso.cli.helpers import storage_file
from plaso.lib import errors
from tests.cli import test_lib as cli_test_lib
class StorageFileArgumentsHelperTe... | Onager/plaso | tests/cli/helpers/storage_file.py | Python | apache-2.0 | 1,615 |
import datetime
import json
import re
from unittest import mock
import pytest
from multidict import CIMultiDict
from aiohttp import hdrs, signals
from aiohttp.protocol import (HttpVersion, HttpVersion10, HttpVersion11,
RawRequestMessage)
from aiohttp.web import (ContentCoding, Request, R... | mind1master/aiohttp | tests/test_web_response.py | Python | apache-2.0 | 26,418 |
__author__ = 'asifj'
import logging
from kafka import KafkaConsumer
import json
import traceback
from bson.json_util import dumps
from kafka import SimpleProducer, KafkaClient
from utils import Utils
logging.basicConfig(
format='%(asctime)s.%(msecs)s:%(name)s:%(thread)d:%(levelname)s:%(process)d:%(me... | asifhj/Python_SOAP_OSSJ_SAP_Fusion_Kafka_Spark_HBase | KafkaCP.py | Python | apache-2.0 | 2,510 |
#!/usr/bin/env finemonkeyrunner
# -*- coding:utf8 -*-
import sys
sys.path.append(r'D:\learning\python\auto\fineMonkeyRunner')
from com.fine.android.finemonkeyrunner import fineMonkeyRunner
# 导入包路径,否则找不到 ---注意
#sys.path.append(r'C:\Users\wangxu\AppData\Local\Android\sdk\tools\testscript')
#sys.path.append(r'D:\learning... | william5065/fineMonkeyRunner | test.py | Python | apache-2.0 | 1,099 |
#!/usr/bin/python
#class SendMail via http://www.oschina.net/code/snippet_221343_49994
#A few modifications: Add Cc support ; print -> return string.
# Sample:
# ./pymail.py -f sender@example.com -t recv@somedomain1.com -c "ccrecv1@otherdomain1.com,ccrecv2@otherdomain2.com" -s smtp.somemailserver.com -u sender@example... | Panblack/ezdpl | servers/common/init/files/usr/local/bin/pymail.py | Python | apache-2.0 | 5,118 |
# coding=utf-8
#
# Copyright 2016 F5 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 required by applicable law or a... | F5Networks/f5-common-python | f5/bigip/tm/util/dig.py | Python | apache-2.0 | 1,322 |
# 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, ... | google/jax | jax/_src/scipy/stats/geom.py | Python | apache-2.0 | 1,244 |
# Copyright 2021, Google LLC. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | google-research/federated | distributed_dp/distributed_discrete_gaussian_query_test.py | Python | apache-2.0 | 6,913 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mayaviviewerwidget.ui'
#
# Created: Mon Nov 11 18:02:00 2013
# by: pyside-uic 0.2.13 running on PySide 1.1.0
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Dialog(object):
def se... | MusculoskeletalAtlasProject/mapclient-tests | test_resources/updater_test/mayaviviewerstep-master/mapclientplugins/mayaviviewerstep/widgets/ui_mayaviviewerwidget.py | Python | apache-2.0 | 12,774 |
# Copyright (c) 2014. Mount Sinai School of Medicine
#
# 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 o... | dmnfarrell/epitopemap | modules/pepdata/hpv.py | Python | apache-2.0 | 2,977 |
from setuptools import setup, find_packages
setup(
name="panic-deployer",
version="0.1",
packages=find_packages(),
requires=['kamaki',
'paramiko'],
author='Giannis Giannakopoulos',
author_email='ggian@cslab.ece.ntua.gr'
) | project-asap/IReS-Platform | panic/panic-deployer/setup.py | Python | apache-2.0 | 260 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | mrunge/openstack_horizon | openstack_horizon/dashboards/project/images/images/views.py | Python | apache-2.0 | 4,298 |
# Copyright (C) 2013 Cisco Systems Inc.
# All rights reserved
import ipaddress
import re
from .feature import Feature
from .vrf import VRF
from .cisco_secret import CiscoSecret
from .nxcli import *
import nxos_utils
class OSPFSession(Feature):
'''
Use this class to configure the OSPF feature.
'''
de... | fmichalo/n9k-programmability | Python nxapi scripts/cisco/ospf.py | Python | apache-2.0 | 11,049 |
#
# 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... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/authentication/authenticationradiuspolicy_systemglobal_binding.py | Python | apache-2.0 | 5,395 |
#!/usr/bin/env python
"""Download Wzx gene sequences from Genbank
Example:
$ python download_wzx_genes.py .
"""
import argparse
import logging
import re
from utils import DownloadUtils, SubtypeParser, GeneFilter
__author__ = "Matthew Whiteside"
__copyright__ = "Copyright Government of Canada 2012-2015. F... | superphy/insilico-subtyping | phylotyper/data/download/download_wzx_genes.py | Python | apache-2.0 | 1,774 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
##
## Test surrogatepass encoding error handler
##
import unittest
import codecs
from iptest import run_test
... | IronLanguages/ironpython3 | Tests/test_surrogatepass.py | Python | apache-2.0 | 4,002 |
# Copyright 2020 Samsung Electronics Co., 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 required by a... | openstack/tempest | tempest/lib/services/identity/v3/protocols_client.py | Python | apache-2.0 | 4,091 |
# #!/usr/bin/env python
#
# Copyright 2016 Sungard Availability Services
# Copyright 2016 Red Hat
# 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.apa... | idegtiarov/ceilometer | ceilometer/tests/unit/network/test_floating_ip.py | Python | apache-2.0 | 4,313 |
#!/usr/bin/env python
#
# Copyright 2001 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 require... | fuchsia-mirror/third_party-ninja | configure.py | Python | apache-2.0 | 22,852 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | nttcom/eclcli | eclcli/bare/bareclient/ecl/common/apiclient/utils.py | Python | apache-2.0 | 2,975 |
import pygame
from pygame.colordict import THECOLORS
import data
class Platform(pygame.sprite.Sprite):
def __init__(self, width, height):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface([width, height])
self.image.fill(THECOLORS["green"])
self.rect = self.image.g... | Sveder/pyweek24 | gamelib/platforms.py | Python | apache-2.0 | 537 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... | jay-lau/magnum | magnum/conductor/mesos_monitor.py | Python | apache-2.0 | 2,587 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | ntt-sic/heat | heat/tests/test_neutron_loadbalancer.py | Python | apache-2.0 | 34,298 |
from bing_search_api import BingSearchAPI
my_key = "MEL5FOrb1H5G1E78YY8N5mkfcvUK2hNBYsZl1aAEEbE"
def query(query_string):
bing = BingSearchAPI(my_key)
params = {'ImageFilters':'"Face:Face"',
'$format': 'json',
'$top': 10,
'$skip': 0}
results = bing.search('web',qu... | mzweilin/HashTag-Understanding | test/test_bing_search.py | Python | apache-2.0 | 529 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-22 22:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0055_v340_add_grafana_notification'),
]
operations = [
migrations.... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/migrations/0056_v350_custom_venv_history.py | Python | apache-2.0 | 879 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/segment_routing/srlbs/srlb/config/__init__.py | Python | apache-2.0 | 36,989 |
import numpy as np
import os
import sys
import math
#import class files
# sys.path.append('../../../')
from source import bioRead as br
from source import classify as cl
#import PyInsect for measuring similarity
#sys.path.append('../../../../')
from PyINSECT import representations as REP
from PyINSECT import comparator... | ysig/BioClassSim | test/BioTest/UCNEs/UCNES_Class.py | Python | apache-2.0 | 4,554 |
from insights.parsers import df, ParseException
from insights.tests import context_wrap
import pytest
DF_ALP = """
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/vg_lxcrhel6sat56-lv_root 98571884 4244032 89313940 5% /
sysfs ... | PaulWay/insights-core | insights/parsers/tests/test_df.py | Python | apache-2.0 | 7,089 |
#
# 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... | dhuang/incubator-airflow | airflow/providers/ssh/hooks/ssh.py | Python | apache-2.0 | 14,364 |
# Copyright 2018 The Lucid Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | tensorflow/lucid | lucid/recipes/image_interpolation_params.py | Python | apache-2.0 | 2,768 |
print " A BBBBBB CCCC DDDDD EEEEEEE FFFFFFF GGGG H H IIIII JJJJJJ"
print " A A B B C C D D E F G G H H I J"
print " A A B B C D D E F G H H I J"
print "AAAAAAA BBBBBB C D D... | kelvinongtoronto/numbers | letters.py | Python | artistic-2.0 | 650 |
#!/usr/bin/env python3
from PIL import Image
import os.path
import sys
if __name__ == '__main__':
img = Image.open(sys.argv[1])
img.load()
name = os.path.splitext(os.path.basename(sys.argv[1]))[0]
frames = 0
for i in range(65536):
try:
img.seek(i)
except EOFError:
... | cahirwpz/demoscene | effects/anim/data/gen-anim.py | Python | artistic-2.0 | 1,148 |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., University of Heidelberg, and University of
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2010 - 2016 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., Universit... | jonasfoe/COPASI | copasi/bindings/python/unittests/Test_CCopasiObject.py | Python | artistic-2.0 | 4,243 |
#!/usr/bin/python
import os, sys, re
args = sys.argv
if not len(args) in (3, 4):
print "Usage: add_test.py <rawdata file> <report file> [tests stash file]"
print "If the last is not specified, `tests_stash.txt' is assumed"
sys.exit(1)
rawdata = []
for line in open(args[1], "rt").readlines():
lookfor = ["basic_c... | joestringer/libcpuid | tests/add_test.py | Python | bsd-2-clause | 1,755 |
import psyco
psyco.full()
import linker.coff
from linker import store
m,n='python26.dll','Py_DecRef'
localname = None,'__imp__<%s!%s>'%(m,n)
if True:
# this should import from python26.lib,Py_DecRef
# this should export ia32.obj,stuff
a = linker.coff.object.open('~/work/syringe/src/ia32.obj')
# impor... | arizvisa/syringe | src/hooktest.py | Python | bsd-2-clause | 3,457 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask import Flask, render_template, session, redirect, url_for, flash
from flask_wtf import FlaskForm
from flask_bootstrap import Bootstrap
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
from flask_sqlalchemy impo... | sharkspeed/dororis | packages/python/flask/flask-dog-book/5-chapter/main.py | Python | bsd-2-clause | 2,710 |
# Copyright (c) 2020, DjaoDjin 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,
# this list of conditions and t... | djaodjin/djaodjin-survey | survey/urls/api/__init__.py | Python | bsd-2-clause | 1,664 |
import sympy
x1, x2 = sympy.symbols('x1 x2')
f = 100*(x2 - x1**2)**2 + (1-x1)**2
df_dx1 = sympy.diff(f,x1)
df_dx2 = sympy.diff(f,x2)
H = sympy.hessian(f, (x1, x2))
xs = sympy.solve([df_dx1, df_dx2], [x1, x2])
H_xs = H.subs([(x1,xs[0][0]), (x2,xs[0][1])])
lambda_xs = H_xs.eigenvals()
count = 0
for i in lambda_xs.ke... | escorciav/amcs211 | hw3/hw3_2a.py | Python | bsd-2-clause | 502 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softw... | timeyyy/PyUpdater | pyupdater/hooks/hook-cryptography.py | Python | bsd-2-clause | 1,600 |
import re
from django.conf.urls import url, patterns, include
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView
from django.template import add_to_builtins
from fabrydb.admin import fadmin
add_to_builtins('avocado.templatetags.avocado_tags')
admin.autodisc... | glabilloy/fabrydb | fabrydb/conf/urls.py | Python | bsd-2-clause | 1,723 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
import re
from .utils import normalize_whitespace
HEADINGS_PATTERN = re.compile(r"\bh\d\b")
class Paragraph(object):
"""Object representing one block of text in HTML."""
def __... | miso-belica/jusText | justext/paragraph.py | Python | bsd-2-clause | 1,667 |
from setuptools import setup, find_packages
setup(
name = 'project',
version = '1.0',
packages = find_packages(),
entry_points = {'scrapy': ['settings = bgmapi.settings']},
) | wattlebird/Bangumi_Spider | setup_bgmapi.py | Python | bsd-2-clause | 207 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_unicode_shift_jis.py | Python | bsd-2-clause | 1,538 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_rich_string01.py | Python | bsd-2-clause | 1,233 |
from unittest import skip
from ion.services.dm.test.dm_test_case import DMTestCase
from pyon.public import PRED, OT, RT
from pyon.util.log import log
from ion.services.dm.test.test_dm_end_2_end import DatasetMonitor
from ion.services.dm.utility.granule import RecordDictionaryTool
from nose.plugins.attrib import attr... | ooici/coi-services | ion/services/dm/test/test_site_data_products.py | Python | bsd-2-clause | 20,250 |
import matplotlib
from kid_readout.roach import baseband
matplotlib.use('agg')
import numpy as np
import time
import sys
from kid_readout.utils import data_file,sweeps
from kid_readout.analysis.resonator import fit_best_resonator
ri = baseband.RoachBasebandWide()
ri.initialize()
#ri.set_fft_gain(6)
#f0s = np.load('/... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/old_scripts/highq_power_sweep_0813f12.py | Python | bsd-2-clause | 5,967 |
"""Terminal management for exposing terminals to a web interface using Tornado.
"""
# Copyright (c) Jupyter Development Team
# Copyright (c) 2014, Ramalingam Saravanan <sarava@sarava.net>
# Distributed under the terms of the Simplified BSD License.
from __future__ import absolute_import, print_function
import asyncio... | takluyver/terminado | terminado/management.py | Python | bsd-2-clause | 12,822 |
import time
from Block import Block
from ..ProtectFlags import ProtectFlags
class UserDirBlock(Block):
def __init__(self, blkdev, blk_num):
Block.__init__(self, blkdev, blk_num, is_type=Block.T_SHORT, is_sub_type=Block.ST_USERDIR)
def set(self, data):
self._set_data(data)
self._read()
def read(... | alpine9000/amiga_examples | tools/external/amitools/amitools/fs/block/UserDirBlock.py | Python | bsd-2-clause | 2,641 |
"""
KAIST 단일인증서비스 모델.
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
class PortalInfoManager(models.Manager):
"""
:class:`PortalInfo` 에 대한 커스텀 매니저.
KAIST 단일인증서비스를 통해 최초 로그인 한 사용자는 자신의 정보를 총학생회에
제공하는 것에 동의해야 최종 가입이 됩니다. 만약 동의하지 않을 경우에는 자동
탈퇴처리가 됩니다. 그러나, ... | hangpark/kaistusc | apps/ksso/models.py | Python | bsd-2-clause | 3,434 |
import javabridge
import bioformats as bf
import numpy as np
from matplotlib import pyplot as plt, cm
javabridge.start_vm(class_path=bf.JARS, run_headless=True)
NT = 10
NC = 2
NZ = 4
NX = 217
NY = 94
output_path = 'outome.tif'
frames = []
for t in range(NT):
for z in range(NZ):
for c in range(NC):
... | sebi06/BioFormatsRead | ometiff_write.py | Python | bsd-2-clause | 1,302 |
from flask.ext.wtf import Form
from wtforms import TextField, TextAreaField, SubmitField, PasswordField, validators, ValidationError, SelectField
class AWSIEFormFields(Form):
deviceId = TextField(u'Device ID', validators=[validators.required()])
notificationEmail = TextField("Notification Email", [validators... | AlperSakarya/AWS-Import-Export-Manifest-Generator | forms.py | Python | bsd-2-clause | 4,728 |
from ctypes import c_void_p
import math
import numpy as np
from OpenGL.GL import *
from OpenGL.GLU import *
from PyEngine3D.Common import logger, COMMAND
from PyEngine3D.Common.Constants import *
from PyEngine3D.Utilities import *
from PyEngine3D.OpenGLContext import InstanceBuffer, FrameBufferManager, RenderBuffer,... | ubuntunux/PyEngine3D | PyEngine3D/Render/Renderer.py | Python | bsd-2-clause | 60,697 |
#!/usr/bin/python
########################################################################
# Copyright (c) 2017
# Daniel Plohmann <daniel.plohmann<at>mailbox<dot>org>
# All rights reserved.
########################################################################
#
# This file is part of apiscout
#
# apiscout... | danielplohmann/apiscout | apiscout/db_builder/DatabaseBuilder.py | Python | bsd-2-clause | 11,496 |
from typing import Dict, List, NamedTuple
import pykube.objects
import requests
import pendulum
from urllib.parse import urlparse
from boto import ec2
from ..context import Context
from k8s_snapshots.snapshot import Snapshot
from .abstract import NewSnapshotIdentifier, SnapshotStatus
from ..errors import SnapshotCreate... | EQTPartners/k8s-snapshots | k8s_snapshots/backends/aws.py | Python | bsd-2-clause | 4,710 |
from urlparse import urljoin
from django.conf import settings
def trailing_slash_or_none():
"""
Return a slash or empty string based on tastypie setting
"""
if getattr(settings, 'TASTYPIE_ALLOW_MISSING_SLASH', False):
return ''
return '/'
def urljoin_forced(base, path, **kwargs):
""... | benthomasson/django-tastypie-swagger | tastypie_swagger/utils.py | Python | bsd-2-clause | 499 |
import pytest
from webtest import TestApp
from pyramid.config import Configurator
from pyramid.testing import DummyRequest
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.authentication import AuthTktAuthenticationPolicy
def make_app(config):
return TestApp(config.make_wsgi_app())
@pytest.... | wichert/rest_toolkit | tests/test_resource.py | Python | bsd-2-clause | 3,615 |
# -*- coding: utf-8 -*-
import sys
import os
from recommonmark.parser import CommonMarkParser
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as str... | nestproject/Frank | docs/conf.py | Python | bsd-2-clause | 8,306 |
import numpy as np
''' Belief Propagation on tree'''
class Node:
children = []
parent = -1
pos = -1
index = -1
depth = 0
msgsDown = {}
msgUp = -1
psi = -1
belief = -1
def __init__(self, parent_=-1, index_=-1, children_=[], pos_=-1, depth_=0):
self.index = index_
self.pos = pos_
self.parent = parent... | colincsl/pyKinectTools | pyKinectTools/algs/SkeletonBeliefPropagation.py | Python | bsd-2-clause | 4,811 |
# Copyright 2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
import uuid as uuid_module
import xml.etree.ElementTree as etree
from ..util import indent_xml
from ..error import ConfigError
import io
import os
Elemen... | depp/sglib | script/d3build/msvc/project.py | Python | bsd-2-clause | 11,200 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 12, transform = "None", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_None/trend_PolyTrend/cycle_12/ar_12/test_artificial_32_None_PolyTrend_12_12_20.py | Python | bsd-3-clause | 260 |
"""KrakenSystem - objects.kraken_core module.
Classes:
KrakenSystem - Class for constructing the Fabric Engine Core client.
"""
import logging
import os
import sys
import json
import importlib
from collections import OrderedDict
import FabricEngine.Core
# import kraken
from kraken.core.profiler import Profiler
fro... | oculusstorystudio/kraken | Python/kraken/core/kraken_system.py | Python | bsd-3-clause | 13,241 |
from __future__ import print_function
from __future__ import absolute_import
# System modules
import argparse
import sys
import multiprocessing
import os
import textwrap
# Third-party modules
# LLDB modules
from . import configuration
class ArgParseNamespace(object):
pass
def parse_args(parser, argv):
""... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/dotest_args.py | Python | bsd-3-clause | 13,110 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
import six
import time
from exam import fixture, patcher
from sentry.quotas.redis import (
is_rate_limited,
RedisQuota,
)
from sentry.testutils import TestCase
from sentry.utils.redis import clusters
def test_is_rate_limited_script... | BuildingLink/sentry | tests/sentry/quotas/redis/tests.py | Python | bsd-3-clause | 3,356 |
from sys import version_info
try:
from collections.abc import Iterable, Container
except ImportError:
from collections import Iterable, Container
from pyvalid import accepts
from pyvalid.validators import AbstractValidator
class NumberValidator(AbstractValidator):
number_types = (int, float)
if vers... | uzumaxy/pyvalid | pyvalid/validators/__number.py | Python | bsd-3-clause | 2,763 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | abhinavsingh/proxy.py | proxy/dashboard/dashboard.py | Python | bsd-3-clause | 1,872 |
from uuid import uuid4
from django.test import TestCase
from casexml.apps.case.cleanup import claim_case, get_first_claim
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.util import post_case_blocks
from corehq.apps.case_search.models import CLAIM_CASE_TYPE
from corehq.apps.domain.shortcuts impor... | dimagi/commcare-hq | corehq/apps/ota/tests/test_claim.py | Python | bsd-3-clause | 4,929 |
from traceback import format_exc
from django.core.management.base import BaseCommand
from ...toolbox import send_scheduled_messages
class Command(BaseCommand):
help = 'Sends scheduled messages (both in pending and error statuses).'
def add_arguments(self, parser):
parser.add_argument(
... | idlesign/django-sitemessage | sitemessage/management/commands/sitemessage_send_scheduled.py | Python | bsd-3-clause | 1,014 |
import logging
from cumulusci.cli.config import CliConfig
from cumulusci.core.config import TaskConfig
from cumulusci.core.exceptions import TaskNotFoundError
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.tasks import CURRENT_TASK
from cumulusci.core.utils import import_class
from cumulusci... | e02d96ec16/CumulusCI | cumulusci/robotframework/CumulusCI.py | Python | bsd-3-clause | 7,324 |
import inspect
import logging
import threading
from django.apps import apps
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured
from django.db import connection
from django.db.migrations.operations.base import Operation
from django.utils.translat... | schinckel/django-boardinghouse | boardinghouse/schema.py | Python | bsd-3-clause | 10,412 |
from django.contrib.sites.models import RequestSite
from django.shortcuts import render
from django.conf import settings
from django.db.models import Q
from django.core.urlresolvers import reverse
from airmozilla.main.models import Channel, Event
from airmozilla.main.views import is_contributor
from airmozilla.base.ut... | kenrick95/airmozilla | airmozilla/roku/views.py | Python | bsd-3-clause | 5,212 |
#!/usr/bin/env python
# Copyright (c) 2013 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.
"""Schema of the JSON summary file written out by the GM tool.
This must be kept in sync with the kJsonKey_ constants in gm_expect... | trevorlinton/skia | gm/gm_json.py | Python | bsd-3-clause | 5,464 |
from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase
class FloatTests(TranspileTestCase):
def test_setattr(self):
self.assertCodeExecution("""
x = 3.14159
try:
x.attr = 42
except AttributeError... | pombredanne/voc | tests/datatypes/test_float.py | Python | bsd-3-clause | 6,425 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.management.base import BaseCommand
from twisted.conch.interfaces import ISession
from twisted.internet import reactor
from twisted.python import components
from brigitte.gitserver.server import GitSession, GitConchUser, GitServer
class Comman... | stephrdev/brigitte | brigitte/gitserver/management/commands/run_gitserver.py | Python | bsd-3-clause | 627 |
#!/usr/bin/env python
# Copyright (c) 2013, Carnegie Mellon University
# All rights reserved.
# Authors: Michael Koval <mkoval@cs.cmu.edu>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of sourc... | Stefanos19/prpy | src/prpy/__init__.py | Python | bsd-3-clause | 1,854 |
from taskinit import *
from mpl_toolkits.mplot3d import axes3d, Axes3D
import matplotlib.pyplot as plt
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib.cm as cm
import numpy as np
from pylab import ion,ioff
# plot3d is released under a BSD 3-Clause License
# See LICENSE for details
# ... | chrishales/plot3d | task_plot3d.py | Python | bsd-3-clause | 18,140 |
from datetime import datetime
import numpy as np
import pandas as pd
from pytest import raises
from featuretools.primitives import Haversine, IsIn, IsNull, Max, TimeSinceLast
from featuretools.primitives.base import TransformPrimitive
def test_call_agg():
primitive = Max()
# the assert is run twice on purp... | Featuretools/featuretools | featuretools/tests/primitive_tests/test_primitive_base.py | Python | bsd-3-clause | 2,871 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0003_auto_20150115_1939'),
]
operations = [
migrations.AddField(
model_name='calendalluser',
... | calendall/calendall | calendall/profiles/migrations/0004_auto_20150117_1017.py | Python | bsd-3-clause | 703 |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import json
import mock
import time
from django.conf import settings
from django.core import mail
from olympia import amo
from olympia.abuse.models import AbuseReport
from olympia.access.models import Group, GroupUser
from olympia.activity.models import... | tsl143/addons-server | src/olympia/reviewers/tests/test_models.py | Python | bsd-3-clause | 63,568 |
##
# api.py
#
# This file is the workhorse for the the entire web application.
# It implements and provides the API required for the iOS portion
# of the project as well as interacting with Google's datastore
# for persistent storage of our models.
##
# for sending mail
from google.appengine.api import mail
# Used i... | zaffra/Inquire | GAE/api.py | Python | bsd-3-clause | 17,740 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.