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 (c) 2014 Potential Ventures Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions an... | stuarthodgson/cocotb | cocotb/drivers/amba.py | Python | bsd-3-clause | 11,722 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcredit Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test proper accounting with malleable transactions
#
from test_framework import BitcreditTestFramework
... | psydrake/bicreditsnew | qa/rpc-tests/txn_doublespend.py | Python | mit | 4,976 |
import smtplib
import argparse
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def main(args):
# Allow HTML-formatted emails (very simplistic atm, should be expanded if used)
msg = MIMEMultipart("alternative")
if args["body"].startswith("<html>", 0, 10):
msg.attach(MIMEText(a... | jgruselius/standalone_scripts | bravo_mailer.py | Python | mit | 1,107 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import redis, frappe, re
import cPickle as pickle
from frappe.utils import cstr
class RedisWrapper(redis.Redis):
"""Redis client that will automatically prefix conf.db_name"""
... | aboganas/frappe | frappe/utils/redis_wrapper.py | Python | mit | 4,952 |
"""rename documentpage
Revision ID: e34d28e9a167
Revises: a5ccf5eaa73f
Create Date: 2016-03-08 10:22:16.063105
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e34d28e9a167'
down_revision = 'a5ccf5eaa73f'
def upgrade():
op.rename_table('page', 'document_page')
def downgrade():
... | gazeti/aleph | aleph/migrate/versions/e34d28e9a167_rename_documentpage.py | Python | mit | 365 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from... | kleetus/bitcoin | qa/rpc-tests/invalidblockrequest.py | Python | mit | 4,242 |
import unittest
import numpy
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'shape': [(), (3, 2)],
}))
class Log1pFunctionTest(unittest.TestCas... | rezoo/chainer | tests/chainer_tests/functions_tests/math_tests/test_logarithm_1p.py | Python | mit | 1,946 |
# This file is part of 'NTLM Authorization Proxy Server' http://sourceforge.net/projects/ntlmaps/
# Copyright 2001 Dmitry A. Rozmanov <dima@xenon.spb.ru>
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Soft... | listyque/TACTIC-Handler | thlib/side/ntlm/des_c.py | Python | epl-1.0 | 9,208 |
#!/usr/bin/env python
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that... | sacsant/avocado-misc-tests | security/evmctl-tests.py | Python | gpl-2.0 | 2,182 |
"""Plugins that are not OS-specific"""
# pylint: disable=unused-import
from rekall.plugins.common import address_resolver
from rekall.plugins.common import api
from rekall.plugins.common import bovine
from rekall.plugins.common import efilter_plugins
from rekall.plugins.common import inspection
from rekall.plugins.com... | dsweet04/rekall | rekall-core/rekall/plugins/common/__init__.py | Python | gpl-2.0 | 471 |
#!/usr/bin/python
#
# Server that will accept connections from a Vim channel.
# Run this server and then in Vim you can open the channel:
# :let handle = ch_open('localhost:8765')
#
# Then Vim can send requests to the server:
# :let response = ch_sendexpr(handle, 'hello!')
#
# And you can control Vim by typing a JSON... | kostyakudinov/Prog | usr/share/vim/vim74/tools/demoserver.py | Python | gpl-2.0 | 3,102 |
# -*- coding: utf-8 -*-
#
# test_pp_psc_delta_stdp.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the ... | HBPNeurorobotics/nest-simulator | testsuite/manualtests/test_pp_psc_delta_stdp.py | Python | gpl-2.0 | 2,827 |
# Copyright (C) 2007 LibreSoft
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the ... | beni55/CVSAnalY | pycvsanaly2/GitParser.py | Python | gpl-2.0 | 13,635 |
#! /usr/bin/env python
# This example illustrates how to use non-homogeneous(nonzero)
# Dirichlet boundary conditions.
#
# PDE: Poisson equation -Laplace u = CONST_F, where CONST_F is
# a constant right-hand side. It is not difficult to see that
# the function u(x,y) = (-CONST_F/4)*(x^2 + y^2) satisfies the
# above PD... | davidquantum/hermes2d | python/examples/04.py | Python | gpl-2.0 | 1,796 |
"""Editor window that can serve as an output file.
"""
import re
from tkinter import messagebox
from idlelib.editor import EditorWindow
file_line_pats = [
# order of patterns matters
r'file "([^"]*)", line (\d+)',
r'([^\s]+)\((\d+)\)',
r'^(\s*\S.*?):\s*(\d+):', # Win filename, maybe starting with ... | bruderstein/PythonScript | PythonLib/full/idlelib/outwin.py | Python | gpl-2.0 | 5,709 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | Six_zebra_models/Six_zebra_models_final_output_0.1_-0.1_13000/mtx1_models/Six_zebra_models30110.py | Python | gpl-3.0 | 13,927 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2011 VoltDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitati... | ifcharming/original2.0 | tests/scripts/examples/sql_coverage/normalizer.py | Python | gpl-3.0 | 4,812 |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gcutil/lib/google_compute_engine/gcutil_lib/mock_api_parser.py | Python | gpl-3.0 | 7,467 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# ... | rcarrillocruz/ansible | lib/ansible/modules/network/f5/bigip_iapp_service.py | Python | gpl-3.0 | 14,587 |
import pygame
from pygame import gfxdraw
from .rangable import Rangable
import random
class Pizza(Rangable):
"""docstring for Pizza"""
def __init__(self, context):
Rangable.__init__(self)
self.context = context
self.pizza = self.context.plain_pizza
self.trashed = False
s... | FOSSRIT/PyCut | game/objects/pizza.py | Python | mpl-2.0 | 13,934 |
#!/usr/bin/python
import sys
file = sys.argv[1]
f = open(file)
print '''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:st... | shreyankg/Dorrie | mckup/build/translations.py | Python | agpl-3.0 | 628 |
#!/usr/bin/env @python@
# ROOT command line tools module: cmdLineUtils
# Author: Julien Ripoche
# Mail: julien.ripoche@u-psud.fr
# Date: 20/08/15
"""Contain utils for ROOT command line tools"""
##########
# Stream redirect functions
# The original code of the these functions can be found here :
# http://stackoverflo... | jrtomps/root | main/python/cmdLineUtils.py | Python | lgpl-2.1 | 47,974 |
"""Parsing and conversion of NTP dates contained in datagrams."""
import datetime
import struct
import time
# 63 zero bits followed by a one in the least signifigant bit is a special
# case meaning "immediately."
IMMEDIATELY = struct.pack('>q', 1)
# From NTP lib.
_SYSTEM_EPOCH = datetime.date(*time.gmtime(0)[0:3])
... | emlyn/python-osc | pythonosc/parsing/ntp.py | Python | unlicense | 1,072 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | lukeiwanski/tensorflow | tensorflow/python/keras/estimator/__init__.py | Python | apache-2.0 | 1,873 |
#/usr/bin/python
"""
Copyright 2014 The Trustees of Princeton University
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 re... | iychoi/syndicate-core | python/syndicate/ag/datasets/disk.py | Python | apache-2.0 | 1,718 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/HUE-SHARK | apps/filebrowser/src/filebrowser/settings.py | Python | apache-2.0 | 946 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | arborh/tensorflow | tensorflow/lite/testing/op_tests/relu.py | Python | apache-2.0 | 2,072 |
#!/usr/bin/env python
#
# Copyright 2015 BMC Software, 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 applicab... | jdgwartney/boundary-api-cli | tests/unit/boundary/cli_test.py | Python | apache-2.0 | 2,812 |
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... | iwaseyusuke/ryu | ryu/services/protocols/bgp/base.py | Python | apache-2.0 | 19,278 |
# 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... | nathanielvarona/airflow | airflow/cli/commands/provider_command.py | Python | apache-2.0 | 3,862 |
# Copyright (c) 2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | xiaoyuanW/gem5 | configs/common/MemConfig.py | Python | bsd-3-clause | 8,019 |
from . import errordocument
from . import recursive
from . import static
| ryanpetrello/pecan | pecan/middleware/__init__.py | Python | bsd-3-clause | 73 |
#!/usr/bin/python
#
# Copyright 2015 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# generate_case_lists.py:
# Helper script for updating the dEQP case list files, stored in the repo.
# Generally only used when... | crezefire/angle | src/tests/deqp_support/generate_case_lists.py | Python | bsd-3-clause | 1,684 |
"""
sentry.templatetags.sentry_activity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from django import template
from django.utils.html import esca... | nicholasserra/sentry | src/sentry/templatetags/sentry_activity.py | Python | bsd-3-clause | 2,769 |
# -*- coding: utf-8 -*-
from mock import Mock
from django.test import TestCase
from opbeat.events import Message
class MessageTest(TestCase):
def test_to_string(self):
unformatted_message = 'My message from %s about %s'
client = Mock()
message = Message(client)
message.logger ... | dirtycoder/opbeat_python | tests/events/tests.py | Python | bsd-3-clause | 676 |
# encoding: 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 'DefinedGeography'
db.create_table('seak_definedgeography', (
('id', self.gf('d... | Ecotrust/cogs-priorities | priorities/seak/migrations/0002_auto__add_definedgeography.py | Python | bsd-3-clause | 12,162 |
"""Constraints definition for minimize."""
from __future__ import division, print_function, absolute_import
import numpy as np
from ._hessian_update_strategy import BFGS
from ._differentiable_functions import (
VectorFunction, LinearVectorFunction, IdentityVectorFunction)
from .optimize import OptimizeWarning
from ... | gertingold/scipy | scipy/optimize/_constraints.py | Python | bsd-3-clause | 17,881 |
# Generated by Django 2.2.5 on 2019-09-12 13:51
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import olympia.amo.fields
import olympia.amo.models
import olympia.amo.validators
import olympia.users.mo... | mozilla/addons-server | src/olympia/users/migrations/0001_initial.py | Python | bsd-3-clause | 10,444 |
"""Generated client library for fusiontables version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.py import base_api
from samples.fusiontables_sample.fusiontables_v1 import fusiontables_v1_messages as messages
class FusiontablesV1(base_api.BaseApiClient):
"""Generat... | endlessm/chromium-browser | third_party/catapult/third_party/gsutil/third_party/apitools/samples/fusiontables_sample/fusiontables_v1/fusiontables_v1_client.py | Python | bsd-3-clause | 34,754 |
import sys
from mock import patch
from pip import pep425tags
class TestPEP425Tags(object):
def mock_get_config_var(self, **kwd):
"""
Patch sysconfig.get_config_var for arbitrary keys.
"""
import pip.pep425tags
get_config_var = pip.pep425tags.sysconfig.get_config_var
... | sigmavirus24/pip | tests/unit/test_pep425tags.py | Python | mit | 5,894 |
import string
import numpy
import six
import cupy
from cupy import carray
from cupy import cuda
from cupy import util
six_range = six.moves.range
six_zip = six.moves.zip
def _get_simple_elementwise_kernel(
params, operation, name, preamble,
loop_prep='', after_loop='', options=()):
module_code... | sou81821/chainer | cupy/elementwise.py | Python | mit | 22,222 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | GdZ/scriptfile | software/googleAppEngine/google/net/proto2/python/public/text_format.py | Python | mit | 19,690 |
#! /usr/bin/env python
# Copyright (c) 2014 Quanta Research Cambridge, Inc
# Original author John Ankcorn
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including with... | cambridgehackers/connectal | scripts/preprocess_trace.py | Python | mit | 4,872 |
############################################################################
# Generic script applicable on any Operating Environments (Unix, Windows)
# ScriptName : wls_reset.py
# Properties : weblogic.properties
# Author : Kevin Yuan
#######################################################################... | RallySoftware/eclipselink.runtime | jpa/eclipselink.jpars.test/resource/weblogic/wls_reset.py | Python | epl-1.0 | 904 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later versi... | tomprince/gemrb | gemrb/GUIScripts/iwd2/Class.py | Python | gpl-2.0 | 5,585 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | zouppen/simulavr | regress/test_opcodes/test_LD_X_decr.py | Python | gpl-2.0 | 3,080 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
External inventory script for Abiquo
====================================
Shamelessly copied from an existing inventory script.
This script generates an inventory that Ansible can understand by making API requests to Abiquo API
Requires some python libraries, ensure ... | camradal/ansible | contrib/inventory/abiquo.py | Python | gpl-3.0 | 8,807 |
# Authors:
# Jason Gerard DeRose <jderose@redhat.com>
# Pavel Zuna <pzuna@redhat.com>
#
# Copyright (C) 2008 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
... | encukou/freeipa | ipaclient/plugins/user.py | Python | gpl-3.0 | 2,966 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Adam Miller <maxamillion@fedoraproject.org>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadat... | valentin-krasontovitsch/ansible | lib/ansible/modules/system/firewalld.py | Python | gpl-3.0 | 29,694 |
# -*- coding: utf-8 -*-
import datetime
import hashlib
from scrapy_proj.helpers import *
class SanatatePipelineExtraMeta(object):
def process_item(self, item, spider):
item['institution'] = spider.name
act_type = LegalHelper.get_type_from_title(item['title'])
if act_type == None:
... | mgax/czl-scrape | sanatate/scrapy_proj/pipelines/extrameta.py | Python | mpl-2.0 | 826 |
""" Tests for commerce views. """
from common.djangoapps.student.tests.factories import UserFactory
class UserMixin:
""" Mixin for tests involving users. """
def setUp(self):
super().setUp()
self.user = UserFactory()
def _login(self):
""" Log into LMS. """
self.client.lo... | eduNEXT/edx-platform | lms/djangoapps/commerce/tests/test_views.py | Python | agpl-3.0 | 370 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class HrPlanWizard(models.TransientModel):
_name = 'hr.plan.wizard'
_description = 'Plan Wizard'
plan_id = fields.Many2one('hr.plan', default=lambda self: self.env['hr.... | rven/odoo | addons/hr/wizard/hr_plan_wizard.py | Python | agpl-3.0 | 1,529 |
test_records = [
[{
"doctype": "Price List",
"price_list_name": "_Test Price List",
"currency": "INR",
"valid_for_all_countries": 1
}]
] | gangadhar-kadam/sms-erpnext | setup/doctype/price_list/test_price_list.py | Python | agpl-3.0 | 146 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/py-nbformat/package.py | Python | lgpl-2.1 | 1,856 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
unsmuggle_url,
)
from ..compat import (
compat_parse_qs,
compat_urlparse,
)
class SenateISVPIE(InfoExtractor):
_COMM_MAP = [
['ag', '76440', 'http://ag... | linglung/ytdl | youtube_dl/extractor/senateisvp.py | Python | unlicense | 6,273 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jbedorf/tensorflow | tensorflow/python/compiler/tensorrt/test/lru_cache_test.py | Python | apache-2.0 | 2,912 |
"""SynologyChat platform for notify component."""
from http import HTTPStatus
import json
import logging
import requests
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_DATA,
PLATFORM_SCHEMA,
BaseNotificationService,
)
from homeassistant.const import CONF_RESOURCE, CONF_VERIFY_... | aronsky/home-assistant | homeassistant/components/synology_chat/notify.py | Python | apache-2.0 | 1,900 |
# Eve W-Space
# Copyright 2014 Andrew Austin and 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 requi... | nyrocron/eve-wspace | evewspace/Alerts/method_registry.py | Python | apache-2.0 | 2,115 |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | arenadata/ambari | ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin.py | Python | apache-2.0 | 4,473 |
# Copyright (c) 2014 VMware, 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... | subramani95/neutron | neutron/tests/unit/vmware/nsxlib/test_router.py | Python | apache-2.0 | 45,472 |
"""For seeding individual ops based on a graph-level seed.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
_DEFAULT_GRAPH_SEED = 87654321
def get_seed(op_seed):
"""Returns the local seeds an operation sh... | arunhotra/tensorflow | tensorflow/python/framework/random_seed.py | Python | apache-2.0 | 4,427 |
#
# 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... | pratikmallya/heat | heat/tests/test_sahara_job_binary.py | Python | apache-2.0 | 5,419 |
# Copyright 2020 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... | annarev/tensorflow | tensorflow/compiler/mlir/tfr/define_op_template.py | Python | apache-2.0 | 2,013 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | daftano/interactive-tutorials | suds/client.py | Python | apache-2.0 | 25,972 |
# Copyright 2014 - Numergy
#
# 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... | ed-/solum | solum/objects/sqlalchemy/infrastructure_stack.py | Python | apache-2.0 | 1,686 |
##########################################################################
#
# Copyright (c) 2011-2012, Image Engine Design 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:
#
# ... | DoubleNegativeVisualEffects/gaffer | python/GafferUITest/ProgressBarTest.py | Python | bsd-3-clause | 2,664 |
from django import http
from django.contrib.messages import constants, get_level, set_level, utils
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import base, default_storage
from django.contrib.messages.storage.ba... | MoritzS/django | tests/messages_tests/base.py | Python | bsd-3-clause | 13,842 |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | XiaosongWei/blink-crosswalk | Tools/Scripts/webkitpy/layout_tests/port/driver.py | Python | bsd-3-clause | 23,508 |
# Authors: Mainak Jas <mainak@neuro.hut.fi>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Romain Trachel <trachelr@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from .mixin import TransformerMixin
from .. import pick_types
from ..filter import (low_pass_filter, high_p... | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/mne/decoding/transformer.py | Python | bsd-3-clause | 19,949 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | Sorsly/subtle | google-cloud-sdk/lib/surface/compute/url_maps/list_cdn_cache_invalidations.py | Python | mit | 3,298 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | tools/automation/utilities/path.py | Python | mit | 6,263 |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.widget import View, Select
from widgetastic_manageiq import (
Accordion, BaseEntitiesView, BootstrapSelect, BreadCrumb, ItemsToolBarViewSelector,
ManageIQTree, SummaryTable, Text, TextInput)
from w... | akarol/cfme_tests | cfme/cloud/security_groups.py | Python | gpl-2.0 | 8,515 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | michaelkirk/QGIS | python/plugins/db_manager/db_plugins/postgis/info_model.py | Python | gpl-2.0 | 11,526 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | taimur97/Feeder | server/appengine/endpoints/api_backend_service.py | Python | gpl-2.0 | 5,564 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of t... | ttreeagency/PootleTypo3Org | pootle/apps/pootle_app/models/__init__.py | Python | gpl-2.0 | 1,034 |
# -*- coding: utf-8 -*-
import re
import urlparse
from module.plugins.captcha.ReCaptcha import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class Keep2ShareCc(SimpleHoster):
__name__ = "Keep2ShareCc"
__type__ = "hoster"
__version__ = "0.25"
__status__... | mationic/pyload | module/plugins/hoster/Keep2ShareCc.py | Python | gpl-3.0 | 4,411 |
#! /usr/bin/env python
"""
This script checks HighGUI's cvGetCaptureProperty functionality for correct return
of the frame width and height of an .avi file containing uncompressed 32bit Bitmap frames.
"""
# name if this test and it's requirements
TESTNAME = "size_bmp32"
REQUIRED = []
# needed for sys.exit(int), .wor... | shiftcontrol/UnityOpenCV | opencv/tests/swig_python/highgui/size_bmp32.py | Python | gpl-3.0 | 739 |
'''Test cases for QLayout handling of child widgets references'''
import unittest
from sys import getrefcount
from PySide.QtGui import QHBoxLayout, QVBoxLayout, QGridLayout, QWidget
from PySide.QtGui import QStackedLayout, QFormLayout
from PySide.QtGui import QApplication, QPushButton, QLabel
from helper import Use... | M4rtinK/pyside-android | tests/QtGui/qlayout_ref_test.py | Python | lgpl-2.1 | 4,597 |
from __future__ import print_function, division
import random
from itertools import permutations
import numpy as np
from scipy.stats.distributions import vonmises
import pickle
import tempfile
from sklearn.pipeline import Pipeline
from msmbuilder.example_datasets import AlanineDipeptide
from msmbuilder.featurizer i... | msultan/msmbuilder | msmbuilder/tests/test_vmhmm.py | Python | lgpl-2.1 | 5,110 |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | haizawa/odenos | src/test/python/org/o3project/odenos/core/component/network/topology/test_port.py | Python | apache-2.0 | 4,161 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/data/experimental/kernel_tests/auto_shard_dataset_test.py | Python | apache-2.0 | 27,708 |
# Copyright 2016 Red Hat, 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, ... | HybridF5/tempest_debug | tempest/services/identity/v2/json/endpoints_client.py | Python | apache-2.0 | 1,870 |
# Copyright 2013-2016 DataStax, 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... | Richard-Mathie/cassandra_benchmark | vendor/github.com/datastax/python-driver/tests/integration/cqlengine/statements/test_where_clause.py | Python | apache-2.0 | 1,642 |
"""Vizio SmartCast Device support."""
from datetime import timedelta
import logging
from typing import Any, Callable, Dict, List, Optional, Union
from pyvizio import VizioAsync
from pyvizio.api.apps import find_app_name
from pyvizio.const import APP_HOME, INPUT_APPS, NO_APP_RUNNING, UNKNOWN_APP
from homeassistant.com... | tboyce021/home-assistant | homeassistant/components/vizio/media_player.py | Python | apache-2.0 | 18,119 |
# Echo client demo using Unix sockets
# Piet van Oostrum
from socket import *
FILE = 'unix-socket'
s = socket(AF_UNIX, SOCK_STREAM)
s.connect(FILE)
s.send('Hello, world')
data = s.recv(1024)
s.close()
print 'Received', repr(data)
| google/google-ctf | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/unixclient.py | Python | apache-2.0 | 244 |
class Solution:
# @param prices, a list of integer
# @return an integer
def maxProfit(self, prices):
if not prices:
return 0
n = len(prices)
m1 = [0] * n
m2 = [0] * n
max_profit1 = 0
min_price1 = prices[0]
max_profit2 = 0
max_price2... | JiaminXuan/leetcode-python | best_time_to_buy_and_sell_stock_iii/solution.py | Python | bsd-2-clause | 846 |
from flask import Blueprint, render_template, jsonify
from flask_website.utils import request_wants_json
from flask_website.listings.projects import projects
mod = Blueprint('community', __name__, url_prefix='/community')
@mod.route('/')
def index():
return render_template('community/index.html')
@mod.route('/... | mitsuhiko/flask-website | flask_website/views/community.py | Python | bsd-3-clause | 824 |
import pingo
'''
In order to use this set of cases, it is necessary to set
the following attributes on your TestCase setUp:
self.analog_input_pin_number = 0
self.expected_analog_input = 1004
self.expected_analog_ratio = 0.98
'''
class AnalogReadBasics(object):
'''
Wire a 10K Ohm resistence fr... | garoa/pingo | pingo/test/level1/cases.py | Python | mit | 1,331 |
f = open("pixels.dat", "r")
pixs = f.readline()
f.close()
print len(pixs)
from PIL import Image
import numpy as np
img = Image.new('RGB', (160, 210), "black") # create a new black image
pixels = img.load() # create the pixel map
# Load the hardcoded grayscale array
from grayscale import getGrayscaleArray
colMat =... | rickyHong/dqn-repl | sandbox/old/imageTest.py | Python | gpl-3.0 | 1,421 |
# coding: UTF-8
"""
Tests for support views.
"""
import itertools
import json
import re
from datetime import datetime, timedelta
import ddt
import pytest
from django.contrib.auth.models import User
from django.urls import reverse
from django.db.models import signals
from nose.plugins.attrib import attr
from pytz impo... | Stanford-Online/edx-platform | lms/djangoapps/support/tests/test_views.py | Python | agpl-3.0 | 17,238 |
"""
:class:`~xblock.field_data.FieldData` subclasses used by the LMS
"""
from xblock.field_data import ReadOnlyFieldData, SplitFieldData
from xblock.fields import Scope
def lms_field_data(authored_data, student_data):
"""
Returns a new :class:`~xblock.field_data.FieldData` that
reads all UserScope.ONE an... | PepperPD/edx-pepper-platform | lms/xblock/field_data.py | Python | agpl-3.0 | 885 |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
import uuid
from sockjs.torn... | dragondgold/OctoPrint | src/octoprint/server/__init__.py | Python | agpl-3.0 | 34,524 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Test if global editor and global reader role has the permission to access
the workflow objects, owned by Admin.
"""
# T0D0: write tests for create, update, delete
from ggrc_workflows.models import Workfl... | andrei-karalionak/ggrc-core | test/integration/ggrc_workflows/roles/test_global_editor_reader.py | Python | apache-2.0 | 4,622 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 - 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... | ntt-sic/neutron | neutron/openstack/common/rpc/amqp.py | Python | apache-2.0 | 22,783 |
# Testing the line trace facility.
from test import test_support
import unittest
import sys
import difflib
# A very basic example. If this fails, we're in deep trouble.
def basic():
return 1
basic.events = [(0, 'call'),
(1, 'line'),
(1, 'return')]
# Many of the tests below are t... | babble/babble | include/jython/Lib/test/test_trace.py | Python | apache-2.0 | 21,728 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import threading
from ggrc import db
from ggrc.app import app
from ggrc.models import create_db, drop_db
from wsgiref.simple_server import make_server
from ggrc import settings
use_migrations = True
def ... | andrei-karalionak/ggrc-core | src/service_specs/environment.py | Python | apache-2.0 | 1,401 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Isaku Yamahata <yamahata@valinux co jp>
# 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
#
# ... | TieWei/nova | nova/block_device.py | Python | apache-2.0 | 16,864 |
from amo.utils import chunked
from mkt.developers.tasks import generate_image_assets
from mkt.webapps.models import Webapp
def run():
for chunk in chunked(Webapp.objects.all(), 50):
for app in chunk:
try:
generate_image_assets.delay(app)
except Exception:
... | aviarypl/mozilla-l10n-addons-server | src/olympia/migrations/465-generate-image-assets.py | Python | bsd-3-clause | 331 |
######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | archifix/settings | sublime/Packages/SublimeCodeIntel/libs/chardet/utf8prober.py | Python | mit | 2,680 |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
import os
import json
from .util import u, slugify
import codecs
def get_tags_count(journal):
"""Returns a set of tuples (count, tag) for all tags present in the journal."""
# Astute reader: should the following ... | dzeban/jrnl | jrnl/exporters.py | Python | mit | 4,046 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.