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 |
|---|---|---|---|---|---|
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import pandas as pd
from mousestyles import path_diversity
def test_smooth_noise():
movement = {'t': pd.Series([0., 0.02, 0.04, 0.06], index=[0, 1, 2, 3]),
'x': pd.Series([0., 0., 0.1, 0.... | changsiyao/mousestyles | mousestyles/path_diversity/tests/test_smooth_noise.py | Python | bsd-2-clause | 2,526 |
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010-2011, 2013, James McCoy
# 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 ... | jeffmahoney/supybot | plugins/Seen/plugin.py | Python | bsd-3-clause | 13,345 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import re
import time
from devil.android import device_errors
from devil.android import flag_changer
from devil.utils import rerais... | axinging/chromium-crosswalk | build/android/pylib/local/device/local_device_instrumentation_test_run.py | Python | bsd-3-clause | 11,330 |
import numpy as np
import numpy.lib.recfunctions as nprf
from statsmodels.tools.tools import add_constant
def add_trend(X, trend="c", prepend=False):
"""
Adds a trend and/or constant to an array.
Parameters
----------
X : array-like
Original array of data.
trend : str {"c","t","ct","ct... | yarikoptic/pystatsmodels | statsmodels/tsa/tsatools.py | Python | bsd-3-clause | 17,721 |
"""
keyring_demo.py
This demo shows how to create a new keyring and enable it in keyring lib.
Created by Kang Zhang on 2009-07-12
"""
import os
KEYRINGRC = "keyringrc.cfg"
def load_keyring_by_config():
"""This function shows how to enable a keyring using config file
"""
# create the config file
co... | robinson96/GRAPE | keyring/demo/keyring_demo.py | Python | bsd-3-clause | 2,347 |
""" Testing hrf module
"""
from __future__ import absolute_import
from os.path import dirname, join as pjoin
import numpy as np
from scipy.stats import gamma
import scipy.io as sio
from ..hrf import (
gamma_params,
gamma_expr,
lambdify_t,
spm_hrf_compat,
spmt,
dspmt,
ddspmt,
)
from ... | alexis-roche/nipy | nipy/modalities/fmri/tests/test_hrf.py | Python | bsd-3-clause | 3,668 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2010, Nicolas Clairon
# 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 abov... | goanpeca/mongokit | mongokit/operators.py | Python | bsd-3-clause | 3,264 |
"""Tests for validatorfuncs """
from django.test import TestCase
from evennia.utils import validatorfuncs
import mock
import datetime
import pytz
class TestValidatorFuncs(TestCase):
def test_text_ok(self):
for val in [None, -123, "abc", 1.234, {1: True, 2: False}, ["a", 1]]:
self.assertEqual(... | jamesbeebop/evennia | evennia/utils/tests/test_validatorfuncs.py | Python | bsd-3-clause | 6,369 |
"""
Images Pipeline
See documentation in topics/media-pipeline.rst
"""
import functools
import hashlib
from contextlib import suppress
from io import BytesIO
from itemadapter import ItemAdapter
from scrapy.exceptions import DropItem, NotConfigured
from scrapy.http import Request
from scrapy.pipelines.files import Fi... | pawelmhm/scrapy | scrapy/pipelines/images.py | Python | bsd-3-clause | 6,853 |
"""
:mod:`neo.io` provides classes for reading and/or writing
electrophysiological data files.
Note that if the package dependency is not satisfied for one io, it does not
raise an error but a warning.
:attr:`neo.io.iolist` provides a list of successfully imported io classes.
Functions:
.. autofunction:: neo.io.get... | samuelgarcia/python-neo | neo/io/__init__.py | Python | bsd-3-clause | 8,472 |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import json
import os
import shutil
import tempfile
import unittest
import zlib
import mock
from core.services import isolate_service
def C... | scheib/chromium | tools/perf/core/services/isolate_service_test.py | Python | bsd-3-clause | 2,741 |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | chshu/openthread | tests/scripts/thread-cert/Cert_5_1_07_MaxChildCount.py | Python | bsd-3-clause | 10,758 |
"""
EvEditor (Evennia Line Editor)
This implements an advanced line editor for editing longer texts
in-game. The editor mimics the command mechanisms of the "VI" editor
(a famous line-by-line editor) as far as reasonable.
Features of the editor:
- undo/redo.
- edit/replace on any line of the buffer.
- search&repl... | ypwalter/evennia | evennia/utils/eveditor.py | Python | bsd-3-clause | 26,775 |
from jinja2 import Environment
from jinja2.loaders import DictLoader
env = Environment(
loader=DictLoader(
{
"child.html": """\
{% extends default_layout or 'default.html' %}
{% include helpers = 'helpers.html' %}
{% macro get_the_answer() %}42{% endmacro %}
{% title = 'Hello World' %}
{% block... | pallets/jinja | examples/basic/test.py | Python | bsd-3-clause | 675 |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | geggo/pyface | pyface/wizard/i_wizard.py | Python | bsd-3-clause | 5,057 |
# -*- coding: UTF-8 -*-
from django.contrib import admin
from django.db import models
from django_markdown.admin import MarkdownModelAdmin, AdminMarkdownWidget
from django_markdown.models import MarkdownField
from happenings.models import Event as HappeningsEvent
from happenings.admin import EventAdmin as HappeningsEve... | hacklab-fi/hhlevents | hhlevents/apps/hhlregistrations/admin.py | Python | bsd-3-clause | 2,455 |
from warnings import warn
warn("The module databroker.broker is just a shim for backward-compatibility. "
"You can import directly from databroker.")
from databroker._core import Broker, BrokerES, ALL
| ericdill/databroker | databroker/broker.py | Python | bsd-3-clause | 209 |
from __future__ import absolute_import
import copy
from six.moves.urllib.parse import urlencode
from sentry.models import GroupHash
from sentry.testutils import APITestCase, SnubaTestCase
from sentry.testutils.factories import DEFAULT_EVENT_DATA
from sentry.testutils.helpers.datetime import iso_format, before_now
fr... | mvaled/sentry | tests/sentry/api/endpoints/test_group_hashes.py | Python | bsd-3-clause | 3,716 |
"""
=========
SMOTE SVM
=========
An illustration of the random SMOTE SVM method.
"""
print(__doc__)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Define some color for the plotting
almost_black = '#262626'
palette = sns.color_palette()
from sklearn.datasets import make_classification
from skl... | RPGOne/Skynet | imbalanced-learn-master/examples/over-sampling/plot_smote_svm.py | Python | bsd-3-clause | 1,830 |
"""Test largefile support on system where this makes sense.
"""
import os
import stat
import sys
import unittest
import socket
import shutil
import threading
from test.support import requires, bigmemtest
from test.support import SHORT_TIMEOUT
from test.support import socket_helper
from test.support.os_helper import TE... | brython-dev/brython | www/src/Lib/test/test_largefile.py | Python | bsd-3-clause | 10,216 |
from django.conf import settings
from django.core.cache import cache
from nose.tools import eq_
from pyquery import PyQuery as pq
from kitsune.products.models import HOT_TOPIC_SLUG
from kitsune.products.tests import ProductFactory, TopicFactory
from kitsune.questions.models import QuestionLocale
from kitsune.search.t... | safwanrahman/kitsune | kitsune/products/tests/test_templates.py | Python | bsd-3-clause | 6,625 |
# -*- coding: utf-8 -*-
# Authors: Mark Wronkiewicz <wronk.mark@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
# Jussi Nurminen <jnu@iki.fi>
# License: BSD (3-clause)
from functools import partial
from math import factorial
from os import path as op
import numpy as np
from scipy import linalg
... | jniediek/mne-python | mne/preprocessing/maxwell.py | Python | bsd-3-clause | 85,148 |
import os
import re
import math
import json
from itertools import chain
from xml.etree import cElementTree as et
os.chdir(os.path.abspath(os.path.dirname(__file__)))
def convert_countries():
countries = {}
with open('raw/countryInfo.txt', 'rb') as f:
for line in f:
line = line.decode('u... | fr0609/timesched | data/convert.py | Python | bsd-3-clause | 7,831 |
#!/usr/bin/env python
'''
CREATED:2014-03-18 by Justin Salamon <justin.salamon@nyu.edu>
Compute melody extraction evaluation measures
Usage:
./melody_eval.py TRUTH.TXT PREDICTION.TXT
(CSV files also accepted)
For a detailed explanation of the measures please refer to:
J. Salamon, E. Gomez, D. P. W. Ellis and G. Ri... | bmcfee/mir_eval | evaluators/melody_eval.py | Python | mit | 2,538 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# metadata
from __future__ import unicode_literals
import frappe, os
from frappe.model.meta import Meta
from frappe.modules import scrub, get_module_path, load_doctype_module
from frappe.model.workflow import get_wo... | gangadharkadam/v5_frappe | frappe/desk/form/meta.py | Python | mit | 6,283 |
class ComplexClause(object):
type_string = ''
def __init__(self, *args):
self.clauses = args
self.add_prefix(self.type_string)
def is_matrix(self):
for c in self.clauses:
if not c.is_matrix():
return False
return True
def involves(self, an... | PhonologicalCorpusTools/PolyglotDB | polyglotdb/query/base/complex.py | Python | mit | 2,772 |
from django.test import SimpleTestCase
from crits.relationships.handlers import forge_relationship, update_relationship_reasons, update_relationship_confidences
from crits.core.user import CRITsUser
from crits.campaigns.campaign import Campaign
TUSER_NAME = "test_user"
TUSER_PASS = "!@#j54kfeimn?>S<D"
TUSER_EMAIL = "... | seanthegeek/crits | crits/relationships/tests.py | Python | mit | 4,809 |
"""
Exceptions raised by django-chunked-upload.
"""
class ChunkedUploadError(Exception):
"""
Exception raised if errors in the request/process.
"""
def __init__(self, status, **data):
self.status_code = status
self.data = data
| voidrank/django-chunked-upload | chunked_upload/exceptions.py | Python | mit | 262 |
"""
Support for chopping a list of alignment blocks to only the portion that
intersects a particular interval.
"""
def chop_list( blocks, src, start, end ):
"""
For each alignment block in the sequence `blocks`, chop out the portion
of the block that overlaps the interval [`start`,`end`) in the
compone... | parlar/calls2xls | external/CrossMap/usr/lib64/python2.7/site-packages/bx/align/tools/chop.py | Python | mit | 1,066 |
from django.core.management.base import BaseCommand
from home.models import ReplicaSet, WhatTorrent, \
TransTorrent, WhatFileMetadataCache
class Command(BaseCommand):
help = u'Cache all .flac and .mp3 metadata in download locations.'
def handle(self, *args, **options):
masters = ReplicaSet.get_w... | grandmasterchef/WhatManager2 | WhatManager2/management/commands/file_metadata_indexer.py | Python | mit | 1,499 |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | samedder/azure-cli | src/azure-cli-nspkg/setup.py | Python | mit | 1,582 |
"""This module contains general utility code that is used throughout
the library.
For users of this library, the C{L{log}} function is probably the most
interesting.
"""
__all__ = [
'log', 'appendArgs', 'toBase64', 'fromBase64', 'autoSubmitHTML',
'toUnicode'
]
import binascii
import logging
# import urllib.... | arantebillywilson/python-snippets | microblog/flask/lib/python3.5/site-packages/openid/oidutil.py | Python | mit | 6,651 |
from functools import partial
import hashlib
import datetime
from storage import Storage
class FunctionCache(Storage):
ONE_MINUTE = 60
ONE_HOUR = 60 * ONE_MINUTE
ONE_DAY = 24 * ONE_HOUR
ONE_WEEK = 7 * ONE_DAY
ONE_MONTH = 4 * ONE_WEEK
def __init__(self, filename, max_file_size_kb=-1):
... | noba3/KoTos | addons/plugin.video.vox-now.de/resources/lib/kodion/utils/function_cache.py | Python | gpl-2.0 | 3,125 |
from shapely.geometry import Polygon, MultiPolygon, LineString, MultiLineString, MultiPoint, Point
from kartograph.errors import KartographError
# # View
# Simple 2D coordinate transformation.
class View(object):
"""
translates a point to a view
"""
def __init__(self, bbox=None, width=None, height=... | hrishioa/Aviato | kartograph/kartograph/geometry/view.py | Python | gpl-2.0 | 3,541 |
#
# Copyright 2008 Google Inc. All Rights Reserved.
"""
The user module contains the objects and methods used to
manage users in Autotest.
The valid action is:
list: lists user(s)
The common options are:
--ulist / -U: file containing a list of USERs
See topic_common.py for a High Level Design and Algorithm.
"""
... | lmr/autotest | cli/user.py | Python | gpl-2.0 | 2,827 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 v... | jainaman224/zenodo | tests/unit/records/test_schemas_csl.py | Python | gpl-2.0 | 5,246 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# ERPNext - web based ERP (http://erpnext.com)
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, unittest
from erpnext.stock.doctype.st... | StrellaGroup/erpnext | erpnext/stock/doctype/serial_no/test_serial_no.py | Python | gpl-3.0 | 2,291 |
# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top-level presubmit script for media/audio/.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the p... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/media/audio/PRESUBMIT.py | Python | gpl-3.0 | 1,539 |
from plugins.external.sergio_proxy.plugins.plugin import Plugin
class CacheKill(Plugin):
name = "CacheKill Plugin"
optname = "cachekill"
desc = "Kills page caching by modifying headers."
implements = ["handleHeader","connectionMade"]
has_opts = True
bad_headers = ['if-none-match','if-modified-s... | P0cL4bs/3vilTwinAttacker | plugins/external/sergio_proxy/plugins/CacheKill.py | Python | gpl-3.0 | 952 |
# Copyright 2016 Facundo Batista, Nicolás Demarchi
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ... | jcabdala/fades | tests/test_file_options.py | Python | gpl-3.0 | 6,427 |
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... | gwq5210/litlib | thirdparty/sources/protobuf/python/google/protobuf/internal/json_format_test.py | Python | gpl-3.0 | 30,685 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# CherryMusic - a standalone music server
# Copyright (c) 2012 - 2014 Tom Wallroth & Tilman Boerner
#
# Project page:
# http://fomori.org/cherrymusic/
# Sources on github:
# http://github.com/devsnd/cherrymusic/
#
# CherryMusic is based on
# jPlayer (GPL/MIT licens... | andpp/cherrymusic | cherrymusicserver/service.py | Python | gpl-3.0 | 7,773 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 NUMA Extreme Systems (www.numaes.com) for Cubic ERP - Teradata SAC. (http://cubicerp.com).
#
# WARNING: This program as such is intended to be use... | Jgarcia-IAS/SAT | openerp/addons-extra/odoo-pruebas/odoo-server/addons-extra/l10n_pe_ple03/report/sunat_3_7.py | Python | agpl-3.0 | 1,980 |
import csv
import re
import unicodedata
from utils import *
def initialise(name):
return re.sub('[^A-Z]', '', name)
def asciify(name):
return unicodedata.normalize('NFKD', unicode(name)).encode('ascii', 'ignore')
def parse(data):
orgs_by_id = dict([ (x['id'], x) for x in data['organizations'].values() ])... | hzj123/56th | pombola/south_africa/bin/people-json/committees.py | Python | agpl-3.0 | 2,683 |
# -*- coding: utf-8 -*-
# © 2016 Daniel Reis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Local Administrative Units',
'category': 'Localisation/Europe',
'version': '8.0.1.0.0',
'depends': [
'base',
],
'data': [
'views/res_partner_lau_view.xml',
... | open-synergy/partner-contact | base_location_lau/__openerp__.py | Python | agpl-3.0 | 496 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('candidates', '0013_remove_max_popit_ids'),
]
operations = [
migrations.AlterField(
model_name='organizationextra... | mysociety/yournextmp-popit | candidates/migrations/0014_make_extra_slugs_unique.py | Python | agpl-3.0 | 789 |
from django.test import TestCase
from django.test.utils import override_settings
from util.testing import UrlResetMixin
class FaviconTestCase(UrlResetMixin, TestCase):
"""
Tests of the courseware favicon.
"""
shard = 1
def test_favicon_redirect(self):
resp = self.client.get("/favicon.ico... | teltek/edx-platform | lms/djangoapps/courseware/tests/test_favicon.py | Python | agpl-3.0 | 961 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the :mod:`iris.common.metadata` package."""
| SciTools/iris | lib/iris/tests/unit/common/metadata/__init__.py | Python | lgpl-3.0 | 255 |
from production import IF, AND, OR, NOT, THEN, run_conditions
import production as lab
from tester import make_test, get_tests, type_encode, type_decode
from zookeeper import ZOOKEEPER_RULES
import random
random.seed()
try:
set()
except NameError:
from sets import Set as set, ImmutableSet as frozenset
### TES... | popuguy/mit-cs-6-034 | lab1/tests.py | Python | unlicense | 15,045 |
# 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/db/sqlalchemy/api_migrations/migrate_repo/versions/059_add_consumer_generation.py | Python | apache-2.0 | 1,178 |
#!/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
# "... | zmalik/mesos | support/mesos-gtest-runner.py | Python | apache-2.0 | 9,368 |
"""Define patches used for androidtv tests."""
from tests.async_mock import mock_open, patch
KEY_PYTHON = "python"
KEY_SERVER = "server"
ADB_DEVICE_TCP_ASYNC_FAKE = "AdbDeviceTcpAsyncFake"
DEVICE_ASYNC_FAKE = "DeviceAsyncFake"
class AdbDeviceTcpAsyncFake:
"""A fake of the `adb_shell.adb_device_async.AdbDeviceT... | sdague/home-assistant | tests/components/androidtv/patchers.py | Python | apache-2.0 | 6,084 |
'''
@author: Frank
'''
import unittest
from zstackwoodpecker.engine import engine
class Test(unittest.TestCase):
def testName(self):
logfd = open('/tmp/log', 'w')
engine.execute_case('test/testcase2.py', logfd)
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.... | zstackio/zstack-woodpecker | zstackwoodpecker/test/test_engine.py | Python | apache-2.0 | 351 |
"""Sensor platform for local_ip."""
from homeassistant.components.network import async_get_source_ip
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.he... | home-assistant/home-assistant | homeassistant/components/local_ip/sensor.py | Python | apache-2.0 | 1,075 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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/l... | onesfreedom/pybuilder | src/main/python/pybuilder/plugins/python/unittest_plugin.py | Python | apache-2.0 | 9,771 |
from __future__ import unicode_literals
import mock
import os
import tempfile
from pygments.token import Token
from diff_cover.snippets import Snippet
from diff_cover.tests.helpers import load_fixture,\
fixture_path, assert_long_str_equal, unittest
import six
class SnippetTest(unittest.TestCase):
SRC_TOKENS ... | ezequielo/diff-cover | diff_cover/tests/test_snippets.py | Python | apache-2.0 | 9,261 |
"""Axis light platform tests."""
from copy import deepcopy
from unittest.mock import patch
from homeassistant.components.axis.const import DOMAIN as AXIS_DOMAIN
from homeassistant.components.light import ATTR_BRIGHTNESS, DOMAIN as LIGHT_DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF... | adrienbrault/home-assistant | tests/components/axis/test_light.py | Python | apache-2.0 | 5,733 |
# 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.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | tylertian/Openstack | openstack F/cinder/cinder/test.py | Python | apache-2.0 | 9,555 |
# 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... | av8ramit/tensorflow | tensorflow/python/ops/linalg/linear_operator_full_matrix.py | Python | apache-2.0 | 6,505 |
# Copyright (c) 2016 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 ... | klmitch/nova | nova/conf/novnc.py | Python | apache-2.0 | 2,021 |
# coding: pyxl
from pyxl import html
def test():
# Presence of comments should not affect contents of tags. (In old pyxl, this led to differences
# in whitespace handling.)
assert str(get_frag1()) == str(get_frag2())
def get_frag1():
return <frag>{'foo'}
</frag>
def get_frag2():
return <frag>{... | dropbox/pyxl | tests/test_whitespace_12.py | Python | apache-2.0 | 345 |
# 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... | dongjoon-hyun/tensorflow | tensorflow/contrib/tensorrt/test/reshape_transpose_test.py | Python | apache-2.0 | 6,469 |
# Copyright (c) 2016, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of con... | schelleg/PYNQ | pynq/lib/rpi/rpi.py | Python | bsd-3-clause | 5,799 |
#!/usr/bin/python
import sys
import CoolProp.CoolProp as cp
import numpy as np
def props(in1=None, in2=None, in3=None, in4=None, in5=None, in6=None):
try:
return cp.PropsU(in1=in1,in2=in2,in3=in3,in4=in4,in5=in5,in6=in6,in7="SI")
except ValueError as ve:
#print "Error in CoolProp, try adjusting... | JonWel/CoolProp | dev/incompressible_liquids/DEPRECATED_testSolutions.py | Python | mit | 1,993 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import ctypes
import ctypes.util
import logging
import os
import platform
import sys
import time
import threading
GET_TICK_COUNT_LAST_NOW = 0
# If GET_TICK... | cricketclubucd/davisdragons | platform-tools/systrace/catapult/common/py_trace_event/py_trace_event/trace_time.py | Python | mit | 7,242 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-keyvault/azure/keyvault/models/issuer_parameters.py | Python | mit | 1,158 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | Geode/geonode | geonode/upload/migrations/0001_initial.py | Python | gpl-3.0 | 2,961 |
###############################################################################
#cyn.in is an open source Collaborative Knowledge Management Appliance that
#enables teams to seamlessly work together on files, documents and content in
#a secure central environment.
#
#cyn.in v2 an open source appliance is distrib... | collective/cyn.in | src/ubify.coretypes/ubify/coretypes/content/spacesfolder.py | Python | gpl-3.0 | 2,590 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | kenorb-contrib/BitTorrent | python_bt_codebase_library/BTL/ebrpc.py | Python | gpl-3.0 | 3,425 |
#
# Copyright 2016 Red Hat | Ansible
#
# 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
# (at your option) any later version.
#
# ... | andmos/ansible | lib/ansible/module_utils/docker/common.py | Python | gpl-3.0 | 37,096 |
"""
Tests for EmbargoMiddleware
"""
from contextlib import contextmanager
import geoip2.database
import maxminddb
import ddt
import mock
from mock import patch, MagicMock
from django.conf import settings
from django.test.utils import override_settings
from django.core.cache import cache
from django.db import connec... | cpennington/edx-platform | openedx/core/djangoapps/embargo/tests/test_api.py | Python | agpl-3.0 | 13,897 |
##############################################################################
# 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... | EmreAtes/spack | var/spack/repos/builtin/packages/modern-wheel/package.py | Python | lgpl-2.1 | 2,877 |
#!/usr/bin/env python3
"""
Rekall offset finder.
Usage:
rekall_offset_finder.py [options] <domain> [<url>]
Options:
-d --debug Enable debug output
-u URI, --uri=URI Specify Libvirt URI [Default: qemu:///system]
-o --old Use the old config format
-h --help ... | libvmi/libvmi | tools/windows-offset-finder/rekall_offset_finder.py | Python | lgpl-3.0 | 5,390 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('data_storage', '0002_auto_20150727_2312'),
]
operations = [
migrations.RenameField(
model_name='readonly',
... | nmccrory/job-visualization | jobvisualization/apps/data_storage/migrations/0003_auto_20150728_2302.py | Python | apache-2.0 | 953 |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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... | eric-stanley/robotframework | src/robot/libraries/Screenshot.py | Python | apache-2.0 | 13,020 |
# 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... | dmlc/tvm | python/tvm/topi/testing/slice_axis_python.py | Python | apache-2.0 | 1,533 |
# 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... | dmlc/tvm | python/tvm/relay/testing/mobilenet.py | Python | apache-2.0 | 7,444 |
# coding: utf-8
from django.utils.translation import ugettext_lazy as _
from scielomanager import settings
| jfunez/scielo-manager | scielomanager/journalmanager/helptexts.py | Python | bsd-2-clause | 108 |
from __future__ import unicode_literals
import copy
import inspect
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils import importlib
from django.utils.module_loading import module_has_submodule
from haystack.con... | zhangtianyi1234/django-haystack | haystack/utils/loading.py | Python | bsd-3-clause | 11,267 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
import visvis as vv
def colorbar(axes=None):
""" colorbar(axes=None)
Attach a colorbar to the given axes (or the current axes if... | pbfy0/visvis.dev | functions/colorbar.py | Python | bsd-3-clause | 531 |
##########################################################################
#
# Copyright (c) 2007-2010, 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:
#
# * Redis... | appleseedhq/cortex | test/IECore/ops/presetParsing/presetParsing-1.py | Python | bsd-3-clause | 3,526 |
from urdf_parser_py.xml_reflection.basics import *
import sys
import copy
# @todo Get rid of "import *"
# @todo Make this work with decorators
# Is this reflection or serialization? I think it's serialization...
# Rename?
# Do parent operations after, to allow child to 'override' parameters?
# Need to make sure tha... | robotology-dependencies/urdfdom | urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py | Python | bsd-3-clause | 16,161 |
from nose import SkipTest
from kombu.tests.case import redirect_stdouts
from funtests import transport
class test_django(transport.TransportCase):
transport = 'django'
prefix = 'django'
event_loop_max = 10
def before_connect(self):
@redirect_stdouts
def setup_django(stdout, stderr)... | mverrilli/kombu | funtests/tests/test_django.py | Python | bsd-3-clause | 1,114 |
import sys, time, re, urllib2, json, psycopg2
import logging
from base64 import b64decode
import helpers.errors
import inspect
logger = logging.getLogger(__name__)
def lineno():
"""Returns the current line number in our program."""
return inspect.currentframe().f_back.f_lineno
class Ha:
def __init__(s... | rabbitt/governor | helpers/ha.py | Python | mit | 4,458 |
#!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... | iohannez/gnuradio | gr-filter/python/filter/qa_pfb_arb_resampler.py | Python | gpl-3.0 | 8,395 |
"""
Helper functions for CP apps
"""
import six
from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode
from cherrypy._cpcompat import basestring
import cherrypy
def expose(func=None, alias=None):
"""
Expose the function or class, optionally providing an alias or set of aliases.
"""... | jealousrobot/PlexArt | lib/cherrypy/_helper.py | Python | gpl-3.0 | 10,332 |
# Copyright 2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# GNU Radio Companion 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) a... | awalls-cx18/gnuradio | grc/core/ports/clone.py | Python | gpl-3.0 | 1,289 |
import process_common as pc
import process_operations as po
import module_dialogs
import module_info
from header_dialogs import *
start_states = []
end_states = []
def compile_dialog_states(processor, dialog_file):
global start_states
global end_states
unique_state_list = ["start", "party_encounter", "prisoner_... | RaJiska/Warband-PW-Punishments-Manager | scripts/process_dialogs.py | Python | gpl-3.0 | 3,283 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
from bedrock.mozorg.tests import TestCase
from bedrock.sitemaps.models import NO_LOCALE, SitemapURL
class TestSitemap... | craigcook/bedrock | bedrock/sitemaps/tests/test_models.py | Python | mpl-2.0 | 1,606 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import nowdate, cstr, flt, now, getdate, add_months
from frappe import throw, _
from frappe.utils import formatdate
imp... | hatwar/buyback-erpnext | erpnext/accounts/utils.py | Python | agpl-3.0 | 17,424 |
# lint-amnesty, pylint: disable=missing-module-docstring
from django.apps import AppConfig
from django.conf import settings
class ThirdPartyAuthConfig(AppConfig): # lint-amnesty, pylint: disable=missing-class-docstring
name = 'common.djangoapps.third_party_auth'
verbose_name = "Third-party authentication"
... | edx/edx-platform | common/djangoapps/third_party_auth/apps.py | Python | agpl-3.0 | 919 |
#
# Reimplementation of gtk.Layout in python
# Example on how to implement a scrollable container in python
#
# Johan Dahlin <johan@gnome.org>, 2006
#
# Requires PyGTK 2.8.0 or later
import pygtk
pygtk.require('2.0')
import gobject
import gtk
from gtk import gdk
class Child:
widget = None
x = 0
y = 0
def... | amremam2004/pygtk | examples/gtk/scrollable.py | Python | lgpl-2.1 | 8,475 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | luotao1/Paddle | python/paddle/fluid/tests/unittests/tokenizer/__init__.py | Python | apache-2.0 | 613 |
"""Support for Wink binary sensors."""
import logging
import pywink
from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DOMAIN, WinkDevice
_LOGGER = logging.getLogger(__name__)
# These are the available sensors mapped to binary_sensor class
SENSOR_TYPES = {
"brightness": "light"... | nkgilley/home-assistant | homeassistant/components/wink/binary_sensor.py | Python | apache-2.0 | 6,531 |
# 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... | rabipanda/tensorflow | tensorflow/contrib/kfac/python/ops/layer_collection_lib.py | Python | apache-2.0 | 1,738 |
"""Support for Toon binary sensors."""
from datetime import timedelta
import logging
from typing import Any
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from . import (ToonEntity, ... | MartinHjelmare/home-assistant | homeassistant/components/toon/binary_sensor.py | Python | apache-2.0 | 4,548 |
# Copyright (C) 2013 Yahoo! 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 ... | Stavitsky/python-neutronclient | neutronclient/tests/unit/test_utils.py | Python | apache-2.0 | 3,942 |
# -*- coding: utf-8 -*-
'''
Created on Mar 13, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... | Richard-West/RootTheBox | handlers/StaticFileHandler.py | Python | apache-2.0 | 2,151 |
"""
#3205: W0704 (except doesn't do anything) false positive if some statements
follow a "pass"
"""
__revision__ = None
try:
A = 2
except ValueError:
pass # pylint: disable-msg=W0107
print A
| dbbhattacharya/kitsune | vendor/packages/pylint/test/input/func_noerror_except_pass.py | Python | bsd-3-clause | 204 |
# Guillaume Valadon <guillaume@valadon.net>
"""
Scapy *BSD native support
"""
| CodeNameGhost/shiva | thirdparty/scapy/arch/bpf/__init__.py | Python | mit | 79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.