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 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | Thingee/cinder | cinder/volume/manager.py | Python | apache-2.0 | 59,306 |
# Copyright 2018 Capital One Services, 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... | kapilt/cloud-custodian | tools/c7n_azure/c7n_azure/query.py | Python | apache-2.0 | 13,063 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TopShops'
db.create_table(u'catalog_topshops', (
(u'id', self.gf('django.db.mode... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0025_auto__add_topshops.py | Python | apache-2.0 | 24,810 |
from operator import and_
from functools import reduce
from django import forms
from django.db.models import Q
from django.utils.six import PY3
from django.utils.translation import ugettext_lazy as _
from api.dc.domain.views import dc_domain
from api.dns.domain.views import dns_domain
from api.dns.record.views import ... | erigones/esdc-ce | gui/dc/dns/forms.py | Python | apache-2.0 | 10,134 |
# coding: utf-8
"""
MailMojo API
v1 of the MailMojo API # noqa: E501
OpenAPI spec version: 1.1.0
Contact: hjelp@mailmojo.no
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import mailmojo_sdk
from mailmojo_sdk.api.pa... | eliksir/mailmojo-python-sdk | test/test_page_api.py | Python | apache-2.0 | 1,093 |
from logging import CRITICAL, getLevelName
from functools import wraps
from django.utils.decorators import available_attrs
from celery import states
from celery.utils.log import get_task_logger
from api.decorators import catch_exception
from api.task.utils import task_log
logger = get_task_logger(__name__)
class De... | erigones/esdc-ce | api/mon/log.py | Python | apache-2.0 | 2,678 |
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | changsimon/trove | trove/tests/int_tests.py | Python | apache-2.0 | 3,057 |
# Copyright (c) 2016 Dustin Doloff
# Licensed under Apache License v2.0
import jinja2
import os
MESSAGE_FILL = '`'
AUTO_GEN_MESSAGE = """
``````````````````````````````````````````````````````
``````````````````````````````````````````````````````
````````______________________________________ ``````
```````/ ... | quittle/bazel_toolbox | actions/scripts/jinja_helper.py | Python | apache-2.0 | 2,197 |
"""Additional form validators
"""
# future imports
from __future__ import absolute_import
# stdlib import
import re
from StringIO import StringIO
# third-party imports
from PIL import Image
from wtforms import ValidationError
from wtforms import validators
# Pulled from http://www.regular-expressions.info/email.htm... | mjmcconnell/sra | src-server/app/forms/utils/validators.py | Python | apache-2.0 | 3,603 |
#
# Copyright 2015-2019, Institute for Systems Biology
#
# 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 ... | isb-cgc/ISB-CGC-Webapp | seqpeek/admin.py | Python | apache-2.0 | 666 |
# coding: pyxl
import unittest2
from pyxl import html
from pyxl.base import PyxlException, x_base
from pyxl.element import x_element
class PyxlTests(unittest2.TestCase):
def test_basics(self):
self.assertEqual(<div />.to_string(), '<div></div>')
self.assertEqual(<img src="blah" />.to_string(), '<i... | lez/pyxl3 | tests/test_basic.py | Python | apache-2.0 | 5,433 |
"""A simple example of Google Analytics batched user permissions."""
import json
from apiclient.errors import HttpError
from apiclient.http import BatchHttpRequest
def call_back(request_id, response, exception):
"""Handle batched request responses."""
print request_id
if exception is not None:
if isinstance(... | mcohoon/api-samples | batching/permissions.py | Python | apache-2.0 | 2,389 |
from sys import maxsize
class Contact:
def __init__(self, Firstname=None, Middlename=None, Lastname=None, Nickname=None, Title=None, Company=None, Address=None, Home=None, Mobile=None, Work=None,
Fax=None, Email=None, Email2=None, Email3=None, Homepage=None, Bday=None, Bmonth=None, Byear=Non... | IrinaZI/Python_training | model/contact.py | Python | apache-2.0 | 1,808 |
from setuptools import setup
setup(name='mock_labels', version='0.0.1', packages=['mock_labels'])
| cloudify-cosmo/cloudify-manager | tests/integration_tests_plugins/mock_labels/setup.py | Python | apache-2.0 | 99 |
import json
from unit.http import TestHTTP
from unit.option import option
http = TestHTTP()
def check_chroot():
available = option.available
resp = http.put(
url='/config',
sock_type='unix',
addr=option.temp_dir + '/control.unit.sock',
body=json.dumps(
{
... | nginx/unit | test/unit/check/chroot.py | Python | apache-2.0 | 748 |
#!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... | msbeta/apollo | modules/tools/open_space_visualization/hybrid_a_star_visualizer.py | Python | apache-2.0 | 6,581 |
import os
import subprocess
SSH_OPTIONS = ['-o', 'StrictHostKeyChecking=no', '-o', 'PreferredAuthentications=publickey', '-o', 'PubkeyAuthentication=yes']
def rsync_get_file(uri_from, uri_to, user, host, port, key):
cmd = [
'rsync',
'-e',
'ssh -i {} -p {} {}'.format(key, port, ' '.join(SS... | galaxyproject/pulsar | pulsar/client/transport/ssh.py | Python | apache-2.0 | 1,799 |
# Copyright (c) 2017-2019 Cloudify Platform 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 ... | cloudify-cosmo/cloudify-manager | cloudify_types/cloudify_types/component/__init__.py | Python | apache-2.0 | 832 |
#!/usr/bin/python
#
# Copyright 2010 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 ag... | arjunsatyapal/lantern | demo1/quiz/models.py | Python | apache-2.0 | 6,723 |
# 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... | karllessard/tensorflow | tensorflow/python/keras/layers/normalization_test.py | Python | apache-2.0 | 30,233 |
import numpy as np
from openfermioncirq.experiments.hfvqe.gradient_hf import (rhf_func_generator,
rhf_minimization)
from openfermioncirq.experiments.hfvqe.molecular_example import make_h6_1_3
def test_rhf_func_gen():
rhf_objective, molecule, parameters, _, _ = make_h6_1_3()
ansa... | quantumlib/OpenFermion-Cirq | openfermioncirq/experiments/hfvqe/gradient_hf_test.py | Python | apache-2.0 | 942 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | eayunstack/nova | nova/tests/network/test_neutronv2.py | Python | apache-2.0 | 148,482 |
import pytest
import copy
import json
from awx.main.utils.common import (
model_instance_diff,
model_to_dict,
)
@pytest.mark.django_db
def test_model_to_dict_user(alice):
username = copy.copy(alice.username)
password = copy.copy(alice.password)
output_dict = model_to_dict(alice)
assert outpu... | snahelou/awx | awx/main/tests/functional/utils/test_common.py | Python | apache-2.0 | 2,126 |
#
# MLDB-2107-scalar-format.py
# Mathieu Marquis Bolduc, 2017-01-10
# This file is part of MLDB. Copyright 2017 mldb.ai inc. All rights reserved.
#
from mldb import mldb, MldbUnitTest, ResponseException
class MLDB2107ScalarFormatTest(MldbUnitTest): # noqa
@classmethod
def setUpClass(cls):
ds = mldb.... | mldbai/mldb | testing/MLDB-2107-scalar-format.py | Python | apache-2.0 | 2,377 |
import copy
import six
from eclcli.common import command
from eclcli.common import utils
class ListLicense(command.Lister):
def get_parser(self, prog_name):
parser = super(ListLicense, self).get_parser(prog_name)
parser.add_argument(
"--license-type",
help="License ty... | anythingrandom/eclcli | eclcli/dh/v2/license.py | Python | apache-2.0 | 3,173 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
使用paramiko模块远程管理服务器
通过key登录
'''
import paramiko
private_key_path = 'D:\workspace\Python-oldboy\day07\zhangyage_pass'
#key = paramiko.RSAKey.from_private_key_file(filename, password)
key = paramiko.RSAKey.from_private_key_file(private_key_path,'12345678') #private_ke... | zhangyage/Python-oldboy | day07/ssh_client2.py | Python | apache-2.0 | 880 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import textwrap
from textwrap import dedent
from pants.engine.internals.native_engine import FileDigest
from pants.jvm.resolve.common import ArtifactRequirement, Coordinate, Coordinates
fr... | pantsbuild/pants | src/python/pants/jvm/run_deploy_jar_intergration_test.py | Python | apache-2.0 | 4,405 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from typing import Tuple
from pants.backend.python.lint.docformatter.skip_field import SkipDocformatterField
from pants.backend.python.lint.docformatter.... | benjyw/pants | src/python/pants/backend/python/lint/docformatter/rules.py | Python | apache-2.0 | 4,834 |
# -*- 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-spanner | samples/generated_samples/spanner_v1_generated_database_admin_create_database_async.py | Python | apache-2.0 | 1,667 |
from ..broker import Broker
class BasicServicesBroker(Broker):
controller = "basic_services"
def authenticate(self, **kwargs):
"""Authenticates the user with NetMRI.
**Inputs**
| ``api version min:`` None
| ``api version max:`` None
| ``required:``... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v2_9_0/basic_services_broker.py | Python | apache-2.0 | 18,594 |
import functools
from framework.auth import Auth
from website.archiver import (
StatResult, AggregateStatResult,
ARCHIVER_NETWORK_ERROR,
ARCHIVER_SIZE_EXCEEDED,
ARCHIVER_FILE_NOT_FOUND,
ARCHIVER_FORCED_FAILURE,
)
from website import (
mails,
settings
)
from osf.utils.sanitize import unesc... | baylee-d/osf.io | website/archiver/utils.py | Python | apache-2.0 | 11,737 |
# Copyright 2015 IBM Corp.
#
# 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, sof... | openstack/vitrage-dashboard | vitrage_dashboard/entities/urls.py | Python | apache-2.0 | 728 |
# Copyright 2017 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... | tensorflow/examples | tensorflow_examples/models/densenet/densenet_distributed_test.py | Python | apache-2.0 | 2,998 |
# Copyright 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... | zerovm/zerovm-cli | zpmlib/zpm.py | Python | apache-2.0 | 26,716 |
import torch
from torch import autograd, nn
batch_size = 1
seq_len = 7
input_size = 6
hidden_size = 4
example = [3, 2, 0, 0, 4, 5, 1, 1]
# input = autograd.Variable(torch.rand(seq_len, batch_size, input_size))
# print('input.size()', input.size())
embedding = nn.Embedding(input_size, hidden_size)
rnn = torch.nn.RN... | hughperkins/pub-prototyping | py/pytorch/test_rnn.py | Python | apache-2.0 | 1,950 |
#
# 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/vpn/vpnsessionpolicy_vpnvserver_binding.py | Python | apache-2.0 | 5,197 |
from backend import photos, boards
p = photos()
#print p.new('asdf',1,1)
print p.get(1)
b = boards()
print p.all(1)
print b.get(1)
| teriyakichild/photoboard | photoboard/tests/test.py | Python | apache-2.0 | 133 |
# Copyright 2017 QuantRocket - 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 ... | quantrocket-llc/quantrocket-client | quantrocket/ibg.py | Python | apache-2.0 | 6,653 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py
# Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details)
#
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.estimators.estimator_base ... | h2oai/h2o-dev | h2o-py/h2o/estimators/xgboost.py | Python | apache-2.0 | 29,759 |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py | Python | apache-2.0 | 16,914 |
# Copyright 2015-2016 Hewlett Packard Enterprise Development Company, LP
#
# 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/li... | huntxu/neutron | neutron/services/auto_allocate/db.py | Python | apache-2.0 | 17,330 |
#-*- coding:utf-8 -*-
'''
====================================================================================
Copyright 2013, 2014 Windy Darian (大地无敌), Studio "Sekai no Kagami"
(世界之镜制作组) of Seven Ocean Game Arts (七海游戏文化社
, 北京航空航天大学学生七海游戏文化社) @ http://sogarts.com
Licensed under the Apache License... | WindyDarian/Sogal | sogasys/sogal_base.py | Python | apache-2.0 | 15,210 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0008_auto_20151124_1135'),
]
operations = [
migrations.AddField(
model_name='service',
name=... | kanarelo/dairy | dairy/core/migrations/0009_auto_20151128_1236.py | Python | apache-2.0 | 992 |
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from xdrlib import Packer, Unpacker
from ..type_checked import type_checked
from .allow_trust_op import AllowTrustOp
from .begin_sponsoring_future_reserves_op import BeginSponsoringFutureReservesOp
from .bump_sequ... | StellarCN/py-stellar-base | stellar_sdk/xdr/operation_body.py | Python | apache-2.0 | 23,177 |
"""
Support for displaying the current CPU speed.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.cpuspeed/
"""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CO... | morphis/home-assistant | homeassistant/components/sensor/cpuspeed.py | Python | apache-2.0 | 2,269 |
# Copyright 2017, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tseaver/gcloud-python | language/tests/unit/gapic/v1beta2/test_language_service_client_v1beta2.py | Python | apache-2.0 | 8,919 |
#
# 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
# ... | steveb/heat | heat/tests/openstack/heat/test_resource_group.py | Python | apache-2.0 | 58,016 |
from panda3d.core import *
from panda3d.direct import *
from toontown.toonbase.ToonBaseGlobal import *
from direct.gui.DirectGui import *
from panda3d.core import *
from panda3d.direct import *
from direct.gui.DirectScrolledList import *
from direct.distributed.ClockDelta import *
from toontown.toontowngui import TTDia... | silly-wacky-3-town-toon/SOURCE-COD | toontown/estate/GardenDropGame.py | Python | apache-2.0 | 20,215 |
# Run this in the Django shell
from clinicalsearch.models import ClinicalTrial
import csv
with open('clinicalsearch/trials_ranked.csv', 'rU') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
print row
t = ClinicalTrial(id=row[0], sponsor=row[1], published=(row[2]=="TRUE"), state=row[3]... | adam2392/clinicaltrials | populatedb.py | Python | apache-2.0 | 574 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Sylvain Afchain <sylvain.afchain@enovance.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.apach... | beagles/neutron_hacking | neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py | Python | apache-2.0 | 4,002 |
from keystone import utils
from keystone.common import wsgi
import keystone.config as config
from keystone.logic.types.tenant import Tenant
from . import get_marker_limit_and_url
class TenantController(wsgi.Controller):
"""Controller for Tenant related operations"""
def __init__(self, options, is_service_ope... | genius1611/Keystone | keystone/controllers/tenant.py | Python | apache-2.0 | 1,975 |
# -*- 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/mpls/lsps/constrained_path/tunnels/tunnel/p2p_tunnel_attributes/p2p_primary_path/__init__.py | Python | apache-2.0 | 14,694 |
"""Cleanup script."""
from grr.lib import export_utils
# After you do this the UI complains a little, but creating a new hunt fixes it.
hunts = aff4.FACTORY.Open("aff4:/hunts/")
for hunt in hunts.ListChildren():
aff4.FACTORY.Delete(hunt)
# Delete clients that haven't polled in for 2hours
for fd in aff4.FACTORY.Mult... | destijl/grr-workshop-setup | cleanup.py | Python | apache-2.0 | 602 |
from django import forms
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from guardian.admin import GuardedModelAdmin
from uploader.projects.models import FileSystem, Project
class FileSystemAdminForm(forms.ModelForm):
class Meta:
model = FileSystem
class ProjectAdmin(Guarde... | stfc/cvmfs-stratum-uploader | uploader/projects/admin.py | Python | apache-2.0 | 642 |
#
# Copyright 2018 Analytics Zoo 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 agreed to... | intel-analytics/analytics-zoo | pyzoo/zoo/chronos/autots/model/auto_seq2seq.py | Python | apache-2.0 | 4,638 |
# coding=utf8
# Copyright © 2015-2017 Cask Data, 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... | cdapio/cdap-ambari-service | src/main/resources/common-services/CDAP/6.0.0/package/scripts/master.py | Python | apache-2.0 | 4,572 |
from collections import OrderedDict
from PyQt4 import QtGui
from PyQt4.QtCore import Qt
from Orange.data import Table
from Orange.classification.svm import SVMLearner, NuSVMLearner
from Orange.widgets import settings, gui
from Orange.widgets.utils.owlearnerwidget import OWBaseLearner
class OWBaseSVM(OWBaseLearner):... | qPCR4vir/orange3 | Orange/widgets/classify/owsvmclassification.py | Python | bsd-2-clause | 7,592 |
#!/usr/bin/python -Wall
# ================================================================
# Given a list, returns a list of pairs of elements and repetition counts.
# Example (with commas elided for legibility):
#
# Input: [ 1 1 1 2 2 3 3 3 3 5 5 1 1 ]
# Output: [ [3 1] [2 2] [4 3] [2 5] [2 1] ]
#
# I.e. there i... | johnkerl/sack | uniqc_m.py | Python | bsd-2-clause | 1,891 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.sw
~~~~~~~~~~~~~~~~~~~~~
Lexers for semantic web languages.
:copyright: 2007 by Philip Cooper <philip.cooper@openvest.com>.
:license: BSD, see LICENSE for more details.
Modified and extended by Gerrit Niezen. (LICENSE file described above is mis... | gniezen/n3pygments | swlexers/__init__.py | Python | bsd-2-clause | 13,819 |
# -*- coding: utf-8 -*-
from flask import render_template
from .. import lastuser_ui
@lastuser_ui.route('/')
def index():
return render_template('index.html.jinja2')
| hasgeek/lastuser | lastuser_ui/views/index.py | Python | bsd-2-clause | 174 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('eventlog', '0002_auto_20170522_1134'),
... | awemulya/fieldsight-kobocat | onadata/apps/eventlog/migrations/0003_auto_20170522_1154.py | Python | bsd-2-clause | 783 |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation 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 sou... | IntelLabs/hpat | examples/series/rolling/series_rolling_median.py | Python | bsd-2-clause | 1,804 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import math
import numpy as np
from scipy.interpolate import interp1d
def _avgdiff(x):
dx = np.diff(x)
dx2 = np.zeros_like(x)
dx2[0], dx2[-1] = dx[0], dx[-1]
dx2[1:-1] = 0.5 * (dx[1:] + dx[:-1])
return dx2
... | bjodah/finitediff | finitediff/grid/rebalance.py | Python | bsd-2-clause | 4,269 |
from distutils.core import setup
setup(
name='captcha2upload',
packages=['captcha2upload'],
package_dir={'captcha2upload': 'src/captcha2upload'},
version='0.2',
install_requires=['requests'],
description='Upload your image and solve captche using the 2Captcha '
'Service',
... | Mirio/captcha2upload | setup.py | Python | bsd-2-clause | 647 |
'''
Created on 10 August 2014
@author: vincent
'''
# Loading necessary packages
import numpy as np
import sys
from seizures.data.DataLoader_v2 import DataLoader
from seizures.evaluation.XValidation import XValidation
from seizures.evaluation.performance_measures import accuracy, auc
from seizures.features.FeatureExt... | vincentadam87/gatsby-hackathon-seizure | code/python/seizures/examples/cross_validation_test.py | Python | bsd-2-clause | 5,173 |
"""SCons.Tool.sgiar
Tool-specific initialization for SGI ar (library archive). If CC
exists, static libraries should be built with it, so the prelinker has
a chance to resolve C++ template instantiations.
There normally shouldn't be any need to import this module directly.
It will usually be imported through ... | kerwinxu/barcodeManager | zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/sgiar.py | Python | bsd-2-clause | 2,644 |
#!/usr/bin/env python3
# coding:utf-8
import os
import sys
current_path = os.path.dirname(os.path.abspath(__file__))
helper_path = os.path.abspath(os.path.join(current_path, os.pardir, os.pardir, os.pardir, 'data', 'launcher', 'helper'))
if __name__ == "__main__":
default_path = os.path.abspath(os.path.join(curr... | xyuanmu/XX-Net | code/default/launcher/mac_tray.py | Python | bsd-2-clause | 19,146 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: db_ext_split.py <src> <dst> <prob>
Options:
-h --help
"""
import os
import cv2
from glob import glob
from docopt import docopt
from mscr.split import Split, RandomSplitPredicate
from mscr.util import Crop
from mscr.data import MyProgressBar
PAD = 8
if ... | fpeder/mscr | bin/db_ext_split.py | Python | bsd-2-clause | 1,070 |
from biokit.rtools import package
import pytest
try:
import create_dummy_package as dun
except:
from . import create_dummy_package as dun
def test_install_packages():
d = dun.CreateDummy()
d()
package.install_package('./dummy/dummytest_1.0.0.tar.gz', verbose=True)
d._clean()
def test_instal... | biokit/biokit | test/rtools/test_package.py | Python | bsd-2-clause | 1,053 |
"""
@package mi.instrument.nortek.aquadopp.ooicore.test.test_driver
@author Rachel Manoni
@brief Test cases for ooicore driver
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/test_driver
$ bin/test_driver -u
$ bin/test_driver -i
$ bin/test_driver -q
* From pyon
... | rmanoni/mi-instrument | mi/instrument/nortek/aquadopp/ooicore/test/test_driver.py | Python | bsd-2-clause | 28,532 |
order = ['','K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
class Sizes(object):
_BASE = 1000.
def toSize(self, value, input='', output='K'):
"""
Convert value in other measurement
"""
input = order.index(input)
output = order.index(output)
factor = input - output
... | Jumpscale/jumpscale6_core | lib/JumpScale/baselib/units/units.py | Python | bsd-2-clause | 787 |
import sdl2 as sdl
class Context(object):
def __init__(self, major, minor, msaa=2):
self.major = major
self.minor = minor
self.msaa = msaa
self.context = None
self._window = None
sdl.SDL_GL_SetAttribute(sdl.SDL_GL_DOUBLEBUFFER, 1)
sdl.SDL_GL_SetAttribute(s... | mdsitton/pract2d | pract2d/core/context.py | Python | bsd-2-clause | 1,065 |
'''
TODO (29.05.2012):
1) show 1x, 2x, 3x threshold (as line)
2) auto scale in y axis? (calc and save min & max values of buffer)
3) draw y axis?
4) 'max_nbr_buffers_transmitted' must be 1 and 'framesize' must be 512 otherwise we get in trouble in RT mode.
5) set 'SHIFT_VIEW' in update() and dequeue in 'do_draw'?... | StimOMatic/StimOMatic | python/OpenGLPlotting/pomp/apps/deprecated/01.06.2012/pCtrlLFP_old.py | Python | bsd-2-clause | 41,129 |
# -*- 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 'Student.student_id'
db.alter_column('publications_stud... | evildmp/arkestra-publications | publications/migrations/0003_auto__chg_field_student_student_id.py | Python | bsd-2-clause | 40,862 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django
from account.views import ChangePasswordView, SignupView, LoginView
from django.conf.urls import include, url
from django.contrib import admin
from example_thirdparty.forms import SignupFormWithCaptcha
urlpatterns = [
url(r'^admin/', in... | hovel/pybbm | test/example_thirdparty/example_thirdparty/urls.py | Python | bsd-2-clause | 911 |
import urllib2
import urllib
import os, sys
from bs4 import *
argv = sys.argv[1:]
begin = int(argv[0])
count = int(argv[1])
for i in range(begin, begin+count):
try:
url = 'http://danbooru.donmai.us/posts/' + str(i)
request = urllib2.Request(url)
response = urllib2.urlopen(request)
... | EdibleEd/vacbooru | VAB_massdownload.py | Python | bsd-2-clause | 1,305 |
"""
Clone server Model Four
Author: Min RK <benjaminrk@gmail.com
"""
import zmq
from kvsimple import KVMsg
# simple struct for routing information for a key-value snapshot
class Route:
def __init__(self, socket, identity, subtree):
self.socket = socket # ROUTER socket to send to
self.iden... | krattai/noo-ebs | docs/zeroMQ-guide2/examples/Python/clonesrv4.py | Python | bsd-2-clause | 2,618 |
'''abduction.py
Base functionality for logical abduction using a knowledge base of definite clauses
Andrew S. Gordon
'''
import itertools
from . import parse
from . import unify
def abduction(obs, kb, maxdepth, skolemize = True):
'''Logical abduction: returns a list of all sets of assumptions that entail the obs... | asgordon/EtcAbductionPy | etcabductionpy/abduction.py | Python | bsd-2-clause | 3,656 |
import redis_url
import unittest
class RedisUrlTestSuite(unittest.TestCase):
def test_redis_parse_localhost(self):
self.assertEqual(
redis_url.parse('redis://localhost:6379/0?cluster=false'),
{
'host': 'localhost',
'port': 6379,
'db'... | Xopherus/redis-url-py | test_redis_url.py | Python | bsd-2-clause | 1,467 |
# mesa - toolkit for building dynamic python apps with zero downtime
# basis: package is inspected for all instances of specified abc and each added to internal mesa list
# Casa is a mesa obj is instantiated as holder of dynamic obj list, one for each abc type in specified package
# m = mesa.Casa(hideExceptions=False) ... | rutherford/mesa | TODO.py | Python | bsd-2-clause | 2,149 |
#!/usr/bin/env python3
from linker import Linker
import htmlPage
import content.index,content.db,content.fincom
# TODO put into config
spbBudgetXlsPath='../spb-budget-xls'
if __name__=='__main__':
linker=Linker('filelists',{
'csv':['csv'],
'xls':['xls'],
'db':['zip','sql','xlsx'],
})
htmlPage.HtmlPage('inde... | AntonKhorev/BudgetSpb | main.py | Python | bsd-2-clause | 1,072 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 ASMlover. 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
# ... | ASMlover/study | zeroMQ/python/interrupt/rep.py | Python | bsd-2-clause | 2,030 |
import datetime
import logging
JRD_TYPES = ('application/json', 'application/xrd+json', 'text/json')
XRD_TYPES = ('application/xrd+xml', 'text/xml')
logger = logging.getLogger("rd")
def _is_str(s):
try:
return isinstance(s, basestring)
except NameError:
return isinstance(s, str)
def loads(... | jcarbaugh/python-rd | rd/core.py | Python | bsd-3-clause | 6,389 |
"""
keybump
~~~~~~~
manage your versioning like a boss .
:copyright: (c) 2015 by gregorynicholas.
:license: MIT, see LICENSE for more details.
"""
from __future__ import unicode_literals
__version__ = '3.0.1'
| gregorynicholas/keybump | keybump/__init__.py | Python | bsd-3-clause | 223 |
#!/usr/bin/env python3
#
# Copyright 2021 The Cobalt 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
#
# Unles... | youtube/cobalt | starboard/build/run_bash.py | Python | bsd-3-clause | 1,290 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Face.district_id'
db.add_column(u'faces_face', 'district_... | RuralIndia/pari | pari/faces/migrations/0006_auto__add_field_face_district_id.py | Python | bsd-3-clause | 11,120 |
"""
A module of restricted Boltzmann machine (RBM) modified
from the Deep Learning Tutorials (www.deeplearning.net/tutorial/).
Copyright (c) 2008-2013, Theano Development Team All rights reserved.
Modified by Yifeng Li
CMMT, UBC, Vancouver
Sep 23, 2014
Contact: yifeng.li.cn@gmail.com
"""
from __future__ import divisi... | yifeng-li/DECRES | rbm.py | Python | bsd-3-clause | 22,163 |
from __future__ import absolute_import
from collections import namedtuple
from django.conf import settings
from sentry.utils.dates import to_datetime
from sentry.utils.services import LazyServiceWrapper
from .backends.base import Backend # NOQA
from .backends.dummy import DummyBackend # NOQA
backend = LazyServic... | JackDanger/sentry | src/sentry/digests/__init__.py | Python | bsd-3-clause | 910 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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 cod... | davetcoleman/moveit | moveit_ros/planning_interface/test/python_move_group_ns.py | Python | bsd-3-clause | 3,928 |
"""
Tests related to deprecation warnings. Also a convenient place
to document how deprecations should eventually be turned into errors.
"""
from __future__ import division, absolute_import, print_function
import datetime
import sys
import operator
import warnings
import pytest
import shutil
import tempfile
import n... | MSeifert04/numpy | numpy/core/tests/test_deprecations.py | Python | bsd-3-clause | 24,541 |
__author__ = 'Bohdan Mushkevych'
from bson import ObjectId
from threading import RLock
from db.model.raw_data import *
from db.model.site_statistics import SiteStatistics
from synergy.db.manager import ds_manager
from synergy.system.decorator import thread_safe
class SiteDao(object):
""" Thread-safe Data Access... | eggsandbeer/scheduler | db/dao/site_dao.py | Python | bsd-3-clause | 1,526 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: put package requireme... | transientlunatic/pylightcurve | setup.py | Python | bsd-3-clause | 1,562 |
import sys
import time
import logging
import threading
import GPy
import numpy as np
import matplotlib.pyplot as plt
import pdb
from GPhelpers import *
from IPython.display import display
from poap.strategy import FixedSampleStrategy
from poap.strategy import InputStrategy
from poap.tcpserve import ThreadedTCPServer
fr... | ericlee0803/surrogate-GCP | gp/GPsim.py | Python | bsd-3-clause | 1,664 |
# vim: set sw=2 ts=2 softtabstop=2 expandtab:
from . RunnerBase import RunnerBaseClass
from .. Analysers.GPUVerify import GPUVerifyAnalyser
import logging
import os
import psutil
import re
import sys
import yaml
_logger = logging.getLogger(__name__)
class GPUVerifyRunnerException(Exception):
def __init__(self, msg)... | symbooglix/boogie-runner | BoogieRunner/Runners/GPUVerify.py | Python | bsd-3-clause | 2,173 |
import re
from collections import namedtuple
from typing import Optional
from esteid import settings
from esteid.constants import Languages
from esteid.exceptions import InvalidIdCode, InvalidParameter
from esteid.signing.types import InterimSessionData
from esteid.types import PredictableDict
from esteid.validators i... | thorgate/django-esteid | esteid/mobileid/types.py | Python | bsd-3-clause | 2,083 |
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
datas = collect_data_files('vispy')
| informatics-isi-edu/synspy | hook-vispy.py | Python | bsd-3-clause | 111 |
from typing import Callable, Iterable, List, Optional
import os
import numpy as np
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
def image_reader(prefix="",
pad_w: Optional[int] = None,
pad_h: Optional[int] = None,
rescale_w: bool = False,
... | bastings/neuralmonkey | neuralmonkey/readers/image_reader.py | Python | bsd-3-clause | 6,848 |
import SCPI
import time
import numpy
totalSamples = 10
sampleFreq = 100
#freq= SCPI.SCPI("172.17.5.121")
dmm = SCPI.SCPI("172.17.5.131")
#setup freq gen
#freq.setSquare()
#freq.setVoltage(0,3)
#freq.setFrequency(sampleFreq)
#setup voltage meter
#dmm.setVoltageDC("10V", "MAX")
# set external trigger
#dmm.setTriggerS... | nesl/SCPI-Scripts | kei/ag-lib/power_measurement_suite_new.py | Python | bsd-3-clause | 1,078 |
from fanstatic import Library, Resource
import js.jquery
library = Library('jquery.socialshareprivacy', 'resources')
css = Resource(library, 'socialshareprivacy/socialshareprivacy.css')
socialshareprivacy = Resource(library, 'jquery.socialshareprivacy.js',
minified='jquery.socialsharepr... | zerobuzz/js.socialshareprivacy | js/socialshareprivacy/__init__.py | Python | bsd-3-clause | 398 |
#!/usr/bin/python2.6
import sys, os, cinesync
if len(sys.argv) == 1:
print >>sys.stderr, 'Usage: %s <file.mov> ...' % sys.argv[0]
sys.exit(1)
# Create the session and add media from command-line arguments
session = cinesync.Session()
session.media = [cinesync.MediaFile(path) for path in sys.argv[1:]]
# Ask ... | jmah/cinesync_python | examples/Start Session.py | Python | bsd-3-clause | 409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.