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 2017 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/in-silico-labeling | isl/augment_test.py | Python | apache-2.0 | 2,507 |
# coding: utf8
from functools import wraps
from logging import getLogger
logger = getLogger(__name__)
__author__ = 'marcos.costa'
class request_logger(object):
def __init__(self, method=None):
self.method = method
def __call__(self, func):
method = self.method
if method is None:
... | GTACSolutions/python-braspag | python_braspag/decorators.py | Python | apache-2.0 | 849 |
import npyscreen
import os
import re
import sys
import time
from docker.errors import DockerException
from npyscreen import notify_confirm
from threading import Thread
from vent.api.actions import Action
from vent.api.menu_helpers import MenuHelper
from vent.helpers.meta import Containers
from vent.helpers.meta impor... | lilchurro/vent | vent/menus/main.py | Python | apache-2.0 | 30,458 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | mxm/incubator-beam | sdks/python/apache_beam/testing/load_tests/co_group_by_key_test.py | Python | apache-2.0 | 7,004 |
# 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... | Yelp/paasta | paasta_tools/mesos/cluster.py | Python | apache-2.0 | 2,143 |
# Copyright 2016 Sungard Availability Services
# Copyright 2016 Red Hat
# Copyright 2012 eNovance <licensing@enovance.com>
# Copyright 2013 IBM Corp
# 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 obtai... | idegtiarov/ceilometer | ceilometer/network/floatingip.py | Python | apache-2.0 | 2,715 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-#
# 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... | googlefonts/nototools | nototools/unicode_data.py | Python | apache-2.0 | 57,418 |
#-------------------------------------------------------------
#
# 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... | asurve/arvind-sysml | src/main/python/systemml/project_info.py | Python | apache-2.0 | 1,177 |
# -*- coding: utf-8 -*-
'''
author: Jimmy
contact: 234390130@qq.com
file: storage.py
time: 2017/9/4 下午3:18
description:
'''
__author__ = 'Jimmy'
import pymongo
from ctp.ctp_struct import *
from bson import json_util as jsonb
from utils.tools import *
def _getDataBase():
client = p... | sjsj0101/backtestengine | utils/storage.py | Python | apache-2.0 | 4,040 |
"""
Test the "snabb lwaftr monitor" subcommand. Needs a NIC name and a TAP interface.
1. Execute "snabb lwaftr run" in on-a-stick mode and with the mirror option set.
2. Run "snabb lwaftr monitor" to set the counter and check its output.
"""
from random import randint
from subprocess import call, check_call
import un... | heryii/snabb | src/program/lwaftr/tests/subcommands/monitor_test.py | Python | apache-2.0 | 2,186 |
import uuid
import pytest
from kazoo.testing import KazooTestCase
from kazoo.tests.util import CI_ZK_VERSION
class KazooQueueTests(KazooTestCase):
def _makeOne(self):
path = "/" + uuid.uuid4().hex
return self.client.Queue(path)
def test_queue_validation(self):
queue = self._makeOne(... | python-zk/kazoo | kazoo/tests/test_queue.py | Python | apache-2.0 | 6,221 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | QISKit/qiskit-sdk-py | qiskit/result/exceptions.py | Python | apache-2.0 | 1,290 |
from setuptools import setup, find_packages
setup(
name="HtmlNode",
version="0.1.8",
packages=find_packages(),
description="A simple Python HTML generator",
author="Hing-Lung Lau",
author_email="lung220@gmail.com",
url="http://github.com/hllau/html_node",
license="Apache v2",
keywor... | hllau/html_node | setup.py | Python | apache-2.0 | 750 |
import sys
sys.path.insert(1, "../../")
import h2o
def vec_show(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader.csv"))
print "iris:"
iris.show()
###################################################################
res = 2 -... | ChristosChristofidis/h2o-3 | h2o-py/tests/testdir_misc/pyunit_vec_show.py | Python | apache-2.0 | 516 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr element.
# And the post order to start with the fir... | saisankargochhayat/algo_quest | leetcode/106. Construct Binary Tree from Inorder and Postorder Traversal/soln.py | Python | apache-2.0 | 978 |
from insights.parsers.hostname import Hostname
from insights.tests import context_wrap
HOSTNAME = "rhel7.example.com"
HOSTNAME_SHORT = "rhel7"
def test_hostname():
data = Hostname(context_wrap(HOSTNAME))
assert data.fqdn == "rhel7.example.com"
assert data.hostname == "rhel7"
assert data.domain == "ex... | wcmitchell/insights-core | insights/parsers/tests/test_hostname.py | Python | apache-2.0 | 685 |
# coding: utf-8
"""
DLRN API
DLRN API client
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
class Params(object):
"""NOTE: This class is auto generated by the swagger code generator program... | javierpena/dlrnapi_client | dlrnapi_client/models/params.py | Python | apache-2.0 | 7,405 |
# -*- 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):
# Changing field 'Conclusion.title'
db.alter_column(u'itest_conclusion',... | xuender/test | testAdmin/itest/migrations/0012_auto__chg_field_conclusion_title__chg_field_answer_title__chg_field_qu.py | Python | apache-2.0 | 5,840 |
# Copyright 2015 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 agreed to in writi... | F5Networks/f5-common-python | f5/bigip/tm/asm/policies/test/unit/test_character_sets.py | Python | apache-2.0 | 1,194 |
from typing import Optional, List
def a(x):
# type: (List[int]) -> List[str]
return <warning descr="Expected type 'List[str]', got 'List[List[int]]' instead">[x]</warning>
def b(x):
# type: (int) -> List[str]
return <warning descr="Expected type 'List[str]', got 'List[int]' instead">[1,2]</warning>
d... | hurricup/intellij-community | python/testData/inspections/PyTypeCheckerInspection/FunctionReturnType.py | Python | apache-2.0 | 1,000 |
from wx import wx
from Converter import Converter
class GameMenuViewModel(object):
def __init__(self, viewSetter):
self.viewSetter = viewSetter
def displayGameMenu(self):
wx.CallAfter(self.viewSetter.setView, "GameMenu")
def animateCurrentPrices(self, currentPricesJavaMap):
wx.... | DarthThanatos/citySimNG | citySimNGView/viewmodel/GameMenuViewModel.py | Python | apache-2.0 | 583 |
class Backend(object):
'''
Backend type with a plugin and zero or more parameters (Parameter functionality is TBD.
Links to categories handled by this backend
'''
def __init__(self, plugin, params):
self._plugin = plugin
self._params = params
self._categories = []
... | compatibleone/accords-platform | tools/codegen/OCCI/Backend.py | Python | apache-2.0 | 544 |
# 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 agreed to in writing, ... | google/gazoo-device | gazoo_device/tests/unit_tests/nrf_matter_device_test.py | Python | apache-2.0 | 4,549 |
"""Test suite for the custom import logic."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import require
def test_patch_replaces_and_restores():
"""Ensure the import function is patched... | kevinconway/require.py | tests/test_imports.py | Python | apache-2.0 | 1,350 |
# -*- coding: UTF-8 -*-
import pigpio
class Car(object):
PINS = ['left_pin', 'right_pin', 'forward_pin', 'backward_pin',
'enable_moving', 'enable_turning']
def __init__(self, left_pin, right_pin, forward_pin, backward_pin,
enable_moving, enable_turning, start_power=65):
s... | lukaszo/picar_worhshop | picar/car.py | Python | apache-2.0 | 3,163 |
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... | olt/mapproxy | mapproxy/image/transform.py | Python | apache-2.0 | 12,700 |
import numpy as np
# Inner (or dot) product
a = np.array([1,2])
b = np.array([3,4])
np.inner(a, b)
a.dot(b)
# Outer product
a = np.array([1,2])
b = np.array([3,4])
np.outer(a, b)
# Inverse
m = np.array([[1,2], [3,4]])
np.linalg.inv(m)
# Inner (or dot) product
m = np.array([[1,2], [3,4]])
minv = np.linalg.inv(m)
m.... | martinahogg/machinelearning | tools/numpy-examples.py | Python | apache-2.0 | 1,533 |
# Copyright 2012 Grid Dynamics
# 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... | adelina-t/nova | nova/tests/unit/virt/libvirt/test_imagebackend.py | Python | apache-2.0 | 59,792 |
# Copyright (c) 2012 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | mortardata/luigi | test/test_ssh.py | Python | apache-2.0 | 1,733 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/clusterfuzz | src/clusterfuzz/_internal/tests/appengine/handlers/testcase_detail/remove_issue_test.py | Python | apache-2.0 | 2,010 |
import logging
import secrets
from typing import List, Optional, Tuple
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect, render
from django.utils.cache import patch_cache_control
from zerver.context_processors import get_valid_realm_from_request
... | rht/zulip | zerver/views/home.py | Python | apache-2.0 | 7,645 |
import json
from typing import TYPE_CHECKING, Optional
from boxsdk.util.text_enum import TextEnum
from boxsdk.exception import BoxAPIException
from .base_object import BaseObject
if TYPE_CHECKING:
from boxsdk.object.user import User
from boxsdk.object.terms_of_service_user_status import TermsOfServiceUserStat... | box/box-python-sdk | boxsdk/object/terms_of_service.py | Python | apache-2.0 | 3,849 |
# -*- coding: utf-8 -*-
import json
import os
import time
import psutil
import pyautogui
pubg_url = 'steam://rungameid/578080'
PROCNAME = "TslGame.exe"
CRASH_PROCNAME = "BroCrashReporter.exe"
debug_directory = "debug_screenshots"
start_state = "HELLO"
play_state = "PLAYING"
play_timer_max = 60 * 3
matching_state = ... | fuckpubg/AHK | botpubg-mpgh/SuperBot.py | Python | apache-2.0 | 12,651 |
# file test_fedora/test_models.py
#
# Copyright 2011 Emory University Libraries
#
# 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
#
... | WSULib/eulfedora | test/test_fedora/test_models.py | Python | apache-2.0 | 62,832 |
from __future__ import unicode_literals
from netaddr import EUI, AddrFormatError
from django import forms
from django.core.exceptions import ValidationError
#
# Form fields
#
class MACAddressFormField(forms.Field):
default_error_messages = {
'invalid': "Enter a valid MAC address.",
}
def to_py... | snazy2000/netbox | netbox/dcim/formfields.py | Python | apache-2.0 | 607 |
#!/usr/bin/env python
# Copyright (c) Suchakra Sharma <suchakrapani.sharma@polymtl.ca>
# Licensed under the Apache License, Version 2.0 (the "License")
from bcc import BPF, _get_num_open_probes, TRACEFS
import os
import sys
from unittest import main, TestCase
class TestKprobeCnt(TestCase):
def setUp(self):
... | mcaleavya/bcc | tests/python/test_probe_count.py | Python | apache-2.0 | 2,656 |
# Generated by Django 2.2.5 on 2019-12-26 20:45
from django.db import migrations, models
import django.db.models.deletion
def non_reversible_migration(apps, schema_editor):
"""Operation to "reverse" an unreversible change"""
pass
def remove_non_sadd_disaggregations(apps, schema_editor):
DisaggregationTyp... | mercycorps/TolaActivity | indicators/migrations/0082_global_disaggregations_data_migration.py | Python | apache-2.0 | 2,118 |
# ===============================================================================
# Copyright 2018 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/LICE... | UManPychron/pychron | pychron/mdd/tasks/nodes.py | Python | apache-2.0 | 17,987 |
#!/usr/bin/env python
# http://ericholscher.com/blog/2009/jun/29/enable-setuppy-test-your-django-apps/
# http://www.travisswicegood.com/2010/01/17/django-virtualenv-pip-and-fabric/
# http://code.djangoproject.com/svn/django/trunk/tests/runtests.py
import os
import sys
# fix sys path so we don't need to setup PYTHONPA... | alanjds/drf-nested-routers | rest_framework_nested/runtests/runtests.py | Python | apache-2.0 | 1,379 |
# -*- coding: utf-8 -*-
# Copyright 2015 Spanish National Research Council
#
# 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 requ... | orviz/ooi | ooi/tests/fakes.py | Python | apache-2.0 | 17,912 |
# 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
# d... | rahulunair/nova | nova/tests/unit/policies/test_admin_actions.py | Python | apache-2.0 | 5,313 |
# A comment, this is so you can read your program later.
# Anything after the # is ignored by python.
print "I could have code like this." # and the comment after is ignored
# You can also use a comment to "disable" or comment out a piece of code:
# print "This won't run."
print "This will run."
| ChucklesZeClown/learn-python | Exercises-learn-python-the-hard-way/ex2-comments-and-pound-characters.py | Python | apache-2.0 | 301 |
#!/usr/bin/env python
# coding=utf-8
import commands
import sys
from docopt import docopt
#from handler import LogFileClient
from sdutil.log_util import getLogger
from sdutil.date_util import *
reload(sys)
sys.setdefaultencoding('utf-8')
from elasticsearch import Elasticsearch
from pdb import *
import requests
import ... | zhaochl/python-utils | es/elasticsearch_util.py | Python | apache-2.0 | 4,771 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | representation_batch_rl/batch_rl/train_eval_online.py | Python | apache-2.0 | 9,735 |
"""
Test that SBProcess.LoadImageUsingPaths works correctly.
"""
from __future__ import print_function
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipIfWindows # The Windows platform doesn't implement DoLoadImage.
class... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py | Python | apache-2.0 | 5,848 |
#! /usr/bin/python
# -*- coding:utf-8 -*-
"""
Author: AsherYang
Email: ouyangfan1991@gmail.com
Date: 2018/6/27
Desc: 后台管理数据库操作类
"""
import sys
sys.path.append('../')
from util import DbUtil
from util.DateUtil import DateUtil
class AdminDao:
def __init__(self):
pass
# 根据管理员电话号码查询管理员信息
def q... | AsherYang/ThreeLine | server/ffstore/db/AdminDao.py | Python | apache-2.0 | 1,494 |
"""The tests for the emulated Hue component."""
import asyncio
import json
from unittest.mock import patch
import pytest
from homeassistant import bootstrap, const, core
import homeassistant.components as core_components
from homeassistant.components import (
emulated_hue, http, light, script, media_player, fan
)... | eagleamon/home-assistant | tests/components/emulated_hue/test_hue_api.py | Python | apache-2.0 | 14,968 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('reddit', '0004_auto_20160518_0017'),
]
operations = [
migrations.AlterField(
mo... | kiwiheretic/logos-v2 | reddit/migrations/0005_auto_20160518_0031.py | Python | apache-2.0 | 471 |
def run(*args, **kwargs):
_run(*args, **kwargs)
def _run(task=None):
if task is None:
return
task()
| githubutilities/gas | gas/interface.py | Python | apache-2.0 | 106 |
# 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
# distributed under t... | stackforge/senlin | senlin/common/messaging.py | Python | apache-2.0 | 4,618 |
"""
Class for parallelizing RandomizedSearchCV jobs in scikit-learn
"""
from sklearn.model_selection import ParameterSampler
from spark_sklearn.base_search import SparkBaseSearchCV
class RandomizedSearchCV(SparkBaseSearchCV):
"""Randomized search on hyper parameters.
RandomizedSearchCV implements a "fit" an... | databricks/spark-sklearn | python/spark_sklearn/random_search.py | Python | apache-2.0 | 10,095 |
# 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.
from common import *
import testdata
class oldstyle:
def __init__(self, value): self.value = valu... | IronLanguages/ironpython3 | Tests/compat/sbs_simple_ops.py | Python | apache-2.0 | 17,059 |
from .fields import BitField, Field
from nettest.exceptions import NettestError
import struct
class PacketMeta(type):
def __new__(cls, name, bases, attrs):
fields = attrs.get('fields')
if fields is None:
raise NettestError(_("packet class must have 'fields' field"))
_fields = []... | public0821/nettest | nettest/packets/base.py | Python | apache-2.0 | 7,940 |
from setuptools import setup, find_packages
exec(open('react/version.py').read())
setup(
name='react',
description='Generate fragments of a molecule using smirks',
version=__version__,
packages=find_packages(),
url='https://github.com/3D-e-Chem/python-modified-tanimoto',
author='Stefan Verhoev... | 3D-e-Chem/rdkit-react | setup.py | Python | apache-2.0 | 639 |
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
schema_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
'../schemas/particle.xsd'))
code = pyxb.binding.generate.GeneratePython(schema_location=schema_path)
rv = compile(code, 'test', '... | jonfoster/pyxb1 | tests/drivers/test-particle.py | Python | apache-2.0 | 4,830 |
from flask.ext import restful
from . import api
class Welcome(restful.Resource):
def get(self):
return api.send_static_file('index.html')
| modulo-/knoydart | api/api_0/apiRequest/Welcome.py | Python | apache-2.0 | 153 |
# Copyright (c) 2014 Rackspace, 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 wr... | obulpathi/poppy | poppy/model/common.py | Python | apache-2.0 | 1,962 |
from gpu import *
LAMP_TYPES = [
GPU_DYNAMIC_LAMP_DYNVEC,
GPU_DYNAMIC_LAMP_DYNCO,
GPU_DYNAMIC_LAMP_DYNIMAT,
GPU_DYNAMIC_LAMP_DYNPERSMAT,
GPU_DYNAMIC_LAMP_DYNENERGY,
GPU_DYNAMIC_LAMP_DYNENERGY,
GPU_DYNAMIC_LAMP_DYNCOL,
GPU_DYNAMIC_LAMP_DISTANCE,
GPU_DYNAMIC_LAMP_ATT1,
GPU_DYNAMIC... | lukesanantonio/blendergltf | gpu_luts.py | Python | apache-2.0 | 3,110 |
from django.http import HttpResponse
# this redirect key is (hopefully) unique but generic so it doesn't signpost the use of DMP/Django.
# not prefixing with X- because that's now deprecated.
REDIRECT_HEADER_KEY = 'Redirect-Location'
###############################################################################
###... | doconix/django-mako-plus | django_mako_plus/http.py | Python | apache-2.0 | 2,608 |
# -*- 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/protocols/protocol/bgp/global_/afi_safis/afi_safi/graceful_restart/state/__init__.py | Python | apache-2.0 | 11,675 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, First Party Software
# 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,
# t... | filipp/Servo | servo/views/device.py | Python | bsd-2-clause | 20,045 |
"""
Compute the force of gravity between the Earth and Sun.
Copyright 2012, Casey W. Stark. See LICENSE.txt for more information.
"""
# Import the gravitational constant and the Quantity class
from dimensionful import G, Quantity
# Supply the mass of Earth, mass of Sun, and the distance between.
mass_earth = Quant... | caseywstark/dimensionful | example/gravity.py | Python | bsd-2-clause | 702 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from django.db import migrations
idDistributionMap = {
80: {'normalMean': 3450, 'normalStDev': 125},
133: {'normalMean': 3350, 'normalStDev': 75},
134: {'normalMean': 2350, 'normalStDev': 50},
135: {'normalMean': 3500, 'no... | lingdb/CoBL-public | ielex/lexicon/migrations/0145_fix_language_distributions.py | Python | bsd-2-clause | 3,447 |
r"""
This module contains linear algebra solvers for SparseMatrices,
TPMatrices and BlockMatrices.
"""
import numpy as np
from numbers import Number, Integral
from scipy.sparse import spmatrix, kron
from scipy.sparse.linalg import spsolve, splu
from scipy.linalg import solve_banded
from shenfun.config import config
fro... | spectralDNS/shenfun | shenfun/la.py | Python | bsd-2-clause | 43,062 |
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Free University
# Berlin, 14195 Berlin, Germany.
# 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 ... | trendelkampschroer/PyEMMA | pyemma/plots/networks.py | Python | bsd-2-clause | 23,764 |
###############################################################################
#
# 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_chart_chartarea02.py | Python | bsd-2-clause | 1,825 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
*****************************
NOTE that this is a modified version from web2py 2.8.2. For full details on what has changed, see
https://github.com/OpenTreeOfLife/opentree/commits/master/custom_import.py
This file was patched (by jimallman, on 10/10/2017) to restore w... | OpenTreeOfLife/opentree | custom_import.py | Python | bsd-2-clause | 7,868 |
"""income_tract.py
Extract the household income per tract for each cbsa, using the
crosswalk between CBSA and Tracts.
"""
import csv
import os
# Income file comprises estimates and margin of error
income_rows = [5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35]
#
# Import data
#
## CBSA to tract
tr_to_cbsa = {}
w... | scities-data/metro-atlas_2014 | bin/income/income_tract.py | Python | bsd-2-clause | 2,140 |
class TschunkMap1(): #(TschunkMap):
def __init__(self):
self.img = 'img/map1.png'
self.figure = 'todo'
self.rows = 15
self.cols = 7
self.origin_x = 1
self.origin_y = 13
self.initial_direction = (0, -1)
| TeamTschunk/TschunkView | map1.py | Python | bsd-2-clause | 267 |
from collections import OrderedDict
import os.path
import shutil
import pytest
from edalize import get_edatool
tests_dir = os.path.dirname(__file__)
class TestFixture:
"""A fixture that makes an edalize backend with work_root directory
Create this object using the make_edalize_test factory fixture. This ... | SymbiFlow/edalize | tests/edalize_common.py | Python | bsd-2-clause | 8,229 |
# Inviwo Python script
import inviwo
import math
import time
start = time.clock()
scale = 1;
d = 15
steps = 120
for i in range(0, steps):
r = (2 * 3.14 * i) / steps
x = d*math.sin(r)
z = -d*math.cos(r)
inviwo.setPropertyValue("EntryExitPoints.camera",((x*scale,3*scale,z*scale),(0,0,0),(0,... | sarbi127/inviwo | data/scripts/camerarotation.py | Python | bsd-2-clause | 687 |
from twython import Twython
from django.conf import settings
from .base import BaseSource
class TwitterSource(BaseSource):
def __init__(self, uid=None, screen_name=None):
if uid is None and screen_name is None:
raise ValueError
self.uid = uid
self.screen_name = screen_name
... | dudarev/reddoid | reddoid/sources/backends/twitter.py | Python | bsd-2-clause | 1,028 |
import logging
from ..calling_conventions import SYSCALL_CC
from ..errors import AngrUnsupportedSyscallError
from ..procedures import SIM_PROCEDURES as P
from .simos import SimOS
_l = logging.getLogger('angr.simos.userland')
class SimUserland(SimOS):
"""
This is a base class for any SimOS that wants to sup... | f-prettyland/angr | angr/simos/userland.py | Python | bsd-2-clause | 4,085 |
#!/usr/env/bin/ python3
from setuptools import setup, Extension
#
#CXX_FLAGS = "-O3 -std=gnu++11 -Wall -Wno-comment"
#
## List of C/C++ sources that will conform the library
#sources = [
#
# "andrnx/clib/android.c",
#
#]
setup(name="andrnx",
version="0.1",
description="Package to convert from GNSS log... | rokubun/android_rinex | setup.py | Python | bsd-2-clause | 547 |
#
# Copyright (C) 2014 Mathias Weber <mathew.weber@gmail.com>
# 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,
# thi... | mweb/flask-starter | app/models/__init__.py | Python | bsd-2-clause | 1,410 |
#! /usr/bin/python3
import sys
sys.path.append(".")
from linear.common.coordinator import Coordinator
import linear.twopc.config as config
if len(sys.argv) != 3:
raise RuntimeError("Invalid arguments. Call like this <name> <num_partitions>")
coordinator = Coordinator(sys.argv[1], int(sys.argv[2]), config.COORDIN... | kaimast/inanutshell | linear/twopc/coordinator.py | Python | bsd-2-clause | 442 |
#!/usr/bin/env python
import messagebird
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--accessKey', help='access key for MessageBird API', type=str, required=True)
parser.add_argument('--webhookId', help='webhook that you want to read', type=str, required=True)
args = vars(parser.parse_args(... | messagebird/python-rest-api | examples/conversation_read_webhook.py | Python | bsd-2-clause | 878 |
import psidialogs
s = psidialogs.choice(["1", "2", "3"], "Choose a number!")
if s is not None:
print(s)
| ponty/psidialogs | psidialogs/examples/choice.py | Python | bsd-2-clause | 109 |
##
##
# File auto-generated by PythonFileGenerator
__all__ = [
'ClusterMembersResponse',
'ContextsResponse',
'StatusResponse'
]
from .ClusterMembersResponse import ClusterMembersResponse
from .ContextsResponse import ContextsResponse
from .StatusResponse import StatusRes... | mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/management/response/diagnostic/__init__.py | Python | bsd-3-clause | 327 |
from __future__ import absolute_import, print_function
import numpy as np
import warnings
def _bit_length_26(x):
if x == 0:
return 0
elif x == 1:
return 1
else:
return len(bin(x)) - 2
try:
from scipy.lib._version import NumpyVersion
except ImportError:
import re
stri... | ljwolf/pysal | pysal/contrib/glm/utils.py | Python | bsd-3-clause | 15,120 |
from .decorators import render_to_json
from .helper import HeadFileUploader, ImageFactory, BaseModelManager, get_first_letter, convertjson | xlk521/cloudguantou | utils/__init__.py | Python | bsd-3-clause | 138 |
# -*- coding: utf-8 -*-
import logging
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
from vkontakte_api.models import VkontakteManager... | ramusus/django-vkontakte-groups | vkontakte_groups/models.py | Python | bsd-3-clause | 6,504 |
#__docformat__ = "restructuredtext en"
# ******NOTICE***************
# optimize.py module by Travis E. Oliphant
#
# You may copy and use this module as you see fit with no
# guarantee implied provided you keep this notice in all copies.
# *****END NOTICE************
# A collection of optimization algorithms. Version ... | apbard/scipy | scipy/optimize/optimize.py | Python | bsd-3-clause | 105,325 |
"""
Custom Authenticator to use generic OAuth2 with JupyterHub
"""
import base64
import os
from urllib.parse import urlencode
from jupyterhub.auth import LocalAuthenticator
from tornado.httpclient import AsyncHTTPClient
from tornado.httpclient import HTTPRequest
from tornado.httputil import url_concat
from traitlets i... | jupyterhub/oauthenticator | oauthenticator/generic.py | Python | bsd-3-clause | 7,328 |
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from .models import Profile
from .forms import ProfileForm
@login_required
def profile_edit(request):
next = request.GET.get("next")
profile, created = Profile.obj... | eldarion/pycon | pycon/profile/views.py | Python | bsd-3-clause | 1,142 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open
from os import path
import re
import ast
here = path.abspath(path.dirname(__file__))
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('radmyarchive/__init__.py', 'rb') as vf:
version = ... | usta/radmyarchive-py | setup.py | Python | bsd-3-clause | 1,376 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sms', '0003_add_backend_models'),
]
operations = [
migrations.CreateModel(
name='SQLIVRBackend',
fields=[
],
options={
'proxy': True,... | dimagi/commcare-hq | corehq/apps/sms/migrations/0004_add_sqlivrbackend_sqlkookoobackend.py | Python | bsd-3-clause | 624 |
from h5py import tests
from h5py import *
class TestCreate(tests.HTest):
def setUp(self):
self.fid, self.name = tests.gettemp()
def tearDown(self):
import os
self.fid.close()
os.unlink(self.name)
@tests.require(api=18)
def test_create_anon(self):
""" (H5D) Ano... | qsnake/h5py | h5py/tests/low/test_h5d.py | Python | bsd-3-clause | 529 |
''' Script to convert the raw data and to plot all histograms'''
from __future__ import division
import logging
import warnings
import os
import multiprocessing as mp
from functools import partial
from matplotlib.backends.backend_pdf import PdfPages
import tables as tb
from tables import dtype_from_descr, Col
import ... | SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | Python | bsd-3-clause | 88,134 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Nahuel Riva
# 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 copyrigh... | snemes/pype32 | setup.py | Python | bsd-3-clause | 4,235 |
from __future__ import absolute_import
class Newsletter(object):
__all__ = ('is_enabled', 'get_subscriptions', 'update_subscription',
'create_or_update_subscription')
DEFAULT_LIST_ID = 1
enabled = False
def is_enabled(self):
return self.enabled
def get_subscriptions(self... | JamesMura/sentry | src/sentry/newsletter/base.py | Python | bsd-3-clause | 571 |
from django.contrib.auth.backends import ModelBackend
# Live sessions will still be using this backend for a while.
# TODO: Remove after there are no more sessions using this in prod.
class Sha256Backend(ModelBackend):
"""Overriding the Django model backend without changes."""
pass
| mozilla/kitsune | kitsune/users/backends.py | Python | bsd-3-clause | 294 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\JohnnyG\Documents\XRDproject_Python_11June2010Release backup\highlowDialog.ui'
#
# Created: Mon Jun 14 16:20:37 2010
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 impor... | johnmgregoire/vanDover_CHESS | ui_highlowDialog.py | Python | bsd-3-clause | 2,451 |
import logging
import pymongo
import emission.net.usercache.abstract_usercache as enua
import emission.core.get_database as edb
import emission.core.wrapper.trip as ecwt
import emission.core.wrapper.section as ecws
import emission.core.wrapper.stop as ecwst
import emission.storage.decorations.timeline as esdt
def c... | joshzarrabi/e-mission-server | emission/storage/decorations/trip_queries.py | Python | bsd-3-clause | 2,808 |
# -*- coding: utf-8 -*-
#
# DyNe documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 10 16:15:03 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | akhambhati/dyne | docs/source/conf.py | Python | bsd-3-clause | 9,233 |
"""
Simple script to help create files needed to make a sphinx documentation
website of the flopy project. The script will read through all of the
flopy modules and create the sphinx autodoc rst (restructured text) files.
"""
import os
# print current working directory
print(os.getcwd())
# look through... | modflowpy/flopydoc | docs/mkrst.py | Python | bsd-3-clause | 1,785 |
from django.db import migrations
from corehq.apps.smsbillables.management.commands.bootstrap_gateway_fees import (
bootstrap_pinpoint_gateway,
)
def add_pinpoint_gateway_fee_for_migration(apps, schema_editor):
bootstrap_pinpoint_gateway(apps)
class Migration(migrations.Migration):
dependencies = [
... | dimagi/commcare-hq | corehq/apps/smsbillables/migrations/0022_pinpoint_gateway_fee_amount_null.py | Python | bsd-3-clause | 485 |
import os
import sys
import imp
import logging
from collections import namedtuple
"""
Objects used to configure Glue at runtime.
"""
__all__ = ['Registry', 'SettingRegistry', 'ExporterRegistry',
'ColormapRegistry', 'DataFactoryRegistry', 'QtClientRegistry',
'LinkFunctionRegistry', 'LinkHelperRegi... | bsipocz/glue | glue/config.py | Python | bsd-3-clause | 11,375 |
import itertools
import logging
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from mypage.pages.models import Page, Widget
from mypage.rsswidgets.models import RSSWidget
from mypage.rsswidgets.forms import RSSCreationConfigForm
log = logging.getLogg... | ella/mypage | mypage/pages/forms.py | Python | bsd-3-clause | 6,005 |
from typing import (
IO,
Any,
BinaryIO,
Iterable,
Optional,
TextIO,
Union,
Type,
cast,
overload,
Generator,
Tuple,
)
import logging
from warnings import warn
import random
from rdflib.namespace import Namespace, RDF
from rdflib import plugin, exceptions, query, namespace
... | RDFLib/rdflib | rdflib/graph.py | Python | bsd-3-clause | 84,117 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.